about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-04-29 14:02:17 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-11-22 14:31:25 +0000
commitc14096c2d31897465acf062bfe8ce2ebc510b866 (patch)
tree38ce4ba46840cb04090f4631ca68183eaaf54972
parente252e5f0827ecbe82058c9c602f2dc5671072cdc (diff)
downloadglibc-c14096c2d31897465acf062bfe8ce2ebc510b866.tar.gz
glibc-c14096c2d31897465acf062bfe8ce2ebc510b866.tar.xz
glibc-c14096c2d31897465acf062bfe8ce2ebc510b866.zip
aarch64: elf: avoid loading incompatible binaries
Prevent lp64 ld.so loading purecap binaries.
-rw-r--r--sysdeps/aarch64/dl-machine.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index ae8b14425a..f31695aff1 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -36,7 +36,8 @@
 static inline int __attribute__ ((unused))
 elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
 {
-  return ehdr->e_machine == EM_AARCH64;
+  return ehdr->e_machine == EM_AARCH64
+	 && (ehdr->e_flags & EF_AARCH64_CHERI_PURECAP) == 0;
 }
 
 /* Return the run-time load address of the shared object.  */