linux/arch
Kees Cook 8f2af155b5 exec: pass stack rlimit into mm layout functions
Patch series "exec: Pin stack limit during exec".

Attempts to solve problems with the stack limit changing during exec
continue to be frustrated[1][2].  In addition to the specific issues
around the Stack Clash family of flaws, Andy Lutomirski pointed out[3]
other places during exec where the stack limit is used and is assumed to
be unchanging.  Given the many places it gets used and the fact that it
can be manipulated/raced via setrlimit() and prlimit(), I think the only
way to handle this is to move away from the "current" view of the stack
limit and instead attach it to the bprm, and plumb this down into the
functions that need to know the stack limits.  This series implements
the approach.

[1] 04e35f4495 ("exec: avoid RLIMIT_STACK races with prlimit()")
[2] 779f4e1c6c ("Revert "exec: avoid RLIMIT_STACK races with prlimit()"")
[3] to security@kernel.org, "Subject: existing rlimit races?"

This patch (of 3):

Since it is possible that the stack rlimit can change externally during
exec (either via another thread calling setrlimit() or another process
calling prlimit()), provide a way to pass the rlimit down into the
per-architecture mm layout functions so that the rlimit can stay in the
bprm structure instead of sitting in the signal structure until exec is
finalized.

Link: http://lkml.kernel.org/r/1518638796-20819-2-git-send-email-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Hugh Dickins <hughd@google.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Greg KH <greg@kroah.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-11 10:28:37 -07:00
..
alpha alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering 2018-04-07 15:04:15 -07:00
arc Merge branch 'akpm' (patches from Andrew) 2018-04-06 14:19:26 -07:00
arm exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
arm64 exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
c6x c6x: pass endianness info to sparse 2018-04-10 09:58:58 -04:00
h8300 h8300: remove extraneous __BIG_ENDIAN definition 2018-03-22 17:07:01 -07:00
hexagon
ia64 pci-v4.17-changes 2018-04-06 18:31:06 -07:00
m68k Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2018-04-09 09:15:46 -07:00
microblaze Merge branch 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux 2018-04-02 21:22:12 -07:00
mips exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
nds32 nds32: To use the generic dump_stack() 2018-03-16 15:45:23 +08:00
nios2 mm: fix races between swapoff and flush dcache 2018-04-05 21:36:26 -07:00
openrisc Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-04-04 15:19:26 -07:00
parisc exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
powerpc exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
riscv RISC-V changes for 4.17 2018-04-04 16:43:47 -07:00
s390 exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
sh Merge branch 'i2c/for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2018-04-07 12:36:18 -07:00
sparc exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
um mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() 2018-04-02 20:16:11 +02:00
unicore32 mm: fix races between swapoff and flush dcache 2018-04-05 21:36:26 -07:00
x86 exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
xtensa pci-v4.17-changes 2018-04-06 18:31:06 -07:00
.gitignore
Kconfig kbuild: remove incremental linking option 2018-03-26 02:01:19 +09:00