diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2022-01-27 12:54:16 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2022-01-27 12:54:16 -0800 |
| commit | 72d044e4bfa6bd9096536e2e1c62aecfe1a525e4 (patch) | |
| tree | 0e408f181f5c704ff43cd006f4643c339e04aff1 /kernel/stackleak.c | |
| parent | e2cf07654efb0fd7bbcb475c6f74be7b5755a8fd (diff) | |
| parent | 23a46422c56144939c091c76cf389aa863ce9c18 (diff) | |
| download | linux-next-72d044e4bfa6bd9096536e2e1c62aecfe1a525e4.tar.gz linux-next-72d044e4bfa6bd9096536e2e1c62aecfe1a525e4.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
No conflicts.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'kernel/stackleak.c')
| -rw-r--r-- | kernel/stackleak.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/kernel/stackleak.c b/kernel/stackleak.c index ce161a8e8d97..66b8af394e58 100644 --- a/kernel/stackleak.c +++ b/kernel/stackleak.c @@ -16,11 +16,13 @@ #ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE #include <linux/jump_label.h> #include <linux/sysctl.h> +#include <linux/init.h> static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass); -int stack_erasing_sysctl(struct ctl_table *table, int write, - void *buffer, size_t *lenp, loff_t *ppos) +#ifdef CONFIG_SYSCTL +static int stack_erasing_sysctl(struct ctl_table *table, int write, + void __user *buffer, size_t *lenp, loff_t *ppos) { int ret = 0; int state = !static_branch_unlikely(&stack_erasing_bypass); @@ -42,6 +44,26 @@ int stack_erasing_sysctl(struct ctl_table *table, int write, state ? "enabled" : "disabled"); return ret; } +static struct ctl_table stackleak_sysctls[] = { + { + .procname = "stack_erasing", + .data = NULL, + .maxlen = sizeof(int), + .mode = 0600, + .proc_handler = stack_erasing_sysctl, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, + }, + {} +}; + +static int __init stackleak_sysctls_init(void) +{ + register_sysctl_init("kernel", stackleak_sysctls); + return 0; +} +late_initcall(stackleak_sysctls_init); +#endif /* CONFIG_SYSCTL */ #define skip_erasing() static_branch_unlikely(&stack_erasing_bypass) #else |
