Commit f732a47
bpf: Realign skb metadata for TC progs using data_meta
After decoupling metadata location from MAC header offset, a gap can appear
between metadata and skb->data on L2 decapsulation (e.g., VLAN, GRE). This
breaks the BPF data_meta pointer which assumes metadata is directly before
skb->data.
Introduce bpf_skb_meta_realign() kfunc to close the gap by moving metadata
to immediately precede the MAC header. Inject a call to it in
tc_cls_act_prologue() when the verifier detects data_meta access
(PA_F_DATA_META_LOAD flag).
Update skb_data_move() to handle the gap case: on skb_push(), move metadata
to the top of the head buffer; on skb_pull() where metadata is already
detached, leave it in place.
This restores data_meta functionality for TC programs while keeping the
performance benefit of avoiding memmove on L2 decapsulation for programs
that don't use data_meta.
Signed-off-by: Jakub Sitnicki <[email protected]>1 parent f81f969 commit f732a47
2 files changed
+70
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4600 | 4600 | | |
4601 | 4601 | | |
4602 | 4602 | | |
4603 | | - | |
4604 | | - | |
4605 | | - | |
4606 | | - | |
4607 | | - | |
| 4603 | + | |
| 4604 | + | |
| 4605 | + | |
4608 | 4606 | | |
4609 | 4607 | | |
4610 | 4608 | | |
4611 | 4609 | | |
4612 | | - | |
4613 | | - | |
4614 | | - | |
| 4610 | + | |
| 4611 | + | |
4615 | 4612 | | |
| 4613 | + | |
| 4614 | + | |
| 4615 | + | |
| 4616 | + | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
| 4620 | + | |
| 4621 | + | |
| 4622 | + | |
| 4623 | + | |
| 4624 | + | |
4616 | 4625 | | |
4617 | 4626 | | |
4618 | 4627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9125 | 9125 | | |
9126 | 9126 | | |
9127 | 9127 | | |
| 9128 | + | |
| 9129 | + | |
| 9130 | + | |
| 9131 | + | |
| 9132 | + | |
| 9133 | + | |
| 9134 | + | |
| 9135 | + | |
| 9136 | + | |
| 9137 | + | |
| 9138 | + | |
| 9139 | + | |
| 9140 | + | |
| 9141 | + | |
| 9142 | + | |
| 9143 | + | |
| 9144 | + | |
| 9145 | + | |
| 9146 | + | |
| 9147 | + | |
| 9148 | + | |
| 9149 | + | |
| 9150 | + | |
| 9151 | + | |
| 9152 | + | |
| 9153 | + | |
| 9154 | + | |
| 9155 | + | |
| 9156 | + | |
| 9157 | + | |
| 9158 | + | |
| 9159 | + | |
| 9160 | + | |
| 9161 | + | |
9128 | 9162 | | |
9129 | 9163 | | |
9130 | 9164 | | |
9131 | | - | |
9132 | | - | |
| 9165 | + | |
| 9166 | + | |
| 9167 | + | |
| 9168 | + | |
| 9169 | + | |
| 9170 | + | |
| 9171 | + | |
| 9172 | + | |
| 9173 | + | |
| 9174 | + | |
| 9175 | + | |
| 9176 | + | |
| 9177 | + | |
| 9178 | + | |
| 9179 | + | |
| 9180 | + | |
| 9181 | + | |
| 9182 | + | |
| 9183 | + | |
9133 | 9184 | | |
9134 | 9185 | | |
9135 | 9186 | | |
| |||
0 commit comments