2019-05-27 08:55:01 +02:00
|
|
|
|
2011-01-20 16:38:33 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-23 00:02:58 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-23 00:02:58 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-20 16:38:33 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-13 19:44:18 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-13 19:44:18 +02:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-20 16:38:27 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-01-20 16:38:33 +00:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-18 22:00:05 +10:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
|
|
|
|
|
keys: Fix proc_keys_next to increase position index
If seq_file .next function does not change position index,
read after some lseek can generate unexpected output:
$ dd if=/proc/keys bs=1 # full usual output
0f6bfdf5 I--Q--- 2 perm 3f010000 1000 1000 user 4af2f79ab8848d0a: 740
1fb91b32 I--Q--- 3 perm 1f3f0000 1000 65534 keyring _uid.1000: 2
27589480 I--Q--- 1 perm 0b0b0000 0 0 user invocation_id: 16
2f33ab67 I--Q--- 152 perm 3f030000 0 0 keyring _ses: 2
33f1d8fa I--Q--- 4 perm 3f030000 1000 1000 keyring _ses: 1
3d427fda I--Q--- 2 perm 3f010000 1000 1000 user 69ec44aec7678e5a: 740
3ead4096 I--Q--- 1 perm 1f3f0000 1000 65534 keyring _uid_ses.1000: 1
521+0 records in
521+0 records out
521 bytes copied, 0,00123769 s, 421 kB/s
But a read after lseek in middle of last line results in the partial
last line and then a repeat of the final line:
$ dd if=/proc/keys bs=500 skip=1
dd: /proc/keys: cannot skip to specified offset
g _uid_ses.1000: 1
3ead4096 I--Q--- 1 perm 1f3f0000 1000 65534 keyring _uid_ses.1000: 1
0+1 records in
0+1 records out
97 bytes copied, 0,000135035 s, 718 kB/s
and a read after lseek beyond end of file results in the last line being
shown:
$ dd if=/proc/keys bs=1000 skip=1 # read after lseek beyond end of file
dd: /proc/keys: cannot skip to specified offset
3ead4096 I--Q--- 1 perm 1f3f0000 1000 65534 keyring _uid_ses.1000: 1
0+1 records in
0+1 records out
76 bytes copied, 0,000119981 s, 633 kB/s
See https://bugzilla.kernel.org/show_bug.cgi?id=206283
Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-04-14 21:33:16 +01:00
|
|
|
|
|
|
|
|
|
2009-09-02 09:14:05 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-18 22:00:05 +10:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-27 12:50:46 -07:00
|
|
|
|
2010-06-11 17:31:10 +01:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2016-10-26 15:01:54 +01:00
|
|
|
|
2017-10-04 16:43:25 +01:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2006-06-26 00:24:56 -07:00
|
|
|
|
|
|
|
|
|
2013-09-24 10:35:15 +01:00
|
|
|
|
KEYS: always initialize keyring_index_key::desc_len
syzbot hit the 'BUG_ON(index_key->desc_len == 0);' in __key_link_begin()
called from construct_alloc_key() during sys_request_key(), because the
length of the key description was never calculated.
The problem is that we rely on ->desc_len being initialized by
search_process_keyrings(), specifically by search_nested_keyrings().
But, if the process isn't subscribed to any keyrings that never happens.
Fix it by always initializing keyring_index_key::desc_len as soon as the
description is set, like we already do in some places.
The following program reproduces the BUG_ON() when it's run as root and
no session keyring has been installed. If it doesn't work, try removing
pam_keyinit.so from /etc/pam.d/login and rebooting.
#include <stdlib.h>
#include <unistd.h>
#include <keyutils.h>
int main(void)
{
int id = add_key("keyring", "syz", NULL, 0, KEY_SPEC_USER_KEYRING);
keyctl_setperm(id, KEY_OTH_WRITE);
setreuid(5000, 5000);
request_key("user", "desc", "", id);
}
Reported-by: syzbot+ec24e95ea483de0a24da@syzkaller.appspotmail.com
Fixes: b2a4df200d57 ("KEYS: Expand the capacity of a keyring")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: James Morris <james.morris@microsoft.com>
2019-02-22 15:36:18 +00:00
|
|
|
|
2017-09-18 11:38:29 -07:00
|
|
|
|
2014-09-16 17:36:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-26 21:02:32 +01:00
|
|
|
|
|
|
|
|
|
2013-09-24 10:35:15 +01:00
|
|
|
|
|
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
2010-06-11 17:31:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
|
|
|
|
|
2019-06-19 16:10:15 +01:00
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
2010-06-11 17:31:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-18 11:38:29 -07:00
|
|
|
|
2014-03-14 17:44:49 +00:00
|
|
|
|
2006-06-26 00:24:56 -07:00
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-09-27 12:50:46 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-09-02 09:14:11 +01:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-11-15 16:38:45 +00:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2017-10-04 16:43:25 +01:00
|
|
|
|
|
|
|
|
|
2017-09-27 12:50:46 -07:00
|
|
|
|
|
|
|
|
|
2005-06-23 22:00:49 -07:00
|
|
|
|
2017-09-27 12:50:46 -07:00
|
|
|
|
2012-05-11 10:56:56 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2017-10-04 16:43:25 +01:00
|
|
|
|
2017-09-27 12:50:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-10-04 16:43:25 +01:00
|
|
|
|
2017-09-27 12:50:46 -07:00
|
|
|
|
2017-03-31 15:20:48 +03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2005-06-23 22:00:49 -07:00
|
|
|
|
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-10 18:43:43 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2009-02-26 18:28:04 -06:00
|
|
|
|
2009-09-02 09:14:11 +01:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2009-06-18 22:00:05 +10:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-18 22:00:05 +10:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2008-04-29 01:01:32 -07:00
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2008-04-29 01:01:32 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
2012-02-08 07:53:04 -08:00
|
|
|
|
2017-03-31 15:20:49 +03:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-29 01:01:32 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2008-04-29 01:01:32 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|