From: syzbot <syzbot+94bbb75204a05da3d89f@syzkaller.appspotmail.com>
To: dhowells@redhat.com
Cc: davem@davemloft.net, dhowells@redhat.com, edumazet@google.com,
jarkko@kernel.org, jmorris@namei.org, keyrings@vger.kernel.org,
kuba@kernel.org, linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, paul@paul-moore.com, serge@hallyn.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [net?] KASAN: slab-out-of-bounds Read in dns_resolver_preparse
Date: Sat, 23 Dec 2023 15:17:22 -0800 [thread overview]
Message-ID: <000000000000f27a0d060d358835@google.com> (raw)
In-Reply-To: <2591733.1703373433@warthog.procyon.org.uk>
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
want either no args or 2 args (repo, branch), got 5
>
> diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c
> index 2a6d363763a2..f18ca02aa95a 100644
> --- a/net/dns_resolver/dns_key.c
> +++ b/net/dns_resolver/dns_key.c
> @@ -91,8 +91,6 @@ const struct cred *dns_resolver_cache;
> static int
> dns_resolver_preparse(struct key_preparsed_payload *prep)
> {
> - const struct dns_server_list_v1_header *v1;
> - const struct dns_payload_header *bin;
> struct user_key_payload *upayload;
> unsigned long derrno;
> int ret;
> @@ -103,27 +101,28 @@ dns_resolver_preparse(struct key_preparsed_payload *prep)
> return -EINVAL;
>
> if (data[0] == 0) {
> + const struct dns_server_list_v1_header *v1;
> +
> /* It may be a server list. */
> - if (datalen <= sizeof(*bin))
> + if (datalen <= sizeof(*v1))
> return -EINVAL;
>
> - bin = (const struct dns_payload_header *)data;
> - kenter("[%u,%u],%u", bin->content, bin->version, datalen);
> - if (bin->content != DNS_PAYLOAD_IS_SERVER_LIST) {
> + v1 = (const struct dns_server_list_v1_header *)data;
> + kenter("[%u,%u],%u", v1->hdr.content, v1->hdr.version, datalen);
> + if (v1->hdr.content != DNS_PAYLOAD_IS_SERVER_LIST) {
> pr_warn_ratelimited(
> "dns_resolver: Unsupported content type (%u)\n",
> - bin->content);
> + v1->hdr.content);
> return -EINVAL;
> }
>
> - if (bin->version != 1) {
> + if (v1->hdr.version != 1) {
> pr_warn_ratelimited(
> "dns_resolver: Unsupported server list version (%u)\n",
> - bin->version);
> + v1->hdr.version);
> return -EINVAL;
> }
>
> - v1 = (const struct dns_server_list_v1_header *)bin;
> if ((v1->status != DNS_LOOKUP_GOOD &&
> v1->status != DNS_LOOKUP_GOOD_WITH_BAD)) {
> if (prep->expiry == TIME64_MAX)
>
next prev parent reply other threads:[~2023-12-23 23:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 8:15 [syzbot] [net?] KASAN: slab-out-of-bounds Read in dns_resolver_preparse syzbot
2023-12-14 14:33 ` [PATCH next] keys/dns: datalen must greater than sizeof(*v1) Edward Adam Davis
2023-12-14 14:46 ` [PATCH V2 next] keys/dns: fix slab-out-of-bounds in dns_resolver_preparse Edward Adam Davis
2023-12-16 21:06 ` Simon Horman
2023-12-15 3:00 ` [PATCH next] keys/dns: datalen must greater than sizeof(*v1) Jarkko Sakkinen
2023-12-23 23:17 ` [syzbot] [net?] KASAN: slab-out-of-bounds Read in dns_resolver_preparse David Howells
2023-12-23 23:17 ` syzbot [this message]
2023-12-23 23:34 ` David Howells
2023-12-23 23:59 ` syzbot
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=000000000000f27a0d060d358835@google.com \
--to=syzbot+94bbb75204a05da3d89f@syzkaller.appspotmail.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=jarkko@kernel.org \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paul@paul-moore.com \
--cc=serge@hallyn.com \
--cc=syzkaller-bugs@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;
as well as URLs for NNTP newsgroup(s).