1. 27 5月, 2011 1 次提交
    • 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
  2. 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
  3. 13 5月, 2011 1 次提交
  4. 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
  5. 08 5月, 2011 1 次提交
  6. 29 4月, 2011 11 次提交
  7. 26 4月, 2011 4 次提交
  8. 25 4月, 2011 3 次提交
  9. 23 4月, 2011 1 次提交
  10. 20 4月, 2011 1 次提交
  11. 10 4月, 2011 1 次提交
  12. 08 4月, 2011 2 次提交
  13. 02 4月, 2011 1 次提交
  14. 31 3月, 2011 1 次提交
  15. 29 3月, 2011 4 次提交
  16. 24 3月, 2011 2 次提交
    • S
      userns: rename is_owner_or_cap to inode_owner_or_capable · 2e149670
      Serge E. Hallyn 提交于
      And give it a kernel-doc comment.
      
      [akpm@linux-foundation.org: btrfs changed in linux-next]
      Signed-off-by: NSerge E. Hallyn <serge.hallyn@canonical.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Daniel Lezcano <daniel.lezcano@free.fr>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2e149670
    • S
      userns: security: make capabilities relative to the user namespace · 3486740a
      Serge E. Hallyn 提交于
      - Introduce ns_capable to test for a capability in a non-default
        user namespace.
      - Teach cap_capable to handle capabilities in a non-default
        user namespace.
      
      The motivation is to get to the unprivileged creation of new
      namespaces.  It looks like this gets us 90% of the way there, with
      only potential uid confusion issues left.
      
      I still need to handle getting all caps after creation but otherwise I
      think I have a good starter patch that achieves all of your goals.
      
      Changelog:
      	11/05/2010: [serge] add apparmor
      	12/14/2010: [serge] fix capabilities to created user namespaces
      	Without this, if user serge creates a user_ns, he won't have
      	capabilities to the user_ns he created.  THis is because we
      	were first checking whether his effective caps had the caps
      	he needed and returning -EPERM if not, and THEN checking whether
      	he was the creator.  Reverse those checks.
      	12/16/2010: [serge] security_real_capable needs ns argument in !security case
      	01/11/2011: [serge] add task_ns_capable helper
      	01/11/2011: [serge] add nsown_capable() helper per Bastian Blank suggestion
      	02/16/2011: [serge] fix a logic bug: the root user is always creator of
      		    init_user_ns, but should not always have capabilities to
      		    it!  Fix the check in cap_capable().
      	02/21/2011: Add the required user_ns parameter to security_capable,
      		    fixing a compile failure.
      	02/23/2011: Convert some macros to functions as per akpm comments.  Some
      		    couldn't be converted because we can't easily forward-declare
      		    them (they are inline if !SECURITY, extern if SECURITY).  Add
      		    a current_user_ns function so we can use it in capability.h
      		    without #including cred.h.  Move all forward declarations
      		    together to the top of the #ifdef __KERNEL__ section, and use
      		    kernel-doc format.
      	02/23/2011: Per dhowells, clean up comment in cap_capable().
      	02/23/2011: Per akpm, remove unreachable 'return -EPERM' in cap_capable.
      
      (Original written and signed off by Eric;  latest, modified version
      acked by him)
      
      [akpm@linux-foundation.org: fix build]
      [akpm@linux-foundation.org: export current_user_ns() for ecryptfs]
      [serge.hallyn@canonical.com: remove unneeded extra argument in selinux's task_has_capability]
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NSerge E. Hallyn <serge.hallyn@canonical.com>
      Acked-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Acked-by: NDaniel Lezcano <daniel.lezcano@free.fr>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Signed-off-by: NSerge E. Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3486740a
  17. 13 3月, 2011 1 次提交
  18. 04 3月, 2011 2 次提交