1. 14 7月, 2012 2 次提交
    • C
      Smack: onlycap limits on CAP_MAC_ADMIN · 1880eff7
      Casey Schaufler 提交于
      Smack is integrated with the POSIX capabilities scheme,
      using the capabilities CAP_MAC_OVERRIDE and CAP_MAC_ADMIN to
      determine if a process is allowed to ignore Smack checks or
      change Smack related data respectively. Smack provides an
      additional restriction that if an onlycap value is set
      by writing to /smack/onlycap only tasks with that Smack
      label are allowed to use CAP_MAC_OVERRIDE.
      
      This change adds CAP_MAC_ADMIN as a capability that is affected
      by the onlycap mechanism.
      
      Targeted for git://git.gitorious.org/smack-next/kernel.gitSigned-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      1880eff7
    • C
      Smack: fix smack_new_inode bogosities · eb982cb4
      Casey Schaufler 提交于
      In January of 2012 Al Viro pointed out three bits of code that
      he titled "new_inode_smack bogosities". This patch repairs these
      errors.
      
      1. smack_sb_kern_mount() included a NULL check that is impossible.
         The check and NULL case are removed.
      2. smack_kb_kern_mount() included pointless locking. The locking is
         removed. Since this is the only place that lock was used the lock
         is removed from the superblock_smack structure.
      3. smk_fill_super() incorrectly and unnecessarily set the Smack label
         for the smackfs root inode. The assignment has been removed.
      
      Targeted for git://gitorious.org/smack-next/kernel.gitSigned-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      eb982cb4
  2. 01 6月, 2012 2 次提交
  3. 15 5月, 2012 3 次提交
    • C
      Smack: allow for significantly longer Smack labels v4 · f7112e6c
      Casey Schaufler 提交于
      V4 updated to current linux-security#next
      Targeted for git://gitorious.org/smack-next/kernel.git
      
      Modern application runtime environments like to use
      naming schemes that are structured and generated without
      human intervention. Even though the Smack limit of 23
      characters for a label name is perfectly rational for
      human use there have been complaints that the limit is
      a problem in environments where names are composed from
      a set or sources, including vendor, author, distribution
      channel and application name. Names like
      
      	softwarehouse-pgwodehouse-coolappstore-mellowmuskrats
      
      are becoming harder to avoid. This patch introduces long
      label support in Smack. Labels are now limited to 255
      characters instead of the old 23.
      
      The primary reason for limiting the labels to 23 characters
      was so they could be directly contained in CIPSO category sets.
      This is still done were possible, but for labels that are too
      large a mapping is required. This is perfectly safe for communication
      that stays "on the box" and doesn't require much coordination
      between boxes beyond what would have been required to keep label
      names consistent.
      
      The bulk of this patch is in smackfs, adding and updating
      administrative interfaces. Because existing APIs can't be
      changed new ones that do much the same things as old ones
      have been introduced.
      
      The Smack specific CIPSO data representation has been removed
      and replaced with the data format used by netlabel. The CIPSO
      header is now computed when a label is imported rather than
      on use. This results in improved IP performance. The smack
      label is now allocated separately from the containing structure,
      allowing for larger strings.
      
      Four new /smack interfaces have been introduced as four
      of the old interfaces strictly required labels be specified
      in fixed length arrays.
      
      The access interface is supplemented with the check interface:
      	access  "Subject                 Object                  rwxat"
      	access2 "Subject Object rwaxt"
      
      The load interface is supplemented with the rules interface:
      	load   "Subject                 Object                  rwxat"
      	load2  "Subject Object rwaxt"
      
      The load-self interface is supplemented with the self-rules interface:
      	load-self   "Subject                 Object                  rwxat"
      	load-self2  "Subject Object rwaxt"
      
      The cipso interface is supplemented with the wire interface:
      	cipso  "Subject                  lvl cnt  c1  c2 ..."
      	cipso2 "Subject lvl cnt  c1  c2 ..."
      
      The old interfaces are maintained for compatibility.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      f7112e6c
    • T
      gfp flags for security_inode_alloc()? · ceffec55
      Tetsuo Handa 提交于
      Dave Chinner wrote:
      > Yes, because you have no idea what the calling context is except
      > for the fact that is from somewhere inside filesystem code and the
      > filesystem could be holding locks. Therefore, GFP_NOFS is really the
      > only really safe way to allocate memory here.
      
      I see. Thank you.
      
      I'm not sure, but can call trace happen where somewhere inside network
      filesystem or stackable filesystem code with locks held invokes operations that
      involves GFP_KENREL memory allocation outside that filesystem?
      ----------
      [PATCH] SMACK: Fix incorrect GFP_KERNEL usage.
      
      new_inode_smack() which can be called from smack_inode_alloc_security() needs
      to use GFP_NOFS like SELinux's inode_alloc_security() does, for
      security_inode_alloc() is called from inode_init_always() and
      inode_init_always() is called from xfs_inode_alloc() which is using GFP_NOFS.
      
      smack_inode_init_security() needs to use GFP_NOFS like
      selinux_inode_init_security() does, for initxattrs() callback function (e.g.
      btrfs_initxattrs()) which is called from security_inode_init_security() is
      using GFP_NOFS.
      
      smack_audit_rule_match() needs to use GFP_ATOMIC, for
      security_audit_rule_match() can be called from audit_filter_user_rules() and
      audit_filter_user_rules() is called from audit_filter_user() with RCU read lock
      held.
      Signed-off-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: NCasey Schaufler <cschaufler@cschaufler-intel.(none)>
      ceffec55
    • C
      Smack: recursive tramsmute · 2267b13a
      Casey Schaufler 提交于
      The transmuting directory feature of Smack requires that
      the transmuting attribute be explicitly set in all cases.
      It seems the users of this facility would expect that the
      transmuting attribute be inherited by subdirectories that
      are created in a transmuting directory. This does not seem
      to add any additional complexity to the understanding of
      how the system works.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      2267b13a
  4. 18 4月, 2012 1 次提交
  5. 11 4月, 2012 1 次提交
  6. 10 4月, 2012 2 次提交
  7. 04 4月, 2012 3 次提交
  8. 14 2月, 2012 1 次提交
  9. 07 1月, 2012 1 次提交
  10. 12 11月, 2011 1 次提交
    • C
      Smack: smackfs cipso seq read repair · 40809565
      Casey Schaufler 提交于
      Commit 272cd7a8 introduced
      a change to the way rule lists are handled and reported in
      the smackfs filesystem. One of the issues addressed had to
      do with the termination of read requests on /smack/load.
      This change introduced a error in /smack/cipso, which shares
      some of the same list processing code.
      
      This patch updates all the file access list handling in
      smackfs to use the code introduced for /smack/load.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      40809565
  11. 21 10月, 2011 1 次提交
  12. 19 10月, 2011 1 次提交
  13. 14 10月, 2011 1 次提交
  14. 13 10月, 2011 7 次提交
    • J
      Smack: fix for /smack/access output, use string instead of byte · f8859d98
      Jarkko Sakkinen 提交于
      Small fix for the output of access SmackFS file. Use string
      is instead of byte. Makes it easier to extend API if it is
      needed.
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@intel.com>
      f8859d98
    • J
      Smack: domain transition protections (v3) · 84088ba2
      Jarkko Sakkinen 提交于
      Protections for domain transition:
      
      - BPRM unsafe flags
      - Secureexec
      - Clear unsafe personality bits.
      - Clear parent death signal
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@intel.com>
      84088ba2
    • C
      Smack: Provide information for UDS getsockopt(SO_PEERCRED) · 975d5e55
      Casey Schaufler 提交于
      This patch is targeted for the smack-next tree.
      
      This patch takes advantage of the recent changes for performance
      and points the packet labels on UDS connect at the output label of
      the far side. This makes getsockopt(...SO_PEERCRED...) function
      properly. Without this change the getsockopt does not provide any
      information.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      975d5e55
    • C
      Smack: Clean up comments · ce8a4321
      Casey Schaufler 提交于
      There are a number of comments in the Smack code that
      are either malformed or include code. This patch cleans
      them up.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      ce8a4321
    • C
      Smack: Repair processing of fcntl · 531f1d45
      Casey Schaufler 提交于
      Al Viro pointed out that the processing of fcntl done
      by Smack appeared poorly designed. He was right. There
      are three things that required change. Most obviously,
      the list of commands that really imply writing is limited
      to those involving file locking and signal handling.
      The initialization if the file security blob was
      incomplete, requiring use of a heretofore unused LSM hook.
      Finally, the audit information coming from a helper
      masked the identity of the LSM hook. This patch corrects
      all three of these defects.
      
      This is targeted for the smack-next tree pending comments.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      531f1d45
    • C
      Smack: Rule list lookup performance · 272cd7a8
      Casey Schaufler 提交于
      This patch is targeted for the smack-next tree.
      
      Smack access checks suffer from two significant performance
      issues. In cases where there are large numbers of rules the
      search of the single list of rules is wasteful. Comparing the
      string values of the smack labels is less efficient than a
      numeric comparison would.
      
      These changes take advantage of the Smack label list, which
      maintains the mapping of Smack labels to secids and optional
      CIPSO labels. Because the labels are kept perpetually, an
      access check can be done strictly based on the address of the
      label in the list without ever looking at the label itself.
      Rather than keeping one global list of rules the rules with
      a particular subject label can be based off of that label
      list entry. The access check need never look at entries that
      do not use the current subject label.
      
      This requires that packets coming off the network with
      CIPSO direct Smack labels that have never been seen before
      be treated carefully. The only case where they could be
      delivered is where the receiving socket has an IPIN star
      label, so that case is explicitly addressed.
      
      On a system with 39,800 rules (200 labels in all permutations)
      a system with this patch runs an access speed test in 5% of
      the time of the old version. That should be a best case
      improvement. If all of the rules are associated with the
      same subject label and all of the accesses are for processes
      with that label (unlikely) the improvement is about 30%.
      Signed-off-by: NCasey Schaufler <casey@schaufler-ca.com>
      272cd7a8
    • J
      Smack: check permissions from user space (v2) · 828716c2
      Jarkko Sakkinen 提交于
      Adds a new file into SmackFS called 'access'. Wanted
      Smack permission is written into /smack/access.
      After that result can be read from the opened file.
      If access applies result contains 1 and otherwise
      0. File access is protected from race conditions
      by using simple_transaction_get()/set() API.
      
      Fixes from the previous version:
      - Removed smack.h changes, refactoring left-over
      from previous version.
      - Removed #include <linux/smack.h>, refactoring
      left-over from previous version.
      Signed-off-by: NJarkko Sakkinen <jarkko.sakkinen@intel.com>
      Signed-off-by: NCasey Schaufler <cschaufler@cschaufler-intel.(none)>
      828716c2
  15. 02 8月, 2011 2 次提交
  16. 20 7月, 2011 1 次提交
  17. 26 4月, 2011 3 次提交
  18. 25 4月, 2011 1 次提交
    • A
      SECURITY: Move exec_permission RCU checks into security modules · 1c990429
      Andi Kleen 提交于
      Right now all RCU walks fall back to reference walk when CONFIG_SECURITY
      is enabled, even though just the standard capability module is active.
      This is because security_inode_exec_permission unconditionally fails
      RCU walks.
      
      Move this decision to the low level security module. This requires
      passing the RCU flags down the security hook. This way at least
      the capability module and a few easy cases in selinux/smack work
      with RCU walks with CONFIG_SECURITY=y
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      1c990429
  19. 23 4月, 2011 1 次提交
  20. 31 3月, 2011 1 次提交
  21. 10 2月, 2011 2 次提交
  22. 09 2月, 2011 1 次提交
  23. 02 2月, 2011 1 次提交
    • E
      fs/vfs/security: pass last path component to LSM on inode creation · 2a7dba39
      Eric Paris 提交于
      SELinux would like to implement a new labeling behavior of newly created
      inodes.  We currently label new inodes based on the parent and the creating
      process.  This new behavior would also take into account the name of the
      new object when deciding the new label.  This is not the (supposed) full path,
      just the last component of the path.
      
      This is very useful because creating /etc/shadow is different than creating
      /etc/passwd but the kernel hooks are unable to differentiate these
      operations.  We currently require that userspace realize it is doing some
      difficult operation like that and than userspace jumps through SELinux hoops
      to get things set up correctly.  This patch does not implement new
      behavior, that is obviously contained in a seperate SELinux patch, but it
      does pass the needed name down to the correct LSM hook.  If no such name
      exists it is fine to pass NULL.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      2a7dba39