unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Mips support for PT_GNU_STACK
@ 2019-06-27 21:49 Dragan Mladjenovic
  2019-06-27 21:50 ` [PATCH 1/3] [ELF] Allow the machine to override stack permissions via USE_DL_EXEC_STACK_OVERRIDE Dragan Mladjenovic
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Dragan Mladjenovic @ 2019-06-27 21:49 UTC (permalink / raw)
  To: libc-alpha@sourceware.org
  Cc: Joseph Myers, Carlos O'Donell, Maciej W. Rozycki,
	Faraz Shahbazker, Dragan Mladjenovic

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-07-09 22:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 21:49 [PATCH 0/3] Mips support for PT_GNU_STACK Dragan Mladjenovic
2019-06-27 21:50 ` [PATCH 1/3] [ELF] Allow the machine to override stack permissions via USE_DL_EXEC_STACK_OVERRIDE Dragan Mladjenovic
2019-07-08 11:33   ` Joseph Myers
2019-07-09 21:35     ` Dragan Mladjenovic
2019-07-08 11:50   ` Florian Weimer
2019-06-27 21:50 ` [PATCH 2/3] [MIPS] Define USE_DL_EXEC_STACK_OVERRIDE on Mips Dragan Mladjenovic
2019-06-27 21:50 ` [PATCH 3/3] [RFC][MIPS] Define GNU_STACK ABI Dragan Mladjenovic
2019-06-28  8:34 ` [PATCH 0/3] Mips support for PT_GNU_STACK Florian Weimer
2019-06-28 12:21   ` Dragan Mladjenovic
2019-06-28 16:19   ` Faraz Shahbazker
2019-07-05 12:52     ` Dragan Mladjenovic
2019-07-05 16:16       ` Maciej W. Rozycki
2019-07-08 12:01     ` Florian Weimer
2019-07-09 22:39       ` Dragan Mladjenovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).