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 14:54:06 +0000 [thread overview]
Message-ID: <23619.1485960846@warthog.procyon.org.uk> (raw)
In-Reply-To: <CACT4Y+aCJAtORPUTr_zfdQE9iehQ_AjCkzx_=B5bihsFQ2orkg@mail.gmail.com>
Dmitry Vyukov <dvyukov@google.com> wrote:
> > Can you disassemble this function for me? There are several possible paths
> > and without the argument to the syscall and whether there's a key that was
> > matched, it's hard to say which path is being taken - but this might help
> > determine that.
>
> Here it is:
> https://gist.githubusercontent.com/dvyukov/65efc41d00ef0033f9374853b9265c71/raw/9d8540dfb199b81f3d3534ec4cc6da378d07f5b2/gistfile1.txt
Okay, it's called from here:
ffffffff820490fd: lea -0x1b0(%rbp),%rdi
ffffffff82049104: callq ffffffff82047800 <construct_get_dest_keyring>
ffffffff82049109: mov -0x1b0(%rbp),%rdi
ffffffff82049110: mov %r15,%rsi
ffffffff82049113: callq ffffffff8203efd0 <key_link> <---
ffffffff82049118: mov -0x1b0(%rbp),%rdi
ffffffff8204911f: mov %eax,%r14d
ffffffff82049122: callq ffffffff82037ab0 <key_put>
Which should correspond to this:
key_ref = search_process_keyrings(&ctx);
if (!IS_ERR(key_ref)) {
key = key_ref_to_ptr(key_ref);
if (dest_keyring) {
construct_get_dest_keyring(&dest_keyring);
ret = key_link(dest_keyring, key); <---
key_put(dest_keyring);
if (ret < 0) {
key_put(key);
key = ERR_PTR(ret);
goto error_free;
}
}
which means that the search was successful, the requested key already exists
and there was a destination keyring nominated by userspace. The first
conditional clause of construct_get_dest_keyring() must've been true:
struct key *dest_keyring = *_dest_keyring
...
if (dest_keyring) {
/* the caller supplied one */
key_get(dest_keyring);
} else {
because it matches the containing if-condition in the calling function.
> I actually know what were the arguments to the syscall. Since it
> happened in a user process context, I know what syzkaller program it
> was running at the time of the crash. It's just they are not
> reproducible. Here are the 3 programs, and they are almost equivalent
> as far as I can see. It's in syzkaller format, but I hope you can
> decipher it, it's just syscall names, address and data in hex:
> https://gist.githubusercontent.com/dvyukov/19bd59ffa286a74b49ca2371b69d4c5c/raw/004eaaa58a4ca775c008591fbb94eae78f92ef86/gistfile1.txt
add_key(&(0x7f0000d02000)="6465616400", ...
What does the "6465616400" represent? A string containing only numeric
characters or are these 2-digit hex codes and the string is actually "dead"?
David
next prev parent reply other threads:[~2017-02-01 14:54 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 [this message]
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
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=23619.1485960846@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