Commit 3595599f authored by Toke Høiland-Jørgensen's avatar Toke Høiland-Jørgensen Committed by Jakub Kicinski
Browse files

net: xdp: Disallow attaching device-bound programs in generic mode



Device-bound programs are used to support RX metadata kfuncs. These
kfuncs are driver-specific and rely on the driver context to read the
metadata. This means they can't work in generic XDP mode. However, there
is no check to disallow such programs from being attached in generic
mode, in which case the metadata kfuncs will be called in an invalid
context, leading to crashes.

Fix this by adding a check to disallow attaching device-bound programs
in generic mode.

Fixes: 2b3486bc ("bpf: Introduce device-bound XDP programs")
Reported-by: default avatarMarcus Wichelmann <marcus.wichelmann@hetzner-cloud.de>
Closes: https://lore.kernel.org/r/dae862ec-43b5-41a0-8edf-46c59071cdda@hetzner-cloud.de


Tested-by: default avatarMarcus Wichelmann <marcus.wichelmann@hetzner-cloud.de>
Acked-by: default avatarStanislav Fomichev <sdf@fomichev.me>
Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250127131344.238147-1-toke@redhat.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 8c670bdf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment