about summary refs log tree commit diff
path: root/sysdeps/aarch64/linkmap.h
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2020-10-28 18:10:23 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2020-11-25 15:25:28 +0000
commitebce134991eae4261bbb32572a2062d3ca56e674 (patch)
treeef1cb71799cc6a09fb7a816f6366c1c67f57ffde /sysdeps/aarch64/linkmap.h
parenta23246987ec0a8b307a9a171193464b74a7cb416 (diff)
downloadglibc-ebce134991eae4261bbb32572a2062d3ca56e674.tar.gz
glibc-ebce134991eae4261bbb32572a2062d3ca56e674.tar.xz
glibc-ebce134991eae4261bbb32572a2062d3ca56e674.zip
aarch64: Use mmap to add PROT_BTI instead of mprotect [BZ #26831] nsz/bti-1
Re-mmap executable segments if possible instead of using mprotect
to add PROT_BTI. This allows using BTI protection with security
policies that prevent mprotect with PROT_EXEC.

If the fd of the ELF module is not available because it was kernel
mapped then mprotect is used and failures are ignored.  To protect
the main executable even when mprotect is filtered the linux kernel
will have to be changed to add PROT_BTI to it.

Computing the mapping bounds follows _dl_map_object_from_fd more
closely now.

The delayed failure reporting is mainly needed because currently
_dl_process_gnu_properties does not propagate failures such that
the required cleanups happen. Using the link_map_machine struct for
error propagation is not ideal, but this seemed to be the least
intrusive solution.

Fixes bug 26831.
Diffstat (limited to 'sysdeps/aarch64/linkmap.h')
-rw-r--r--sysdeps/aarch64/linkmap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h
index 847a03ace2..b3f7663b07 100644
--- a/sysdeps/aarch64/linkmap.h
+++ b/sysdeps/aarch64/linkmap.h
@@ -22,5 +22,5 @@ struct link_map_machine
 {
   ElfW(Addr) plt;	  /* Address of .plt */
   void *tlsdesc_table;	  /* Address of TLS descriptor hash table.  */
-  bool bti;		  /* Branch Target Identification is enabled.  */
+  bool bti_fail;	  /* Failed to enable Branch Target Identification.  */
 };