linux: Add PT_GNU_STACK to synthesized test module ELF The DebugRendezvous.Self, ProcessReaderLinux.SelfModules, and ProcessReaderLinux.ChildModules tests synthesize a minimal shared object in memory and dlopen it. The generated ELF had no PT_GNU_STACK program header, so glibc's loader treated it as requiring an executable stack and asked the kernel to mark the stack executable. Recent Linux kernels refuse that request, causing dlopen to fail with "cannot enable executable stack as shared object requires: Invalid argument". Add a PT_GNU_STACK phdr with PF_R | PF_W so the loader knows the module does not need an executable stack. e_phnum is auto-derived from sizeof(phdr_table), so no other bookkeeping is needed. This is backwards-compatible: PT_GNU_STACK has been honored by Linux, glibc, and binutils since ~2003 (Linux 2.6, glibc 2.3.3), and loaders that do not recognize the OS-specific phdr type simply ignore it. Declaring non-exec is strictly safer on both old and new kernels. Change-Id: I7ca40fe422520b4046590a2ff8b21285b7ccc7c8 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/7750611 Reviewed-by: Mark Mentovai <mark@chromium.org> Reviewed-by: Joshua Peraza <jperaza@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org> GitOrigin-RevId: 4f6597ac4d465ce28dde5c7a36e42bf8b5cab81f
Crashpad is a crash-reporting system.
Crashpad’s source code is hosted in a Git repository at https://chromium.googlesource.com/crashpad/crashpad.