sysctl.c (1941011a8bd26f01f36f827d5ebc6469749485bb) sysctl.c (eaee41727e6d8a7d2b94421c25e82b00cb2fded5)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * sysctl.c: General linux system control interface
4 *
5 * Begun 24 March 1995, Stephen Tweedie
6 * Added /proc support, Dec 1995
7 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
8 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.

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

224#ifdef CONFIG_COREDUMP
225static int proc_dostring_coredump(struct ctl_table *table, int write,
226 void __user *buffer, size_t *lenp, loff_t *ppos);
227#endif
228static int proc_dopipe_max_size(struct ctl_table *table, int write,
229 void __user *buffer, size_t *lenp, loff_t *ppos);
230
231#ifdef CONFIG_MAGIC_SYSRQ
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * sysctl.c: General linux system control interface
4 *
5 * Begun 24 March 1995, Stephen Tweedie
6 * Added /proc support, Dec 1995
7 * Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
8 * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.

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

224#ifdef CONFIG_COREDUMP
225static int proc_dostring_coredump(struct ctl_table *table, int write,
226 void __user *buffer, size_t *lenp, loff_t *ppos);
227#endif
228static int proc_dopipe_max_size(struct ctl_table *table, int write,
229 void __user *buffer, size_t *lenp, loff_t *ppos);
230
231#ifdef CONFIG_MAGIC_SYSRQ
232/* Note: sysrq code uses its own private copy */
233static int __sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
234
235static int sysrq_sysctl_handler(struct ctl_table *table, int write,
232static int sysrq_sysctl_handler(struct ctl_table *table, int write,
236 void __user *buffer, size_t *lenp,
237 loff_t *ppos)
238{
239 int error;
240
241 error = proc_dointvec(table, write, buffer, lenp, ppos);
242 if (error)
243 return error;
244
245 if (write)
246 sysrq_toggle_support(__sysrq_enabled);
247
248 return 0;
249}
250
233 void __user *buffer, size_t *lenp, loff_t *ppos);
251#endif
252
253static struct ctl_table kern_table[];
254static struct ctl_table vm_table[];
255static struct ctl_table fs_table[];
256static struct ctl_table debug_table[];
257static struct ctl_table dev_table[];
258extern struct ctl_table random_table[];

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

742 .maxlen = 3*sizeof(int),
743 .mode = 0644,
744 .proc_handler = proc_dointvec,
745 },
746#endif
747#ifdef CONFIG_MAGIC_SYSRQ
748 {
749 .procname = "sysrq",
234#endif
235
236static struct ctl_table kern_table[];
237static struct ctl_table vm_table[];
238static struct ctl_table fs_table[];
239static struct ctl_table debug_table[];
240static struct ctl_table dev_table[];
241extern struct ctl_table random_table[];

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

725 .maxlen = 3*sizeof(int),
726 .mode = 0644,
727 .proc_handler = proc_dointvec,
728 },
729#endif
730#ifdef CONFIG_MAGIC_SYSRQ
731 {
732 .procname = "sysrq",
750 .data = &__sysrq_enabled,
733 .data = NULL,
751 .maxlen = sizeof (int),
752 .mode = 0644,
753 .proc_handler = sysrq_sysctl_handler,
754 },
755#endif
756#ifdef CONFIG_PROC_SYSCTL
757 {
758 .procname = "cad_pid",

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

2830{
2831 int error = proc_dostring(table, write, buffer, lenp, ppos);
2832 if (!error)
2833 validate_coredump_safety();
2834 return error;
2835}
2836#endif
2837
734 .maxlen = sizeof (int),
735 .mode = 0644,
736 .proc_handler = sysrq_sysctl_handler,
737 },
738#endif
739#ifdef CONFIG_PROC_SYSCTL
740 {
741 .procname = "cad_pid",

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

2813{
2814 int error = proc_dostring(table, write, buffer, lenp, ppos);
2815 if (!error)
2816 validate_coredump_safety();
2817 return error;
2818}
2819#endif
2820
2821#ifdef CONFIG_MAGIC_SYSRQ
2822static int sysrq_sysctl_handler(struct ctl_table *table, int write,
2823 void __user *buffer, size_t *lenp, loff_t *ppos)
2824{
2825 int tmp, ret;
2826
2827 tmp = sysrq_mask();
2828
2829 ret = __do_proc_dointvec(&tmp, table, write, buffer,
2830 lenp, ppos, NULL, NULL);
2831 if (ret || !write)
2832 return ret;
2833
2834 if (write)
2835 sysrq_toggle_support(tmp);
2836
2837 return 0;
2838}
2839#endif
2840
2838static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2839 void __user *buffer,
2840 size_t *lenp, loff_t *ppos,
2841 unsigned long convmul,
2842 unsigned long convdiv)
2843{
2844 unsigned long *i, *min, *max;
2845 int vleft, first = 1, err = 0;

--- 577 unchanged lines hidden ---
2841static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
2842 void __user *buffer,
2843 size_t *lenp, loff_t *ppos,
2844 unsigned long convmul,
2845 unsigned long convdiv)
2846{
2847 unsigned long *i, *min, *max;
2848 int vleft, first = 1, err = 0;

--- 577 unchanged lines hidden ---