diff mbox series

[v3,3/9] elf: Parse gnu properties for the loader

Message ID 20240930200831.1669010-4-adhemerval.zanella@linaro.org
State New
Headers show
Series Add support for memory sealing | expand

Commit Message

Adhemerval Zanella Netto Sept. 30, 2024, 8:08 p.m. UTC
So it can opt-in for memory sealing.

Checked on x86_64-linux-gnu.
---
 elf/rtld.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/elf/rtld.c b/elf/rtld.c
index cb6b61d570..8dfa089f83 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1751,11 +1751,15 @@  dl_main (const ElfW(Phdr) *phdr,
   /* PT_GNU_RELRO is usually the last phdr.  */
   size_t cnt = rtld_ehdr->e_phnum;
   while (cnt-- > 0)
-    if (rtld_phdr[cnt].p_type == PT_GNU_RELRO)
+    switch (rtld_phdr[cnt].p_type)
       {
+      case PT_GNU_RELRO:
 	GL(dl_rtld_map).l_relro_addr = rtld_phdr[cnt].p_vaddr;
 	GL(dl_rtld_map).l_relro_size = rtld_phdr[cnt].p_memsz;
 	break;
+      case PT_GNU_PROPERTY:
+	_dl_process_pt_gnu_property (&GL(dl_rtld_map), -1, &rtld_phdr[cnt]);
+	break;
       }
 
   /* Add the dynamic linker to the TLS list if it also uses TLS.  */