From: Andrei Vagin <avagin@virtuozzo.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: syzbot <syzbot+e432865c29eb4c48c142@syzkaller.appspotmail.com>,
Jason@zx2c4.com, Andrew Morton <akpm@linux-foundation.org>,
alexander.deucher@amd.com, avagin <avagin@openvz.org>,
Chris Wilson <chris@chris-wilson.co.uk>,
David Miller <davem@davemloft.net>,
David Ahern <dsahern@gmail.com>,
Eric Dumazet <edumazet@google.com>,
elena.reshetova@intel.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
Johannes Berg <johannes.berg@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
Xin Long <lucien.xin@gmail.com>,
mchehab@kernel.org, netdev <netdev@vger.kernel.org>,
syzkaller-bugs@googlegroups.com
Subject: Re: general protection fault in __netlink_ns_capable
Date: Thu, 4 Jan 2018 10:14:38 -0800 [thread overview]
Message-ID: <20180104181437.GA6260@outlook.office365.com> (raw)
In-Reply-To: <CACT4Y+ZNkQaJ0WWv5F6r_yFwyrniF4s9CXJ62DbKYioMieRfGw@mail.gmail.com>
On Thu, Jan 04, 2018 at 01:01:17PM +0100, Dmitry Vyukov wrote:
> On Wed, Jan 3, 2018 at 8:37 AM, Andrei Vagin <avagin@virtuozzo.com> wrote:
> >> > Hello,
> >> >
> >> > syzkaller hit the following crash on
> >> > 75aa5540627fdb3d8f86229776ea87f995275351
> >> > git://git.cmpxchg.org/linux-mmots.git/master
> >> > compiler: gcc (GCC) 7.1.1 20170620
> >> > .config is attached
> >> > Raw console output is attached.
> >> > C reproducer is attached
> >> > syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> >> > for information about syzkaller reproducers
> >> >
> >> >
> >> > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> >> > Reported-by: syzbot+e432865c29eb4c48c142@syzkaller.appspotmail.com
> >> > It will help syzbot understand when the bug is fixed. See footer for
> >> > details.
> >> > If you forward the report, please keep this part and the footer.
> >> >
> >> > netlink: 3 bytes leftover after parsing attributes in process
> >> > `syzkaller140561'.
> >> > netlink: 3 bytes leftover after parsing attributes in process
> >> > `syzkaller140561'.
> >> > netlink: 3 bytes leftover after parsing attributes in process
> >> > `syzkaller140561'.
> >> > kasan: CONFIG_KASAN_INLINE enabled
> >> > kasan: GPF could be caused by NULL-ptr deref or user memory access
> >> > general protection fault: 0000 [#1] SMP KASAN
> >> > Dumping ftrace buffer:
> >> > (ftrace buffer empty)
> >> > Modules linked in:
> >> > CPU: 1 PID: 3149 Comm: syzkaller140561 Not tainted 4.15.0-rc4-mm1+ #47
> >> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> >> > Google 01/01/2011
> >> > RIP: 0010:__netlink_ns_capable+0x8b/0x120 net/netlink/af_netlink.c:868
> >>
> >> NETLINK_CB(skb).sk is NULL here. It looks like we have to use
> >> sk_ns_capable instead of netlink_ns_capable:
> >>
> >> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> >> index c688dc564b11..408c75de52ea 100644
> >> --- a/net/core/rtnetlink.c
> >> +++ b/net/core/rtnetlink.c
> >> @@ -1762,7 +1762,7 @@ static struct net *get_target_net(struct sk_buff
> >> *skb, int netnsid)
> >> /* For now, the caller is required to have CAP_NET_ADMIN in
> >> * the user namespace owning the target net ns.
> >> */
> >> - if (!netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) {
> >> + if (!sk_ns_capable(skb->sk, net->user_ns, CAP_NET_ADMIN)) {
> >> put_net(net);
> >> return ERR_PTR(-EACCES);
> >> }
> >>
> >
> > get_target_net() is used twice in the code. In rtnl_getlink(), we need
> > to use netlink_ns_capable(skb, ...), but in rtnl_dump_ifinfo, we need to
> > use sk_ns_capable(skb->sk, ...).
> >
> > Pls, take a look at this patch:
> > https://patchwork.ozlabs.org/patch/854896/
> > Subject: rtnetlink: give a user socket to get_target_net()
>
>
> Please include this tag into the commit:
>
I sent v2 with this tag. Sorry for inconvenience.
https://patchwork.ozlabs.org/patch/855147/
> > > IMPORTANT: if you fix the bug, please add the following tag to the commit:
> > > Reported-by: syzbot+e432865c29eb4c48c142@syzkaller.appspotmail.com
> > > It will help syzbot understand when the bug is fixed.
next prev parent reply other threads:[~2018-01-04 18:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 18:58 general protection fault in __netlink_ns_capable syzbot
2018-01-03 0:35 ` Andrei Vagin
2018-01-03 7:37 ` Andrei Vagin
2018-01-04 12:01 ` Dmitry Vyukov
2018-01-04 18:14 ` Andrei Vagin [this message]
2018-02-01 7:39 ` Eric Biggers
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=20180104181437.GA6260@outlook.office365.com \
--to=avagin@virtuozzo.com \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.deucher@amd.com \
--cc=avagin@openvz.org \
--cc=chris@chris-wilson.co.uk \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=dvyukov@google.com \
--cc=edumazet@google.com \
--cc=elena.reshetova@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=johannes.berg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=mchehab@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzbot+e432865c29eb4c48c142@syzkaller.appspotmail.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).