This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/3] Mips support for PT_GNU_STACK


Hello everyone,

Patches in this series are slight variation of work done previously by Faraz Shahbazker [1]
in 2016. A brief summary of the issue this is trying to address:

Up until the Linux kernel version 4.8 [2] MIPS FPU emulator used a small trampoline created on
user stack to handle delay slots when emulating FPU branches. Because of this non-executable stack
could not be enabled by default on MIPS. The compatibility issue is that these old kernels respect
PT_GNU_STACK, making the stack non-executable if requested, and could crash the user process if there
would be need to emulate a instruction in the delay slot of a FPU branch.

In order to allow for the tool-chain to safely use PT_GNU_STACK by default and to provide the
compatibility with pre-4.8 kernels, original patch would revert stack protection back to executable
stack if it could not detect that kernel supports non-executable stack.

The form of detection the patch proposes is not yet provided by the kernel. Instead, this version of
the patch does kernel version check at runtime and provides compatible behavior if it cannot detect
the 4.8 kernel or newer.
 
The last patch increments the ABI Version number in order to disallow new binaries to run with older glibc.
The number is not set in stone. I'm assuming it will probably land after GNU_HASH [3] support which consumes
ABI version 5 for MIPS. I will send proposal for Binutils and GCC after this part gets finalized.

Even if this part doesn't get in the next release due to issue [4] with ABI version handling.
It would be still nice if the back-compat support gets in. I would like to hear your thoughts on this.

Best regards,

Dragan

[1] https://sourceware.org/ml/libc-alpha/2016-02/msg00076.html
[2] https://github.com/torvalds/linux/commit/432c6bacbd0c16ec210c43da411ccc3855c4c010
[3] https://sourceware.org/ml/libc-alpha/2019-06/msg00456.html
[4] https://sourceware.org/ml/libc-alpha/2019-06/msg00730.html


Dragan Mladjenovic (3):
  [ELF] Allow the machine to override stack permissions via
    USE_DL_EXEC_STACK_OVERRIDE.
  [MIPS] Define USE_DL_EXEC_STACK_OVERRIDE on Mips
  [RFC][MIPS] Define GNU_STACK ABI

 elf/dl-load.c                                      | 10 +++++
 elf/dl-support.c                                   |  8 +++-
 sysdeps/generic/ldsodefs.h                         |  4 ++
 sysdeps/unix/sysv/linux/mips/Makefile              | 28 +++++++++++--
 sysdeps/unix/sysv/linux/mips/configure.ac          |  2 +
 sysdeps/unix/sysv/linux/mips/dl-execstack-ovrd.c   | 48 ++++++++++++++++++++++
 sysdeps/unix/sysv/linux/mips/dl-sysdep.h           | 28 +++++++++++++
 sysdeps/unix/sysv/linux/mips/ldsodefs.h            |  2 +-
 sysdeps/unix/sysv/linux/mips/libc-abis             |  2 +
 .../sysv/linux/mips/tst-execstack-ovrd-static.c    |  1 +
 sysdeps/unix/sysv/linux/mips/tst-execstack-ovrd.c  |  2 +
 .../sysv/linux/mips/tst-execstack-ovrd1-static.c   |  1 +
 sysdeps/unix/sysv/linux/mips/tst-execstack-ovrd1.c | 11 +++++
 13 files changed, 141 insertions(+), 6 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/mips/dl-execstack-ovrd.c
 create mode 100644 sysdeps/unix/sysv/linux/mips/dl-sysdep.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/tst-execstack-ovrd-static.c
 create mode 100644 sysdeps/unix/sysv/linux/mips/tst-execstack-ovrd.c
 create mode 100644 sysdeps/unix/sysv/linux/mips/tst-execstack-ovrd1-static.c
 create mode 100644 sysdeps/unix/sysv/linux/mips/tst-execstack-ovrd1.c

-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]