Eduard Zingerman and Alexei Starovoitov
cd5b460ed1
bpf: range_within() must check cnum ranges instead of min/max pairs
...
states.c:range_within() must be updated to properly check if
cnum-based range in an old state is a superset of a range in the cur
state. Currently it makes the decision using min/max accessors:
reg_umin(old) <= reg_umin(cur) <= reg_umax(old)
This is wrong for cnums that cross both UT_MAX/0 and ST_MAX/ST_MIN
boundaries. Consider cnum32{base=0x7FFFFFF0, size=0x80000020},
which represents values [0x7FFFFFF0, ..., U32_MAX, 0, ..., 0x10].
Its projections are u32_min/max=0/U32_MAX, s32_min/max=S32_MIN/MAX.
A register with range [0x100, 0x200] (which lies entirely in the gap
of the wrapping range) would pass the min/max check despite having no
overlap with the actual cnum arc.
This commit replaces min/max comparison with cnum{32,64}_is_subset()
operation. The operation implementation is verified using cbmc model
checker in [1].
[1] https://github.com/eddyz87/cnum-verif/
Fixes: bbc6310855 ("bpf: replace min/max fields with struct cnum{32,64}")
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com >
Link: https://lore.kernel.org/r/20260425-cnum-range-within-v1-1-2fdca70cb09d@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
2026-04-27 09:56:38 -07:00
..
2026-04-13 19:03:11 -07:00
2026-04-08 19:38:52 -07:00
2026-04-16 20:34:34 -07:00
2026-04-04 20:41:25 +02:00
2026-04-13 20:10:58 -07:00
2026-04-05 13:53:04 -07:00
2026-04-15 09:20:49 -07:00
2026-04-16 08:01:16 -07:00
2026-04-15 14:15:25 -07:00
2026-04-17 21:51:05 +02:00
2026-04-08 07:51:26 +02:00
2026-04-17 10:29:01 -07:00
2026-04-02 23:36:21 -07:00
2026-04-06 09:37:50 -05:00
2026-04-06 09:37:51 -05:00
2026-04-15 17:15:18 -07:00
2026-04-17 14:18:55 -07:00
2026-04-11 11:53:54 +01:00
2026-04-05 13:53:07 -07:00
2026-04-15 08:32:10 -07:00
2026-04-09 21:40:22 +02:00
2026-04-13 14:56:54 -07:00
2026-04-03 16:53:50 -04:00
2026-04-07 08:22:24 -06:00
2026-04-01 20:03:07 -04:00
2026-04-09 13:28:05 -04:00
2026-04-13 15:51:31 -07:00
2026-04-10 21:22:32 -07:00
2026-04-24 18:14:18 -07:00
2026-04-06 18:37:52 -07:00
2026-04-23 07:54:50 -07:00
2026-04-12 11:33:23 -07:00
2026-04-20 17:52:48 -07:00
2026-04-04 08:10:37 -06:00
2026-04-15 10:54:24 -07:00
2026-04-11 07:58:33 +02:00
2026-04-14 10:53:44 -07:00
2026-04-27 09:56:38 -07:00
2026-04-15 08:37:45 -07:00
2026-04-04 18:40:58 -06:00
2026-04-04 20:55:56 +02:00
2026-04-07 15:32:20 +02:00
2026-04-02 23:36:24 -07:00
2026-04-05 13:53:28 -07:00
2026-04-05 13:53:19 -07:00
2026-04-14 12:01:12 -05:00
2026-04-17 11:24:00 -07:00
2026-04-08 15:27:47 +02:00
2026-04-02 07:29:33 +02:00
2026-04-01 20:54:16 +02:00
2026-04-03 16:48:01 -07:00
2026-04-06 20:21:37 -06:00
2026-04-14 16:48:56 -07:00
2026-04-23 07:54:50 -07:00
2026-04-05 13:53:07 -07:00
2026-04-05 13:53:07 -07:00
2026-04-07 17:38:07 +02:00
2026-04-15 12:59:16 -07:00
2026-04-06 20:21:37 -06:00
2026-04-06 20:21:37 -06:00
2026-04-08 14:23:29 -07:00
2026-04-16 21:07:13 +02:00
2026-04-12 16:46:29 +08:00
2026-04-05 13:53:45 -07:00
2026-04-05 13:53:25 -07:00
2026-04-15 12:59:16 -07:00
2026-04-06 09:43:18 -05:00
2026-04-05 13:53:44 -07:00
2026-04-07 15:36:02 +02:00
2026-04-08 08:55:15 +02:00
2026-04-12 15:20:46 -07:00
2026-04-13 15:09:49 +02:00
2026-04-01 16:03:05 +02:00
2026-04-13 16:22:30 -07:00
2026-04-15 12:59:16 -07:00
2026-04-09 13:18:27 +01:00
2026-04-14 23:03:02 -07:00
2026-04-09 10:52:35 -04:00
2026-04-05 13:53:28 -07:00
2026-04-13 10:10:28 -07:00
2026-04-05 13:53:04 -07:00
2026-04-09 14:36:52 +02:00
2026-04-09 14:36:52 +02:00
2026-04-05 13:53:40 -07:00
2026-04-03 19:39:52 +02:00
2026-04-13 19:00:43 +02:00
2026-04-05 13:53:46 -07:00
2026-04-03 16:53:50 -04:00
2026-04-13 15:42:19 -07:00
2026-04-03 16:53:50 -04:00
2026-04-05 13:52:55 -07:00
2026-04-18 11:29:14 -07:00
2026-04-05 13:53:04 -07:00
2026-04-05 13:53:00 -07:00
2026-04-05 13:53:32 -07:00
2026-04-05 13:53:33 -07:00
2026-04-05 13:53:01 -07:00
2026-04-02 18:03:03 -07:00
2026-04-05 13:53:36 -07:00
2026-04-05 13:53:45 -07:00
2026-04-18 11:29:14 -07:00
2026-04-05 13:53:41 -07:00
2026-04-08 13:18:57 -07:00
2026-04-15 12:59:16 -07:00
2026-04-15 12:59:16 -07:00
2026-04-13 14:56:28 -07:00
2026-04-14 18:36:10 -07:00
2026-04-13 15:51:31 -07:00
2026-04-17 14:09:02 -07:00
2026-04-05 13:53:12 -07:00
2026-04-05 13:53:17 -07:00
2026-04-05 13:53:19 -07:00
2026-04-05 13:53:10 -07:00
2026-04-10 17:27:39 -05:00
2026-04-04 16:14:37 +05:30
2026-04-06 16:55:16 +02:00
2026-04-15 14:41:21 -07:00
2026-04-05 13:53:35 -07:00
2026-04-12 11:33:23 -07:00
2026-04-01 13:33:35 +02:00
2026-04-07 12:24:49 -07:00
2026-04-10 11:46:15 +01:00
2026-04-06 09:37:51 -05:00
2026-04-14 13:33:36 -07:00
2026-04-13 15:42:19 -07:00
2026-04-12 10:54:31 -07:00
2026-04-05 13:53:06 -07:00
2026-04-13 19:03:11 -07:00
2026-04-08 12:30:31 +02:00
2026-04-01 17:13:35 +02:00
2026-04-22 22:44:29 +02:00
2026-04-17 09:43:12 -07:00
2026-04-05 13:53:08 -07:00
2026-04-13 08:39:51 -07:00
2026-04-05 13:53:44 -07:00
2026-04-02 09:43:26 +02:00
2026-04-05 13:53:41 -07:00
2026-04-04 00:47:50 +02:00
2026-04-05 13:52:58 -07:00
2026-04-05 13:53:04 -07:00
2026-04-04 00:45:14 +02:00
2026-04-01 10:24:18 -10:00
2026-04-05 13:53:07 -07:00