1. 11 7月, 2011 1 次提交
  2. 08 7月, 2011 1 次提交
  3. 01 7月, 2011 1 次提交
  4. 30 6月, 2011 2 次提交
  5. 29 6月, 2011 17 次提交
  6. 27 6月, 2011 5 次提交
  7. 22 6月, 2011 1 次提交
    • D
      KEYS: Fix error handling in construct_key_and_link() · b1d7dd80
      David Howells 提交于
      Fix error handling in construct_key_and_link().
      
      If construct_alloc_key() returns an error, it shouldn't pass out through
      the normal path as the key_serial() called by the kleave() statement
      will oops when it gets an error code in the pointer:
      
        BUG: unable to handle kernel paging request at ffffffffffffff84
        IP: [<ffffffff8120b401>] request_key_and_link+0x4d7/0x52f
        ..
        Call Trace:
         [<ffffffff8120b52c>] request_key+0x41/0x75
         [<ffffffffa00ed6e8>] cifs_get_spnego_key+0x206/0x226 [cifs]
         [<ffffffffa00eb0c9>] CIFS_SessSetup+0x511/0x1234 [cifs]
         [<ffffffffa00d9799>] cifs_setup_session+0x90/0x1ae [cifs]
         [<ffffffffa00d9c02>] cifs_get_smb_ses+0x34b/0x40f [cifs]
         [<ffffffffa00d9e05>] cifs_mount+0x13f/0x504 [cifs]
         [<ffffffffa00caabb>] cifs_do_mount+0xc4/0x672 [cifs]
         [<ffffffff8113ae8c>] mount_fs+0x69/0x155
         [<ffffffff8114ff0e>] vfs_kern_mount+0x63/0xa0
         [<ffffffff81150be2>] do_kern_mount+0x4d/0xdf
         [<ffffffff81152278>] do_mount+0x63c/0x69f
         [<ffffffff8115255c>] sys_mount+0x88/0xc2
         [<ffffffff814fbdc2>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b1d7dd80
  8. 20 6月, 2011 1 次提交
  9. 18 6月, 2011 1 次提交
    • D
      KEYS/DNS: Fix ____call_usermodehelper() to not lose the session keyring · 87966996
      David Howells 提交于
      ____call_usermodehelper() now erases any credentials set by the
      subprocess_inf::init() function.  The problem is that commit
      17f60a7d ("capabilites: allow the application of capability limits
      to usermode helpers") creates and commits new credentials with
      prepare_kernel_cred() after the call to the init() function.  This wipes
      all keyrings after umh_keys_init() is called.
      
      The best way to deal with this is to put the init() call just prior to
      the commit_creds() call, and pass the cred pointer to init().  That
      means that umh_keys_init() and suchlike can modify the credentials
      _before_ they are published and potentially in use by the rest of the
      system.
      
      This prevents request_key() from working as it is prevented from passing
      the session keyring it set up with the authorisation token to
      /sbin/request-key, and so the latter can't assume the authority to
      instantiate the key.  This causes the in-kernel DNS resolver to fail
      with ENOKEY unconditionally.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NEric Paris <eparis@redhat.com>
      Tested-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      87966996
  10. 15 6月, 2011 1 次提交
  11. 14 6月, 2011 2 次提交
  12. 09 6月, 2011 2 次提交
    • J
      AppArmor: Fix sleep in invalid context from task_setrlimit · 1780f2d3
      John Johansen 提交于
      Affected kernels 2.6.36 - 3.0
      
      AppArmor may do a GFP_KERNEL memory allocation with task_lock(tsk->group_leader);
      held when called from security_task_setrlimit.  This will only occur when the
      task's current policy has been replaced, and the task's creds have not been
      updated before entering the LSM security_task_setrlimit() hook.
      
      BUG: sleeping function called from invalid context at mm/slub.c:847
       in_atomic(): 1, irqs_disabled(): 0, pid: 1583, name: cupsd
       2 locks held by cupsd/1583:
        #0:  (tasklist_lock){.+.+.+}, at: [<ffffffff8104dafa>] do_prlimit+0x61/0x189
        #1:  (&(&p->alloc_lock)->rlock){+.+.+.}, at: [<ffffffff8104db2d>]
      do_prlimit+0x94/0x189
       Pid: 1583, comm: cupsd Not tainted 3.0.0-rc2-git1 #7
       Call Trace:
        [<ffffffff8102ebf2>] __might_sleep+0x10d/0x112
        [<ffffffff810e6f46>] slab_pre_alloc_hook.isra.49+0x2d/0x33
        [<ffffffff810e7bc4>] kmem_cache_alloc+0x22/0x132
        [<ffffffff8105b6e6>] prepare_creds+0x35/0xe4
        [<ffffffff811c0675>] aa_replace_current_profile+0x35/0xb2
        [<ffffffff811c4d2d>] aa_current_profile+0x45/0x4c
        [<ffffffff811c4d4d>] apparmor_task_setrlimit+0x19/0x3a
        [<ffffffff811beaa5>] security_task_setrlimit+0x11/0x13
        [<ffffffff8104db6b>] do_prlimit+0xd2/0x189
        [<ffffffff8104dea9>] sys_setrlimit+0x3b/0x48
        [<ffffffff814062bb>] system_call_fastpath+0x16/0x1b
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      Reported-by: NMiles Lane <miles.lane@gmail.com>
      Cc: stable@kernel.org
      Signed-off-by: NJames Morris <jmorris@namei.org>
      1780f2d3
    • 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
  13. 01 6月, 2011 1 次提交
  14. 27 5月, 2011 4 次提交
    • 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
    • B
      cgroups: add per-thread subsystem callbacks · f780bdb7
      Ben Blum 提交于
      Add cgroup subsystem callbacks for per-thread attachment in atomic contexts
      
      Add can_attach_task(), pre_attach(), and attach_task() as new callbacks
      for cgroups's subsystem interface.  Unlike can_attach and attach, these
      are for per-thread operations, to be called potentially many times when
      attaching an entire threadgroup.
      
      Also, the old "bool threadgroup" interface is removed, as replaced by
      this.  All subsystems are modified for the new interface - of note is
      cpuset, which requires from/to nodemasks for attach to be globally scoped
      (though per-cpuset would work too) to persist from its pre_attach to
      attach_task and attach.
      
      This is a pre-patch for cgroup-procs-writable.patch.
      Signed-off-by: NBen Blum <bblum@andrew.cmu.edu>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Reviewed-by: NPaul Menage <menage@google.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Miao Xie <miaox@cn.fujitsu.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f780bdb7
    • 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
    • S
      Set cred->user_ns in key_replace_session_keyring · f7285b5d
      Serge E. Hallyn 提交于
      Since this cred was not created with copy_creds(), it needs to get
      initialized.  Otherwise use of syscall(__NR_keyctl, KEYCTL_SESSION_TO_PARENT);
      can lead to a NULL deref.  Thanks to Robert for finding this.
      
      But introduced by commit 47a150ed ("Cache user_ns in struct cred").
      Signed-off-by: NSerge E. Hallyn <serge.hallyn@canonical.com>
      Reported-by: NRobert Święcki <robert@swiecki.net>
      Cc: David Howells <dhowells@redhat.com>
      Cc: stable@kernel.org (2.6.39)
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f7285b5d