yama_lsm.c (ecb41832bd2a7a3f8ac93527cec5e51e3827daed) yama_lsm.c (eec4844fae7c033a0c1fc1eb3b8517aeb8b6cc49)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Yama Linux Security Module
4 *
5 * Author: Kees Cook <keescook@chromium.org>
6 *
7 * Copyright (C) 2010 Canonical, Ltd.
8 * Copyright (C) 2011 The Chromium OS Authors.

--- 431 unchanged lines hidden (view full) ---

440 /* Lock the max value if it ever gets set. */
441 table_copy = *table;
442 if (*(int *)table_copy.data == *(int *)table_copy.extra2)
443 table_copy.extra1 = table_copy.extra2;
444
445 return proc_dointvec_minmax(&table_copy, write, buffer, lenp, ppos);
446}
447
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Yama Linux Security Module
4 *
5 * Author: Kees Cook <keescook@chromium.org>
6 *
7 * Copyright (C) 2010 Canonical, Ltd.
8 * Copyright (C) 2011 The Chromium OS Authors.

--- 431 unchanged lines hidden (view full) ---

440 /* Lock the max value if it ever gets set. */
441 table_copy = *table;
442 if (*(int *)table_copy.data == *(int *)table_copy.extra2)
443 table_copy.extra1 = table_copy.extra2;
444
445 return proc_dointvec_minmax(&table_copy, write, buffer, lenp, ppos);
446}
447
448static int zero;
449static int max_scope = YAMA_SCOPE_NO_ATTACH;
450
451static struct ctl_path yama_sysctl_path[] = {
452 { .procname = "kernel", },
453 { .procname = "yama", },
454 { }
455};
456
457static struct ctl_table yama_sysctl_table[] = {
458 {
459 .procname = "ptrace_scope",
460 .data = &ptrace_scope,
461 .maxlen = sizeof(int),
462 .mode = 0644,
463 .proc_handler = yama_dointvec_minmax,
448static int max_scope = YAMA_SCOPE_NO_ATTACH;
449
450static struct ctl_path yama_sysctl_path[] = {
451 { .procname = "kernel", },
452 { .procname = "yama", },
453 { }
454};
455
456static struct ctl_table yama_sysctl_table[] = {
457 {
458 .procname = "ptrace_scope",
459 .data = &ptrace_scope,
460 .maxlen = sizeof(int),
461 .mode = 0644,
462 .proc_handler = yama_dointvec_minmax,
464 .extra1 = &zero,
463 .extra1 = SYSCTL_ZERO,
465 .extra2 = &max_scope,
466 },
467 { }
468};
469static void __init yama_init_sysctl(void)
470{
471 if (!register_sysctl_paths(yama_sysctl_path, yama_sysctl_table))
472 panic("Yama: sysctl registration failed.\n");

--- 17 unchanged lines hidden ---
464 .extra2 = &max_scope,
465 },
466 { }
467};
468static void __init yama_init_sysctl(void)
469{
470 if (!register_sysctl_paths(yama_sysctl_path, yama_sysctl_table))
471 panic("Yama: sysctl registration failed.\n");

--- 17 unchanged lines hidden ---