1. 09 3月, 2011 2 次提交
  2. 08 3月, 2011 4 次提交
  3. 05 3月, 2011 1 次提交
  4. 04 3月, 2011 5 次提交
    • E
      SELinux: implement the new sb_remount LSM hook · 026eb167
      Eric Paris 提交于
      For SELinux we do not allow security information to change during a remount
      operation.  Thus this hook simply strips the security module options from
      the data and verifies that those are the same options as exist on the
      current superblock.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Reviewed-by: NJames Morris <jmorris@namei.org>
      026eb167
    • E
      LSM: Pass -o remount options to the LSM · ff36fe2c
      Eric Paris 提交于
      The VFS mount code passes the mount options to the LSM.  The LSM will remove
      options it understands from the data and the VFS will then pass the remaining
      options onto the underlying filesystem.  This is how options like the
      SELinux context= work.  The problem comes in that -o remount never calls
      into LSM code.  So if you include an LSM specific option it will get passed
      to the filesystem and will cause the remount to fail.  An example of where
      this is a problem is the 'seclabel' option.  The SELinux LSM hook will
      print this word in /proc/mounts if the filesystem is being labeled using
      xattrs.  If you pass this word on mount it will be silently stripped and
      ignored.  But if you pass this word on remount the LSM never gets called
      and it will be passed to the FS.  The FS doesn't know what seclabel means
      and thus should fail the mount.  For example an ext3 fs mounted over loop
      
      # mount -o loop /tmp/fs /mnt/tmp
      # cat /proc/mounts | grep /mnt/tmp
      /dev/loop0 /mnt/tmp ext3 rw,seclabel,relatime,errors=continue,barrier=0,data=ordered 0 0
      # mount -o remount /mnt/tmp
      mount: /mnt/tmp not mounted already, or bad option
      # dmesg
      EXT3-fs (loop0): error: unrecognized mount option "seclabel" or missing value
      
      This patch passes the remount mount options to an new LSM hook.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Reviewed-by: NJames Morris <jmorris@namei.org>
      ff36fe2c
    • H
      SELinux: Compute SID for the newly created socket · 2ad18bdf
      Harry Ciao 提交于
      The security context for the newly created socket shares the same
      user, role and MLS attribute as its creator but may have a different
      type, which could be specified by a type_transition rule in the relevant
      policy package.
      Signed-off-by: NHarry Ciao <qingtao.cao@windriver.com>
      [fix call to security_transition_sid to include qstr, Eric Paris]
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      2ad18bdf
    • H
      SELinux: Socket retains creator role and MLS attribute · 6f5317e7
      Harry Ciao 提交于
      The socket SID would be computed on creation and no longer inherit
      its creator's SID by default. Socket may have a different type but
      needs to retain the creator's role and MLS attribute in order not
      to break labeled networking and network access control.
      
      The kernel value for a class would be used to determine if the class
      if one of socket classes. If security_compute_sid is called from
      userspace the policy value for a class would be mapped to the relevant
      kernel value first.
      Signed-off-by: NHarry Ciao <qingtao.cao@windriver.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      6f5317e7
    • H
      SELinux: Auto-generate security_is_socket_class · 4bc6c2d5
      Harry Ciao 提交于
      The security_is_socket_class() is auto-generated by genheaders based
      on classmap.h to reduce maintenance effort when a new class is defined
      in SELinux kernel. The name for any socket class should be suffixed by
      "socket" and doesn't contain more than one substr of "socket".
      Signed-off-by: NHarry Ciao <qingtao.cao@windriver.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      4bc6c2d5
  5. 03 3月, 2011 1 次提交
  6. 26 2月, 2011 5 次提交
  7. 24 2月, 2011 1 次提交
    • M
      ima: remove unnecessary call to ima_must_measure · 1adace9b
      Mimi Zohar 提交于
      The original ima_must_measure() function based its results on cached
      iint information, which required an iint be allocated for all files.
      Currently, an iint is allocated only for files in policy.  As a result,
      for those files in policy, ima_must_measure() is now called twice: once
      to determine if the inode is in the measurement policy and, the second
      time, to determine if it needs to be measured/re-measured.
      
      The second call to ima_must_measure() unnecessarily checks to see if
      the file is in policy. As we already know the file is in policy, this
      patch removes the second unnecessary call to ima_must_measure(), removes
      the vestige iint parameter, and just checks the iint directly to determine
      if the inode has been measured or needs to be measured/re-measured.
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Acked-by: NEric Paris <eparis@redhat.com>
      1adace9b
  8. 11 2月, 2011 1 次提交
  9. 10 2月, 2011 5 次提交
  10. 09 2月, 2011 1 次提交
  11. 08 2月, 2011 1 次提交
    • T
      CRED: Fix BUG() upon security_cred_alloc_blank() failure · 2edeaa34
      Tetsuo Handa 提交于
      In cred_alloc_blank() since 2.6.32, abort_creds(new) is called with
      new->security == NULL and new->magic == 0 when security_cred_alloc_blank()
      returns an error.  As a result, BUG() will be triggered if SELinux is enabled
      or CONFIG_DEBUG_CREDENTIALS=y.
      
      If CONFIG_DEBUG_CREDENTIALS=y, BUG() is called from __invalid_creds() because
      cred->magic == 0.  Failing that, BUG() is called from selinux_cred_free()
      because selinux_cred_free() is not expecting cred->security == NULL.  This does
      not affect smack_cred_free(), tomoyo_cred_free() or apparmor_cred_free().
      
      Fix these bugs by
      
      (1) Set new->magic before calling security_cred_alloc_blank().
      
      (2) Handle null cred->security in creds_are_invalid() and selinux_cred_free().
      Signed-off-by: NTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2edeaa34
  12. 02 2月, 2011 4 次提交
    • L
      security: remove unused security_sysctl hook · 4916ca40
      Lucian Adrian Grijincu 提交于
      The only user for this hook was selinux. sysctl routes every call
      through /proc/sys/. Selinux and other security modules use the file
      system checks for sysctl too, so no need for this hook any more.
      Signed-off-by: NLucian Adrian Grijincu <lucian.grijincu@gmail.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      4916ca40
    • L
      security/selinux: fix /proc/sys/ labeling · 8e6c9693
      Lucian Adrian Grijincu 提交于
      This fixes an old (2007) selinux regression: filesystem labeling for
      /proc/sys returned
           -r--r--r-- unknown                          /proc/sys/fs/file-nr
      instead of
           -r--r--r-- system_u:object_r:sysctl_fs_t:s0 /proc/sys/fs/file-nr
      
      Events that lead to breaking of /proc/sys/ selinux labeling:
      
      1) sysctl was reimplemented to route all calls through /proc/sys/
      
          commit 77b14db5
          [PATCH] sysctl: reimplement the sysctl proc support
      
      2) proc_dir_entry was removed from ctl_table:
      
          commit 3fbfa981
          [PATCH] sysctl: remove the proc_dir_entry member for the sysctl tables
      
      3) selinux still walked the proc_dir_entry tree to apply
         labeling. Because ctl_tables don't have a proc_dir_entry, we did
         not label /proc/sys/ inodes any more. To achieve this the /proc/sys/
         inodes were marked private and private inodes were ignored by
         selinux.
      
          commit bbaca6c2
          [PATCH] selinux: enhance selinux to always ignore private inodes
      
          commit 86a71dbd
          [PATCH] sysctl: hide the sysctl proc inodes from selinux
      
      Access control checks have been done by means of a special sysctl hook
      that was called for read/write accesses to any /proc/sys/ entry.
      
      We don't have to do this because, instead of walking the
      proc_dir_entry tree we can walk the dentry tree (as done in this
      patch). With this patch:
      * we don't mark /proc/sys/ inodes as private
      * we don't need the sysclt security hook
      * we walk the dentry tree to find the path to the inode.
      
      We have to strip the PID in /proc/PID/ entries that have a
      proc_dir_entry because selinux does not know how to label paths like
      '/1/net/rpc/nfsd.fh' (and defaults to 'proc_t' labeling). Selinux does
      know of '/net/rpc/nfsd.fh' (and applies the 'sysctl_rpc_t' label).
      
      PID stripping from the path was done implicitly in the previous code
      because the proc_dir_entry tree had the root in '/net' in the example
      from above. The dentry tree has the root in '/1'.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: NLucian Adrian Grijincu <lucian.grijincu@gmail.com>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      8e6c9693
    • E
      SELinux: Use dentry name in new object labeling · 652bb9b0
      Eric Paris 提交于
      Currently SELinux has rules which label new objects according to 3 criteria.
      The label of the process creating the object, the label of the parent
      directory, and the type of object (reg, dir, char, block, etc.)  This patch
      adds a 4th criteria, the dentry name, thus we can distinguish between
      creating a file in an etc_t directory called shadow and one called motd.
      
      There is no file globbing, regex parsing, or anything mystical.  Either the
      policy exactly (strcmp) matches the dentry name of the object or it doesn't.
      This patch has no changes from today if policy does not implement the new
      rules.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      652bb9b0
    • 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
  13. 26 1月, 2011 1 次提交
    • D
      KEYS: Fix __key_link_end() quota fixup on error · ceb73c12
      David Howells 提交于
      Fix __key_link_end()'s attempt to fix up the quota if an error occurs.
      
      There are two erroneous cases: Firstly, we always decrease the quota if
      the preallocated replacement keyring needs cleaning up, irrespective of
      whether or not we should (we may have replaced a pointer rather than
      adding another pointer).
      
      Secondly, we never clean up the quota if we added a pointer without the
      keyring storage being extended (we allocate multiple pointers at a time,
      even if we're not going to use them all immediately).
      
      We handle this by setting the bottom bit of the preallocation pointer in
      __key_link_begin() to indicate that the quota needs fixing up, which is
      then passed to __key_link() (which clears the whole thing) and
      __key_link_end().
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ceb73c12
  14. 24 1月, 2011 6 次提交
  15. 22 1月, 2011 2 次提交