mbox series

[0/2] Access variable length array relaxed for integer type

Message ID 20230417080749.39074-1-zhoufeng.zf@bytedance.com
Headers show
Series Access variable length array relaxed for integer type | expand

Message

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

Add support for integer type of accessing variable length array.
Add a selftest to check it.

Feng Zhou (2):
  bpf: support access variable length array of integer type
  selftests/bpf: Add test to access integer type of variable array

 kernel/bpf/btf.c                              |  8 +++++---
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 20 +++++++++++++++++++
 .../selftests/bpf/prog_tests/tracing_struct.c |  2 ++
 .../selftests/bpf/progs/tracing_struct.c      | 13 ++++++++++++
 4 files changed, 40 insertions(+), 3 deletions(-)

Comments

Alexei Starovoitov April 18, 2023, 12:08 a.m. UTC | #1
On Mon, Apr 17, 2023 at 04:07:48PM +0800, Feng zhou wrote:
> From: Feng Zhou <zhoufeng.zf@bytedance.com>
> 
> After this commit:
> bpf: Support variable length array in tracing programs (9c5f8a1008a1)
> Trace programs can access variable length array, but for structure
> type. This patch adds support for integer type.
> 
> Example:
> Hook load_balance
> struct sched_domain {
> 	...
> 	unsigned long span[];
> }
> 
> The access: sd->span[0].

The use case makes sense.
Please add it as a selftest. Either combine it with patch 2 or another patch 3.
and then resubmit.
Make sure to use [PATCH bpf-next] subject, so BPF CI knows how to test it.
Feng Zhou April 18, 2023, 2:53 a.m. UTC | #2
在 2023/4/18 08:08, Alexei Starovoitov 写道:
> On Mon, Apr 17, 2023 at 04:07:48PM +0800, Feng zhou wrote:
>> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>>
>> After this commit:
>> bpf: Support variable length array in tracing programs (9c5f8a1008a1)
>> Trace programs can access variable length array, but for structure
>> type. This patch adds support for integer type.
>>
>> Example:
>> Hook load_balance
>> struct sched_domain {
>> 	...
>> 	unsigned long span[];
>> }
>>
>> The access: sd->span[0].
> The use case makes sense.
> Please add it as a selftest. Either combine it with patch 2 or another patch 3.
> and then resubmit.
> Make sure to use [PATCH bpf-next] subject, so BPF CI knows how to test it.

Will do, thanks.