Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Eric Dumazet
Wed, 07 Oct 2026 08:54
Re: [PATCH net] neighbour: stop using device addresses in hashes
Author: Eric Dumazet
Date: Wed, 07 Oct 2026 08:54
Date: Wed, 07 Oct 2026 08:54
45 lines
8356 bytes
8356 bytes
Le mer. 7 oct. 2026 ร 10:25, Ido Schimmel <idosch@nvidia.com> a รฉcrit :
>
> On Tue, Oct 06, 2026 at 03:41:18PM -0700, Kyle Zeng wrote:
> > RTM_GETNEIGHTBL exposes the live hash multiplier and bucket mask. For
> > ARP, that multiplier is applied to the IPv4 key XOR hash32_ptr(dev).
> > Since hash32_ptr() merely folds the address, timing chosen-key misses
> > through the unprivileged SIOCGARP ioctl can reveal the folded address
> > of the loopback net_device. NDISC uses the same address-dependent
> > first hash term.
> >
> > Give each net_device an independent random neighbour hash discriminator
> > at allocation time and use it in both protocol hashes. Keep it immutable
> > so that lookups, insertion and rehashing agree even if the device's
> > ifindex or network namespace changes. This retains the cross-namespace
> > hash distribution that motivated using the device pointer, without
> > putting a kernel address into the observable hash. A dedicated value
> > also avoids making a salt used by unrelated network hashes observable.
> >
> > The existing NDTA_CONFIG fields and neighbour key comparisons can stay
> > unchanged. Update the net_device cacheline documentation and assertions
> > for the new read-mostly field.
> >
> > Fixes: b14f243a42c7 ("net: Dont use ifindices in hash fns")
> > Assisted-by: Codex:gpt-6-astra
> > Signed-off-by: Kyle Zeng <kylebot@openai.com>
> > ---
> > Documentation/networking/net_cachelines/net_device.rst | 1 +
> > include/linux/netdevice.h | 2 ++
> > include/net/arp.h | 3 +--
> > include/net/ndisc.h | 3 +--
> > net/core/dev.c | 4 +++-
> > 5 files changed, 8 insertions(+), 5 deletions(-)
>
> Eric,
>
> Given [1], do you think this should be targeted at net-next?
>
> In net-next the neighbour tables are per-netns, so we can return to
> hashing based on the device index instead of its pointer. Something like
> [2].
Definitely this can target net-next and avoid merge conflicts.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads