lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3c943df286f9886735ac6212e4096731b80f6db4f245303cd2864157fac2072d@mail.kernel.org>
Date: Tue, 16 Dec 2025 03:34:12 +0000 (UTC)
From: bot+bpf-ci@...nel.org
To: donglaipang@....com,syzbot+2b3391f44313b3983e91@...kaller.appspotmail.com
Cc: andrii@...nel.org,ast@...nel.org,bpf@...r.kernel.org,daniel@...earbox.net,davem@...emloft.net,eddyz87@...il.com,haoluo@...gle.com,hawk@...nel.org,john.fastabend@...il.com,jolsa@...nel.org,kpsingh@...nel.org,kuba@...nel.org,linux-kernel@...r.kernel.org,martin.lau@...ux.dev,netdev@...r.kernel.org,sdf@...ichev.me,song@...nel.org,syzkaller-bugs@...glegroups.com,yonghong.song@...ux.dev,donglaipang@....com,ast@...nel.org,andrii@...nel.org,daniel@...earbox.net,martin.lau@...nel.org,eddyz87@...il.com,yonghong.song@...ux.dev,clm@...a.com,ihor.solodrai@...ux.dev
Subject: Re: [PATCH] bpf: Fix NULL deref in __list_del_clearprev for flush_node

> diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> index 04171fbc39cb..6ab6eae31989 100644
> --- a/kernel/bpf/cpumap.c
> +++ b/kernel/bpf/cpumap.c
> @@ -450,6 +450,7 @@ __cpu_map_entry_alloc(struct bpf_map *map, struct bpf_cpumap_val *value,
>
>  	for_each_possible_cpu(i) {
>  		bq = per_cpu_ptr(rcpu->bulkq, i);
> +		INIT_LIST_HEAD(&bq->flush_node);
>  		bq->obj = rcpu;
>  	}
>

[ ... ]

> diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c
> index 2625601de76e..7a7347e709cc 100644
> --- a/kernel/bpf/devmap.c
> +++ b/kernel/bpf/devmap.c
> @@ -428,7 +428,8 @@ void __dev_flush(struct list_head *flush_list)
>  		bq_xmit_all(bq, XDP_XMIT_FLUSH);
>  		bq->dev_rx = NULL;
>  		bq->xdp_prog = NULL;
> -		__list_del_clearprev(&bq->flush_node);
> +		if (bq->flush_node.prev)
> +			__list_del_clearprev(&bq->flush_node);
                ^^^^

The devmap code adds the same defensive check but doesn't initialize
flush_node the way cpumap does. Looking at dev_map_notification(), when
NETDEV_REGISTER occurs, it calls:

    alloc_percpu(struct xdp_dev_bulk_queue)

And then only initializes the dev field:

    per_cpu_ptr(netdev->xdp_bulkq, cpu)->dev = netdev;

Without INIT_LIST_HEAD(&bq->flush_node), if alloc_percpu() returns
memory with non-zero bytes, bq->flush_node.prev could contain garbage.

The enqueue path in bq_enqueue() uses:

    if (!bq->dev_rx)
        list_add(&bq->flush_node, flush_list);

So if dev_rx contains non-zero garbage, the node never gets added to the
list. But this flush code checks bq->flush_node.prev which could also be
garbage, causing __list_del_clearprev() to be called with invalid
pointers.

Does devmap need INIT_LIST_HEAD(&bq->flush_node) similar to cpumap? The
commit message states that initialization is part of the fix, but only
cpumap gets it.

[ ... ]


---
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

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/20255377282

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ