Re: [PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-14 Thread Alexei Starovoitov
On Tue, Aug 13, 2024 at 1:51 PM Thorsten Blum wrote: > > On 13. Aug 2024, at 20:57, Alexei Starovoitov > wrote: > > On Tue, Aug 13, 2024 at 10:59 AM Thorsten Blum > > wrote: > >> On 13. Aug 2024, at 18:28, Alexei Starovoitov > >> wrote: > >>> On Tue, Aug 13, 2024 at 8:19 AM Thorsten Blum >

Re: [PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-13 Thread Thorsten Blum
On 13. Aug 2024, at 20:57, Alexei Starovoitov wrote: > On Tue, Aug 13, 2024 at 10:59 AM Thorsten Blum > wrote: >> On 13. Aug 2024, at 18:28, Alexei Starovoitov >> wrote: >>> On Tue, Aug 13, 2024 at 8:19 AM Thorsten Blum >>> wrote: Add the __counted_by compiler attribute to the fl

Re: [PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-13 Thread Eduard Zingerman
On Tue, 2024-08-13 at 11:57 -0700, Alexei Starovoitov wrote: > On Tue, Aug 13, 2024 at 10:59 AM Thorsten Blum > wrote: > > > > On 13. Aug 2024, at 18:28, Alexei Starovoitov > > wrote: > > > On Tue, Aug 13, 2024 at 8:19 AM Thorsten Blum > > > wrote: > > > > > > > > Add the __counted_by compile

Re: [PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-13 Thread Alexei Starovoitov
On Tue, Aug 13, 2024 at 10:59 AM Thorsten Blum wrote: > > On 13. Aug 2024, at 18:28, Alexei Starovoitov > wrote: > > On Tue, Aug 13, 2024 at 8:19 AM Thorsten Blum > > wrote: > >> > >> Add the __counted_by compiler attribute to the flexible array member > >> cands to improve access bounds-check

Re: [PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-13 Thread Thorsten Blum
On 13. Aug 2024, at 18:28, Alexei Starovoitov wrote: > On Tue, Aug 13, 2024 at 8:19 AM Thorsten Blum > wrote: >> >> Add the __counted_by compiler attribute to the flexible array member >> cands to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and >> CONFIG_FORTIFY_SOURCE. >> >> Incre

Re: [PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-13 Thread Alexei Starovoitov
On Tue, Aug 13, 2024 at 8:19 AM Thorsten Blum wrote: > > Add the __counted_by compiler attribute to the flexible array member > cands to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE. > > Increment cnt before adding a new struct to the cands array. why? What h

[PATCH] bpf: Annotate struct bpf_cand_cache with __counted_by()

2024-08-13 Thread Thorsten Blum
Add the __counted_by compiler attribute to the flexible array member cands to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Increment cnt before adding a new struct to the cands array. Signed-off-by: Thorsten Blum --- kernel/bpf/btf.c | 6 +++--- 1 file chang