mbox series

[v3,0/2] Fix failure to access u32* argument of tracked function

Message ID 20230410085908.98493-1-zhoufeng.zf@bytedance.com (mailing list archive)
Headers show
Series Fix failure to access u32* argument of tracked function | expand

Message

Feng Zhou April 10, 2023, 8:59 a.m. UTC
From: Feng Zhou <zhoufeng.zf@bytedance.com>

When access traced function arguments with type is u32*, bpf verifier failed.
Because u32 have typedef, needs to skip modifier. Add btf_type_is_modifier in
is_int_ptr. Add a selftest to check it.

Feng Zhou (2):
  bpf/btf: Fix is_int_ptr()
  selftests/bpf: Add test to access u32 ptr argument in tracing program

Changelog:
v2->v3: Addressed comments from jirka
- Fix an issue that caused other test items to fail
Details in here:
https://lore.kernel.org/all/20230407084608.62296-1-zhoufeng.zf@bytedance.com/

v1->v2: Addressed comments from Martin KaFai Lau
- Add a selftest.
- use btf_type_skip_modifiers.
Some details in here:
https://lore.kernel.org/all/20221012125815.76120-1-zhouchengming@bytedance.com/

 kernel/bpf/btf.c                                    |  8 ++------
 net/bpf/test_run.c                                  |  8 +++++++-
 .../testing/selftests/bpf/verifier/btf_ctx_access.c | 13 +++++++++++++
 3 files changed, 22 insertions(+), 7 deletions(-)

Comments

Jiri Olsa April 10, 2023, 7:41 p.m. UTC | #1
On Mon, Apr 10, 2023 at 04:59:06PM +0800, Feng zhou wrote:
> From: Feng Zhou <zhoufeng.zf@bytedance.com>
> 
> When access traced function arguments with type is u32*, bpf verifier failed.
> Because u32 have typedef, needs to skip modifier. Add btf_type_is_modifier in
> is_int_ptr. Add a selftest to check it.
> 
> Feng Zhou (2):
>   bpf/btf: Fix is_int_ptr()
>   selftests/bpf: Add test to access u32 ptr argument in tracing program
> 
> Changelog:
> v2->v3: Addressed comments from jirka
> - Fix an issue that caused other test items to fail
> Details in here:
> https://lore.kernel.org/all/20230407084608.62296-1-zhoufeng.zf@bytedance.com/

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> 
> v1->v2: Addressed comments from Martin KaFai Lau
> - Add a selftest.
> - use btf_type_skip_modifiers.
> Some details in here:
> https://lore.kernel.org/all/20221012125815.76120-1-zhouchengming@bytedance.com/
> 
>  kernel/bpf/btf.c                                    |  8 ++------
>  net/bpf/test_run.c                                  |  8 +++++++-
>  .../testing/selftests/bpf/verifier/btf_ctx_access.c | 13 +++++++++++++
>  3 files changed, 22 insertions(+), 7 deletions(-)
> 
> -- 
> 2.20.1
>
patchwork-bot+netdevbpf@kernel.org April 11, 2023, 6:40 p.m. UTC | #2
Hello:

This series was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Mon, 10 Apr 2023 16:59:06 +0800 you wrote:
> From: Feng Zhou <zhoufeng.zf@bytedance.com>
> 
> When access traced function arguments with type is u32*, bpf verifier failed.
> Because u32 have typedef, needs to skip modifier. Add btf_type_is_modifier in
> is_int_ptr. Add a selftest to check it.
> 
> Feng Zhou (2):
>   bpf/btf: Fix is_int_ptr()
>   selftests/bpf: Add test to access u32 ptr argument in tracing program
> 
> [...]

Here is the summary with links:
  - [v3,1/2] bpf/btf: Fix is_int_ptr()
    https://git.kernel.org/bpf/bpf-next/c/91f2dc6838c1
  - [v3,2/2] selftests/bpf: Add test to access u32 ptr argument in tracing program
    https://git.kernel.org/bpf/bpf-next/c/75dcef8d3609

You are awesome, thank you!