Make slabinfo available but restricted to root only. The existing Grsec GRKERNSEC_PROC_ADD totally removes the /proc/slabinfo file. This is painful when debugging memory leaks, so instead of removing it entirely, alter the permissions only. This changes the file from 0644 to 0600. Signed-off-by: Robin H. Johnson --- a/mm/slab.c 2010-05-25 00:35:43.000000000 +0000 +++ b/mm/slab.c 2010-05-28 09:49:49.000000000 +0000 @@ -4082,7 +4082,7 @@ schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC)); } -#if defined(CONFIG_SLABINFO) && !defined(CONFIG_GRKERNSEC_PROC_ADD) +#if defined(CONFIG_SLABINFO) static void print_slabinfo_header(struct seq_file *m) { @@ -4471,7 +4471,13 @@ static int __init slab_proc_init(void) { - proc_create("slabinfo",S_IWUSR|S_IRUGO,NULL,&proc_slabinfo_operations); +#ifdef CONFIG_GRKERNSEC_PROC_ADD +#define SLABINFO_PERMS S_IWUSR +#else +#define SLABINFO_PERMS S_IWUSR|S_IRUGO +#endif + proc_create("slabinfo",SLABINFO_PERMS,NULL,&proc_slabinfo_operations); +#undef SLABINFO_PERMS #ifdef CONFIG_DEBUG_SLAB_LEAK proc_create("slab_allocators", 0, NULL, &proc_slabstats_operations); #endif --- a/init/Kconfig 2010-05-25 00:35:43.000000000 +0000 +++ b/init/Kconfig 2010-05-28 09:51:17.000000000 +0000 @@ -1116,7 +1116,7 @@ config SLABINFO bool - depends on PROC_FS && !GRKERNSEC_PROC_ADD + depends on PROC_FS depends on SLAB || SLUB_DEBUG - default n + default y