Commit 8b70543e authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'selinux-pr-20180605' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux

Pull SELinux updates from Paul Moore:
 "SELinux is back with a quiet pull request for v4.18. Three patches,
  all small: two cleanups of the SELinux audit records, and one to
  migrate to a newly defined type (vm_fault_t).

  Everything passes our test suite, and as of about five minutes ago it
  merged cleanly with your tree"

* tag 'selinux-pr-20180605' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
  audit: normalize MAC_POLICY_LOAD record
  audit: normalize MAC_STATUS record
  security: selinux: Change return type to vm_fault_t
parents 10b1eb7d d141136f
...@@ -168,10 +168,12 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf, ...@@ -168,10 +168,12 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf,
if (length) if (length)
goto out; goto out;
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS, audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
"enforcing=%d old_enforcing=%d auid=%u ses=%u", "enforcing=%d old_enforcing=%d auid=%u ses=%u"
" enabled=%d old-enabled=%d lsm=selinux res=1",
new_value, old_value, new_value, old_value,
from_kuid(&init_user_ns, audit_get_loginuid(current)), from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current)); audit_get_sessionid(current),
selinux_enabled, selinux_enabled);
enforcing_set(state, new_value); enforcing_set(state, new_value);
if (new_value) if (new_value)
avc_ss_reset(state->avc, 0); avc_ss_reset(state->avc, 0);
...@@ -279,6 +281,7 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf, ...@@ -279,6 +281,7 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf,
char *page; char *page;
ssize_t length; ssize_t length;
int new_value; int new_value;
int enforcing;
if (count >= PAGE_SIZE) if (count >= PAGE_SIZE)
return -ENOMEM; return -ENOMEM;
...@@ -296,13 +299,16 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf, ...@@ -296,13 +299,16 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf,
goto out; goto out;
if (new_value) { if (new_value) {
enforcing = enforcing_enabled(fsi->state);
length = selinux_disable(fsi->state); length = selinux_disable(fsi->state);
if (length) if (length)
goto out; goto out;
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS, audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_STATUS,
"selinux=0 auid=%u ses=%u", "enforcing=%d old_enforcing=%d auid=%u ses=%u"
" enabled=%d old-enabled=%d lsm=selinux res=1",
enforcing, enforcing,
from_kuid(&init_user_ns, audit_get_loginuid(current)), from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current)); audit_get_sessionid(current), 0, 1);
} }
length = count; length = count;
...@@ -453,7 +459,7 @@ static ssize_t sel_read_policy(struct file *filp, char __user *buf, ...@@ -453,7 +459,7 @@ static ssize_t sel_read_policy(struct file *filp, char __user *buf,
return ret; return ret;
} }
static int sel_mmap_policy_fault(struct vm_fault *vmf) static vm_fault_t sel_mmap_policy_fault(struct vm_fault *vmf)
{ {
struct policy_load_memory *plm = vmf->vma->vm_file->private_data; struct policy_load_memory *plm = vmf->vma->vm_file->private_data;
unsigned long offset; unsigned long offset;
...@@ -576,7 +582,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf, ...@@ -576,7 +582,7 @@ static ssize_t sel_write_load(struct file *file, const char __user *buf,
out1: out1:
audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_POLICY_LOAD, audit_log(current->audit_context, GFP_KERNEL, AUDIT_MAC_POLICY_LOAD,
"policy loaded auid=%u ses=%u", "auid=%u ses=%u lsm=selinux res=1",
from_kuid(&init_user_ns, audit_get_loginuid(current)), from_kuid(&init_user_ns, audit_get_loginuid(current)),
audit_get_sessionid(current)); audit_get_sessionid(current));
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment