Currently SELinux enforcement of controls on the ability to map the 0 page is determined by the mmap_min_addr tunable. This patch causes SELinux to ignore the tunable and to always (but ONLY) protect the 0 page. The tunable will now only control the need for CAP_SYS_RAWIO and SELinux permissions will always protect the 0 page based on it's mmap_zero permission. This allows users who need to disable the mmap_min_addr controls (usual reason being they run WINE as a non-root user) to do so and still have SELinux controls preventing confined domains (like a web server) from being able to map the 0 page. Note: the additional SELinux restriction will now ONLY protect the 0 page. CAP_SYS_RAWIO will protect anything between 0 and mmap_min_addr, but SELinux will only protect between 0 and PAGE_SIZE. Signed-off-by: Eric Paris <eparis@xxxxxxxxxx> --- include/linux/security.h | 1 - security/selinux/hooks.c | 2 +- 2 files changed, 1 insertions(+), 2 deletions(-) diff --git a/include/linux/security.h b/include/linux/security.h index f7d198a..de774f7 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -91,7 +91,6 @@ struct seq_file; extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); extern int cap_netlink_recv(struct sk_buff *skb, int cap); -extern unsigned long mmap_min_addr; /* * Values used in the task_security_ops calls */ diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index e65677d..7bbac1d 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -3034,7 +3034,7 @@ static int selinux_file_mmap(struct file *file, unsigned long reqprot, int rc = 0; u32 sid = current_sid(); - if (addr < mmap_min_addr) + if (addr < PAGE_SIZE) rc = avc_has_perm(sid, sid, SECCLASS_MEMPROTECT, MEMPROTECT__MMAP_ZERO, NULL); if (rc || addr_only) -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with the words "unsubscribe selinux" without quotes as the message.