1. 06 1月, 2012 7 次提交
  2. 21 12月, 2011 1 次提交
    • D
      SELinux: Fix RCU deref check warning in sel_netport_insert() · 94d4ef0c
      David Howells 提交于
      Fix the following bug in sel_netport_insert() where rcu_dereference() should
      be rcu_dereference_protected() as sel_netport_lock is held.
      
      ===================================================
      [ INFO: suspicious rcu_dereference_check() usage. ]
      ---------------------------------------------------
      security/selinux/netport.c:127 invoked rcu_dereference_check() without protection!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 1, debug_locks = 0
      1 lock held by ossec-rootcheck/3323:
       #0:  (sel_netport_lock){+.....}, at: [<ffffffff8117d775>] sel_netport_sid+0xbb/0x226
      
      stack backtrace:
      Pid: 3323, comm: ossec-rootcheck Not tainted 3.1.0-rc8-fsdevel+ #1095
      Call Trace:
       [<ffffffff8105cfb7>] lockdep_rcu_dereference+0xa7/0xb0
       [<ffffffff8117d871>] sel_netport_sid+0x1b7/0x226
       [<ffffffff8117d6ba>] ? sel_netport_avc_callback+0xbc/0xbc
       [<ffffffff8117556c>] selinux_socket_bind+0x115/0x230
       [<ffffffff810a5388>] ? might_fault+0x4e/0x9e
       [<ffffffff810a53d1>] ? might_fault+0x97/0x9e
       [<ffffffff81171cf4>] security_socket_bind+0x11/0x13
       [<ffffffff812ba967>] sys_bind+0x56/0x95
       [<ffffffff81380dac>] ? sysret_check+0x27/0x62
       [<ffffffff8105b767>] ? trace_hardirqs_on_caller+0x11e/0x155
       [<ffffffff81076fcd>] ? audit_syscall_entry+0x17b/0x1ae
       [<ffffffff811b5eae>] ? trace_hardirqs_on_thunk+0x3a/0x3f
       [<ffffffff81380d7b>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Acked-by: NPaul Moore <paul@paul-moore.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      94d4ef0c
  3. 02 8月, 2011 1 次提交
  4. 27 7月, 2011 1 次提交
  5. 24 7月, 2011 1 次提交
    • T
      VFS : mount lock scalability for internal mounts · 423e0ab0
      Tim Chen 提交于
      For a number of file systems that don't have a mount point (e.g. sockfs
      and pipefs), they are not marked as long term. Therefore in
      mntput_no_expire, all locks in vfs_mount lock are taken instead of just
      local cpu's lock to aggregate reference counts when we release
      reference to file objects.  In fact, only local lock need to have been
      taken to update ref counts as these file systems are in no danger of
      going away until we are ready to unregister them.
      
      The attached patch marks file systems using kern_mount without
      mount point as long term.  The contentions of vfs_mount lock
      is now eliminated.  Before un-registering such file system,
      kern_unmount should be called to remove the long term flag and
      make the mount point ready to be freed.
      Signed-off-by: NTim Chen <tim.c.chen@linux.intel.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      423e0ab0
  6. 21 7月, 2011 2 次提交
  7. 20 7月, 2011 2 次提交
  8. 23 6月, 2011 1 次提交
  9. 15 6月, 2011 1 次提交
  10. 09 6月, 2011 1 次提交
    • L
      selinux: simplify and clean up inode_has_perm() · 95f4efb2
      Linus Torvalds 提交于
      This is a rather hot function that is called with a potentially NULL
      "struct common_audit_data" pointer argument.  And in that case it has to
      provide and initialize its own dummy common_audit_data structure.
      
      However, all the _common_ cases already pass it a real audit-data
      structure, so that uncommon NULL case not only creates a silly run-time
      test, more importantly it causes that function to have a big stack frame
      for the dummy variable that isn't even used in the common case!
      
      So get rid of that stupid run-time behavior, and make the (few)
      functions that currently call with a NULL pointer just call a new helper
      function instead (naturally called inode_has_perm_noapd(), since it has
      no adp argument).
      
      This makes the run-time test be a static code generation issue instead,
      and allows for a much denser stack since none of the common callers need
      the dummy structure.  And a denser stack not only means less stack space
      usage, it means better cache behavior.  So we have a win-win-win from
      this simplification: less code executed, smaller stack footprint, and
      better cache behavior.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      95f4efb2
  11. 27 5月, 2011 2 次提交
    • L
      selinux: don't pass in NULL avd to avc_has_perm_noaudit · f01e1af4
      Linus Torvalds 提交于
      Right now security_get_user_sids() will pass in a NULL avd pointer to
      avc_has_perm_noaudit(), which then forces that function to have a dummy
      entry for that case and just generally test it.
      
      Don't do it.  The normal callers all pass a real avd pointer, and this
      helper function is incredibly hot.  So don't make avc_has_perm_noaudit()
      do conditional stuff that isn't needed for the common case.
      
      This also avoids some duplicated stack space.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f01e1af4
    • K
      selinux: fix case of names with whitespace/multibytes on /selinux/create · 0f7e4c33
      Kohei Kaigai 提交于
      I submit the patch again, according to patch submission convension.
      
      This patch enables to accept percent-encoded object names as forth
      argument of /selinux/create interface to avoid possible bugs when we
      give an object name including whitespace or multibutes.
      
      E.g) if and when a userspace object manager tries to create a new object
       named as "resolve.conf but fake", it shall give this name as the forth
       argument of the /selinux/create. But sscanf() logic in kernel space
       fetches only the part earlier than the first whitespace.
       In this case, selinux may unexpectedly answer a default security context
       configured to "resolve.conf", but it is bug.
      
      Although I could not test this patch on named TYPE_TRANSITION rules
      actually, But debug printk() message seems to me the logic works
      correctly.
      I assume the libselinux provides an interface to apply this logic
      transparently, so nothing shall not be changed from the viewpoint of
      application.
      Signed-off-by: NKaiGai Kohei <kohei.kaigai@emea.nec.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      0f7e4c33
  12. 20 5月, 2011 2 次提交
    • L
      selinux: avoid unnecessary avc cache stat hit count · 257313b2
      Linus Torvalds 提交于
      There is no point in counting hits - we can calculate it from the number
      of lookups and misses.
      
      This makes the avc statistics a bit smaller, and makes the code
      generation better too.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      257313b2
    • L
      selinux: de-crapify avc cache stat code generation · 044aea9b
      Linus Torvalds 提交于
      You can turn off the avc cache stats, but distributions seem to not do
      that (perhaps because several performance tuning how-to's talk about the
      avc cache statistics).
      
      Which is sad, because the code it generates is truly horrendous, with
      the statistics update being sandwitched between get_cpu/put_cpu which in
      turn causes preemption disables etc.  We're talking ten+ instructions
      just to increment a per-cpu variable in some pretty hot code.
      
      Fix the craziness by just using 'this_cpu_inc()' instead.  Suddenly we
      only need a single 'inc' instruction to increment the statistics.  This
      is quite noticeable in the incredibly hot avc_has_perm_noaudit()
      function (which triggers all the statistics by virtue of doing an
      avc_lookup() call).
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      044aea9b
  13. 13 5月, 2011 1 次提交
  14. 12 5月, 2011 1 次提交
    • G
      SELINUX: add /sys/fs/selinux mount point to put selinuxfs · 7a627e3b
      Greg Kroah-Hartman 提交于
      In the interest of keeping userspace from having to create new root
      filesystems all the time, let's follow the lead of the other in-kernel
      filesystems and provide a proper mount point for it in sysfs.
      
      For selinuxfs, this mount point should be in /sys/fs/selinux/
      
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: James Morris <jmorris@namei.org>
      Cc: Eric Paris <eparis@parisplace.org>
      Cc: Lennart Poettering <mzerqung@0pointer.de>
      Cc: Daniel J Walsh <dwalsh@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      [include kobject.h - Eric Paris]
      [use selinuxfs_obj throughout - Eric Paris]
      Signed-off-by: NEric Paris <eparis@redhat.com>
      7a627e3b
  15. 08 5月, 2011 1 次提交
  16. 29 4月, 2011 11 次提交
  17. 26 4月, 2011 4 次提交