<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/security/keys/key.c, branch v3.18.15</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v3.18.15</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v3.18.15'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2014-10-12T14:13:55+00:00</updated>
<entry>
<title>Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security</title>
<updated>2014-10-12T14:13:55+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2014-10-12T14:13:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5e40d331bd72447197f26525f21711c4a265b6a6'/>
<id>urn:sha1:5e40d331bd72447197f26525f21711c4a265b6a6</id>
<content type='text'>
Pull security subsystem updates from James Morris.

Mostly ima, selinux, smack and key handling updates.

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (65 commits)
  integrity: do zero padding of the key id
  KEYS: output last portion of fingerprint in /proc/keys
  KEYS: strip 'id:' from ca_keyid
  KEYS: use swapped SKID for performing partial matching
  KEYS: Restore partial ID matching functionality for asymmetric keys
  X.509: If available, use the raw subjKeyId to form the key description
  KEYS: handle error code encoded in pointer
  selinux: normalize audit log formatting
  selinux: cleanup error reporting in selinux_nlmsg_perm()
  KEYS: Check hex2bin()'s return when generating an asymmetric key ID
  ima: detect violations for mmaped files
  ima: fix race condition on ima_rdwr_violation_check and process_measurement
  ima: added ima_policy_flag variable
  ima: return an error code from ima_add_boot_aggregate()
  ima: provide 'ima_appraise=log' kernel option
  ima: move keyring initialization to ima_init()
  PKCS#7: Handle PKCS#7 messages that contain no X.509 certs
  PKCS#7: Better handling of unsupported crypto
  KEYS: Overhaul key identification when searching for asymmetric keys
  KEYS: Implement binary asymmetric key ID handling
  ...
</content>
</entry>
<entry>
<title>KEYS: Remove key_type::match in favour of overriding default by match_preparse</title>
<updated>2014-09-16T16:36:06+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-09-16T16:36:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81'/>
<id>urn:sha1:c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81</id>
<content type='text'>
A previous patch added a -&gt;match_preparse() method to the key type.  This is
allowed to override the function called by the iteration algorithm.
Therefore, we can just set a default that simply checks for an exact match of
the key description with the original criterion data and allow match_preparse
to override it as needed.

The key_type::match op is then redundant and can be removed, as can the
user_match() function.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Increase root_maxkeys and root_maxbytes sizes</title>
<updated>2014-09-03T00:27:12+00:00</updated>
<author>
<name>Steve Dickson</name>
<email>stevedredhatcom</email>
</author>
<published>2014-09-02T12:52:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=738c5d190f6540539a04baf36ce21d46b5da04bd'/>
<id>urn:sha1:738c5d190f6540539a04baf36ce21d46b5da04bd</id>
<content type='text'>
Now that NFS client uses the kernel key ring facility to store the NFSv4
id/gid mappings, the defaults for root_maxkeys and root_maxbytes need to be
substantially increased.

These values have been soak tested:

	https://bugzilla.redhat.com/show_bug.cgi?id=1033708#c73

Signed-off-by: Steve Dickson &lt;steved@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: James Morris &lt;james.l.morris@oracle.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Call -&gt;free_preparse() even after -&gt;preparse() returns an error</title>
<updated>2014-07-22T20:46:12+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-07-18T17:56:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4d8c0250b841159b128785f7a7efbaff40cc8501'/>
<id>urn:sha1:4d8c0250b841159b128785f7a7efbaff40cc8501</id>
<content type='text'>
Call the -&gt;free_preparse() key type op even after -&gt;preparse() returns an
error as it does cleaning up type stuff.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Steve Dickson &lt;steved@redhat.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Reviewed-by: Sage Weil &lt;sage@redhat.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Allow expiry time to be set when preparsing a key</title>
<updated>2014-07-22T20:46:08+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-07-18T17:56:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7dfa0ca6a95de65b7a7760630cdbd7d30f204bfa'/>
<id>urn:sha1:7dfa0ca6a95de65b7a7760630cdbd7d30f204bfa</id>
<content type='text'>
Allow a key type's preparsing routine to set the expiry time for a key.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Steve Dickson &lt;steved@redhat.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Reviewed-by: Sage Weil &lt;sage@redhat.com&gt;
</content>
</entry>
<entry>
<title>KEYS: struct key_preparsed_payload should have two payload pointers</title>
<updated>2014-07-22T20:46:02+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-07-18T17:56:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fc7c70e0b6b637bbf6cf8b9cee547d5ae83899c9'/>
<id>urn:sha1:fc7c70e0b6b637bbf6cf8b9cee547d5ae83899c9</id>
<content type='text'>
struct key_preparsed_payload should have two payload pointers to correspond
with those in struct key.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Steve Dickson &lt;steved@redhat.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Reviewed-by: Sage Weil &lt;sage@redhat.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Provide a generic instantiation function</title>
<updated>2014-07-18T17:56:34+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-07-18T17:56:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6a09d17bb66a533c165be81e8a4c3557f68e1a3b'/>
<id>urn:sha1:6a09d17bb66a533c165be81e8a4c3557f68e1a3b</id>
<content type='text'>
Provide a generic instantiation function for key types that use the preparse
hook.  This makes it easier to prereserve key quota before keyrings get locked
to retain the new key.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Steve Dickson &lt;steved@redhat.com&gt;
Acked-by: Jeff Layton &lt;jlayton@primarydata.com&gt;
Reviewed-by: Sage Weil &lt;sage@redhat.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Move the flags representing required permission to linux/key.h</title>
<updated>2014-03-14T17:44:49+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2014-03-14T17:44:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f5895943d91b41b0368830cdb6eaffb8eda0f4c8'/>
<id>urn:sha1:f5895943d91b41b0368830cdb6eaffb8eda0f4c8</id>
<content type='text'>
Move the flags representing required permission to linux/key.h as the perm
parameter of security_key_permission() is in terms of them - and not the
permissions mask flags used in key-&gt;perm.

Whilst we're at it:

 (1) Rename them to be KEY_NEED_xxx rather than KEY_xxx to avoid collisions
     with symbols in uapi/linux/input.h.

 (2) Don't use key_perm_t for a mask of required permissions, but rather limit
     it to the permissions mask attached to the key and arguments related
     directly to that.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Tested-by: Dmitry Kasatkin &lt;d.kasatkin@samsung.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Pre-clear struct key on allocation</title>
<updated>2013-12-02T11:24:18+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2013-12-02T11:24:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2480f57fb3023eb047c5f2d6dfefef41ab9b893c'/>
<id>urn:sha1:2480f57fb3023eb047c5f2d6dfefef41ab9b893c</id>
<content type='text'>
The second word of key-&gt;payload does not get initialised in key_alloc(), but
the big_key type is relying on it having been cleared.  The problem comes when
big_key fails to instantiate a large key and doesn't then set the payload.  The
big_key_destroy() op is called from the garbage collector and this assumes that
the dentry pointer stored in the second word will be NULL if instantiation did
not complete.

Therefore just pre-clear the entire struct key on allocation rather than trying
to be clever and only initialising to 0 only those bits that aren't otherwise
initialised.

The lack of initialisation can lead to a bug report like the following if
big_key failed to initialise its file:

	general protection fault: 0000 [#1] SMP
	Modules linked in: ...
	CPU: 0 PID: 51 Comm: kworker/0:1 Not tainted 3.10.0-53.el7.x86_64 #1
	Hardware name: Dell Inc. PowerEdge 1955/0HC513, BIOS 1.4.4 12/09/2008
	Workqueue: events key_garbage_collector
	task: ffff8801294f5680 ti: ffff8801296e2000 task.ti: ffff8801296e2000
	RIP: 0010:[&lt;ffffffff811b4a51&gt;] dput+0x21/0x2d0
	...
	Call Trace:
	 [&lt;ffffffff811a7b06&gt;] path_put+0x16/0x30
	 [&lt;ffffffff81235604&gt;] big_key_destroy+0x44/0x60
	 [&lt;ffffffff8122dc4b&gt;] key_gc_unused_keys.constprop.2+0x5b/0xe0
	 [&lt;ffffffff8122df2f&gt;] key_garbage_collector+0x1df/0x3c0
	 [&lt;ffffffff8107759b&gt;] process_one_work+0x17b/0x460
	 [&lt;ffffffff8107834b&gt;] worker_thread+0x11b/0x400
	 [&lt;ffffffff81078230&gt;] ? rescuer_thread+0x3e0/0x3e0
	 [&lt;ffffffff8107eb00&gt;] kthread+0xc0/0xd0
	 [&lt;ffffffff8107ea40&gt;] ? kthread_create_on_node+0x110/0x110
	 [&lt;ffffffff815c4bec&gt;] ret_from_fork+0x7c/0xb0
	 [&lt;ffffffff8107ea40&gt;] ? kthread_create_on_node+0x110/0x110

Reported-by: Patrik Kis &lt;pkis@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Reviewed-by: Stephen Gallagher &lt;sgallagh@redhat.com&gt;
</content>
</entry>
<entry>
<title>KEYS: Fix a race between negating a key and reading the error set</title>
<updated>2013-10-30T11:15:24+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2013-10-30T11:15:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=74792b0001ee85b845dc82c1a716c6052c2db9de'/>
<id>urn:sha1:74792b0001ee85b845dc82c1a716c6052c2db9de</id>
<content type='text'>
key_reject_and_link() marking a key as negative and setting the error with
which it was negated races with keyring searches and other things that read
that error.

The fix is to switch the order in which the assignments are done in
key_reject_and_link() and to use memory barriers.

Kudos to Dave Wysochanski &lt;dwysocha@redhat.com&gt; and Scott Mayhew
&lt;smayhew@redhat.com&gt; for tracking this down.

This may be the cause of:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000070
IP: [&lt;ffffffff81219011&gt;] wait_for_key_construction+0x31/0x80
PGD c6b2c3067 PUD c59879067 PMD 0
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/system/cpu/cpu3/cache/index2/shared_cpu_map
CPU 0
Modules linked in: ...

Pid: 13359, comm: amqzxma0 Not tainted 2.6.32-358.20.1.el6.x86_64 #1 IBM System x3650 M3 -[7945PSJ]-/00J6159
RIP: 0010:[&lt;ffffffff81219011&gt;] wait_for_key_construction+0x31/0x80
RSP: 0018:ffff880c6ab33758  EFLAGS: 00010246
RAX: ffffffff81219080 RBX: 0000000000000000 RCX: 0000000000000002
RDX: ffffffff81219060 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff880c6ab33768 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: ffff880adfcbce40
R13: ffffffffa03afb84 R14: ffff880adfcbce40 R15: ffff880adfcbce43
FS:  00007f29b8042700(0000) GS:ffff880028200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000070 CR3: 0000000c613dc000 CR4: 00000000000007f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process amqzxma0 (pid: 13359, threadinfo ffff880c6ab32000, task ffff880c610deae0)
Stack:
 ffff880adfcbce40 0000000000000000 ffff880c6ab337b8 ffffffff81219695
&lt;d&gt; 0000000000000000 ffff880a000000d0 ffff880c6ab337a8 000000000000000f
&lt;d&gt; ffffffffa03afb93 000000000000000f ffff88186c7882c0 0000000000000014
Call Trace:
 [&lt;ffffffff81219695&gt;] request_key+0x65/0xa0
 [&lt;ffffffffa03a0885&gt;] nfs_idmap_request_key+0xc5/0x170 [nfs]
 [&lt;ffffffffa03a0eb4&gt;] nfs_idmap_lookup_id+0x34/0x80 [nfs]
 [&lt;ffffffffa03a1255&gt;] nfs_map_group_to_gid+0x75/0xa0 [nfs]
 [&lt;ffffffffa039a9ad&gt;] decode_getfattr_attrs+0xbdd/0xfb0 [nfs]
 [&lt;ffffffff81057310&gt;] ? __dequeue_entity+0x30/0x50
 [&lt;ffffffff8100988e&gt;] ? __switch_to+0x26e/0x320
 [&lt;ffffffffa039ae03&gt;] decode_getfattr+0x83/0xe0 [nfs]
 [&lt;ffffffffa039b610&gt;] ? nfs4_xdr_dec_getattr+0x0/0xa0 [nfs]
 [&lt;ffffffffa039b69f&gt;] nfs4_xdr_dec_getattr+0x8f/0xa0 [nfs]
 [&lt;ffffffffa02dada4&gt;] rpcauth_unwrap_resp+0x84/0xb0 [sunrpc]
 [&lt;ffffffffa039b610&gt;] ? nfs4_xdr_dec_getattr+0x0/0xa0 [nfs]
 [&lt;ffffffffa02cf923&gt;] call_decode+0x1b3/0x800 [sunrpc]
 [&lt;ffffffff81096de0&gt;] ? wake_bit_function+0x0/0x50
 [&lt;ffffffffa02cf770&gt;] ? call_decode+0x0/0x800 [sunrpc]
 [&lt;ffffffffa02d99a7&gt;] __rpc_execute+0x77/0x350 [sunrpc]
 [&lt;ffffffff81096c67&gt;] ? bit_waitqueue+0x17/0xd0
 [&lt;ffffffffa02d9ce1&gt;] rpc_execute+0x61/0xa0 [sunrpc]
 [&lt;ffffffffa02d03a5&gt;] rpc_run_task+0x75/0x90 [sunrpc]
 [&lt;ffffffffa02d04c2&gt;] rpc_call_sync+0x42/0x70 [sunrpc]
 [&lt;ffffffffa038ff80&gt;] _nfs4_call_sync+0x30/0x40 [nfs]
 [&lt;ffffffffa038836c&gt;] _nfs4_proc_getattr+0xac/0xc0 [nfs]
 [&lt;ffffffff810aac87&gt;] ? futex_wait+0x227/0x380
 [&lt;ffffffffa038b856&gt;] nfs4_proc_getattr+0x56/0x80 [nfs]
 [&lt;ffffffffa0371403&gt;] __nfs_revalidate_inode+0xe3/0x220 [nfs]
 [&lt;ffffffffa037158e&gt;] nfs_revalidate_mapping+0x4e/0x170 [nfs]
 [&lt;ffffffffa036f147&gt;] nfs_file_read+0x77/0x130 [nfs]
 [&lt;ffffffff811811aa&gt;] do_sync_read+0xfa/0x140
 [&lt;ffffffff81096da0&gt;] ? autoremove_wake_function+0x0/0x40
 [&lt;ffffffff8100bb8e&gt;] ? apic_timer_interrupt+0xe/0x20
 [&lt;ffffffff8100b9ce&gt;] ? common_interrupt+0xe/0x13
 [&lt;ffffffff81228ffb&gt;] ? selinux_file_permission+0xfb/0x150
 [&lt;ffffffff8121bed6&gt;] ? security_file_permission+0x16/0x20
 [&lt;ffffffff81181a95&gt;] vfs_read+0xb5/0x1a0
 [&lt;ffffffff81181bd1&gt;] sys_read+0x51/0x90
 [&lt;ffffffff810dc685&gt;] ? __audit_syscall_exit+0x265/0x290
 [&lt;ffffffff8100b072&gt;] system_call_fastpath+0x16/0x1b

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
cc: Dave Wysochanski &lt;dwysocha@redhat.com&gt;
cc: Scott Mayhew &lt;smayhew@redhat.com&gt;
</content>
</entry>
</feed>
