coredump: reduce stack usage in vfs_coredump
PATCH 1/1 coredump: reduce stack usage in vfs_coredump
From: Arnd Bergmann <[email protected]>
A recent patch changed the coredump code in mostly harmless ways, but after this I get a very high stack usage in one function that was benign before:
fs/coredump.c: In function 'vfs_coredump':fs/coredump.c:1313:1: error: the frame size of 1872 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
This happens reproducibly every couple of randconfig builds on s390 with gcc-16 and seems to be caused by kasan checks causing local variables to be spilled to the stack.
Marking the do_coredump function as noinline_for_stack avoids the problem here, instead I get only 464 and 672 bytes in the worst case for vfs_coredump and do_coredump, respectively.
---
If anyone wants to look at it in more detail, here is the information I have:
randconfig: https://pastebin.com/raw/bskKJixQ
assembler output: https://pastebin.com/raw/Wr1V8kRS
--- fs/coredump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/coredump.c +4 -2
@@ -1198,8 +1198,10 @@ static inline bool coredump_skip(const struct coredump_params *cprm,return false; } -static void do_coredump (struct core_name *cn,struct coredump_params *cprm, -size_t **argv,int *argc,const struct linux_binfmt *binfmt) +static noinline_for_stack void do_coredump(struct core_name *cn, +struct coredump_params *cprm, +size_t **argv,int *argc, +const struct linux_binfmt *binfmt) {trace_coredump (cprm->siginfo->si_signo);
Signature · 1 line
2.53.0
Quoted 1 line · Arnd Bergmann
coredump: reduce stack usage in
vfs_coredump
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] coredump: reduce stack usage in vfs_coredump
https://git.kernel.org/vfs/vfs/c/5a7e104cc9bb