]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
aarch64: rtld: avoid loading incompatible binaries
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 29 Apr 2022 13:02:17 +0000 (14:02 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Fri, 5 Aug 2022 18:45:19 +0000 (19:45 +0100)
Prevent lp64 ld.so loading purecap binaries.

sysdeps/aarch64/dl-machine.h

index ae8b14425a671dcf6833af99812e83e5760b13e4..f31695aff1ec34170541d94a38141912eab63a05 100644 (file)
@@ -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.  */