Alexei Starovoitov
af86ca4e30
bpf: Prevent memory disambiguation attack
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>
2018-05-19 20:44:24 +02:00
..
2018-04-12 11:04:35 -07:00
2018-04-23 10:06:59 +02:00
2018-04-05 21:21:08 -07:00
2018-03-31 01:32:57 +08:00
2018-04-16 12:10:48 -04:00
2018-04-13 15:51:06 -07:00
2018-04-20 16:32:23 +01:00
2018-05-19 20:44:24 +02:00
2018-04-10 10:10:30 -07:00
2018-04-22 21:12:00 -04:00
2018-04-06 17:35:43 -07:00
2018-04-18 23:37:39 -04:00
2018-04-16 15:15:23 -07:00
2018-04-25 10:37:46 +02:00
2018-04-26 16:22:47 -07:00
2018-05-05 00:51:44 +02:00
2018-04-17 08:26:33 -04:00