bpf: fix a task_iter bug caused by a merge conflict resolution
Subsystems (2)
PATCH 1/1 bpf: fix a task_iter bug caused by a merge conflict resolution
Latest bpf tree has a bug for bpf_iter selftest.
$ ./test_progs -n 4/25
test_bpf_sk_storage_get:PASS:bpf_iter_bpf_sk_storage_helpers__open_and_load 0 nsec
test_bpf_sk_storage_get:PASS:socket 0 nsec
...
do_dummy_read:PASS:read 0 nsec
test_bpf_sk_storage_get:FAIL:bpf_map_lookup_elem map value wasn't set correctly
(expected 1792, got -1, err=0)
#4/25 bpf_sk_storage_get:FAIL
#4 bpf_iter:FAIL
Summary: 0/0 PASSED, 0 SKIPPED, 2 FAILEDWhen doing merge conflict resolution, Commit 4bfc4714849d missed to save curr_task to seq_file private data. The task pointer in seq_file private data is passed to bpf program. This caused NULL-pointer task passed to bpf program which will immediately return upon checking whether task pointer is NULL.
This patch added back the assignment of curr_task to seq_file private data and fixed the issue.
--- kernel/bpf/task_iter.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/task_iter.c +1 -0
@@ -159,6 +159,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info) }/* set info->task and info->tid */ + info->task = curr_task;if (curr_tid == info->tid) { curr_fd = info->fd; }else {
Signature · 1 line
2.24.1
Quoted 42 lines · Yonghong Song
Latest bpf tree has a bug for
bpf_iterselftest.$ ./test_progs -n 4/25 test_bpf_sk_storage_get:PASS:bpf_iter_bpf_sk_storage_helpers__open_and_load 0 nsec test_bpf_sk_storage_get:PASS:socket 0 nsec ... do_dummy_read:PASS:read 0 nsec test_bpf_sk_storage_get:FAIL:bpf_map_lookup_elem map value wasn't set correctly (expected 1792, got -1, err=0) #4/25 bpf_sk_storage_get:FAIL #4 bpf_iter:FAIL Summary: 0/0 PASSED, 0 SKIPPED, 2 FAILEDWhen doing merge conflict resolution, Commit
4bfc4714849dmissed to savecurr_tasktoseq_fileprivate data. The task pointer inseq_fileprivate data is passed to bpf program. This caused NULL-pointer task passed to bpf program which will immediately return upon checking whether task pointer is NULL.This patch added back the assignment of
curr_tasktoseq_fileprivate data and fixed the issue.Fixes 4bfc4714849d ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf")Signed-off-by Yonghong Song <[email protected]>--- kernel/bpf/task_iter.c | 1 + 1 file changed, 1 insertion(+)kernel/bpf/task_iter.c +1
-0@@ -159,6 +159,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info) }/* set info->task and info->tid */ + info->task = curr_task;if (curr_tid == info->tid) { curr_fd = info->fd; }else {Signature · 1 line
2.24.1
This patch was applied to bpf/bpf.git (refs/heads/master):
Hello:
This patch was applied to bpf/bpf.git (refs/heads/master):
Quoted 12 lines · On Wed, 30 Dec 2020 21:24:18 -0800 you wrote:
Latest bpf tree has a bug for
bpf_iterselftest.$ ./test_progs -n 4/25 test_bpf_sk_storage_get:PASS:bpf_iter_bpf_sk_storage_helpers__open_and_load 0 nsec test_bpf_sk_storage_get:PASS:socket 0 nsec ... do_dummy_read:PASS:read 0 nsec test_bpf_sk_storage_get:FAIL:bpf_map_lookup_elem map value wasn't set correctly (expected 1792, got -1, err=0) #4/25 bpf_sk_storage_get:FAIL #4 bpf_iter:FAIL Summary: 0/0 PASSED, 0 SKIPPED, 2 FAILED
Quoted 1 line
[...]
Here is the summary with links:
- [bpf] bpf: fix a task_iter bug caused by a merge conflict resolution
https://git.kernel.org/bpf/bpf/c/04901aab40ea
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html