lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpVVc1ev8juG8=dQ0wu8c_RoJ8HfDUewRc1AempvV=85kw@mail.gmail.com>
Date:   Wed, 12 Apr 2017 13:07:59 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc:     Andrey Konovalov <andreyknvl@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Alexey Kuznetsov <kuznet@....inr.ac.ru>,
        James Morris <jmorris@...ei.org>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Patrick McHardy <kaber@...sh.net>,
        netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Kostya Serebryany <kcc@...gle.com>,
        syzkaller <syzkaller@...glegroups.com>
Subject: Re: net/ipv4: use-after-free in ipv4_datagram_support_cmsg

On Wed, Apr 12, 2017 at 8:39 AM, Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
> ===================
>> BUG: KASAN: use-after-free in ipv4_datagram_support_cmsg
>> net/ipv4/ip_sockglue.c:500 [inline] at addr ffff880059be0128
>
> Thanks for the report. This is accessing skb->dev from within recvmsg() at line
>
>         info->ipi_ifindex = skb->dev->ifindex;
>
> Introduced in 829ae9d61165 ("net-timestamp: allow reading recv cmsg on
> errqueue with origin tstamp"). At this time the device may indeed have
> gone away. I'm having a look at a way to read this in the receive BH
> and store the ifindex.

Why not use skb_iif?

diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index ebd953b..a2aef45 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -497,7 +497,7 @@ static bool ipv4_datagram_support_cmsg(const
struct sock *sk,

        info = PKTINFO_SKB_CB(skb);
        info->ipi_spec_dst.s_addr = ip_hdr(skb)->saddr;
-       info->ipi_ifindex = skb->dev->ifindex;
+       info->ipi_ifindex = skb->skb_iif;
        return true;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ