Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

stackleak: let stack_erasing_sysctl take a kernel pointer buffer

Commit 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
changed ctl_table.proc_handler to take a kernel pointer. Adjust the
signature of stack_erasing_sysctl to match ctl_table.proc_handler which
fixes the following sparse warning:

kernel/stackleak.c:31:50: warning: incorrect type in argument 3 (different address spaces)
kernel/stackleak.c:31:50: expected void *
kernel/stackleak.c:31:50: got void [noderef] __user *buffer

Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lkml.kernel.org/r/20200907093253.13656-1-tklauser@distanz.ch
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Tobias Klauser and committed by
Linus Torvalds
4773ef33 7bb82ac3

+2 -2
+1 -1
include/linux/stackleak.h
··· 25 25 26 26 #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE 27 27 int stack_erasing_sysctl(struct ctl_table *table, int write, 28 - void __user *buffer, size_t *lenp, loff_t *ppos); 28 + void *buffer, size_t *lenp, loff_t *ppos); 29 29 #endif 30 30 31 31 #else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
+1 -1
kernel/stackleak.c
··· 20 20 static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass); 21 21 22 22 int stack_erasing_sysctl(struct ctl_table *table, int write, 23 - void __user *buffer, size_t *lenp, loff_t *ppos) 23 + void *buffer, size_t *lenp, loff_t *ppos) 24 24 { 25 25 int ret = 0; 26 26 int state = !static_branch_unlikely(&stack_erasing_bypass);