Alexei Starovoitov
2339cd6cd0
bpf: fix precision tracking of stack slots
...
The problem can be seen in the following two tests:
0: (bf) r3 = r10
1: (55) if r3 != 0x7b goto pc+0
2: (7a) *(u64 *)(r3 -8) = 0
3: (79) r4 = *(u64 *)(r10 -8)
..
0: (85) call bpf_get_prandom_u32#7
1: (bf) r3 = r10
2: (55) if r3 != 0x7b goto pc+0
3: (7b) *(u64 *)(r3 -8) = r0
4: (79) r4 = *(u64 *)(r10 -8)
When backtracking need to mark R4 it will mark slot fp-8.
But ST or STX into fp-8 could belong to the same block of instructions.
When backtracing is done the parent state may have fp-8 slot
as "unallocated stack". Which will cause verifier to warn
and incorrectly reject such programs.
Writes into stack via non-R10 register are rare. llvm always
generates canonical stack spill/fill.
For such pathological case fall back to conservative precision
tracking instead of rejecting.
Reported-by: syzbot+c8d66267fd2b5955287e@syzkaller.appspotmail.com
Fixes: b5dc0163d8 ("bpf: precise scalar_value tracking")
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net >
2019-09-05 14:06:58 +02:00
..
2019-09-05 14:06:58 +02:00
2019-07-19 10:42:02 -07:00
2018-10-24 20:55:56 -04:00
2019-05-21 10:50:46 +02:00
2019-08-21 07:14:10 +09:00
2019-07-25 15:41:31 +02:00
2019-06-03 16:18:12 +02:00
2019-08-19 21:41:19 +02:00
2019-07-11 15:30:05 -07:00
2019-07-25 15:39:27 +02:00
2019-07-15 20:44:49 -07:00
2019-05-21 11:28:45 +02:00
2019-06-28 19:46:47 +02:00
2019-08-25 10:06:12 -07:00
2019-08-23 02:12:11 +02:00
2019-08-31 06:51:56 -04:00
2019-04-29 16:48:03 +02:00
2019-04-04 21:04:13 -04:00
2019-06-05 17:37:17 +02:00
2019-05-30 11:26:37 -07:00
2019-04-26 13:51:03 -04:00
2019-05-30 11:26:35 -07:00
2019-07-08 18:55:42 -07:00
2019-07-08 18:55:42 -07:00
2019-07-08 18:55:42 -07:00
2019-05-28 17:46:43 -04:00
2019-06-05 17:37:17 +02:00
2018-10-31 08:54:14 -07:00
2019-01-25 11:22:43 -08:00
2019-06-19 17:09:55 +02:00
2019-07-30 18:34:15 +02:00
2019-05-21 10:50:45 +02:00
2019-06-05 17:36:37 +02:00
2019-07-08 10:39:56 -07:00
2019-06-19 17:09:06 +02:00
2019-05-21 10:50:45 +02:00
2019-07-25 08:36:29 -07:00
2019-05-21 11:52:39 +02:00
2018-05-16 07:23:35 +02:00
2018-05-16 07:23:35 +02:00
2019-07-30 19:57:14 +02:00
2019-05-30 11:26:35 -07:00
2019-06-03 15:49:06 +02:00
2019-07-25 15:37:04 +02:00
2019-05-21 10:50:45 +02:00
2019-06-03 11:50:18 +02:00
2019-07-09 10:10:52 +09:00
2019-05-21 10:50:45 +02:00
2019-07-12 11:05:40 -07:00
2019-05-21 10:50:45 +02:00
2019-06-17 12:09:22 +02:00
2019-08-27 16:19:56 +01:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-07-22 18:05:11 +02:00
2019-03-07 18:32:02 -08:00
2019-06-19 17:09:06 +02:00
2019-07-08 20:28:59 -07:00
2019-06-19 17:09:06 +02:00
2019-05-24 20:16:01 +02:00
2019-08-19 12:22:19 +02:00
2019-05-30 11:26:39 -07:00
2019-05-21 10:50:45 +02:00
2019-06-05 17:37:17 +02:00
2019-08-03 07:02:01 -07:00
2019-05-24 17:27:11 +02:00
2019-05-24 17:27:11 +02:00
2019-08-21 10:43:56 +02:00
2019-05-21 10:50:45 +02:00
2019-06-05 17:37:17 +02:00
2019-07-18 13:39:54 +08:00
2019-07-15 11:03:01 -03:00
2019-05-30 11:26:35 -07:00
2019-07-18 17:08:07 -07:00
2019-07-16 19:23:24 -07:00
2019-05-21 10:50:45 +02:00
2019-07-16 19:23:24 -07:00
2019-05-21 10:50:45 +02:00
2019-03-12 13:27:20 -07:00
2019-07-18 17:08:06 -07:00
2019-05-27 09:36:28 -05:00
2019-05-29 09:31:44 -05:00
2019-08-19 06:34:13 -05:00
2019-07-20 11:27:16 +02:00
2019-05-21 10:50:45 +02:00
2019-07-08 11:01:13 -07:00
2018-12-05 19:31:44 -08:00
2019-07-18 16:47:24 +02:00
2019-06-15 12:25:55 +02:00
2019-06-21 01:54:53 +02:00
2019-06-01 15:51:31 -07:00
2019-01-04 13:13:47 -08:00
2019-07-18 17:08:07 -07:00
2019-05-30 11:26:37 -07:00
2019-05-21 11:52:39 +02:00
2019-05-28 09:06:09 -07:00
2019-07-18 11:51:00 -07:00
2019-05-30 11:26:37 -07:00
2019-07-18 17:08:07 -07:00
2019-05-21 10:50:45 +02:00
2019-06-23 14:26:26 +02:00
2019-07-08 19:36:47 -07:00
2019-05-21 10:50:45 +02:00
2019-07-08 19:36:47 -07:00
2019-06-05 17:37:17 +02:00
2019-06-05 17:37:17 +02:00
2019-04-19 09:46:05 -07:00
2019-04-18 14:05:51 +02:00
2019-04-16 16:55:15 +02:00
2019-06-27 14:12:19 -07:00