Skip to content

bpf: cpumap: add missing XDP_ABORTED handling in xdp prog runner#11095

Closed
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1055073=>bpf-next
Closed

bpf: cpumap: add missing XDP_ABORTED handling in xdp prog runner#11095
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1055073=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link

Pull request for series with
subject: bpf: cpumap: add missing XDP_ABORTED handling in xdp prog runner
version: 2
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1055073

cpu_map_bpf_prog_run_xdp() handles XDP_PASS, XDP_REDIRECT, and
XDP_DROP but is missing an XDP_ABORTED case. Without it, XDP_ABORTED
falls into the default case which logs a misleading "invalid XDP
action" warning instead of tracing the abort via trace_xdp_exception().

Add the missing XDP_ABORTED case with trace_xdp_exception(), matching
the handling already present in the skb path (cpu_map_bpf_prog_run_skb),
devmap (dev_map_bpf_prog_run), and the generic XDP path (do_xdp_generic).

Also pass xdpf->dev_rx instead of NULL to bpf_warn_invalid_xdp_action()
in the default case, so the warning includes the actual device name.
This aligns with the generic XDP path in net/core/dev.c which already
passes the real device.

Signed-off-by: Anand Kumar Shaw <anandkrshawheritage@gmail.com>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 4c51f90
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1055073
version: 2

@kernel-patches-review-bot
Copy link

commit 7e79659e6b07d03a4511bbfdae3a39c578f1ce59
Author: Anand Kumar Shaw <anandkrshawheritage@gmail.com>

bpf: cpumap: add missing XDP_ABORTED handling in xdp prog runner

Adds a missing XDP_ABORTED case to cpu_map_bpf_prog_run_xdp() so that
aborted XDP actions fire trace_xdp_exception() instead of a misleading
"invalid XDP action" warning.  Also passes xdpf->dev_rx to
bpf_warn_invalid_xdp_action() for the actual device name.

> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> --- a/kernel/bpf/cpumap.c
> +++ b/kernel/bpf/cpumap.c
> @@ -195,7 +195,7 @@ struct xdp_rxq_info rxq = {};
>
>  		rxq.dev = xdpf->dev_rx;
>  		rxq.mem.type = xdpf->mem_type;
> -		/* TODO: report queue_index to xdp_rxq_info */
> +		rxq.queue_index = xdpf->queue_index;

struct xdp_frame does not have a queue_index member:

include/net/xdp.h:
    struct xdp_frame {
        void *data;
        u32 len;
        u32 headroom;
        u32 metasize;
        enum xdp_mem_type mem_type:32;
        struct net_device *dev_rx;
        u32 frame_sz;
        u32 flags;
    };

Won't this fail to compile?  The queue_index field lives in
struct xdp_rxq_info, but it is not carried over into xdp_frame by
xdp_convert_buff_to_frame().

The v3 changelog on lore says "Dropped unrelated queue_index changes
that were accidentally included in v2," but the committed diff still
contains them.  It looks like v2 was applied instead of v3.

[ ... ]

> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -346,6 +346,7 @@ struct xdp_rxq_info rxq = { .dev = rx_dev };
>  		u32 act;
>  		int err;
>
> +		rxq.queue_index = xdpf->queue_index;

Same issue here in dev_map_bpf_prog_run() -- xdpf->queue_index does
not exist in struct xdp_frame.  This hunk was also part of the v2
changes that v3 intended to drop.



AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

In-Reply-To-Subject: bpf: cpumap: add missing XDP_ABORTED handling in xdp prog runner
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/22126440713

AI-authorship-score: medium
AI-authorship-explanation: Well-structured commit message with formulaic cross-reference phrasing suggests possible AI assistance, though the version management errors are typical of new contributors.
issues-found: 1
issue-severity-score: urgent
issue-severity-explanation: Accessing non-existent struct member xdpf->queue_index causes a compilation failure, preventing the kernel from building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments