klibc-bot for Ben Hutchings
2020-Jul-25 16:36 UTC
[klibc] [klibc:master] Kbuild: Add a per-architecture option to disable exectable stacks
Commit-ID: c562319cdba0102c3a8a8298ba94e645418193d5 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=c562319cdba0102c3a8a8298ba94e645418193d5 Author: Ben Hutchings <ben at decadent.org.uk> AuthorDate: Wed, 29 Apr 2020 22:28:10 +0100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 25 Jul 2020 17:33:29 +0100 [klibc] Kbuild: Add a per-architecture option to disable exectable stacks We still want to avoid executable stacks, but now we will only do so for architectures where we know we can avoid stack trampolines for signal return. Disable executable stacks only if KLIBCEXECSTACK is set to 'n' by the architecture's MCONFIG. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- scripts/Kbuild.klibc | 5 ++++- usr/klibc/Kbuild | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index b7e99b56..a9a2a40e 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -118,13 +118,16 @@ KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ $(if $(KBUILD_SRC),-I$(srctree)/include) \ $(KLIBCARCHINCFLAGS) +# compiler/assembler option for whether we want an executable stack +KLIBCSTACKFLAGS := -Wa,$(if $(filter n,$(KLIBCEXECSTACK)),no)execstack + # klibc definitions KLIBCDEFS += -D__KLIBC__=$(KLIBCMAJOR) \ -D__KLIBC_MINOR__=$(KLIBCMINOR) \ -D_BITSIZE=$(KLIBCBITSIZE) KLIBCCPPFLAGS += $(KLIBCDEFS) KLIBCCFLAGS += $(KLIBCCPPFLAGS) $(KLIBCREQFLAGS) $(KLIBCARCHREQFLAGS) \ - $(KLIBCOPTFLAGS) $(KLIBCWARNFLAGS) + $(KLIBCOPTFLAGS) $(KLIBCSTACKFLGS) $(KLIBCWARNFLAGS) KLIBCAFLAGS += -D__ASSEMBLY__ $(KLIBCCFLAGS) KLIBCSTRIPFLAGS += --strip-all -R .comment -R .note diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild index bec9cdb4..c6338851 100644 --- a/usr/klibc/Kbuild +++ b/usr/klibc/Kbuild @@ -185,6 +185,7 @@ quiet_cmd_interp = BUILD $@ cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \ -DLIBDIR=\"$(SHLIBDIR)\" \ -DSOHASH=\"$(SOLIBHASH)\" \ + $(KLIBCSTACKFLAGS) \ -c -o $@ $< $(INTERP_O): $(obj)/interp.S $(SOLIB).hash
Apparently Analagous Threads
- [PATCH klibc 1/3] Revert " Kbuild: Tell gas we don't want executable stacks"
- [klibc:master] Revert " Kbuild: Tell gas we don't want executable stacks"
- [klibc:master] Kbuild: Fix the compiler execstack option
- [klibc:master] Kbuild: Tell gas we don't want executable stacks
- [klibc 19/43] klibc basic build infrastructure