On Fri, Nov 30, 2018 at 8:10 AM Dmitry Vyukov <dvyu...@google.com> wrote:
>
> On Fri, Nov 30, 2018 at 4:02 PM, Ido Schimmel <ido...@idosch.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)

Reply via email to