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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iLxRCgn_M5hLn09DjeTS_x7pY6FXmiUELvUTimWTjsz4A@mail.gmail.com>
Date:   Wed, 23 Jan 2019 17:44:04 -0800
From:   Eric Dumazet <edumazet@...gle.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
Cc:     Eric Dumazet <eric.dumazet@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        netdev <netdev@...r.kernel.org>,
        Ralf Baechle <ralf@...ux-mips.org>,
        syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH net] ax25: fix possible use-after-free

On Wed, Jan 23, 2019 at 5:12 PM Cong Wang <xiyou.wangcong@...il.com> wrote:
>
> On Wed, Jan 23, 2019 at 3:42 PM Eric Dumazet <eric.dumazet@...il.com> wrote:
> >
> >
> >
> > On 01/23/2019 03:25 PM, Cong Wang wrote:
> > > On Tue, Jan 22, 2019 at 10:41 AM 'Eric Dumazet' via syzkaller
> > > <syzkaller@...glegroups.com> wrote:
> > >>
> > >> syzbot found that ax25 routes where not properly protected
> > >> against concurrent use [1].
> > >>
> > >> In this particular report the bug happened while
> > >> copying ax25->digipeat.
> > >>
> > >> Fix this problem by making sure we call ax25_get_route()
> > >> while ax25_route_lock is held, so that no modification
> > >> could happen while using the route.
> > >
> > > ax25_route_lock_use() is a read lock, so two ax25_rt_autobind()
> > > could still enter the same critical section?
> > >
> >
> > Not sure I understand your concern.
> >
> > The two ax25_rt_autobind() would only read the route contents,
> > so that should be fine ?
>
> Not sure if it is read-only and safe for the following code:
>
>         if (ax25_rt->digipeat != NULL) {
>                 ax25->digipeat = kmemdup(ax25_rt->digipeat, sizeof(ax25_digi),
>                                          GFP_ATOMIC);

ax25_rt would be the shared object. (protected by the read lock)

ax25 is private object in the thread/socket context.

So no worries.

>                 if (ax25->digipeat == NULL) {
>                         err = -ENOMEM;
>                         goto put;
>                 }
>                 ax25_adjust_path(addr, ax25->digipeat);
>         }
>
> Maybe we leak memory here at least, not sure...
>
>
> >
> > >
> > >>
> > >> The current two ax25_get_route() callers do not sleep,
> > >> so this change should be fine.
> > >>
> > >> Once we do that, ax25_get_route() no longer needs to
> > >> grab a reference on the found route.
> > > .
> > >
> > > After your patch, ax25_hold_route() has no callers while
> > > ax25_put_route() still does. Is ->refcount always 1?
> >
> > Yes, the plan is to remove this refcount in net-next.
> >
>
> Good to know.
>
> Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ