search for: klibcexecstack

Displaying 19 results from an estimated 19 matches for "klibcexecstack".

2020 Jul 25
0
[klibc:master] arch: Explicitly disable or enable executable stacks
...s <ben at decadent.org.uk> AuthorDate: Wed, 29 Apr 2020 22:56:59 +0100 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 25 Jul 2020 17:33:29 +0100 [klibc] arch: Explicitly disable or enable executable stacks For each architecture (except cris, which is obsolete) set KLIBCEXECSTACK to 'y' or 'n', and comment on the kernel's signal return implementation. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/klibc/arch/alpha/MCONFIG | 4 ++++ usr/klibc/arch/arm/MCONFIG | 3 +++ usr/klibc/arch/arm64/MCONFIG | 3 +++ usr/klibc/arch/i38...
2020 Apr 29
2
[PATCH klibc 1/3] Revert " Kbuild: Tell gas we don't want executable stacks"
This reverts commit 9d8d648e604026b32cad00a84ed6c29cbd157641, which broke signal handing on some architectures. On m68k and parisc, signal return depends on a trampoline that the kernel writes on the stack. On alpha, s390, and sparc (32-bit), we can avoid this by providing our own function as sa_restorer, but we currently don't. Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
2020 Jul 25
0
[klibc:master] Kbuild: support clang's lld
...sing normal inter-module # calls, and work on the memory models for this architecture # 96 MB - normal binaries start at 128 MB -KLIBCSHAREDFLAGS = -Ttext-segment 0x06000000 +KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x06000000 # Kernel uses dedicated page or vDSO for signal return since 2.5.55 KLIBCEXECSTACK := n diff --git a/usr/klibc/arch/mips64/MCONFIG b/usr/klibc/arch/mips64/MCONFIG index 94b825a6..6dcb143e 100644 --- a/usr/klibc/arch/mips64/MCONFIG +++ b/usr/klibc/arch/mips64/MCONFIG @@ -19,8 +19,9 @@ KLIBCBITSIZE = 64 # 256M aligned region. Since we can't put ourselves below the normal # l...
2020 Aug 27
0
[klibc:master] sparc: Set sa_restorer for signals and disable executable stack
...k. * Define a __sigreturn() routine that calls rt_sigreturn * Force the SA_RESTORER flag on for all signal handlers, and set __sigreturn as the restorer if none is already set * Force the SA_SIGINFO flag on for all signal handlers, so that we can always return from them with rt_sigreturn * Set KLIBCEXECSTACK=n Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/arch/sparc/klibc/archconfig.h | 5 +++++ usr/klibc/SYSCALLS.def | 2 +- usr/klibc/arch/sparc/MCONFIG | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/usr/include...
2020 Aug 27
0
[klibc:master] s390: Set sa_restorer for signals and disable executable stack
...k. * Define a __sigreturn() routine that calls rt_sigreturn * Force the SA_RESTORER flag on for all signal handlers, and set __sigreturn as the restorer if none is already set * Force the SA_SIGINFO flag on for all signal handlers, so that we can always return from them with rt_sigreturn * Set KLIBCEXECSTACK=n Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/arch/s390/klibc/archconfig.h | 5 +++++ usr/klibc/SYSCALLS.def | 2 +- usr/klibc/arch/s390/MCONFIG | 5 ++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/usr/include/ar...
2020 Aug 27
0
[klibc:master] alpha: Pass restorer to rt_sigaction() and disable executable stack
...n(). We should do this to avoid needing an executable stack. * Force the SA_SIGINFO flag on for all signal handlers, so that we can always return from them with rt_sigreturn * Define a __sigreturn() routine that calls rt_sigreturn * Pass that routine as the last argument to rt_sigaction() * Set KLIBCEXECSTACK=n Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- usr/include/arch/alpha/klibc/archconfig.h | 2 ++ usr/klibc/arch/alpha/Kbuild | 2 +- usr/klibc/arch/alpha/MCONFIG | 5 ++--- usr/klibc/arch/alpha/sigreturn.S | 18 ++++++++++++++++++ usr/kli...
2020 Jul 25
0
[klibc:master] Kbuild: Add a per-architecture option to disable exectable stacks
...Date: 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 b7e...
2020 Jul 25
0
[klibc:master] Kbuild: Fix the compiler execstack option
...index a9a2a40e..d1c78ce6 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -119,7 +119,7 @@ KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ $(KLIBCARCHINCFLAGS) # compiler/assembler option for whether we want an executable stack -KLIBCSTACKFLAGS := -Wa,$(if $(filter n,$(KLIBCEXECSTACK)),no)execstack +KLIBCSTACKFLAGS := -Wa,--$(if $(filter n,$(KLIBCEXECSTACK)),no)execstack # klibc definitions KLIBCDEFS += -D__KLIBC__=$(KLIBCMAJOR) \
2020 Jul 25
0
[klibc:execstack-fixes] s390: Set sa_restorer for signals and disable executable stack
...r/klibc/arch/s390/MCONFIG index c36acd7a..7ffbcc45 100644 --- a/usr/klibc/arch/s390/MCONFIG +++ b/usr/klibc/arch/s390/MCONFIG @@ -22,6 +22,5 @@ endif KLIBCASMARCH = s390 KLIBCSHAREDFLAGS = -Ttext-segment 0x40000000 -# Kernel uses stack trampoline for signal return unless we set -# sa_restorer -KLIBCEXECSTACK := y +# Kernel uses our sa_restorer for signal return +KLIBCEXECSTACK := n
2020 Jul 25
0
[klibc:execstack-fixes] sparc: Set sa_restorer for signals and disable executable stack
...ch/sparc/MCONFIG +++ b/usr/klibc/arch/sparc/MCONFIG @@ -18,6 +18,5 @@ KLIBCARCHREQFLAGS += -D__sparc32__ # and call instructions have a 30-bit signed offset, << 2. KLIBCSHAREDFLAGS = -Ttext-segment 0x40000000 -# Kernel uses stack trampoline for signal return unless we set -# sa_restorer -KLIBCEXECSTACK := y +# Kernel uses our sa_restorer for signal return +KLIBCEXECSTACK := n
2020 Aug 20
0
[klibc:execstack-fixes] s390: Set sa_restorer for signals and disable executable stack
...r/klibc/arch/s390/MCONFIG index c36acd7a..7ffbcc45 100644 --- a/usr/klibc/arch/s390/MCONFIG +++ b/usr/klibc/arch/s390/MCONFIG @@ -22,6 +22,5 @@ endif KLIBCASMARCH = s390 KLIBCSHAREDFLAGS = -Ttext-segment 0x40000000 -# Kernel uses stack trampoline for signal return unless we set -# sa_restorer -KLIBCEXECSTACK := y +# Kernel uses our sa_restorer for signal return +KLIBCEXECSTACK := n
2020 Aug 20
0
[klibc:execstack-fixes] sparc: Set sa_restorer for signals and disable executable stack
...ch/sparc/MCONFIG +++ b/usr/klibc/arch/sparc/MCONFIG @@ -18,6 +18,5 @@ KLIBCARCHREQFLAGS += -D__sparc32__ # and call instructions have a 30-bit signed offset, << 2. KLIBCSHAREDFLAGS = -Ttext-segment 0x40000000 -# Kernel uses stack trampoline for signal return unless we set -# sa_restorer -KLIBCEXECSTACK := y +# Kernel uses our sa_restorer for signal return +KLIBCEXECSTACK := n
2020 Jul 25
0
[klibc:execstack-fixes] alpha: Set sa_restorer for signals and disable executable stack
...ch/alpha/MCONFIG index 072adb85..e71db264 100644 --- a/usr/klibc/arch/alpha/MCONFIG +++ b/usr/klibc/arch/alpha/MCONFIG @@ -15,6 +15,5 @@ KLIBCBITSIZE = 64 # the binary. KLIBCSHAREDFLAGS = -Ttext-segment 0x1c0000000 -# Kernel uses stack trampoline for signal return unless we set -# sa_restorer -KLIBCEXECSTACK := y +# Kernel uses our sa_restorer for signal return +KLIBCEXECSTACK := n diff --git a/usr/klibc/arch/alpha/sigreturn.S b/usr/klibc/arch/alpha/sigreturn.S new file mode 100644 index 00000000..02aba9c5 --- /dev/null +++ b/usr/klibc/arch/alpha/sigreturn.S @@ -0,0 +1,16 @@ +/* + * arch/alpha/sigretur...
2020 Aug 20
0
[klibc:execstack-fixes] alpha: Set sa_restorer for signals and disable executable stack
...ch/alpha/MCONFIG index 072adb85..e71db264 100644 --- a/usr/klibc/arch/alpha/MCONFIG +++ b/usr/klibc/arch/alpha/MCONFIG @@ -15,6 +15,5 @@ KLIBCBITSIZE = 64 # the binary. KLIBCSHAREDFLAGS = -Ttext-segment 0x1c0000000 -# Kernel uses stack trampoline for signal return unless we set -# sa_restorer -KLIBCEXECSTACK := y +# Kernel uses our sa_restorer for signal return +KLIBCEXECSTACK := n diff --git a/usr/klibc/arch/alpha/sigreturn.S b/usr/klibc/arch/alpha/sigreturn.S new file mode 100644 index 00000000..95415edd --- /dev/null +++ b/usr/klibc/arch/alpha/sigreturn.S @@ -0,0 +1,16 @@ +/* + * arch/alpha/sigretur...
2023 Mar 05
0
[klibc:master] Add LoongArch64 port
...lly +# use the BL instruction which requires a destination between -128M +# to 128M. Since we can't put ourselves below the normal load +# address, use the very top of the 128M region (minus 2MB) +KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x127E00000 # Kernel has never used stack trampolines -KLIBCEXECSTACK := n +KLIBCEXECSTACK := n diff --git a/usr/klibc/arch/riscv64/crt0.S b/usr/klibc/arch/loongarch64/crt0.S similarity index 54% copy from usr/klibc/arch/riscv64/crt0.S copy to usr/klibc/arch/loongarch64/crt0.S index 76fa3c28..cb3da669 100644 --- a/usr/klibc/arch/riscv64/crt0.S +++ b/usr/klibc/arch...
2020 Oct 13
1
[PATCH] klibc: support llvm's lld for arm64
...+= -fno-exceptions -mgeneral-regs-only # On arm64, binaries are normally loaded at 4MB. Place klibc.so # a little before that at 2MB to prevent overlap. -KLIBCSHAREDFLAGS = -Ttext-segment 0x0200000 +KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x0200000 # Kernel has never used stack trampolines KLIBCEXECSTACK := n -- 2.28.0.1011.ga647a8990f-goog
2020 Aug 29
0
[klibc:riscv64-enable-relax] riscv64: Make linker relaxation work and enable it
...hat gp -# should be. For now, disable gp-relative addressing. -KLIBCLDFLAGS = --no-relax KLIBCOPTFLAGS += -Os -fomit-frame-pointer ifeq ($(DEBUG),y) KLIBCOPTFLAGS += -g @@ -21,3 +18,6 @@ KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x00200000 # Kernel has never used stack trampolines KLIBCEXECSTACK := n + +KLIBCEMAIN := -e _main +KLIBCCRTSHARED += $(KLIBCOBJ)/arch/riscv64/_main.o diff --git a/usr/klibc/arch/riscv64/_main.S b/usr/klibc/arch/riscv64/_main.S new file mode 100644 index 00000000..284a2222 --- /dev/null +++ b/usr/klibc/arch/riscv64/_main.S @@ -0,0 +1,17 @@ +# +# arch/risc...
2020 Aug 29
0
[klibc:riscv64-enable-relax] riscv64: Make linker relaxation work and enable it
...G),y) KLIBCOPTFLAGS += -g @@ -18,6 +15,10 @@ KLIBCBITSIZE = 64 # Normal binaries start at 64 KB, so start the libary at 2 MB. KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x00200000 +KLIBCSHAREDFLAGS += --defsym '__global_pointer$$=0' # Kernel has never used stack trampolines KLIBCEXECSTACK := n + +KLIBCEMAIN := -e _main +KLIBCCRTSHARED += $(KLIBCOBJ)/arch/riscv64/_main.o diff --git a/usr/klibc/arch/riscv64/_main.S b/usr/klibc/arch/riscv64/_main.S new file mode 100644 index 00000000..284a2222 --- /dev/null +++ b/usr/klibc/arch/riscv64/_main.S @@ -0,0 +1,17 @@ +# +# arch/risc...
2023 Feb 20
1
[PATCH] Add LoongArch64 port
...lly +# use the BL instruction which requires a destination between -128M +# to 128M. Since we can't put ourselves below the normal load +# address, use the very top of the 128M region (minus 2MB) +KLIBCSHAREDFLAGS = $(LD_IMAGE_BASE_OPT) 0x127E00000 + +# Kernel has never used stack trampolines +KLIBCEXECSTACK := n diff --git a/usr/klibc/arch/loongarch64/crt0.S b/usr/klibc/arch/loongarch64/crt0.S new file mode 100644 index 00000000..cb3da669 --- /dev/null +++ b/usr/klibc/arch/loongarch64/crt0.S @@ -0,0 +1,18 @@ +# +# arch/loongarch64/crt0.S +# +# Does arch-specific initialization and invokes __libc_in...