[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+yKN-9NSu1j-nws8u8vGnfJpz6o82JaF997r7NYNcXeA@mail.gmail.com>
Date: Sun, 11 Feb 2024 10:29:48 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com,
Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH net] net: add rcu safety to rtnl_prop_list_size()
On Fri, Feb 9, 2024 at 7:12 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> rtnl_prop_list_size() can be called while alternative names
> are added or removed concurrently.
>
> if_nlmsg_size() / rtnl_calcit() can indeed be called
> without RTNL held.
>
> Use explicit RCU protection to avoid UAF.
>
> Fixes: 88f4fb0c7496 ("net: rtnetlink: put alternative names to getlink message")
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Jiri Pirko <jiri@...dia.com>
> ---
> net/core/dev.c | 2 +-
> net/core/rtnetlink.c | 15 +++++++++------
> 2 files changed, 10 insertions(+), 7 deletions(-)
BTW, when testing this patch, adding many altnames to one device, I
saw that 'ifquery' would not see the device,
and all devices following in the dump.
This is orthogonal to this patch, just a reminder that some user space
programs do not cope well with one netdevice
needing more bytes than their recvmsg() buffer size.
Apparently ifquery is still using a buffer of 4096 bytes, while "ip
link " is using MSG_PEEK since 2017 to
sense what is the appropriate size.
Powered by blists - more mailing lists