1. 29 3月, 2011 1 次提交
  2. 24 3月, 2011 3 次提交
    • 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: allow ptrace from non-init user namespaces · 8409cca7
      Serge E. Hallyn 提交于
      ptrace is allowed to tasks in the same user namespace according to the
      usual rules (i.e.  the same rules as for two tasks in the init user
      namespace).  ptrace is also allowed to a user namespace to which the
      current task the has CAP_SYS_PTRACE capability.
      
      Changelog:
      	Dec 31: Address feedback by Eric:
      		. Correct ptrace uid check
      		. Rename may_ptrace_ns to ptrace_capable
      		. Also fix the cap_ptrace checks.
      	Jan  1: Use const cred struct
      	Jan 11: use task_ns_capable() in place of ptrace_capable().
      	Feb 23: same_or_ancestore_user_ns() was not an appropriate
      		check to constrain cap_issubset.  Rather, cap_issubset()
      		only is meaningful when both capsets are in the same
      		user_ns.
      Signed-off-by: NSerge E. Hallyn <serge.hallyn@canonical.com>
      Cc: "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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8409cca7
    • 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
  3. 13 3月, 2011 1 次提交
  4. 09 3月, 2011 2 次提交
  5. 08 3月, 2011 4 次提交
  6. 05 3月, 2011 1 次提交
  7. 04 3月, 2011 7 次提交
  8. 03 3月, 2011 1 次提交
  9. 26 2月, 2011 5 次提交
  10. 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
  11. 23 2月, 2011 1 次提交
  12. 11 2月, 2011 1 次提交
  13. 10 2月, 2011 5 次提交
  14. 09 2月, 2011 1 次提交
  15. 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
  16. 02 2月, 2011 5 次提交
    • R
      time: Correct the *settime* parameters · 1e6d7679
      Richard Cochran 提交于
      Both settimeofday() and clock_settime() promise with a 'const'
      attribute not to alter the arguments passed in. This patch adds the
      missing 'const' attribute into the various kernel functions
      implementing these calls.
      Signed-off-by: NRichard Cochran <richard.cochran@omicron.at>
      Acked-by: NJohn Stultz <johnstul@us.ibm.com>
      LKML-Reference: <20110201134417.545698637@linutronix.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      1e6d7679
    • 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