Yonghong Song
7bca0a9702
bpf: enhance verifier to understand stack pointer arithmetic
...
[ Upstream commit 332270fdc8 ]
llvm 4.0 and above generates the code like below:
....
440: (b7) r1 = 15
441: (05) goto pc+73
515: (79) r6 = *(u64 *)(r10 -152)
516: (bf) r7 = r10
517: (07) r7 += -112
518: (bf) r2 = r7
519: (0f) r2 += r1
520: (71) r1 = *(u8 *)(r8 +0)
521: (73) *(u8 *)(r2 +45) = r1
....
and the verifier complains "R2 invalid mem access 'inv'" for insn #521 .
This is because verifier marks register r2 as unknown value after #519
where r2 is a stack pointer and r1 holds a constant value.
Teach verifier to recognize "stack_ptr + imm" and
"stack_ptr + reg with const val" as valid stack_ptr with new offset.
Signed-off-by: Yonghong Song <yhs@fb.com >
Acked-by: Martin KaFai Lau <kafai@fb.com >
Acked-by: Daniel Borkmann <daniel@iogearbox.net >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Signed-off-by: David S. Miller <davem@davemloft.net >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-05-14 14:00:20 +02:00
..
2017-05-14 14:00:20 +02:00
2016-10-11 15:06:32 -07:00
2017-01-06 10:40:17 +01:00
2017-03-26 13:05:57 +02:00
2016-07-15 14:54:27 +09:00
2017-02-09 08:08:31 +01:00
2016-08-26 14:42:08 +02:00
2017-03-22 12:43:40 +01:00
2016-11-02 05:10:04 +01:00
2017-02-23 17:44:36 +01:00
2017-01-26 08:24:37 +01:00
2017-03-31 10:31:46 +02:00
2017-02-23 17:44:36 +01:00
2017-04-27 09:10:37 +02:00
2015-10-21 15:18:35 +01:00
2015-04-11 22:27:55 -04:00
2015-11-19 17:51:48 +01:00
2016-01-22 18:04:28 -05:00
2016-04-04 09:46:47 -04:00
2016-09-01 15:55:56 -07:00
2016-10-04 14:21:41 -07:00
2016-07-29 17:54:17 -07:00
2016-06-27 11:01:00 -04:00
2016-10-04 14:21:41 -07:00
2014-06-04 16:54:14 -07:00
2014-08-08 15:57:18 -07:00
2017-01-06 10:40:13 +01:00
2015-12-03 10:24:08 -05:00
2017-03-26 13:05:58 +02:00
2017-04-21 09:31:18 +02:00
2015-06-04 23:57:18 +02:00
2015-11-24 09:56:43 +01:00
2015-09-03 02:42:20 +02:00
2017-05-08 07:47:55 +02:00
2016-10-14 12:18:50 -07:00
2014-08-25 15:42:19 -07:00
2016-06-30 18:05:09 -05:00
2016-01-14 16:00:49 -08:00
2015-04-12 21:03:31 +02:00
2016-11-22 12:33:43 +01:00
2015-09-10 13:29:01 -07:00
2017-01-06 10:40:13 +01:00
2016-07-28 16:07:41 -07:00
2016-01-20 17:09:18 -08:00
2017-03-22 12:43:40 +01:00
2016-10-07 18:46:30 -07:00
2016-10-11 15:06:33 -07:00
2015-11-23 09:44:58 +01:00
2017-01-19 20:17:59 +01:00
2016-03-15 16:55:16 -07:00
2016-01-20 17:09:18 -08:00
2015-05-12 09:46:00 +02:00
2016-12-07 17:10:00 -08:00
2016-08-02 19:35:31 -04:00
2016-09-01 17:52:01 -07:00
2016-01-20 17:09:18 -08:00
2016-08-02 19:35:27 -04:00
2015-10-23 17:55:10 +09:00
2016-10-11 15:06:31 -07:00
2016-08-02 19:35:30 -04:00
2017-04-21 09:31:18 +02:00
2016-02-09 11:54:23 +01:00
2016-08-08 13:18:58 -05:00
2017-03-12 06:41:45 +01:00
2017-03-12 06:41:43 +01:00
2016-04-11 22:43:43 +01:00
2016-11-29 16:01:30 -08:00
2015-09-01 08:40:25 -07:00
2016-02-16 13:04:58 -05:00
2017-04-08 09:30:36 +02:00
2016-10-11 15:06:32 -07:00
2015-11-09 15:53:39 -08:00
2017-01-19 20:18:03 +01:00
2016-05-27 15:26:11 -07:00
2016-07-15 10:41:42 +02:00
2017-04-12 12:41:12 +02:00
2015-01-17 10:02:23 +13:00
2015-09-10 13:29:01 -07:00
2017-01-12 11:39:30 +01:00
2016-04-14 12:56:09 -07:00
2016-08-30 16:12:46 -07:00
2017-03-12 06:41:44 +01:00
2016-09-22 14:49:10 +02:00
2016-10-11 15:06:33 -07:00
2016-03-01 20:36:56 +01:00
2016-10-21 15:45:47 -06:00
2017-02-14 15:25:42 -08:00
2016-10-03 13:39:00 -07:00
2016-09-13 14:41:36 +02:00
2016-05-23 17:04:14 -07:00
2016-05-20 17:58:30 -07:00
2017-02-01 08:33:05 +01:00
2016-08-02 19:35:02 -04:00
2016-11-03 16:55:58 -04:00
2014-08-08 15:57:18 -07:00
2016-08-22 10:01:49 -07:00
2016-03-22 15:36:02 -07:00
2016-02-29 09:53:09 +01:00
2017-03-18 19:14:29 +08:00
2016-10-07 18:46:30 -07:00
2016-09-05 13:52:39 +02:00
2016-09-22 20:00:36 -05:00
2014-08-26 13:45:45 -04:00
2014-12-17 12:31:40 -08:00
2014-06-06 16:08:16 -07:00
2016-09-22 20:00:36 -05:00
2017-01-06 10:40:16 +01:00
2016-03-02 10:28:47 -05:00
2016-10-11 15:06:33 -07:00