<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/security/keys/request_key.c, branch v3.4.22</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/security/keys/request_key.c?h=v3.4.22</id>
<link rel='self' href='https://git.amat.us/linux/atom/security/keys/request_key.c?h=v3.4.22'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-03-23T23:58:41Z</updated>
<entry>
<title>usermodehelper: kill umh_wait, renumber UMH_* constants</title>
<updated>2012-03-23T23:58:41Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2012-03-23T22:02:48Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=9d944ef32e83405a07376f112e9f02161d3e9731'/>
<id>urn:sha1:9d944ef32e83405a07376f112e9f02161d3e9731</id>
<content type='text'>
No functional changes.  It is not sane to use UMH_KILLABLE with enum
umh_wait, but obviously we do not want another argument in
call_usermodehelper_* helpers.  Kill this enum, use the plain int.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Cc: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Rientjes &lt;rientjes@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>KEYS: Fix error handling in construct_key_and_link()</title>
<updated>2011-06-22T01:31:45Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-06-21T13:32:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b1d7dd80aadb9042e83f9778b484a2f92e0b04d4'/>
<id>urn:sha1:b1d7dd80aadb9042e83f9778b484a2f92e0b04d4</id>
<content type='text'>
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: [&lt;ffffffff8120b401&gt;] request_key_and_link+0x4d7/0x52f
  ..
  Call Trace:
   [&lt;ffffffff8120b52c&gt;] request_key+0x41/0x75
   [&lt;ffffffffa00ed6e8&gt;] cifs_get_spnego_key+0x206/0x226 [cifs]
   [&lt;ffffffffa00eb0c9&gt;] CIFS_SessSetup+0x511/0x1234 [cifs]
   [&lt;ffffffffa00d9799&gt;] cifs_setup_session+0x90/0x1ae [cifs]
   [&lt;ffffffffa00d9c02&gt;] cifs_get_smb_ses+0x34b/0x40f [cifs]
   [&lt;ffffffffa00d9e05&gt;] cifs_mount+0x13f/0x504 [cifs]
   [&lt;ffffffffa00caabb&gt;] cifs_do_mount+0xc4/0x672 [cifs]
   [&lt;ffffffff8113ae8c&gt;] mount_fs+0x69/0x155
   [&lt;ffffffff8114ff0e&gt;] vfs_kern_mount+0x63/0xa0
   [&lt;ffffffff81150be2&gt;] do_kern_mount+0x4d/0xdf
   [&lt;ffffffff81152278&gt;] do_mount+0x63c/0x69f
   [&lt;ffffffff8115255c&gt;] sys_mount+0x88/0xc2
   [&lt;ffffffff814fbdc2&gt;] system_call_fastpath+0x16/0x1b

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>KEYS/DNS: Fix ____call_usermodehelper() to not lose the session keyring</title>
<updated>2011-06-17T16:40:48Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-06-17T10:25:59Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=879669961b11e7f40b518784863a259f735a72bf'/>
<id>urn:sha1:879669961b11e7f40b518784863a259f735a72bf</id>
<content type='text'>
____call_usermodehelper() now erases any credentials set by the
subprocess_inf::init() function.  The problem is that commit
17f60a7da150 ("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: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Eric Paris &lt;eparis@redhat.com&gt;
Tested-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'docs-move' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs</title>
<updated>2011-05-27T17:25:02Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2011-05-27T17:25:02Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=e52e713ec30a31e9a4663d9aebbaae5ec07466a6'/>
<id>urn:sha1:e52e713ec30a31e9a4663d9aebbaae5ec07466a6</id>
<content type='text'>
* 'docs-move' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs:
  Create Documentation/security/, move LSM-, credentials-, and keys-related files from Documentation/   to Documentation/security/, add Documentation/security/00-INDEX, and update all occurrences of Documentation/&lt;moved_file&gt;   to Documentation/security/&lt;moved_file&gt;.
</content>
</entry>
<entry>
<title>Create Documentation/security/,</title>
<updated>2011-05-19T22:59:38Z</updated>
<author>
<name>Randy Dunlap</name>
<email>randy.dunlap@oracle.com</email>
</author>
<published>2011-05-19T22:59:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=d410fa4ef99112386de5f218dd7df7b4fca910b4'/>
<id>urn:sha1:d410fa4ef99112386de5f218dd7df7b4fca910b4</id>
<content type='text'>
move LSM-, credentials-, and keys-related files from Documentation/
  to Documentation/security/,
add Documentation/security/00-INDEX, and
update all occurrences of Documentation/&lt;moved_file&gt;
  to Documentation/security/&lt;moved_file&gt;.
</content>
</entry>
<entry>
<title>KEYS: Improve /proc/keys</title>
<updated>2011-03-17T00:59:32Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-03-11T17:57:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=78b7280cce23293f7570ad52c1ffe1485c6d9669'/>
<id>urn:sha1:78b7280cce23293f7570ad52c1ffe1485c6d9669</id>
<content type='text'>
Improve /proc/keys by:

 (1) Don't attempt to summarise the payload of a negated key.  It won't have
     one.  To this end, a helper function - key_is_instantiated() has been
     added that allows the caller to find out whether the key is positively
     instantiated (as opposed to being uninstantiated or negatively
     instantiated).

 (2) Do show keys that are negative, expired or revoked rather than hiding
     them.  This requires an override flag (no_state_check) to be passed to
     search_my_process_keyrings() and keyring_search_aux() to suppress this
     check.

     Without this, keys that are possessed by the caller, but only grant
     permissions to the caller if possessed are skipped as the possession check
     fails.

     Keys that are visible due to user, group or other checks are visible with
     or without this patch.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>KEYS: Add a new keyctl op to reject a key with a specified error code</title>
<updated>2011-03-08T00:17:18Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-03-07T15:06:09Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=fdd1b94581782a2ddf9124414e5b7a5f48ce2f9c'/>
<id>urn:sha1:fdd1b94581782a2ddf9124414e5b7a5f48ce2f9c</id>
<content type='text'>
Add a new keyctl op to reject a key with a specified error code.  This works
much the same as negating a key, and so keyctl_negate_key() is made a special
case of keyctl_reject_key().  The difference is that keyctl_negate_key()
selects ENOKEY as the error to be reported.

Typically the key would be rejected with EKEYEXPIRED, EKEYREVOKED or
EKEYREJECTED, but this is not mandatory.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>KEYS: Fix __key_link_end() quota fixup on error</title>
<updated>2011-01-25T22:58:20Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-01-25T16:34:28Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ceb73c12047b8d543570b23353e7848eb7c540a1'/>
<id>urn:sha1:ceb73c12047b8d543570b23353e7848eb7c540a1</id>
<content type='text'>
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: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>KEYS: Fix up comments in key management code</title>
<updated>2011-01-21T22:59:30Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2011-01-20T16:38:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=973c9f4f49ca96a53bcf6384c4c59ccd26c33906'/>
<id>urn:sha1:973c9f4f49ca96a53bcf6384c4c59ccd26c33906</id>
<content type='text'>
Fix up comments in the key management code.  No functional changes.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>KEYS: Don't call up_write() if __key_link_begin() returns an error</title>
<updated>2010-12-23T23:31:48Z</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2010-12-22T16:24:13Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=3fc5e98d8cf85e0d77fc597b49e9268dff67400e'/>
<id>urn:sha1:3fc5e98d8cf85e0d77fc597b49e9268dff67400e</id>
<content type='text'>
In construct_alloc_key(), up_write() is called in the error path if
__key_link_begin() fails, but this is incorrect as __key_link_begin() only
returns with the nominated keyring locked if it returns successfully.

Without this patch, you might see the following in dmesg:

	=====================================
	[ BUG: bad unlock balance detected! ]
	-------------------------------------
	mount.cifs/5769 is trying to release lock (&amp;key-&gt;sem) at:
	[&lt;ffffffff81201159&gt;] request_key_and_link+0x263/0x3fc
	but there are no more locks to release!

	other info that might help us debug this:
	3 locks held by mount.cifs/5769:
	 #0:  (&amp;type-&gt;s_umount_key#41/1){+.+.+.}, at: [&lt;ffffffff81131321&gt;] sget+0x278/0x3e7
	 #1:  (&amp;ret_buf-&gt;session_mutex){+.+.+.}, at: [&lt;ffffffffa0258e59&gt;] cifs_get_smb_ses+0x35a/0x443 [cifs]
	 #2:  (root_key_user.cons_lock){+.+.+.}, at: [&lt;ffffffff81201000&gt;] request_key_and_link+0x10a/0x3fc

	stack backtrace:
	Pid: 5769, comm: mount.cifs Not tainted 2.6.37-rc6+ #1
	Call Trace:
	 [&lt;ffffffff81201159&gt;] ? request_key_and_link+0x263/0x3fc
	 [&lt;ffffffff81081601&gt;] print_unlock_inbalance_bug+0xca/0xd5
	 [&lt;ffffffff81083248&gt;] lock_release_non_nested+0xc1/0x263
	 [&lt;ffffffff81201159&gt;] ? request_key_and_link+0x263/0x3fc
	 [&lt;ffffffff81201159&gt;] ? request_key_and_link+0x263/0x3fc
	 [&lt;ffffffff81083567&gt;] lock_release+0x17d/0x1a4
	 [&lt;ffffffff81073f45&gt;] up_write+0x23/0x3b
	 [&lt;ffffffff81201159&gt;] request_key_and_link+0x263/0x3fc
	 [&lt;ffffffffa026fe9e&gt;] ? cifs_get_spnego_key+0x61/0x21f [cifs]
	 [&lt;ffffffff812013c5&gt;] request_key+0x41/0x74
	 [&lt;ffffffffa027003d&gt;] cifs_get_spnego_key+0x200/0x21f [cifs]
	 [&lt;ffffffffa026e296&gt;] CIFS_SessSetup+0x55d/0x1273 [cifs]
	 [&lt;ffffffffa02589e1&gt;] cifs_setup_session+0x90/0x1ae [cifs]
	 [&lt;ffffffffa0258e7e&gt;] cifs_get_smb_ses+0x37f/0x443 [cifs]
	 [&lt;ffffffffa025a9e3&gt;] cifs_mount+0x1aa1/0x23f3 [cifs]
	 [&lt;ffffffff8111fd94&gt;] ? alloc_debug_processing+0xdb/0x120
	 [&lt;ffffffffa027002c&gt;] ? cifs_get_spnego_key+0x1ef/0x21f [cifs]
	 [&lt;ffffffffa024cc71&gt;] cifs_do_mount+0x165/0x2b3 [cifs]
	 [&lt;ffffffff81130e72&gt;] vfs_kern_mount+0xaf/0x1dc
	 [&lt;ffffffff81131007&gt;] do_kern_mount+0x4d/0xef
	 [&lt;ffffffff811483b9&gt;] do_mount+0x6f4/0x733
	 [&lt;ffffffff8114861f&gt;] sys_mount+0x88/0xc2
	 [&lt;ffffffff8100ac42&gt;] system_call_fastpath+0x16/0x1b

Reported-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reviewed-and-Tested-by: Jeff Layton &lt;jlayton@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
