Patch "bpf/btf: Fix is_int_ptr()" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bpf/btf: Fix is_int_ptr()

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bpf-btf-fix-is_int_ptr.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cea72040945a935b4e67534c29655064b13cc2d3
Author: Feng Zhou <zhoufeng.zf@xxxxxxxxxxxxx>
Date:   Mon Apr 10 16:59:07 2023 +0800

    bpf/btf: Fix is_int_ptr()
    
    [ Upstream commit 91f2dc6838c19342f7f2993627c622835cc24890 ]
    
    When tracing a kernel function with arg type is u32*, btf_ctx_access()
    would report error: arg2 type INT is not a struct.
    
    The commit bb6728d75611 ("bpf: Allow access to int pointer arguments
    in tracing programs") added support for int pointer, but did not skip
    modifiers before checking it's type. This patch fixes it.
    
    Fixes: bb6728d75611 ("bpf: Allow access to int pointer arguments in tracing programs")
    Co-developed-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>
    Signed-off-by: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>
    Signed-off-by: Feng Zhou <zhoufeng.zf@xxxxxxxxxxxxx>
    Signed-off-by: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
    Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
    Link: https://lore.kernel.org/bpf/20230410085908.98493-2-zhoufeng.zf@xxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 73780748404c2..3140a7881665d 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -5891,12 +5891,8 @@ struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog)
 
 static bool is_int_ptr(struct btf *btf, const struct btf_type *t)
 {
-	/* t comes in already as a pointer */
-	t = btf_type_by_id(btf, t->type);
-
-	/* allow const */
-	if (BTF_INFO_KIND(t->info) == BTF_KIND_CONST)
-		t = btf_type_by_id(btf, t->type);
+	/* skip modifiers */
+	t = btf_type_skip_modifiers(btf, t->type, NULL);
 
 	return btf_type_is_int(t);
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux