Commit d9ab2f7
libbpf: Tie struct_ops programs to kernel BTF ids, not to local ids
Enforce the following existing limitation on struct_ops programs based
on kernel BTF id instead of program-local BTF id:
struct_ops BPF prog can be re-used between multiple .struct_ops &
.struct_ops.link as long as it's the same struct_ops struct
definition and the same function pointer field
This allows reusing same BPF program for versioned struct_ops map
definitions, e.g.:
SEC("struct_ops/test")
int BPF_PROG(foo) { ... }
struct some_ops___v1 { int (*test)(void); };
struct some_ops___v2 { int (*test)(void); };
SEC(".struct_ops.link") struct some_ops___v1 a = { .test = foo }
SEC(".struct_ops.link") struct some_ops___v2 b = { .test = foo }
Signed-off-by: Eduard Zingerman <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]1 parent a2a5172 commit d9ab2f7
1 file changed
+26
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1146 | 1146 | | |
1147 | 1147 | | |
1148 | 1148 | | |
1149 | | - | |
1150 | | - | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
1151 | 1175 | | |
1152 | 1176 | | |
1153 | 1177 | | |
| |||
9428 | 9452 | | |
9429 | 9453 | | |
9430 | 9454 | | |
9431 | | - | |
9432 | | - | |
9433 | | - | |
9434 | | - | |
9435 | | - | |
9436 | | - | |
9437 | | - | |
9438 | | - | |
9439 | | - | |
9440 | | - | |
9441 | | - | |
9442 | | - | |
9443 | | - | |
9444 | | - | |
9445 | | - | |
9446 | | - | |
9447 | | - | |
9448 | | - | |
9449 | | - | |
9450 | | - | |
9451 | | - | |
9452 | 9455 | | |
9453 | 9456 | | |
9454 | 9457 | | |
| |||
0 commit comments