[klibc] [klibc:master] Kbuild: Properly disable executable stacks in static builds

klibc-bot for Ben Hutchings ben at decadent.org.uk
Wed Aug 3 15:51:07 PDT 2022


Commit-ID:  2acbe15d7a8093cfa295aadc56707892e87a7eaf
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=2acbe15d7a8093cfa295aadc56707892e87a7eaf
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Tue, 2 Aug 2022 22:47:14 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Thu, 4 Aug 2022 00:45:26 +0200

[klibc] Kbuild: Properly disable executable stacks in static builds

I typo'd the variable name KLIBCSTACKFLAGS in the value of
KLIBCCFLAGS, leaving the stack executable in statically linked
executables.  Fix that.

Executables using a shared library did not have this problem, unless
they included assembly language sources.  C compilers generate the
no-executable-stack header by default, and the interpreter definition
that's statically linked into such executables was built with a
correctly spelt KLIBCSTACKFLAGS as an extra option.

Fixes: c562319cdba0 ("[klibc] Kbuild: Add a per-architecture option to ...")
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 scripts/Kbuild.klibc | 2 +-
 usr/klibc/Kbuild     | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc
index e88bc003..64da31ac 100644
--- a/scripts/Kbuild.klibc
+++ b/scripts/Kbuild.klibc
@@ -133,7 +133,7 @@ KLIBCDEFS        += -D__KLIBC__=$(KLIBCMAJOR)          \
 		    -D_BITSIZE=$(KLIBCBITSIZE)
 KLIBCCPPFLAGS    += $(KLIBCDEFS)
 KLIBCCFLAGS      += $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS)  \
-                    $(KLIBCOPTFLAGS) $(KLIBCSTACKFLGS) $(KLIBCWARNFLAGS)
+                    $(KLIBCOPTFLAGS) $(KLIBCSTACKFLAGS) $(KLIBCWARNFLAGS)
 KLIBCAFLAGS      += -D__ASSEMBLY__ $(KLIBCCFLAGS)
 KLIBCSTRIPFLAGS  += --strip-all -R .comment -R .note
 
diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
index 9ea55a23..5933f89a 100644
--- a/usr/klibc/Kbuild
+++ b/usr/klibc/Kbuild
@@ -186,7 +186,6 @@ quiet_cmd_interp = BUILD   $@
       cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__     \
                              -DLIBDIR=\"$(SHLIBDIR)\"         \
 			     -DSOHASH=\"$(SOLIBHASH)\" \
-                             $(KLIBCSTACKFLAGS) \
 			     -c -o $@ $<
 
 $(INTERP_O): $(obj)/interp.S $(SOLIB).hash


More information about the klibc mailing list