Alexei Starovoitov
75e3417f89
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-22 18:56:31 +02:00
..
2018-05-22 18:56:31 +02:00
2018-02-21 11:39:22 -08:00
2018-02-10 13:16:35 -08:00
2018-01-03 18:01:08 -06:00
2018-05-16 10:12:36 +02:00
2017-11-02 11:10:55 +01:00
2018-02-22 22:05:43 +01:00
2018-01-31 16:36:38 +01:00
2018-03-20 08:07:41 +01:00
2018-02-02 23:33:50 +01:00
2018-03-01 10:06:39 -08:00
2018-01-31 11:23:28 -08:00
2018-05-16 10:12:35 +02:00
2018-05-22 18:56:24 +02:00
2018-05-16 10:12:35 +02:00
2018-01-04 16:45:09 -08:00
2018-02-06 18:32:44 -08:00
2017-11-14 14:08:20 -08:00
2017-08-16 16:48:34 -07:00
2017-11-10 16:08:47 -05:00
2017-11-15 13:28:48 -08:00
2017-11-10 16:08:56 -05:00
2017-11-15 13:28:48 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-16 10:12:28 +02:00
2017-07-31 13:09:49 +02:00
2017-12-31 12:30:34 -08:00
2018-01-13 10:42:48 -08:00
2018-01-16 03:29:36 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-01-04 16:45:09 -08:00
2018-02-21 16:54:06 +01:00
2018-03-12 16:16:00 +01:00
2018-02-21 15:35:42 -08:00
2017-11-02 11:10:55 +01:00
2018-02-06 18:32:46 -08:00
2017-12-14 16:00:49 -08:00
2018-01-08 19:43:15 +01:00
2018-03-20 08:57:17 +01:00
2018-02-01 13:36:15 -08:00
2017-11-02 11:10:55 +01:00
2018-02-06 18:32:46 -08:00
2017-11-07 15:35:57 +01:00
2017-11-02 11:10:55 +01:00
2017-09-08 18:26:51 -07:00
2018-04-29 11:35:52 +02:00
2017-11-21 16:35:54 -08:00
2018-01-12 17:33:38 -08:00
2018-03-06 10:58:54 -08:00
2018-05-01 12:47:28 -07:00
2018-01-05 18:43:00 +11:00
2018-03-09 16:40:01 -08:00
2017-10-03 17:54:26 -07:00
2017-11-17 16:10:04 -08:00
2018-02-06 18:32:46 -08:00
2018-02-06 18:32:46 -08:00
2017-11-02 11:10:55 +01:00
2017-11-17 16:10:04 -08:00
2018-02-21 15:35:43 -08:00
2018-04-24 09:42:49 +02:00
2018-05-22 18:56:28 +02:00
2018-01-31 13:02:18 -08:00
2017-11-08 11:13:50 +01:00
2017-10-04 10:53:54 +02:00
2017-11-02 11:10:55 +01:00
2017-12-04 10:28:58 -08:00
2017-11-02 11:10:55 +01:00
2018-05-22 18:56:27 +02:00
2017-11-02 11:10:55 +01:00
2018-02-06 18:32:47 -08:00
2017-12-17 13:57:15 +01:00
2018-02-06 18:32:46 -08:00
2017-10-20 11:02:54 +02:00
2017-12-11 09:18:30 -08:00
2018-05-09 09:53:05 +02:00
2017-12-14 16:00:49 -08:00
2017-11-17 16:10:01 -08:00
2017-08-29 15:14:38 +02:00
2017-11-16 12:20:15 -08:00
2018-02-22 10:21:02 -08:00
2017-11-04 08:53:04 +01:00
2017-11-08 10:17:15 +01:00
2017-11-06 12:26:49 -08:00
2018-03-13 13:37:42 -07:00