* [PATCH dwarves] btf_encoder: Fix dwarf int type with greater-than-16 byte issue @ 2024-04-24 22:35 Yonghong Song 2024-04-25 8:17 ` Alan Maguire 0 siblings, 1 reply; 4+ messages in thread From: Yonghong Song @ 2024-04-24 22:35 UTC (permalink / raw) To: Arnaldo Carvalho de Melo, dwarves Cc: Alexei Starovoitov, Andrii Nakryiko, bpf, Daniel Borkmann, kernel-team, Nick Desaulniers, Xin Liu, Alan Maguire Nick Desaulniers and Xin Liu separately reported that int type might have greater-than-16 byte size ([1] and [2]). More specifically, the reported int type sizes are 1024 and 64 bytes. The libbpf and bpf program does not really support any int type greater than 16 bytes. Therefore, with current pahole, btf encoding will fail with greater-than-16 byte int types. Since for now bpf does not support '> 16' bytes int type, the simplest way is to sanitize such types, similar to existing conditions like '!byte_sz' and 'byte_sz & (byte_sz - 1)'. This way, pahole won't call libbpf with an unsupported int type size. The patch [3] was proposed before. Now I resubmitted this patch as there are another failure due to the same issue. [1] https://github.com/libbpf/libbpf/pull/680 [2] https://lore.kernel.org/bpf/20240422144538.351722-1-liuxin350@huawei.com/ [3] https://lore.kernel.org/bpf/20230426055030.3743074-1-yhs@fb.com/ Cc: Xin Liu <liuxin350@huawei.com> Cc: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Yonghong Song <yonghong.song@linux.dev> --- btf_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btf_encoder.c b/btf_encoder.c index e1e3529..19e9d90 100644 --- a/btf_encoder.c +++ b/btf_encoder.c @@ -393,7 +393,7 @@ static int32_t btf_encoder__add_base_type(struct btf_encoder *encoder, const str * these non-regular int types to avoid libbpf/kernel complaints. */ byte_sz = BITS_ROUNDUP_BYTES(bt->bit_size); - if (!byte_sz || (byte_sz & (byte_sz - 1))) { + if (!byte_sz || (byte_sz & (byte_sz - 1)) || byte_sz > 16) { name = "__SANITIZED_FAKE_INT__"; byte_sz = 4; } -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH dwarves] btf_encoder: Fix dwarf int type with greater-than-16 byte issue 2024-04-24 22:35 [PATCH dwarves] btf_encoder: Fix dwarf int type with greater-than-16 byte issue Yonghong Song @ 2024-04-25 8:17 ` Alan Maguire 2024-04-25 13:43 ` Xin Liu 0 siblings, 1 reply; 4+ messages in thread From: Alan Maguire @ 2024-04-25 8:17 UTC (permalink / raw) To: Yonghong Song, Arnaldo Carvalho de Melo, dwarves Cc: Alexei Starovoitov, Andrii Nakryiko, bpf, Daniel Borkmann, kernel-team, Nick Desaulniers, Xin Liu On 24/04/2024 23:35, Yonghong Song wrote: > Nick Desaulniers and Xin Liu separately reported that int type might > have greater-than-16 byte size ([1] and [2]). More specifically, the > reported int type sizes are 1024 and 64 bytes. > > The libbpf and bpf program does not really support any int type greater > than 16 bytes. Therefore, with current pahole, btf encoding will fail > with greater-than-16 byte int types. > > Since for now bpf does not support '> 16' bytes int type, the simplest > way is to sanitize such types, similar to existing conditions like > '!byte_sz' and 'byte_sz & (byte_sz - 1)'. This way, pahole won't > call libbpf with an unsupported int type size. The patch [3] was > proposed before. Now I resubmitted this patch as there are another > failure due to the same issue. > > [1] https://github.com/libbpf/libbpf/pull/680 > [2] https://lore.kernel.org/bpf/20240422144538.351722-1-liuxin350@huawei.com/ > [3] https://lore.kernel.org/bpf/20230426055030.3743074-1-yhs@fb.com/ > > Cc: Xin Liu <liuxin350@huawei.com> > Cc: Alan Maguire <alan.maguire@oracle.com> > Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Reviewed-by: Alan Maguire <alan.maguire@oracle.com> > --- > btf_encoder.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/btf_encoder.c b/btf_encoder.c > index e1e3529..19e9d90 100644 > --- a/btf_encoder.c > +++ b/btf_encoder.c > @@ -393,7 +393,7 @@ static int32_t btf_encoder__add_base_type(struct btf_encoder *encoder, const str > * these non-regular int types to avoid libbpf/kernel complaints. > */ > byte_sz = BITS_ROUNDUP_BYTES(bt->bit_size); > - if (!byte_sz || (byte_sz & (byte_sz - 1))) { > + if (!byte_sz || (byte_sz & (byte_sz - 1)) || byte_sz > 16) { > name = "__SANITIZED_FAKE_INT__"; > byte_sz = 4; > } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH dwarves] btf_encoder: Fix dwarf int type with greater-than-16 byte issue 2024-04-25 8:17 ` Alan Maguire @ 2024-04-25 13:43 ` Xin Liu 2024-04-25 14:19 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 4+ messages in thread From: Xin Liu @ 2024-04-25 13:43 UTC (permalink / raw) To: alan.maguire Cc: andrii, arnaldo.melo, ast, bpf, daniel, dwarves, kernel-team, liuxin350, ndesaulniers, yonghong.song, yanan, wuchangye, xiesongyang, kongweibin2, zhangmingyi5, liwei883 On Wed, 24 Apr 2024 15:35:38 -0700 Yonghong Song <yonghong.song@linux.dev> wrote: > Nick Desaulniers and Xin Liu separately reported that int type might > have greater-than-16 byte size ([1] and [2]). More specifically, the > reported int type sizes are 1024 and 64 bytes. > > The libbpf and bpf program does not really support any int type greater > than 16 bytes. Therefore, with current pahole, btf encoding will fail > with greater-than-16 byte int types. > > Since for now bpf does not support '> 16' bytes int type, the simplest > way is to sanitize such types, similar to existing conditions like > '!byte_sz' and 'byte_sz & (byte_sz - 1)'. This way, pahole won't > call libbpf with an unsupported int type size. The patch [3] was > proposed before. Now I resubmitted this patch as there are another > failure due to the same issue. > > [1] https://github.com/libbpf/libbpf/pull/680 > [2] https://lore.kernel.org/bpf/20240422144538.351722-1-liuxin350@huawei.com/ > [3] https://lore.kernel.org/bpf/20230426055030.3743074-1-yhs@fb.com/ > > Cc: Xin Liu <liuxin350@huawei.com> > Cc: Alan Maguire <alan.maguire@oracle.com> > Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Reviewed-by: Xin Liu <liuxin350@huawei.com> > --- > btf_encoder.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/btf_encoder.c b/btf_encoder.c > index e1e3529..19e9d90 100644 > --- a/btf_encoder.c > +++ b/btf_encoder.c > @@ -393,7 +393,7 @@ static int32_t btf_encoder__add_base_type(struct btf_encoder *encoder, const str > * these non-regular int types to avoid libbpf/kernel complaints. > */ > byte_sz = BITS_ROUNDUP_BYTES(bt->bit_size); > - if (!byte_sz || (byte_sz & (byte_sz - 1))) { > + if (!byte_sz || (byte_sz & (byte_sz - 1)) || byte_sz > 16) { > name = "__SANITIZED_FAKE_INT__"; > byte_sz = 4; > } ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH dwarves] btf_encoder: Fix dwarf int type with greater-than-16 byte issue 2024-04-25 13:43 ` Xin Liu @ 2024-04-25 14:19 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 4+ messages in thread From: Arnaldo Carvalho de Melo @ 2024-04-25 14:19 UTC (permalink / raw) To: Xin Liu Cc: alan.maguire, andrii, arnaldo.melo, ast, bpf, daniel, dwarves, kernel-team, ndesaulniers, yonghong.song, yanan, wuchangye, xiesongyang, kongweibin2, zhangmingyi5, liwei883 On Thu, Apr 25, 2024 at 09:43:40PM +0800, Xin Liu wrote: > On Wed, 24 Apr 2024 15:35:38 -0700 Yonghong Song <yonghong.song@linux.dev> wrote: > > Nick Desaulniers and Xin Liu separately reported that int type might > > have greater-than-16 byte size ([1] and [2]). More specifically, the > > reported int type sizes are 1024 and 64 bytes. > > > > The libbpf and bpf program does not really support any int type greater > > than 16 bytes. Therefore, with current pahole, btf encoding will fail > > with greater-than-16 byte int types. > > > > Since for now bpf does not support '> 16' bytes int type, the simplest > > way is to sanitize such types, similar to existing conditions like > > '!byte_sz' and 'byte_sz & (byte_sz - 1)'. This way, pahole won't > > call libbpf with an unsupported int type size. The patch [3] was > > proposed before. Now I resubmitted this patch as there are another > > failure due to the same issue. > > > > [1] https://github.com/libbpf/libbpf/pull/680 > > [2] https://lore.kernel.org/bpf/20240422144538.351722-1-liuxin350@huawei.com/ > > [3] https://lore.kernel.org/bpf/20230426055030.3743074-1-yhs@fb.com/ > > > > Cc: Xin Liu <liuxin350@huawei.com> > > Cc: Alan Maguire <alan.maguire@oracle.com> > > Signed-off-by: Yonghong Song <yonghong.song@linux.dev> > > Reviewed-by: Xin Liu <liuxin350@huawei.com> Thanks, applied to next, - Arnaldo > > --- > > btf_encoder.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/btf_encoder.c b/btf_encoder.c > > index e1e3529..19e9d90 100644 > > --- a/btf_encoder.c > > +++ b/btf_encoder.c > > @@ -393,7 +393,7 @@ static int32_t btf_encoder__add_base_type(struct btf_encoder *encoder, const str > > * these non-regular int types to avoid libbpf/kernel complaints. > > */ > > byte_sz = BITS_ROUNDUP_BYTES(bt->bit_size); > > - if (!byte_sz || (byte_sz & (byte_sz - 1))) { > > + if (!byte_sz || (byte_sz & (byte_sz - 1)) || byte_sz > 16) { > > name = "__SANITIZED_FAKE_INT__"; > > byte_sz = 4; > > } ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-25 14:19 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-24 22:35 [PATCH dwarves] btf_encoder: Fix dwarf int type with greater-than-16 byte issue Yonghong Song 2024-04-25 8:17 ` Alan Maguire 2024-04-25 13:43 ` Xin Liu 2024-04-25 14:19 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox