[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yg1tExg4IGAKm7Bq@shredder>
Date: Wed, 16 Feb 2022 23:30:59 +0200
From: Ido Schimmel <idosch@...sch.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <edumazet@...gle.com>,
Ido Schimmel <idosch@...dia.com>,
syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH net 1/2] ipv4: fix data races in fib_alias_hw_flags_set
On Wed, Feb 16, 2022 at 09:32:16AM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@...gle.com>
>
> fib_alias_hw_flags_set() can be used by concurrent threads,
> and is only RCU protected.
>
> We need to annotate accesses to following fields of struct fib_alias:
>
> offload, trap, offload_failed
>
> Because of READ_ONCE()WRITE_ONCE() limitations, make these
> field u8.
[...]
> Fixes: 90b93f1b31f8 ("ipv4: Add "offload" and "trap" indications to routes")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Ido Schimmel <idosch@...dia.com>
> Reported-by: syzbot <syzkaller@...glegroups.com>
Reviewed-by: Ido Schimmel <idosch@...dia.com>
Thanks, this is better than taking RTNL
> ---
> net/ipv4/fib_lookup.h | 7 +++----
> net/ipv4/fib_semantics.c | 6 +++---
> net/ipv4/fib_trie.c | 22 +++++++++++++---------
> net/ipv4/route.c | 4 ++--
> 4 files changed, 21 insertions(+), 18 deletions(-)
>
> diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h
> index e184bcb1994343c00914e09ab728ae16c4d23dc8..78e40ea42e58d930b3439d497de2b9e15fe45706 100644
> --- a/net/ipv4/fib_lookup.h
> +++ b/net/ipv4/fib_lookup.h
> @@ -16,10 +16,9 @@ struct fib_alias {
> u8 fa_slen;
> u32 tb_id;
> s16 fa_default;
> - u8 offload:1,
> - trap:1,
> - offload_failed:1,
> - unused:5;
> + u8 offload;
> + u8 trap;
> + u8 offload_failed;
There is a 5 bytes hole here, so this shouldn't increase the struct and
it should still fit in one cache line
> struct rcu_head rcu;
> };
Powered by blists - more mailing lists