summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-02-14 01:41:23 +0300
committerAlexei Starovoitov <ast@kernel.org>2026-02-14 01:41:23 +0300
commitbd86ab5bbe3c0d61bfcbe1ba12e693b82f419cfb (patch)
tree60e47c9585fc133a2e170d634a566bef8bbc6dc3 /include/linux
parentf632de6e195533426017187b85f55f6169b09a50 (diff)
parent3d91c618aca403a7f7d2064272f528a97b849475 (diff)
downloadlinux-bd86ab5bbe3c0d61bfcbe1ba12e693b82f419cfb.tar.xz
Merge branch 'bpf-consolidate-pointer-offset-tracking-in-var_off'
Eduard Zingerman says: ==================== bpf: consolidate pointer offset tracking in var_off Consolidate static and varying pointer offset tracking logic in the BPF verifier. All pointer offsets are now represented solely using `reg->var_off` and min/max fields, simplifying pointer tracking code and making it easier to widen pointer registers for loop convergence checks. Patch 1 is a preparatory refactoring of check_reg_sane_offset(). Patch 2 is the main change, moving pointer offsets from `reg->off` to `reg->var_off`. Patch 3 removes references to `reg->off` in netronome code. Patch 4 renames the now-repurposed `reg->off` field to `reg->delta`, reflecting its remaining role as a constant delta between linked scalar registers. Note: netronome changes are compile-tested only! Changelog: v1 -> v2: - put back WARN_ON_ONCE in mark_ptr_or_null_reg() (Alexei). - references to `ptr->off` field are removed from netronome code (bot+bpf-ci, kernel test robot). - fix for a comment referencing `ptr->off` in bpf_verifier.h (bot+bpf-ci). v1: https://lore.kernel.org/bpf/20260211-ptrs-off-migration-v1-0-996c2a37b063@gmail.com/ --- ==================== Link: https://patch.msgid.link/20260212-ptrs-off-migration-v2-0-00820e4d3438@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bpf_verifier.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index ef8e45a362d9..c1e30096ea7b 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -38,10 +38,9 @@ struct bpf_reg_state {
/* Ordering of fields matters. See states_equal() */
enum bpf_reg_type type;
/*
- * Fixed part of pointer offset, pointer types only.
- * Or constant delta between "linked" scalars with the same ID.
+ * Constant delta between "linked" scalars with the same ID.
*/
- s32 off;
+ s32 delta;
union {
/* valid when type == PTR_TO_PACKET */
int range;
@@ -146,9 +145,9 @@ struct bpf_reg_state {
* Upper bit of ID is used to remember relationship between "linked"
* registers. Example:
* r1 = r2; both will have r1->id == r2->id == N
- * r1 += 10; r1->id == N | BPF_ADD_CONST and r1->off == 10
+ * r1 += 10; r1->id == N | BPF_ADD_CONST and r1->delta == 10
* r3 = r2; both will have r3->id == r2->id == N
- * w3 += 10; r3->id == N | BPF_ADD_CONST32 and r3->off == 10
+ * w3 += 10; r3->id == N | BPF_ADD_CONST32 and r3->delta == 10
*/
#define BPF_ADD_CONST64 (1U << 31)
#define BPF_ADD_CONST32 (1U << 30)