stackleak: Use a copy of the ctl_table argument
authorThomas Weißschuh <linux@weissschuh.net>
Fri, 3 May 2024 13:44:09 +0000 (15:44 +0200)
committerKees Cook <keescook@chromium.org>
Fri, 3 May 2024 19:35:12 +0000 (12:35 -0700)
commit0e148d3cca0dc1a7c6063939f6cb9ba4866c39a7
treea2f14853623d0ec84dfca6c5ea7616447c0a708f
parent7d78a77733552092361239b1d8afaf8412f5dffd
stackleak: Use a copy of the ctl_table argument

Sysctl handlers are not supposed to modify the ctl_table passed to them.
Adapt the logic to work with a temporary variable, similar to how it is
done in other parts of the kernel.

This is also a prerequisite to enforce the immutability of the argument
through the callbacks.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Tycho Andersen <tycho@tycho.pizza>
Link: https://lore.kernel.org/r/20240503-sysctl-const-stackleak-v1-1-603fecb19170@weissschuh.net
Signed-off-by: Kees Cook <keescook@chromium.org>
kernel/stackleak.c