public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: dhowells@redhat.com, james.l.morris@oracle.com, serge@hallyn.com,
	keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller <syzkaller@googlegroups.com>
Subject: Re: keys: GPF in request_key
Date: Wed, 01 Feb 2017 16:50:24 +0000	[thread overview]
Message-ID: <25638.1485967824@warthog.procyon.org.uk> (raw)
In-Reply-To: <CACT4Y+aBRPpUCOMC_sOy2uvhko=iJGsuCeWtTzSt1x=ydB3H4g@mail.gmail.com>

Do you reboot the system between running individual programs?  If not, the
programs will be influencing each other.  Further, only those calls with valid
type and matching description values are relevant, I think.  This means those
that use:

	static const char type_2[] = "user";
	static const char desc_2[] = "syz\1";

so:

	r25 = request_key(type_2, desc_2, ...);
	...
	r26 = add_key(type_2, desc_2, ...);
	...
	r24 = request_key(type_2, desc_2, ...);
	...
	r25 = add_key(type_2, desc_2, ...);
	...
	r25 = request_key(type_2, desc_2, ...);
	...
	r26 = add_key(type_2, desc_2, ...);

The first request_key() call will fail because it doesn't find anything and
the upcall process, if it is available, has no suitable handler and will
negatively instantiate it.

The first add_key() call will then update the key to make it positively
instantiated, after which subsequent request_key() calls will return the key
and add_key() calls will update its contents.

So, it would appear that it's not the first call to request_key() of type_2,
desc_2, but one subsequent to that.  The type_4 request_key() calls should get
weeded out very quickly in sys_request_key() by key_get_type_from_user() -
which seems to happen (EPERM is returned).

Doing:

	keyctl link @us @s

before running the program on Fedora allows the request_key() to find the
add_key() results.

Do you run some of these in parallel?  Running the combo program 100,000 times
sequentially didn't produce a crash.

> The OS is debian/wheezy created with:
> $ debootstrap --include=openssh-server,curl,tar,time,strace,sudo,less,psmisc
> wheezy wheezy
> 
> I did not do any additional setup. I don't know what is PAM, so I
> guess I did not set it up.
> The machine is GCE VM.

I would imagine that PAM is part of the core OS - it does things like
controlling login service security.  Jessie apparently has it.  However,
Debian didn't use to include pam_keyinit.

David

  reply	other threads:[~2017-02-01 16:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01 12:19 keys: GPF in request_key Dmitry Vyukov
2017-02-01 13:11 ` David Howells
2017-02-01 13:23   ` Dmitry Vyukov
2017-02-01 13:22 ` David Howells
2017-02-01 13:48 ` David Howells
2017-02-01 14:07   ` Dmitry Vyukov
2017-02-01 14:54     ` David Howells
2017-02-01 15:26       ` Dmitry Vyukov
2017-02-01 15:42         ` David Howells
2017-02-01 15:50           ` Dmitry Vyukov
2017-02-01 16:50             ` David Howells [this message]
2017-02-01 17:13               ` Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25638.1485967824@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=dvyukov@google.com \
    --cc=james.l.morris@oracle.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=syzkaller@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox