1. 23 7月, 2014 1 次提交
  2. 02 12月, 2013 1 次提交
    • E
      security: shmem: implement kernel private shmem inodes · c7277090
      Eric Paris 提交于
      We have a problem where the big_key key storage implementation uses a
      shmem backed inode to hold the key contents.  Because of this detail of
      implementation LSM checks are being done between processes trying to
      read the keys and the tmpfs backed inode.  The LSM checks are already
      being handled on the key interface level and should not be enforced at
      the inode level (since the inode is an implementation detail, not a
      part of the security model)
      
      This patch implements a new function shmem_kernel_file_setup() which
      returns the equivalent to shmem_file_setup() only the underlying inode
      has S_PRIVATE set.  This means that all LSM checks for the inode in
      question are skipped.  It should only be used for kernel internal
      operations where the inode is not exposed to userspace without proper
      LSM checking.  It is possible that some other users of
      shmem_file_setup() should use the new interface, but this has not been
      explored.
      
      Reproducing this bug is a little bit difficult.  The steps I used on
      Fedora are:
      
       (1) Turn off selinux enforcing:
      
      	setenforce 0
      
       (2) Create a huge key
      
      	k=`dd if=/dev/zero bs=8192 count=1 | keyctl padd big_key test-key @s`
      
       (3) Access the key in another context:
      
      	runcon system_u:system_r:httpd_t:s0-s0:c0.c1023 keyctl print $k >/dev/null
      
       (4) Examine the audit logs:
      
      	ausearch -m AVC -i --subject httpd_t | audit2allow
      
      If the last command's output includes a line that looks like:
      
      	allow httpd_t user_tmpfs_t:file { open read };
      
      There was an inode check between httpd and the tmpfs filesystem.  With
      this patch no such denial will be seen.  (NOTE! you should clear your
      audit log if you have tested for this previously)
      
      (Please return you box to enforcing)
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: Hugh Dickins <hughd@google.com>
      cc: linux-mm@kvack.org
      c7277090
  3. 14 11月, 2013 1 次提交
    • D
      KEYS: Fix error handling in big_key instantiation · 97826c82
      David Howells 提交于
      In the big_key_instantiate() function we return 0 if kernel_write() returns us
      an error rather than returning an error.  This can potentially lead to
      dentry_open() giving a BUG when called from big_key_read() with an unset
      tmpfile path.
      
      	------------[ cut here ]------------
      	kernel BUG at fs/open.c:798!
      	...
      	RIP: 0010:[<ffffffff8119bbd1>] dentry_open+0xd1/0xe0
      	...
      	Call Trace:
      	 [<ffffffff812350c5>] big_key_read+0x55/0x100
      	 [<ffffffff81231084>] keyctl_read_key+0xb4/0xe0
      	 [<ffffffff81231e58>] SyS_keyctl+0xf8/0x1d0
      	 [<ffffffff815bb799>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Reviewed-by: NStephen Gallagher <sgallagh@redhat.com>
      97826c82
  4. 30 10月, 2013 1 次提交
  5. 24 9月, 2013 1 次提交