Skip to content

Commit bdde21d

Browse files
committed
lsm: preserve /proc/sys/vm/mmap_min_addr when !CONFIG_SECURITY
While reworking the LSM initialization code the /proc/sys/vm/mmap_min_addr handler was inadvertently caught up in the change and the procfs entry wasn't setup when CONFIG_SECURITY was not selected at kernel build time. This patch restores the previous behavior and ensures that the procfs entry is setup regardless of the CONFIG_SECURITY state. Future work will improve upon this, likely by moving the procfs handler into the mm subsystem, but this patch should resolve the immediate regression. Fixes: 4ab5efc ("lsm: consolidate all of the LSM framework initcalls") Reported-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Tested-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reviewed-by: Kees Cook <kees@kernel.org> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 63804fe commit bdde21d

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

security/lsm.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ int lsm_task_alloc(struct task_struct *task);
3737

3838
/* LSM framework initializers */
3939

40-
#ifdef CONFIG_MMU
41-
int min_addr_init(void);
42-
#else
43-
static inline int min_addr_init(void)
44-
{
45-
return 0;
46-
}
47-
#endif /* CONFIG_MMU */
48-
4940
#ifdef CONFIG_SECURITYFS
5041
int securityfs_init(void);
5142
#else

security/lsm_init.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,7 @@ int __init security_init(void)
489489
*/
490490
static int __init security_initcall_pure(void)
491491
{
492-
int rc_adr, rc_lsm;
493-
494-
rc_adr = min_addr_init();
495-
rc_lsm = lsm_initcall(pure);
496-
497-
return (rc_adr ? rc_adr : rc_lsm);
492+
return lsm_initcall(pure);
498493
}
499494
pure_initcall(security_initcall_pure);
500495

security/min_addr.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#include <linux/sysctl.h>
66
#include <linux/minmax.h>
77

8-
#include "lsm.h"
9-
108
/* amount of vm to protect from userspace access by both DAC and the LSM*/
119
unsigned long mmap_min_addr;
1210
/* amount of vm to protect from userspace using CAP_SYS_RAWIO (DAC) */
@@ -54,10 +52,11 @@ static const struct ctl_table min_addr_sysctl_table[] = {
5452
},
5553
};
5654

57-
int __init min_addr_init(void)
55+
static int __init mmap_min_addr_init(void)
5856
{
5957
register_sysctl_init("vm", min_addr_sysctl_table);
6058
update_mmap_min_addr();
6159

6260
return 0;
6361
}
62+
pure_initcall(mmap_min_addr_init);

0 commit comments

Comments
 (0)