linux/security
Stephen Smalley 872d2790a3 selinux: fix mprotect PROT_EXEC regression caused by mm change
commit 892e8cac99 upstream.

commit 66fc130394 ("mm: shmem_zero_setup
skip security check and lockdep conflict with XFS") caused a regression
for SELinux by disabling any SELinux checking of mprotect PROT_EXEC on
shared anonymous mappings.  However, even before that regression, the
checking on such mprotect PROT_EXEC calls was inconsistent with the
checking on a mmap PROT_EXEC call for a shared anonymous mapping.  On a
mmap, the security hook is passed a NULL file and knows it is dealing
with an anonymous mapping and therefore applies an execmem check and no
file checks.  On a mprotect, the security hook is passed a vma with a
non-NULL vm_file (as this was set from the internally-created shmem
file during mmap) and therefore applies the file-based execute check
and no execmem check.  Since the aforementioned commit now marks the
shmem zero inode with the S_PRIVATE flag, the file checks are disabled
and we have no checking at all on mprotect PROT_EXEC.  Add a test to
the mprotect hook logic for such private inodes, and apply an execmem
check in that case.  This makes the mmap and mprotect checking
consistent for shared anonymous mappings, as well as for /dev/zero and
ashmem.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2015-08-03 09:29:14 -07:00
..
apparmor VFS: security/: d_inode() annotations 2015-04-15 15:06:57 -04:00
integrity ima: update builtin policies 2015-08-03 09:29:12 -07:00
keys KEYS: ensure we free the assoc array edit if edit is valid 2015-08-03 09:29:11 -07:00
selinux selinux: fix mprotect PROT_EXEC regression caused by mm change 2015-08-03 09:29:14 -07:00
smack sysfs: Create mountpoints with sysfs_create_mount_point 2015-07-21 10:10:01 -07:00
tomoyo Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
yama security/yama: Remove unnecessary selects from Kconfig. 2015-02-27 16:53:10 -08:00
capability.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-04-15 09:00:47 -07:00
commoncap.c VFS: security/: d_backing_inode() annotations 2015-04-15 15:06:56 -04:00
device_cgroup.c cgroup: rename cgroup_subsys->base_cftypes to ->legacy_cftypes 2014-07-15 11:05:09 -04:00
inode.c sysfs: Create mountpoints with sysfs_create_mount_point 2015-07-21 10:10:01 -07:00
Kconfig kernel: conditionally support non-root users, groups and capabilities 2015-04-15 16:35:22 -07:00
lsm_audit.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
Makefile security: cleanup Makefiles to use standard syntax for specifying sub-directories 2014-02-17 11:08:04 +11:00
min_addr.c mmap_min_addr check CAP_SYS_RAWIO only for write 2010-04-23 08:56:31 +10:00
security.c VFS: security/: d_backing_inode() annotations 2015-04-15 15:06:56 -04:00