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  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]
Date:   Fri, 1 May 2020 15:52:55 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Martin KaFai Lau <kafai@...com>
Cc:     Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Kernel Team <kernel-team@...com>,
        syzbot+39b64425f91b5aab714d@...kaller.appspotmail.com
Subject: Re: [PATCH v2 bpf-next] bpf: fix use-after-free of bpf_link when
 priming half-fails

On Fri, May 1, 2020 at 1:00 PM Martin KaFai Lau <kafai@...com> wrote:
>
> On Fri, May 01, 2020 at 11:56:22AM -0700, Andrii Nakryiko wrote:
> > If bpf_link_prime() succeeds to allocate new anon file, but then fails to
> > allocate ID for it, link priming is considered to be failed and user is
> > supposed ot be able to directly kfree() bpf_link, because it was never exposed
> > to user-space.
> >
> > But at that point file already keeps a pointer to bpf_link and will eventually
> > call bpf_link_release(), so if bpf_link was kfree()'d by caller, that would
> > lead to use-after-free.
> >
> > Fix this by first allocating ID and only then allocating file. Adding ID to
> > link_idr is ok, because link at that point still doesn't have its ID set, so
> > no user-space process can create a new FD for it.
> Acked-by: Martin KaFai Lau <kafai@...com>

Applied. Thanks

Powered by blists - more mailing lists