bpf: btf: include linux/types.h for u32
PATCH 1/1 bpf: btf: include linux/types.h for u32
Inclusion of the header linux/btf_ids.h relies on indirect inclusion of the header linux/types.h. Including it directly on the top level helps to avoid potential problems if linux/types.h hasn't been included before.
--- include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/btf_ids.h +2 -0
@@ -3,6 +3,8 @@ #ifndef _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H +#include <linux/types.h> /* for u32 */ + struct btf_id_set { u32 cnt; u32 ids[];
Signature · 1 line
2.34.1
please use '[PATCH bpf-next]' in subject
Quoted 15 lines · Dmitrii Bundin
Inclusion of the header
linux/btf_ids.hrelies on indirect inclusion of the headerlinux/types.h. Including it directly on the top level helps to avoid potential problems iflinux/types.hhasn't been included before.Signed-off-by Dmitrii Bundin <[email protected]>--- include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)include/linux/btf_ids.h +0
-0
include/linux/btf_ids.h line 6
Quoted 4 lines
include/linux/btf_ids.h +1
-0@@ -3,6 +3,8 @@#ifndef _LINUX_BTF_IDS_H#define _LINUX_BTF_IDS_H +#include <linux/types.h> /* for u32 */
lgtm, did it actualy cause problem anywhere?
there's also tools/include/linux/btf_ids.h
jirka
Quoted 7 lines
include/linux/btf_ids.h +1
-0+struct btf_id_set {u32 cnt;u32 ids[];Signature · 1 line
2.34.1
PATCH v2 1/1 bpf: btf: include linux/types.h for u32
Inclusion of the header linux/btf_ids.h relies on indirect inclusion of the header linux/types.h. Including it directly on the top level helps to avoid potential problems if linux/types.h hasn't been included before.
---
Changes in v2: Add bpf-next to the subject
include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/btf_ids.h +2 -0
@@ -3,6 +3,8 @@ #ifndef _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H +#include <linux/types.h> /* for u32 */ + struct btf_id_set { u32 cnt; u32 ids[];
Signature · 1 line
2.34.1
Quoted 6 lines · Dmitrii Bundin
Inclusion of the header
linux/btf_ids.hrelies on indirect inclusion of the headerlinux/types.h. Including it directly on the top level helps to avoid potential problems iflinux/types.hhasn't been included before.Signed-off-by Dmitrii Bundin <[email protected]>
jirka
Quoted 23 lines
---
Changes in v2: Add bpf-next to the subject
include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)include/linux/btf_ids.h +2
-0@@ -3,6 +3,8 @@ #ifndef _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H +#include <linux/types.h> /* for u32 */ + struct btf_id_set { u32 cnt; u32 ids[];Signature · 1 line
2.34.1
Quoted 3 lines · Jiri Olsa
lgtm, did it actualy cause problem anywhere?
there's also
tools/include/linux/btf_ids.h
It caused the problems exactly in the filetools/include/linux/btf_ids.h and was reported in
https://bugzilla.kernel.org/show_bug.cgi?id=218647
The patch including linux/types.h in tools/include/linux/btf_ids.h is already there https://lore.kernel.org/all/[email protected]/
I also faced the same compile-error of the form
error: unknown type name 'u32'
u32 cnt;
^~~when compiling the bpf tool with glibc 2.28.
I think it might be reasonable to add the inclusion in include/linux/btf_ids.h as well to prevent build problems like this.
Quoted 12 lines · Dmitrii Bundin
Quoted 3 lines · Jiri Olsa
lgtm, did it actualy cause problem anywhere?
there's also
tools/include/linux/btf_ids.hIt caused the problems exactly in the file
tools/include/linux/btf_ids.hand was reported in
https://bugzilla.kernel.org/show_bug.cgi?id=218647
The patch includinglinux/types.hintools/include/linux/btf_ids.his already there https://lore.kernel.org/all/[email protected]/
I also faced the same compile-error of the form
Quoted 7 lines
error: unknown type name 'u32' u32 cnt; ^~~when compiling the bpf tool with glibc 2.28.
I think it might be reasonable to add the inclusion in
include/linux/btf_ids.has well to prevent build problems like this.
ok, it's in the bpf/master already
jirka
Daniel Borkmann
maintainerQuoted 18 lines · Jiri Olsa
Quoted 17 lines · Dmitrii Bundin
Quoted 3 lines · Jiri Olsa
lgtm, did it actualy cause problem anywhere?
there's also
tools/include/linux/btf_ids.hIt caused the problems exactly in the file
tools/include/linux/btf_ids.hand was reported in
https://bugzilla.kernel.org/show_bug.cgi?id=218647
The patch includinglinux/types.hintools/include/linux/btf_ids.his already there https://lore.kernel.org/all/[email protected]/
I also faced the same compile-error of the formerror: unknown type name 'u32' u32 cnt; ^~~when compiling the bpf tool with glibc 2.28.
Quoted 4 lines
Quoted 2 lines
I think it might be reasonable to add the inclusion in
include/linux/btf_ids.has well to prevent build problems like this.ok, it's in the bpf/master already
Please add the error description as motivation aka "why" into the commit description, otherwise it's not really obvious looking at it at a later point in time why the include was needed.
Thanks,
Daniel
Quoted 3 lines · Daniel Borkmann
Please add the error description as motivation aka "why" into the commit description, otherwise it's not really obvious looking at it at a later point in time why the include was needed.
Doesn't the comment /* for u32 */ following the include explain the purpose? I thought the include was actually missing since relying on indirect declaration of u32 is relatively fragile.
Jiri Olsa
Tested-by Greg ThelenQuoted 8 lines · Dmitrii Bundin
Quoted 3 lines · Daniel Borkmann
Please add the error description as motivation aka "why" into the commit description, otherwise it's not really obvious looking at it at a later point in time why the include was needed.
Doesn't the comment /* for u32 */ following the include explain the purpose? I thought the include was actually missing since relying on indirect declaration of u32 is relatively fragile.
I think you can add similar descirption as for the already merged tool change in bpf/master, and also include the Fixes/stable tags
commit 62248b22d01e96a4d669cde0d7005bd51ebf9e76
Author: Natanael Copa <[email protected]> Date: Thu Mar 28 11:59:13 2024 +0100
tools/resolve_btfids: fix build with musl libc
Include the header that defines u32.
This fixes build of 6.6.23 and 6.1.83 kernels for Alpine Linux, which uses musl libc. I assume that GNU libc indirecly pulls in linux/types.h.
jirka
PATCH v3 1/1 bpf: btf: include linux/types.h for u32
Inclusion of the header linux/btf_ids.h relies on indirect inclusion of the header linux/types.h. Including it directly on the top level helps to avoid potential problems if linux/types.h hasn't been included before.
The main motiviation to introduce this it is to avoid similar problems that was shown up in the bpf tool where GNU libc indirectly pulls linux/types.h causing compile error of the form:
error: unknown type name 'u32'
u32 cnt;
^~~The bpf tool compile error was fixed at 62248b22d01e96a4d669cde0d7005bd51ebf9e76
---
Changes in v2: Add bpf-next to the subject Changes in v3: Add Fixes tag and bpf tool commit reference
include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/btf_ids.h +2 -0
@@ -3,6 +3,8 @@ #ifndef _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H +#include <linux/types.h> /* for u32 */ + struct btf_id_set { u32 cnt; u32 ids[];
Signature · 1 line
2.34.1
Daniel Borkmann
maintainerQuoted 6 lines · Dmitrii Bundin
Inclusion of the header
linux/btf_ids.hrelies on indirect inclusion of the headerlinux/types.h. Including it directly on the top level helps to avoid potential problems iflinux/types.hhasn't been included before.The main motiviation to introduce this it is to avoid similar problems that
nit: spelling
Quoted 26 lines
was shown up in the bpf tool where GNU libc indirectly pulls
linux/types.hcausing compile error of the form:error: unknown type name 'u32' u32 cnt; ^~~The bpf tool compile error was fixed at
62248b22d01e96a4d669cde0d7005bd51ebf9e76Fixes 9707ac4fe2f5 ("tools/resolve_btfids: Refactor set sorting with types from btf_ids.h")Signed-off-by Dmitrii Bundin <[email protected]>---
Changes in v2: Add bpf-next to the subject Changes in v3: Add Fixes tag and bpf tool commit reference
include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)include/linux/btf_ids.h +0
-0
include/linux/btf_ids.h line 10
Quoted 8 lines
include/linux/btf_ids.h +2
-0@@ -3,6 +3,8 @@ #ifndef _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H +#include <linux/types.h> /* for u32 */ + struct btf_id_set { u32 cnt; u32 ids[];
Lgtm, not sure if its worth it but also doesn't hurt and aligns the header from tooling a bit closer to the kernel one. Just to clarify, this does not fix a concrete issue today, so small 'cleanup' rather than 'fix'.
Thanks,
Daniel
Quoted 39 lines · Daniel Borkmann
Quoted 6 lines · Dmitrii Bundin
Inclusion of the header
linux/btf_ids.hrelies on indirect inclusion of the headerlinux/types.h. Including it directly on the top level helps to avoid potential problems iflinux/types.hhasn't been included before.The main motiviation to introduce this it is to avoid similar problems that
nit: spelling
Quoted 28 lines
was shown up in the bpf tool where GNU libc indirectly pulls
linux/types.hcausing compile error of the form:error: unknown type name 'u32' u32 cnt; ^~~The bpf tool compile error was fixed at
62248b22d01e96a4d669cde0d7005bd51ebf9e76Fixes 9707ac4fe2f5 ("tools/resolve_btfids: Refactor set sorting with types from btf_ids.h")Signed-off-by Dmitrii Bundin <[email protected]>---
Changes in v2: Add bpf-next to the subject Changes in v3: Add Fixes tag and bpf tool commit reference
include/linux/btf_ids.h | 2 ++ 1 file changed, 2 insertions(+)include/linux/btf_ids.h +0
-0@@ -3,6 +3,8 @@#ifndef _LINUX_BTF_IDS_H#define _LINUX_BTF_IDS_H
Quoted 11 lines
include/linux/btf_ids.h line 10
Quoted 6 lines
include/linux/btf_ids.h +2
-0+#include <linux/types.h> /* for u32 */ +struct btf_id_set {u32 cnt;u32 ids[];Lgtm, not sure if its worth it but also doesn't hurt and aligns the header from tooling a bit closer to the kernel one. Just to clarify, this does not fix a concrete issue today, so small 'cleanup' rather than 'fix'.
Adjusted commit message and pushed to bpf-next, thanks.
Quoted 2 lines
Thanks,
Daniel
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 10 lines · On Sat, 20 Apr 2024 07:24:57 +0300 you wrote:
Inclusion of the header
linux/btf_ids.hrelies on indirect inclusion of the headerlinux/types.h. Including it directly on the top level helps to avoid potential problems iflinux/types.hhasn't been included before.The main motiviation to introduce this it is to avoid similar problems that was shown up in the bpf tool where GNU libc indirectly pulls
linux/types.hcausing compile error of the form:[...]
Here is the summary with links:
- [bpf-next,v3] bpf: btf: include linux/types.h for u32
https://git.kernel.org/bpf/bpf-next/c/cfd3bfe9507b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html