Commit 07e3aff
KVM: x86: fix singlestepping over syscall
commit c8401dda2f0a00cd25c0af6a95ed50e478d25de4 upstream.
TF is handled a bit differently for syscall and sysret, compared
to the other instructions: TF is checked after the instruction completes,
so that the OS can disable #DB at a syscall by adding TF to FMASK.
When the sysret is executed the #DB is taken "as if" the syscall insn
just completed.
KVM emulates syscall so that it can trap 32-bit syscall on Intel processors.
Fix the behavior, otherwise you could get #DB on a user stack which is not
nice. This does not affect Linux guests, as they use an IST or task gate
for #DB.
This fixes CVE-2017-7518.
Reported-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
[bwh: Backported to 4.4:
- kvm_vcpu_check_singlestep() sets some flags differently
- Drop changes to kvm_skip_emulated_instruction()]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent ceb5c56 commit 07e3aff
3 files changed
Lines changed: 24 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2726 | 2726 | | |
2727 | 2727 | | |
2728 | 2728 | | |
| 2729 | + | |
2729 | 2730 | | |
2730 | 2731 | | |
2731 | 2732 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5095 | 5095 | | |
5096 | 5096 | | |
5097 | 5097 | | |
| 5098 | + | |
| 5099 | + | |
5098 | 5100 | | |
5099 | 5101 | | |
5100 | 5102 | | |
| |||
5315 | 5317 | | |
5316 | 5318 | | |
5317 | 5319 | | |
5318 | | - | |
| 5320 | + | |
5319 | 5321 | | |
5320 | 5322 | | |
5321 | 5323 | | |
5322 | | - | |
5323 | | - | |
5324 | | - | |
5325 | | - | |
5326 | | - | |
5327 | | - | |
5328 | | - | |
5329 | | - | |
5330 | | - | |
5331 | | - | |
5332 | | - | |
5333 | | - | |
5334 | | - | |
5335 | | - | |
5336 | | - | |
5337 | | - | |
5338 | | - | |
5339 | | - | |
5340 | | - | |
5341 | | - | |
5342 | | - | |
5343 | | - | |
5344 | | - | |
5345 | | - | |
5346 | | - | |
5347 | | - | |
5348 | | - | |
| 5324 | + | |
| 5325 | + | |
| 5326 | + | |
| 5327 | + | |
| 5328 | + | |
| 5329 | + | |
| 5330 | + | |
| 5331 | + | |
| 5332 | + | |
| 5333 | + | |
| 5334 | + | |
| 5335 | + | |
| 5336 | + | |
| 5337 | + | |
| 5338 | + | |
| 5339 | + | |
5349 | 5340 | | |
5350 | 5341 | | |
5351 | 5342 | | |
| |||
5500 | 5491 | | |
5501 | 5492 | | |
5502 | 5493 | | |
5503 | | - | |
5504 | | - | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
5505 | 5497 | | |
5506 | 5498 | | |
5507 | 5499 | | |
| |||
0 commit comments