OpenCloudOS-Kernel/arch/s390
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
..
appldata s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
boot s390/decompressor: trim uncompressed image head during the build 2018-03-18 23:02:07 -07:00
configs firmware: Drop FIRMWARE_IN_KERNEL Kconfig option 2018-01-25 12:46:30 +01:00
crypto s390/crypto: Fix kernel crash on aes_s390 module remove. 2018-03-18 23:02:05 -07:00
hypfs s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
include ARM: 2018-04-09 11:42:31 -07:00
kernel Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2018-04-09 09:04:10 -07:00
kvm KVM: s390: provide counters for all interrupt injects/delivery 2018-03-14 19:21:18 +00:00
lib s390: fix preemption race in disable_sacf_uaccess 2017-12-15 15:05:21 +01:00
mm exec: pass stack rlimit into mm layout functions 2018-04-11 10:28:37 -07:00
net bpf, s390x: remove obsolete exception handling from div/mod 2018-01-26 16:42:06 -08:00
numa s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
oprofile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci s390/pci: handle insufficient resources during dma tlb flush 2017-12-13 10:51:33 +01:00
tools KVM: s390: implement CPU model only facilities 2018-03-09 09:44:17 +00:00
Kbuild s390: add a few more SPDX identifiers 2017-12-05 07:51:09 +01:00
Kconfig s390: add sysfs attributes for spectre 2018-03-28 08:38:26 +02:00
Kconfig.debug License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile s390: add automatic detection of the spectre defense 2018-03-28 08:38:24 +02:00
defconfig s390: update defconfig 2017-10-16 08:19:28 +02:00