Skip to content

Commit f81f969

Browse files
jsitnickiKernel Patches Daemon
authored andcommitted
bpf, verifier: Track when data_meta pointer is loaded
Introduce PA_F_DATA_META_LOAD flag to track when a BPF program loads the skb->data_meta pointer. This information will be used by gen_prologue() to handle cases where there is a gap between metadata end and skb->data, requiring metadata to be realigned. Signed-off-by: Jakub Sitnicki <[email protected]>
1 parent 7eef5d4 commit f81f969

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

include/linux/bpf_verifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ enum priv_stack_mode {
639639

640640
enum packet_access_flags {
641641
PA_F_DIRECT_WRITE = BIT(0),
642+
PA_F_DATA_META_LOAD = BIT(1),
642643
};
643644

644645
struct bpf_subprog_info {

kernel/bpf/verifier.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6160,6 +6160,10 @@ static int check_ctx_access(struct bpf_verifier_env *env, int insn_idx, int off,
61606160
} else {
61616161
env->insn_aux_data[insn_idx].ctx_field_size = info->ctx_field_size;
61626162
}
6163+
6164+
if (base_type(info->reg_type) == PTR_TO_PACKET_META)
6165+
env->seen_packet_access |= PA_F_DATA_META_LOAD;
6166+
61636167
/* remember the offset of last byte accessed in ctx */
61646168
if (env->prog->aux->max_ctx_offset < off + size)
61656169
env->prog->aux->max_ctx_offset = off + size;

0 commit comments

Comments
 (0)