Alexei Starovoitov
def8c1d045
bpf: Prevent memory disambiguation attack
...
commit af86ca4e3088fe5eacf2f7e58c01fa68ca067672 upstream.
Detect code patterns where malicious 'speculative store bypass' can be used
and sanitize such patterns.
39: (bf) r3 = r10
40: (07) r3 += -216
41: (79) r8 = *(u64 *)(r7 +0) // slow read
42: (7a) *(u64 *)(r10 -72) = 0 // verifier inserts this instruction
43: (7b) *(u64 *)(r8 +0) = r3 // this store becomes slow due to r8
44: (79) r1 = *(u64 *)(r6 +0) // cpu speculatively executes this load
45: (71) r2 = *(u8 *)(r1 +0) // speculatively arbitrary 'load byte'
// is now sanitized
Above code after x86 JIT becomes:
e5: mov %rbp,%rdx
e8: add $0xffffffffffffff28,%rdx
ef: mov 0x0(%r13),%r14
f3: movq $0x0,-0x48(%rbp)
fb: mov %rdx,0x0(%r14)
ff: mov 0x0(%rbx),%rdi
103: movzbq 0x0(%rdi),%rsi
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bwh: Backported to 4.9:
- Add bpf_verifier_env parameter to check_stack_write()
- Look up stack slot_types with state->stack_slot_type[] rather than
state->stack[].slot_type[]
- Drop bpf_verifier_env argument to verbose()
- Adjust context]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-08 13:05:10 +01:00
..
2018-12-08 13:05:10 +01:00
2016-10-11 15:06:32 -07:00
2018-12-08 13:05:05 +01:00
2018-12-08 13:05:06 +01:00
2017-09-02 07:07:53 +02:00
2018-11-13 11:17:01 -08:00
2016-08-26 14:42:08 +02:00
2018-11-13 11:16:48 -08:00
2018-09-09 20:01:23 +02:00
2018-11-13 11:17:01 -08:00
2018-05-30 07:50:50 +02:00
2018-12-01 09:44:25 +01:00
2018-11-10 07:43:01 -08:00
2018-09-29 03:07:32 -07:00
2018-01-10 09:29:51 +01:00
2018-02-17 13:21:18 +01:00
2016-04-04 09:46:47 -04:00
2018-09-26 08:36:37 +02:00
2018-05-30 07:50:49 +02:00
2016-07-29 17:54:17 -07:00
2018-08-03 07:55:25 +02:00
2018-08-03 07:55:25 +02:00
2018-11-13 11:16:57 -08:00
2017-01-06 10:40:13 +01:00
2017-03-26 13:05:58 +02:00
2018-10-13 09:18:56 +02:00
2018-11-23 12:57:41 +01:00
2017-10-12 11:51:25 +02:00
2016-06-30 18:05:09 -05:00
2018-05-19 10:27:01 +02:00
2017-07-21 07:42:21 +02:00
2018-09-19 22:47:10 +02:00
2016-07-28 16:07:41 -07:00
2018-11-10 07:42:54 -08:00
2018-01-10 09:29:52 +01:00
2016-10-11 15:06:33 -07:00
2017-12-14 09:28:24 +01:00
2018-08-03 07:55:12 +02:00
2018-06-05 10:28:57 +02:00
2016-09-01 17:52:01 -07:00
2016-08-02 19:35:27 -04:00
2018-11-13 11:16:50 -08:00
2016-08-02 19:35:30 -04:00
2018-08-03 07:55:12 +02:00
2017-06-17 06:41:57 +02:00
2017-03-12 06:41:45 +01:00
2018-02-28 10:18:34 +01:00
2016-04-11 22:43:43 +01:00
2018-10-03 17:01:48 -07:00
2017-05-20 14:28:40 +02:00
2017-07-05 14:40:24 +02:00
2017-05-25 15:44:38 +02:00
2018-04-13 19:47:53 +02:00
2016-07-15 10:41:42 +02:00
2017-06-14 15:05:54 +02:00
2018-05-30 07:50:29 +02:00
2018-04-24 09:34:09 +02:00
2018-05-22 16:58:02 +02:00
2018-11-13 11:16:53 -08:00
2018-08-15 18:14:53 +02:00
2016-10-11 15:06:33 -07:00
2018-08-15 18:14:42 +02:00
2017-02-14 15:25:42 -08:00
2018-08-03 07:55:24 +02:00
2016-09-13 14:41:36 +02:00
2018-09-09 20:01:24 +02:00
2016-05-20 17:58:30 -07:00
2018-12-01 09:44:25 +01:00
2016-08-02 19:35:02 -04:00
2016-11-03 16:55:58 -04:00
2016-08-22 10:01:49 -07:00
2018-05-09 09:50:20 +02:00
2017-06-17 06:41:51 +02:00
2018-01-10 09:29:52 +01:00
2016-09-05 13:52:39 +02:00
2018-09-09 20:01:24 +02:00
2018-09-09 20:01:24 +02:00
2016-09-22 20:00:36 -05:00
2017-06-17 06:41:57 +02:00
2017-06-17 06:41:57 +02:00
2017-11-15 15:53:17 +01:00
2018-05-30 07:50:36 +02:00