diff options
author | Dragan Mladjenovic <dmladjenovic@wavecomp.com> | 2019-08-23 16:38:04 +0000 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-11-05 14:25:38 -0300 |
commit | 92f04eedb50dc12643addbcb033a06b51633d0ff (patch) | |
tree | cd586a4b9d119dce9a951c7982e55f48c2422956 /sysdeps/unix/sysv/linux/mips/Makefile | |
parent | 5b4f7382af46b4187a958e40fb3123ac3ce16810 (diff) | |
download | glibc-92f04eedb50dc12643addbcb033a06b51633d0ff.tar.gz glibc-92f04eedb50dc12643addbcb033a06b51633d0ff.tar.xz glibc-92f04eedb50dc12643addbcb033a06b51633d0ff.zip |
mips: Force RWX stack for hard-float builds that can run on pre-4.8 kernels
Linux/Mips kernels prior to 4.8 could potentially crash the user process when doing FPU emulation while running on non-executable user stack. Currently, gcc doesn't emit .note.GNU-stack for mips, but that will change in the future. To ensure that glibc can be used with such future gcc, without silently resulting in binaries that might crash in runtime, this patch forces RWX stack for all built objects if configured to run against minimum kernel version less than 4.8. * sysdeps/unix/sysv/linux/mips/Makefile (test-xfail-check-execstack): Move under mips-has-gnustack != yes. (CFLAGS-.o*, ASFLAGS-.o*): New rules. Apply -Wa,-execstack if mips-force-execstack == yes. * sysdeps/unix/sysv/linux/mips/configure: Regenerated. * sysdeps/unix/sysv/linux/mips/configure.ac (mips-force-execstack): New var. Set to yes for hard-float builds with minimum_kernel < 4.8.0 or minimum_kernel not set at all. (mips-has-gnustack): New var. Use value of libc_cv_as_noexecstack if mips-force-execstack != yes, otherwise set to no. (cherry picked from commit 33bc9efd91de1b14354291fc8ebd5bce96379f12)
Diffstat (limited to 'sysdeps/unix/sysv/linux/mips/Makefile')
-rw-r--r-- | sysdeps/unix/sysv/linux/mips/Makefile | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile index 8217f42e75..03044e7365 100644 --- a/sysdeps/unix/sysv/linux/mips/Makefile +++ b/sysdeps/unix/sysv/linux/mips/Makefile @@ -63,14 +63,25 @@ sysdep-dl-routines += dl-static sysdep_routines += dl-vdso endif - -# Supporting non-executable stacks on MIPS requires changes to both -# the Linux kernel and glibc. See -# <https://sourceware.org/ml/libc-alpha/2016-01/msg00567.html> and -# <https://sourceware.org/ml/libc-alpha/2016-01/msg00719.html>. +# If the compiler doesn't use GNU.stack note, +# this test is expected to fail. +ifneq ($(mips-has-gnustack),yes) test-xfail-check-execstack = yes endif +endif ifeq ($(subdir),stdlib) gen-as-const-headers += ucontext_i.sym endif + +ifeq ($(mips-force-execstack),yes) +CFLAGS-.o += -Wa,-execstack +CFLAGS-.os += -Wa,-execstack +CFLAGS-.op += -Wa,-execstack +CFLAGS-.oS += -Wa,-execstack + +ASFLAGS-.o += -Wa,-execstack +ASFLAGS-.os += -Wa,-execstack +ASFLAGS-.op += -Wa,-execstack +ASFLAGS-.oS += -Wa,-execstack +endif |