Alexei Starovoitov
def8c1d045
bpf: Prevent memory disambiguation attack
commit af86ca4e30 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-01 09:44:19 +01:00
2018-12-08 13:05:10 +01:00
2018-08-24 13:12:40 +02:00
2018-11-10 07:42:55 -08:00
2018-04-13 19:48:19 +02:00
2018-09-26 08:36:30 +02:00
2018-08-03 07:55:22 +02:00
2018-05-01 15:13:07 -07:00
2018-11-27 16:09:39 +01:00
2018-10-13 09:18:58 +02:00
2018-10-03 17:01:52 -07:00
2018-09-09 20:01:23 +02:00
2018-05-25 16:13:04 +02:00
2018-10-03 17:01:54 -07:00
2018-04-24 09:34:18 +02:00
2018-04-24 09:34:18 +02:00
2018-07-03 11:23:18 +02:00
2018-12-08 13:05:10 +01:00
2018-03-31 18:11:33 +02:00
2018-08-15 18:14:42 +02:00
2018-07-22 14:27:35 +02:00
2018-07-03 11:23:07 +02:00
2018-08-15 18:14:53 +02:00
2018-05-30 07:50:26 +02:00
2018-09-26 08:36:37 +02:00
2018-05-30 07:50:16 +02:00
2018-08-03 07:55:22 +02:00
2018-05-22 16:57:58 +02:00
2018-11-10 07:42:48 -08:00
2018-12-01 09:44:25 +01:00
2018-03-28 18:39:23 +02:00
2018-04-24 09:34:12 +02:00
2018-10-20 09:51:31 +02:00
2018-11-21 09:26:03 +01:00
2018-11-21 09:26:01 +01:00
2018-04-29 11:32:01 +02:00
2018-04-08 12:12:52 +02:00
2018-12-01 09:44:26 +01:00
2018-09-09 20:01:24 +02:00
2018-10-10 08:53:18 +02:00
2018-11-23 08:20:35 +01:00
2018-05-30 07:50:26 +02:00
2018-05-30 07:50:30 +02:00
2018-07-17 11:37:52 +02:00
2018-04-08 12:12:50 +02:00
2018-09-19 22:47:17 +02:00
2018-11-21 09:26:03 +01:00
2018-11-23 08:20:35 +01:00
2018-10-18 09:13:22 +02:00
2018-05-22 16:58:02 +02:00
2018-12-01 09:44:21 +01:00
2018-09-15 09:42:56 +02:00
2018-09-09 20:01:20 +02:00
2018-12-01 09:44:25 +01:00
2018-03-24 11:00:09 +01:00
2018-11-10 07:43:01 -08:00
2018-10-03 17:01:43 -07:00
2018-05-30 07:50:21 +02:00
2018-04-20 08:21:05 +02:00
2018-05-30 07:50:27 +02:00
2018-12-08 13:05:09 +01:00
2018-10-18 09:13:25 +02:00
2018-08-09 12:17:59 +02:00
2018-09-19 22:47:17 +02:00
2018-05-22 16:58:01 +02:00
2018-08-03 07:55:25 +02:00
2018-05-22 16:57:57 +02:00
2018-10-18 09:13:26 +02:00
2018-10-03 17:01:50 -07:00
2018-07-22 14:27:42 +02:00
2018-05-30 07:50:24 +02:00
2018-08-15 18:14:45 +02:00
2018-08-15 18:14:43 +02:00
2018-09-05 09:20:10 +02:00
2018-11-13 11:17:02 -08:00
2018-06-06 16:44:34 +02:00
2018-08-09 12:18:00 +02:00
2018-05-01 15:13:05 -07:00
2018-11-27 16:09:41 +01:00
2018-09-09 20:01:23 +02:00
2018-05-01 15:13:05 -07:00
2018-09-19 22:47:17 +02:00
2018-09-19 22:47:17 +02:00
2018-12-05 19:42:42 +01:00