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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 Jul 2020 22:48:10 +0200
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     Daniel Borkmann <daniel@...earbox.net>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org, davem@...emloft.net,
        ast@...nel.org, brouer@...hat.com, toke@...hat.com,
        lorenzo.bianconi@...hat.com, dsahern@...nel.org,
        andrii.nakryiko@...il.com
Subject: Re: [PATCH v5 bpf-next 5/9] bpf: cpumap: add the possibility to
 attach an eBPF program to cpumap

> On 6/30/20 2:49 PM, Lorenzo Bianconi wrote:
> [...]

[...]

> >   	old_rcpu = xchg(&cmap->cpu_map[key_cpu], rcpu);
> >   	if (old_rcpu) {
> > +		if (old_rcpu->prog)
> > +			bpf_prog_put(old_rcpu->prog);
> >   		call_rcu(&old_rcpu->rcu, __cpu_map_entry_free);
> >   		INIT_WORK(&old_rcpu->kthread_stop_wq, cpu_map_kthread_stop);
> >   		schedule_work(&old_rcpu->kthread_stop_wq);
> 
> Hm, not quite sure I follow the logic here. Why is the bpf_prog_put() not placed inside
> __cpu_map_entry_free(), for example? Wouldn't this at least leave a potential small race
> window of UAF given the rest is still live? If we already piggy-back from RCU side on
> rcpu entry, why not having it in __cpu_map_entry_free()?

ack right, thanks for spotting this issue. I guess we can even move
"bpf_prog_put(rcpu->prog)" in put_cpu_map_entry() so the last consumer
of bpf_cpu_map_entry will free the attached program. Agree?

Regards,
Lorenzo

> 
> Thanks,
> Daniel

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ