]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
execve: expand new process stack manually ahead of time
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 5 Jul 2023 12:34:23 +0000 (09:34 -0300)
committerLuke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
Thu, 6 Jul 2023 20:20:10 +0000 (13:20 -0700)
commitae5159e39f1187cbccb0340ccd41574e661bcb1a
tree0610f3067bd7b396242bdc97d6365dafc48991e3
parent3e59eb9d7487c1b63089e319822fd177c8a977ab
execve: expand new process stack manually ahead of time

This is a small step towards a model where GUP itself would not expand
the stack, and any user that needs GUP to not look up existing mappings,
but actually expand on them, would have to do so manually before-hand,
and with the mm lock held for writing.

It turns out that execve() already did almost exactly that, except it
didn't take the mm lock at all (it's single-threaded so no locking
technically needed, but it could cause lockdep errors).  And it only did
it for the CONFIG_STACK_GROWSUP case, since in that case GUP has
obviously never expanded the stack downwards.

So just make that CONFIG_STACK_GROWSUP case do the right thing with
locking, and enable it generally.  This will eventually help GUP, and in
the meantime avoids a special case and the lockdep issue.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit f313c51d26aa87e69633c9b46efb37a930faca71)
CVE-2023-3269
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Acked-by: Cengiz Can <cengiz.can@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
fs/exec.c