unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Mips support for PT_GNU_STACK
@ 2019-07-15 18:23 Dragan Mladjenovic
  2019-07-16 11:15 ` [PATCH v2 1/3] [ELF] Allow the machine support to enforce executable stack Dragan Mladjenovic
  2019-07-17 19:43 ` [PATCH v2 0/3] Mips support for PT_GNU_STACK Adhemerval Zanella
  0 siblings, 2 replies; 14+ messages in thread
From: Dragan Mladjenovic @ 2019-07-15 18:23 UTC (permalink / raw)
  To: libc-alpha@sourceware.org
  Cc: Dragan Mladjenovic, Joseph Myers, Carlos O'Donell,
	Maciej W . Rozycki, Faraz Shahbazker

Hello everyone,

Patches in this series are a 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 an instruction in the delay slot of an 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, the 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 a proposal for Binutils and GCC after this
part gets finalized.

Even if this part doesn't get in the next release due to issues [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.

Changes from v1 [5]: Moved stack override logic behind inline _dl_exec_stack_override.

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
[5] https://sourceware.org/ml/libc-alpha/2019-06/msg00889.html

Dragan Mladjenovic (3):
  [ELF] Allow the machine support to enforce executable stack
  [MIPS] Define DL_EXEC_STACK_OVERRIDE
  [RFC][MIPS] Define GNU_STACK ABI

 elf/dl-exec-stack-override.h                       | 36 ++++++++++++++++++++++
 elf/dl-support.c                                   |  3 ++
 elf/rtld.c                                         |  3 ++
 sysdeps/generic/ldsodefs.h                         |  4 +++
 sysdeps/unix/sysv/linux/mips/Makefile              | 26 +++++++++++++---
 sysdeps/unix/sysv/linux/mips/configure.ac          |  3 ++
 sysdeps/unix/sysv/linux/mips/ldsodefs.h            | 13 +++++++-
 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 | 10 ++++++
 12 files changed, 99 insertions(+), 5 deletions(-)
 create mode 100644 elf/dl-exec-stack-override.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-18 20:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 18:23 [PATCH v2 0/3] Mips support for PT_GNU_STACK Dragan Mladjenovic
2019-07-16 11:15 ` [PATCH v2 1/3] [ELF] Allow the machine support to enforce executable stack Dragan Mladjenovic
2019-07-16 11:16   ` [PATCH v2 2/3] [MIPS] Define DL_EXEC_STACK_OVERRIDE Dragan Mladjenovic
2019-07-16 11:16   ` [PATCH v2 3/3] [RFC][MIPS] Define GNU_STACK ABI Dragan Mladjenovic
2019-07-17 19:43 ` [PATCH v2 0/3] Mips support for PT_GNU_STACK Adhemerval Zanella
2019-07-17 21:47   ` Dragan Mladjenovic
2019-07-18 13:33     ` Adhemerval Zanella
2019-07-18 20:00       ` Dragan Mladjenovic
2019-07-17 22:59   ` Faraz Shahbazker
2019-07-18 13:38     ` Adhemerval Zanella
2019-07-18 15:34       ` Faraz Shahbazker
2019-07-18 19:49       ` Dragan Mladjenovic
2019-07-18 20:54         ` Adhemerval Zanella
2019-07-18 14:50   ` Maciej W. Rozycki

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).