[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKm=WookfR6X8u46781czOyQXka3pvfdGwiUTtJrGE_uw@mail.gmail.com>
Date: Fri, 30 Nov 2018 08:17:04 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Ido Schimmel <idosch@...sch.org>, David Ahern <dsahern@...il.com>,
David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
syzkaller@...glegroups.com, idosch@...lanox.com
Subject: Re: [PATCH net] rtnetlink: Refine sanity checks in rtnl_fdb_{add|del}
On Fri, Nov 30, 2018 at 8:10 AM Dmitry Vyukov <dvyukov@...gle.com> wrote:
>
> On Fri, Nov 30, 2018 at 4:02 PM, Ido Schimmel <idosch@...sch.org> wrote:
> > On Fri, Nov 30, 2018 at 08:59:09AM -0700, David Ahern wrote:
> >> This does not repro for me:
> >> # ./a.out
> >> Invalid address length 6 - must be 4 bytes
> >> RTNETLINK answers: No buffer space available
> >> RTNETLINK answers: Operation not supported
> >> Invalid address length 6 - must be 4 bytes
> >> Invalid address length 6 - must be 4 bytes
> >> Invalid address length 6 - must be 4 bytes
> >> Invalid address length 6 - must be 16 bytes
> >> Invalid address length 6 - must be 16 bytes
> >> Invalid address length 6 - must be 16 bytes
> >>
> >> config available>?
> >
> > You need a kernel with kmsan. See:
> > https://github.com/google/kmsan
>
>
> Another option may be to spray memory at the allocation stack with
> some distinctive byte pattern and then check this pattern at the use
> stack. Not 100% sounds, but should be enough for testing.
Well, no need for kmsan here, once you know the problem
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a498bb41c9aa9b8976eb8d87f71489695cb019f2..5ce53215d622a670b0dcf06113b01174d49e6efc
100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3471,6 +3471,7 @@ static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
ndm->ndm_ifindex = dev->ifindex;
ndm->ndm_state = ndm_state;
+ WARN_ON_ONCE(dev->addr_len != ETH_ALEN);
if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr))
goto nla_put_failure;
if (vid)
Powered by blists - more mailing lists