From: Ido Schimmel <idosch@idosch.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
Ido Schimmel <idosch@nvidia.com>,
syzbot <syzkaller@googlegroups.com>
Subject: Re: [PATCH net 1/2] ipv4: fix data races in fib_alias_hw_flags_set
Date: Wed, 16 Feb 2022 23:30:59 +0200 [thread overview]
Message-ID: <Yg1tExg4IGAKm7Bq@shredder> (raw)
In-Reply-To: <20220216173217.3792411-1-eric.dumazet@gmail.com>
On Wed, Feb 16, 2022 at 09:32:16AM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.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@google.com>
> Cc: Ido Schimmel <idosch@nvidia.com>
> Reported-by: syzbot <syzkaller@googlegroups.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.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;
> };
next prev parent reply other threads:[~2022-02-16 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 17:32 [PATCH net 1/2] ipv4: fix data races in fib_alias_hw_flags_set Eric Dumazet
2022-02-16 17:32 ` [PATCH net 2/2] ipv6: fix data-race in fib6_info_hw_flags_set / fib6_purge_rt Eric Dumazet
2022-02-16 21:30 ` Ido Schimmel [this message]
2022-02-17 18:10 ` [PATCH net 1/2] ipv4: fix data races in fib_alias_hw_flags_set patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yg1tExg4IGAKm7Bq@shredder \
--to=idosch@idosch.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox