aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-07-09 13:34:38 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-07-31 17:02:05 -0300
commit8d2a331b64c8d299d11826058c43d29643cf6b86 (patch)
tree08add1295e872559161b7113929b92de759a203c
parent6a785f1dcf4e63e169f0214dc3bbda962066fde9 (diff)
downloadglibc-8d2a331b64c8d299d11826058c43d29643cf6b86.zip
glibc-8d2a331b64c8d299d11826058c43d29643cf6b86.tar.gz
glibc-8d2a331b64c8d299d11826058c43d29643cf6b86.tar.bz2
elf: Also parse gnu properties for static linked binaries
So the static binary can opt-out of memory sealing. Checked on x86_64-linux-gnu.
-rw-r--r--elf/dl-support.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 8290a38..a02ae71 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -45,6 +45,7 @@
#include <dl-find_object.h>
#include <array_length.h>
#include <dl-symbol-redir-ifunc.h>
+#include <dl-prop.h>
#include <dl-mseal.h>
extern char *__progname;
@@ -336,6 +337,18 @@ _dl_non_dynamic_init (void)
_dl_main_map.l_relro_size = ph->p_memsz;
break;
}
+ /* Process program headers again, but scan them backwards so
+ that PT_NOTE can be skipped if PT_GNU_PROPERTY exits. */
+ for (const ElfW(Phdr) *ph = &_dl_phdr[_dl_phnum]; ph != _dl_phdr; --ph)
+ switch (ph[-1].p_type)
+ {
+ case PT_NOTE:
+ _dl_process_pt_note (&_dl_main_map, -1, &ph[-1]);
+ break;
+ case PT_GNU_PROPERTY:
+ _dl_process_pt_gnu_property (&_dl_main_map, -1, &ph[-1]);
+ break;
+ }
call_function_static_weak (_dl_find_object_init);