Skip to contentSkip to conversation

bpf: fix bpf_shim_tramp_link_release ifdef guards

PATCH In review Stanislav Fomichev 2 participants 3 messages Jul 20, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: fix bpf_shim_tramp_link_release ifdef guards

They were updated in kernel/bpf/trampoline.c to fix another build issue. We should to do the same for include/linux/bpf.h header.

Fixes 3908fcddc65d ("bpf: fix lsm_cgroup build errors on esoteric configs")
---
 include/linux/bpf.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/bpf.h +5 -1
index a5bf00649995..0ff033afe0ad 100644
@@ -1256,7 +1256,6 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
 #endif
 int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
 				    int cgroup_atype);
-void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog);
 #else
 static inline const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id)
 {
@@ -1285,6 +1284,11 @@ static inline int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
 {
 	return -EOPNOTSUPP;
 }
+#endif
+
+#if defined(CONFIG_CGROUP_BPF) && defined(CONFIG_BPF_LSM)
+void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog);
+#else
 static inline void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog)
 {
 }
Signature · 1 line
2.37.0.170.g444d1eabd0-goog
#1 lore raw
Quoted 15 lines · Stanislav Fomichev

They were updated in kernel/bpf/trampoline.c to fix another build issue. We should to do the same for include/linux/bpf.h header.

Fixes 3908fcddc65d ("bpf: fix lsm_cgroup build errors on esoteric configs")
---
 include/linux/bpf.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/linux/bpf.h +0 -0
index a5bf00649995..0ff033afe0ad 100644

include/linux/bpf.h int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr, · line 1258

Quoted 3 lines
include/linux/bpf.h +0 -0
@@ -1256,7 +1256,6 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
 #endif
 int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
 				    int cgroup_atype);

This link_cgroup_shim also needs to move ?

Quoted 19 lines
include/linux/bpf.h +5 -1
-void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog);
 #else
 static inline const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id)
 {
@@ -1285,6 +1284,11 @@ static inline int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
 {
 	return -EOPNOTSUPP;
 }
+#endif
+
+#if defined(CONFIG_CGROUP_BPF) && defined(CONFIG_BPF_LSM)
+void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog);
+#else
 static inline void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog)
 {
 }
Signature · 1 line
2.37.0.170.g444d1eabd0-goog
#2 lore raw
Quoted 12 lines · Martin KaFai Lau
Quoted 10 lines · Stanislav Fomichev

They were updated in kernel/bpf/trampoline.c to fix another build issue. We should to do the same for include/linux/bpf.h header.

Fixes 3908fcddc65d ("bpf: fix lsm_cgroup build errors on esoteric configs")
---
 include/linux/bpf.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Quoted 9 lines

include/linux/bpf.h int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr, · line 1258

Quoted 8 lines
include/linux/bpf.h +0 -0
index a5bf00649995..0ff033afe0ad 100644
@@ -1256,7 +1256,6 @@ int bpf_struct_ops_test_run(struct bpf_prog *prog, const union bpf_attr *kattr,
 #endif
 int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
                                  int cgroup_atype);

This link_cgroup_shim also needs to move ?

Doh, definitely! Thanks for catching this.

Quoted 19 lines
Quoted 19 lines
include/linux/bpf.h +5 -2
-void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog);
 #else
 static inline const struct bpf_struct_ops *bpf_struct_ops_find(u32 type_id)
 {
@@ -1285,6 +1284,11 @@ static inline int bpf_trampoline_link_cgroup_shim(struct bpf_prog *prog,
 {
      return -EOPNOTSUPP;
 }
+#endif
+
+#if defined(CONFIG_CGROUP_BPF) && defined(CONFIG_BPF_LSM)
+void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog);
+#else
 static inline void bpf_trampoline_unlink_cgroup_shim(struct bpf_prog *prog)
 {
 }
--

2.37.0.170.g444d1eabd0-goog