Puranjay Mohan
7a433e5193
bpf: Support negative offsets, BPF_SUB, and alu32 for linked register tracking
...
Previously, the verifier only tracked positive constant deltas between
linked registers using BPF_ADD. This limitation meant patterns like:
r1 = r0;
r1 += -4;
if r1 s>= 0 goto l0_%=; // r1 >= 0 implies r0 >= 4
// verifier couldn't propagate bounds back to r0
if r0 != 0 goto l0_%=;
r0 /= 0; // Verifier thinks this is reachable
l0_%=:
Similar limitation exists for 32-bit registers.
With this change, the verifier can now track negative deltas in reg->off
enabling bound propagation for the above pattern.
For alu32, we make sure the destination register has the upper 32 bits
as 0s before creating the link. BPF_ADD_CONST is split into
BPF_ADD_CONST64 and BPF_ADD_CONST32, the latter is used in case of alu32
and sync_linked_regs uses this to zext the result if known_reg has this
flag.
Signed-off-by: Puranjay Mohan <puranjay@kernel.org >
Acked-by: Eduard Zingerman <eddyz87@gmail.com >
Link: https://lore.kernel.org/r/20260204151741.2678118-2-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2026-02-04 13:35:28 -08:00
..
2025-11-29 13:37:12 +01:00
2025-11-26 23:29:11 +01:00
2025-11-26 14:20:10 +01:00
2025-12-06 10:15:41 -08:00
2025-12-08 09:38:52 +09:00
2025-12-01 14:39:03 -08:00
2025-11-28 08:43:55 +01:00
2025-11-28 12:58:05 +01:00
2025-12-12 23:59:39 +01:00
2025-12-06 18:34:24 -08:00
2025-12-05 17:01:20 -08:00
2025-11-27 14:24:41 -08:00
2025-11-20 16:29:35 -05:00
2025-11-28 09:31:53 -06:00
2025-12-04 12:19:49 -08:00
2025-11-19 20:32:28 -08:00
2026-01-11 06:09:11 -10:00
2025-11-27 10:41:31 +01:00
2025-12-02 17:03:55 -08:00
2025-12-10 06:38:17 +09:00
2025-12-05 13:52:43 -08:00
2026-01-05 16:31:11 -08:00
2025-11-20 17:23:00 +00:00
2025-12-12 21:52:42 +12:00
2025-12-06 18:42:12 -08:00
2025-12-02 17:24:03 -08:00
2025-12-06 11:13:50 -08:00
2025-12-03 19:45:29 +01:00
2025-12-05 21:29:02 -08:00
2025-12-10 16:07:42 -08:00
2025-12-05 20:41:20 -08:00
2025-12-03 19:26:18 -08:00
2025-11-20 14:03:43 -08:00
2025-12-12 12:36:44 -07:00
2025-11-24 14:15:46 -05:00
2025-11-20 12:14:54 +01:00
2025-12-04 15:43:28 -07:00
2025-12-04 07:19:26 -07:00
2025-11-28 09:09:19 -07:00
2026-01-27 18:39:58 -08:00
2026-02-04 13:35:28 -08:00
2026-01-06 20:48:32 -08:00
2026-01-31 13:51:04 -08:00
2026-01-20 16:15:56 -08:00
2025-11-21 11:21:31 +01:00
2025-11-21 18:42:01 +00:00
2025-11-25 09:17:13 +01:00
2026-01-07 15:11:03 -10:00
2025-12-08 15:32:14 -08:00
2025-12-20 14:47:05 -08:00
2025-12-20 14:47:05 -08:00
2025-12-08 15:32:14 -08:00
2025-11-27 12:03:27 +01:00
2025-12-03 12:42:36 -08:00
2025-11-21 09:42:03 +01:00
2025-11-25 19:01:29 +01:00
2025-12-06 09:01:27 -08:00
2025-11-20 06:57:58 -10:00
2025-11-20 13:44:01 -08:00
2025-12-05 15:25:13 -08:00
2025-11-24 00:02:01 +09:00
2025-11-20 12:02:19 -07:00
2025-11-20 12:02:19 -07:00
2025-12-08 09:40:57 +01:00
2025-12-04 17:10:08 -08:00
2025-12-04 02:00:04 +00:00
2025-12-13 20:04:32 +12:00
2025-12-15 15:20:33 +01:00
2026-01-31 13:51:04 -08:00
2025-12-02 19:57:01 +01:00
2025-12-16 00:57:29 -05:00
2026-01-15 16:15:25 -08:00
2026-01-28 11:44:57 -08:00
2025-12-23 11:23:10 -08:00
2025-11-25 15:16:03 -08:00
2025-11-26 17:21:48 +01:00
2026-01-11 06:09:11 -10:00
2025-12-13 20:35:41 +12:00
2025-11-24 15:08:55 -08:00
2025-11-20 10:25:10 +01:00
2025-11-25 10:28:20 +01:00
2025-12-01 16:45:06 -08:00
2025-12-17 17:24:28 +01:00
2025-12-22 16:19:53 +02:00
2026-01-01 08:16:40 -07:00
2025-12-15 15:17:44 +01:00
2025-12-05 13:52:43 -08:00
2025-11-25 19:45:41 +01:00
2025-11-25 19:45:41 +01:00
2025-12-18 10:43:52 +01:00
2025-12-07 16:15:22 +01:00
2025-12-10 11:16:50 +09:00
2025-11-27 15:45:37 +01:00
2025-12-23 11:23:11 -08:00
2025-11-27 14:24:36 -08:00
2025-12-23 11:23:13 -08:00
2025-11-27 23:56:58 +02:00
2025-11-28 09:20:13 -07:00
2026-01-11 06:09:11 -10:00
2025-12-23 11:23:12 -08:00
2025-12-05 20:41:20 -08:00
2025-11-27 14:24:40 -08:00
2025-12-01 06:56:16 +01:00
2025-12-01 06:56:16 +01:00
2025-12-10 05:58:51 +09:00
2025-11-20 14:03:42 -08:00
2025-11-20 14:03:42 -08:00
2026-01-05 21:02:05 -08:00
2025-12-23 11:23:15 -08:00
2025-12-05 13:52:43 -08:00
2025-11-23 12:30:40 +01:00
2025-12-05 13:52:43 -08:00
2025-11-24 15:08:51 -08:00
2025-11-26 16:56:33 -08:00
2025-12-08 15:32:14 -08:00
2025-11-24 15:08:54 -08:00
2025-12-13 11:01:16 +01:00
2025-12-23 11:23:15 -08:00
2025-11-20 13:43:59 -08:00
2025-12-09 11:25:32 -08:00
2025-11-26 15:17:37 +01:00
2025-12-01 06:51:57 +01:00
2025-12-01 16:13:46 -08:00
2026-01-04 10:26:11 -08:00
2025-11-29 17:23:03 -05:00
2025-11-23 16:01:47 -05:00
2025-11-23 16:01:47 -05:00
2025-11-20 10:02:22 -05:00
2025-12-03 19:42:37 +01:00
2025-11-20 08:32:48 -06:00
2025-12-13 16:26:55 +12:00
2025-11-20 14:03:43 -08:00
2025-11-27 20:18:05 -05:00
2025-12-05 17:01:20 -08:00
2025-11-20 12:02:00 -07:00
2025-12-06 10:15:41 -08:00
2025-11-24 11:45:20 +01:00
2026-01-11 06:09:11 -10:00
2025-12-05 13:52:43 -08:00
2025-12-01 15:08:24 -08:00
2025-12-05 21:29:02 -08:00
2025-11-28 12:03:22 +02:00
2026-01-11 06:09:11 -10:00
2025-11-25 19:01:29 +01:00
2025-11-25 19:01:29 +01:00
2025-12-04 20:38:13 +01:00
2025-12-04 13:50:39 -08:00
2025-12-22 13:32:22 +01:00
2025-12-06 10:15:41 -08:00
2025-11-21 09:42:02 +01:00
2025-11-27 14:24:30 -08:00
2025-12-03 17:24:33 -08:00
2025-12-04 11:16:44 -08:00
2025-11-21 22:35:22 +01:00
2025-12-10 17:21:30 +09:00
2025-12-12 10:26:26 +01:00
2025-11-25 19:45:42 +01:00
2025-11-25 19:45:42 +01:00
2026-01-11 06:09:11 -10:00
2025-11-28 09:21:18 -07:00
2025-12-03 13:04:07 -08:00
2025-12-05 14:36:21 -08:00
2025-12-06 09:53:05 +01:00
2025-12-06 14:01:20 -08:00
2025-11-24 17:23:58 -06:00
2025-11-27 17:41:51 -08:00
2026-01-27 09:11:30 -08:00
2025-12-07 18:09:54 +01:00
2025-12-03 18:58:57 -08:00
2025-11-27 14:22:31 +01:00
2025-11-27 14:22:31 +01:00
2025-11-27 14:22:31 +01:00
2025-11-20 17:57:40 -08:00
2025-12-05 09:11:02 -08:00
2025-11-24 15:08:52 -08:00
2025-11-20 14:03:40 -08:00
2025-11-27 15:45:38 +01:00
2025-11-26 15:16:35 +01:00
2025-11-20 20:17:32 +01:00
2026-02-04 13:22:39 -08:00
2025-12-05 06:42:51 +02:00
2025-12-05 15:17:56 -05:00
2026-01-07 14:52:22 -05:00
2025-11-25 10:07:42 +01:00
2025-12-06 14:01:20 -08:00
2026-01-11 06:09:11 -10:00
2025-11-24 15:08:54 -08:00
2025-11-20 14:03:41 -08:00
2025-12-23 14:07:08 -07:00
2025-11-20 21:20:00 -07:00
2025-11-27 02:03:07 -05:00
2025-12-24 08:02:56 -05:00
2025-11-26 19:45:54 -08:00
2025-11-27 02:03:07 -05:00
2025-12-24 08:02:55 -05:00
2025-11-27 14:24:44 -08:00
2025-11-24 15:08:54 -08:00
2025-12-01 09:20:51 -08:00