[v8,3/8] elf: Parse gnu properties for the loader

Message ID 20250129172550.1119706-4-adhemerval.zanella@linaro.org (mailing list archive)
State Under Review
Delegated to: Florian Weimer
Headers
Series Add support for memory sealing |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 fail Patch failed to apply

Commit Message

Adhemerval Zanella Netto Jan. 29, 2025, 5:22 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(-)
  

Patch

diff --git a/elf/rtld.c b/elf/rtld.c
index 00bec15316..b1ae901053 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1731,11 +1731,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:
 	_dl_rtld_map.l_relro_addr = rtld_phdr[cnt].p_vaddr;
 	_dl_rtld_map.l_relro_size = rtld_phdr[cnt].p_memsz;
 	break;
+      case PT_GNU_PROPERTY:
+	_dl_process_pt_gnu_property (&_dl_rtld_map, -1, &rtld_phdr[cnt]);
+	break;
       }
 
   /* Add the dynamic linker to the TLS list if it also uses TLS.  */