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: <87h7hhj9jt.fsf@toke.dk>
Date:   Tue, 29 Jun 2021 11:37:42 +0200
From:   Toke Høiland-Jørgensen <toke@...hat.com>
To:     Martin KaFai Lau <kafai@...com>
Cc:     bpf@...r.kernel.org, netdev@...r.kernel.org,
        Hangbin Liu <liuhangbin@...il.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Magnus Karlsson <magnus.karlsson@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH bpf-next] bpf/devmap: convert remaining READ_ONCE() to
 rcu_dereference()

Martin KaFai Lau <kafai@...com> writes:

> On Tue, Jun 29, 2021 at 01:00:51AM +0200, Toke Høiland-Jørgensen wrote:
>> There were a couple of READ_ONCE()-invocations left-over by the devmap RCU
>> conversion. Convert these to rcu_dereference() as well to avoid complaints
>> from sparse.
>> 
>> Fixes: 782347b6bcad ("xdp: Add proper __rcu annotations to redirect map entries")
>> Reported-by: kernel test robot <lkp@...el.com>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
>> ---
>>  kernel/bpf/devmap.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
>> index 2f6bd75cd682..7a0c008f751b 100644
>> --- a/kernel/bpf/devmap.c
>> +++ b/kernel/bpf/devmap.c
>> @@ -558,7 +558,7 @@ int dev_map_enqueue_multi(struct xdp_buff *xdp, struct net_device *dev_rx,
>>  
>>  	if (map->map_type == BPF_MAP_TYPE_DEVMAP) {
>>  		for (i = 0; i < map->max_entries; i++) {
>> -			dst = READ_ONCE(dtab->netdev_map[i]);
>> +			dst = rcu_dereference(dtab->netdev_map[i]);
> __dev_map_lookup_elem() uses rcu_dereference_check(dtab->netdev_map[key], rcu_read_lock_bh_held()).
> It is not needed here?

Hmm, I somehow managed to convince myself last night that it wasn't, but
looking at it again now I think you're right. Will send a v2.

-Toke

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ