From: Yonghong Song <hidden> Date: 2020-09-30 16:41:21
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
On Wed, Sep 30, 2020 at 9:41 AM Yonghong Song [off-list ref] wrote:
quoted hunk
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
From: Yonghong Song <hidden> Date: 2020-09-30 19:25:22
On 9/30/20 11:40 AM, Andrii Nakryiko wrote:
On Wed, Sep 30, 2020 at 9:41 AM Yonghong Song [off-list ref] wrote:
quoted
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
Why BTF_SOCK_TYPE_xxx doesn't still work here after the above changes?
The macro, e.g., BTF_SOCK_TYPE_TCP_TW, still needed to be defined as
it is used to get the location for btf_id.
const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = {
.func = bpf_skc_to_tcp_timewait_sock,
.gpl_only = false,
.ret_type = RET_PTR_TO_BTF_ID_OR_NULL,
.arg1_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON,
.ret_btf_id = &btf_sock_ids[BTF_SOCK_TYPE_TCP_TW],
};
If CONFIG_INET is not defined, bpf_sock_ids[BTF_SOCK_TYPE_TCP_TW]
will be 0.
On Wed, Sep 30, 2020 at 12:25 PM Yonghong Song [off-list ref] wrote:
On 9/30/20 11:40 AM, Andrii Nakryiko wrote:
quoted
On Wed, Sep 30, 2020 at 9:41 AM Yonghong Song [off-list ref] wrote:
quoted
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
Why BTF_SOCK_TYPE_xxx doesn't still work here after the above changes?
The macro, e.g., BTF_SOCK_TYPE_TCP_TW, still needed to be defined as
it is used to get the location for btf_id.
Ah, right, so you want those here unconditionally, even if CONFIG_INET
is not defined. Missed that. Might be worth leaving a short comment.
Otherwise LGTM.
Acked-by: Andrii Nakryiko <redacted>
const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = {
.func = bpf_skc_to_tcp_timewait_sock,
.gpl_only = false,
.ret_type = RET_PTR_TO_BTF_ID_OR_NULL,
.arg1_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON,
.ret_btf_id = &btf_sock_ids[BTF_SOCK_TYPE_TCP_TW],
};
If CONFIG_INET is not defined, bpf_sock_ids[BTF_SOCK_TYPE_TCP_TW]
will be 0.
From: Martin KaFai Lau <hidden> Date: 2020-09-30 20:59:15
On Wed, Sep 30, 2020 at 09:41:09AM -0700, Yonghong Song wrote:
quoted hunk
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
BTF_SOCK_TYPE_xxx is used in BTF_ID_LIST_GLOBAL(btf_sock_ids) in filter.c
which does not include BTF_SOCK_TYPE_TCP_TW.
However, btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] is still used
in bpf_skc_to_tcp_timewait_sock_proto.
From: Yonghong Song <hidden> Date: 2020-09-30 22:50:34
On 9/30/20 1:58 PM, Martin KaFai Lau wrote:
On Wed, Sep 30, 2020 at 09:41:09AM -0700, Yonghong Song wrote:
quoted
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
BTF_SOCK_TYPE_xxx is used in BTF_ID_LIST_GLOBAL(btf_sock_ids) in filter.c
which does not include BTF_SOCK_TYPE_TCP_TW.
However, btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] is still used
in bpf_skc_to_tcp_timewait_sock_proto.
BTF_SOCK_TYPE_TCP_TW is at the end of this enum.
Would btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] always be 0?
No. If CONFIG_INET is y, the above BTF_SOCK_TYPE_xxx contains
__BTF_SOCK_TW_TYPE_xxx
and
btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] will be calculated properly.
But if CONFIG_INET is n, then BTF_SOCK_TYPE_xxx will not contain
__BTF_SOCK_TW_TYPE_xxx
so btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] will have default value 0
as btf_sock_ids is a global.
Will send v2 to add some comments to make it easy to understand.
From: Martin KaFai Lau <hidden> Date: 2020-09-30 23:00:13
On Wed, Sep 30, 2020 at 03:50:10PM -0700, Yonghong Song wrote:
On 9/30/20 1:58 PM, Martin KaFai Lau wrote:
quoted
On Wed, Sep 30, 2020 at 09:41:09AM -0700, Yonghong Song wrote:
quoted
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
BTF_SOCK_TYPE_xxx is used in BTF_ID_LIST_GLOBAL(btf_sock_ids) in filter.c
which does not include BTF_SOCK_TYPE_TCP_TW.
However, btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] is still used
in bpf_skc_to_tcp_timewait_sock_proto.
BTF_SOCK_TYPE_TCP_TW is at the end of this enum.
Would btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] always be 0?
No. If CONFIG_INET is y, the above BTF_SOCK_TYPE_xxx contains
__BTF_SOCK_TW_TYPE_xxx
and
btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] will be calculated properly.
But if CONFIG_INET is n, then BTF_SOCK_TYPE_xxx will not contain
__BTF_SOCK_TW_TYPE_xxx
so btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] will have default value 0
as btf_sock_ids is a global.
I could be missing something here.
Why btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] must be 0?
How does BTF_ID_LIST_GLOBAL() know there is a
btf_sock_ids[BTF_SOCK_TYPE_TCP_TW]?
I would expect at least BTF_ID_UNUSED is required.
Otherwise, the value will be whatever follow the last
btf_sock_ids[BTF_SOCK_TYPE_UDP6].
Will send v2 to add some comments to make it easy to understand.
From: Yonghong Song <hidden> Date: 2020-10-01 01:00:28
On 9/30/20 3:59 PM, Martin KaFai Lau wrote:
On Wed, Sep 30, 2020 at 03:50:10PM -0700, Yonghong Song wrote:
quoted
On 9/30/20 1:58 PM, Martin KaFai Lau wrote:
quoted
On Wed, Sep 30, 2020 at 09:41:09AM -0700, Yonghong Song wrote:
quoted
Michal reported a build failure likes below:
BTFIDS vmlinux
FAILED unresolved symbol tcp_timewait_sock
make[1]: *** [/.../linux-5.9-rc7/Makefile:1176: vmlinux] Error 255
This error can be triggered when config has CONFIG_NET enabled
but CONFIG_INET disabled. In this case, there is no user of
structs inet_timewait_sock and tcp_timewait_sock and hence vmlinux BTF
types are not generated for these two structures.
To fix the problem, omit the above two types for BTF_SOCK_TYPE_xxx
macro if CONFIG_INET is not defined.
Fixes: fce557bcef11 ("bpf: Make btf_sock_ids global")
Reported-by: Michal Kubecek <redacted>
Signed-off-by: Yonghong Song <redacted>
---
include/linux/btf_ids.h | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
BTF_SOCK_TYPE_xxx is used in BTF_ID_LIST_GLOBAL(btf_sock_ids) in filter.c
which does not include BTF_SOCK_TYPE_TCP_TW.
However, btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] is still used
in bpf_skc_to_tcp_timewait_sock_proto.
BTF_SOCK_TYPE_TCP_TW is at the end of this enum.
Would btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] always be 0?
No. If CONFIG_INET is y, the above BTF_SOCK_TYPE_xxx contains
__BTF_SOCK_TW_TYPE_xxx
and
btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] will be calculated properly.
But if CONFIG_INET is n, then BTF_SOCK_TYPE_xxx will not contain
__BTF_SOCK_TW_TYPE_xxx
so btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] will have default value 0
as btf_sock_ids is a global.
I could be missing something here.
Why btf_sock_ids[BTF_SOCK_TYPE_TCP_TW] must be 0?
How does BTF_ID_LIST_GLOBAL() know there is a
btf_sock_ids[BTF_SOCK_TYPE_TCP_TW]?
I would expect at least BTF_ID_UNUSED is required.
Otherwise, the value will be whatever follow the last
btf_sock_ids[BTF_SOCK_TYPE_UDP6].
Right, I realized later on when I prepare v2. Will send patch v2 shortly.
quoted
Will send v2 to add some comments to make it easy to understand.