Re: execlineb ELF executable stack on Linux

From: Guillermo <gdiazhartusch_at_gmail.com>
Date: Sun, 11 Apr 2021 13:01:24 -0300

Hello,

El vie, 9 abr 2021 a las 11:02, Xavier Stonestreet escribió:
>
> I did some more investigation and the problem lies
> in the Makefile's strip instructions which remove the GNU-stack
> section from the object files. Without the GNU-stack section the
> linker reverts to its backwards-compatible default which is to make
> the stack executable. Here is a patch to fix skalibs' Makefile for
> example:
> [...]
> strip: $(ALL_LIBS)
> ifneq ($(strip $(STATIC_LIBS)),)
> - exec $(STRIP) -x -R .note -R .comment -R .note.GNU-stack $(STATIC_LIBS)
> + exec $(STRIP) -x -R .note -R .comment $(STATIC_LIBS)

I guess this executable stack thing is toolchain- / libc-specific? The
relevant test is using 'readelf -l' to check if there is a GNU_STACK
program header, and that its flags are RW instead of RWE, right?

If yes, I've checked manually building the latest numbered releases of
skalibs, execline and s6 with Gentoo's toolchain and packaged GNU
libc, and all the resulting executables and shared libraries have a
GNU_STACK header with RW flags. No sign of RWE flags... Even after
doing 'make strip' with the original version of the makefile that
removes the .note.GNU-stack section.

The same happens with the earlier versions packaged by Gentoo that are
built by Portage. Although Portage strips itself rather than relying
on the packages' build system.

G.
Received on Sun Apr 11 2021 - 16:01:24 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC