On 1/27/25 2:13 PM, Toke Høiland-Jørgensen wrote:
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: 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs") Reported-by: Marcus Wichelmann <marcus.wichelmann@xxxxxxxxxxxxxxxx> Closes: https://lore.kernel.org/r/dae862ec-43b5-41a0-8edf-46c59071cdda@xxxxxxxxxxxxxxxx Tested-by: Marcus Wichelmann <marcus.wichelmann@xxxxxxxxxxxxxxxx> Acked-by: Stanislav Fomichev <sdf@xxxxxxxxxxx> Signed-off-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx>
Acked-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>