qemu-e2k/target/i386
Roman Pen d45fc087c2 i386/kvm: do not zero out segment flags if segment is unusable or not present
This is a fix for the problem [1], where VMCB.CPL was set to 0 and interrupt
was taken on userspace stack.  The root cause lies in the specific AMD CPU
behaviour which manifests itself as unusable segment attributes on SYSRET[2].

Here in this patch flags are not touched even segment is unusable or is not
present, therefore CPL (which is stored in DPL field) should not be lost and
will be successfully restored on kvm/svm kernel side.

Also current patch should not break desired behavior described in this commit:

4cae9c9796 ("target-i386: kvm: clear unusable segments' flags in migration")

since present bit will be dropped if segment is unusable or is not present.

This is the second part of the whole fix of the corresponding problem [1],
first part is related to kvm/svm kernel side and does exactly the same:
segment attributes are not zeroed out.

[1] Message id: CAJrWOzD6Xq==b-zYCDdFLgSRMPM-NkNuTSDFEtX=7MreT45i7Q@mail.gmail.com
[2] Message id: 5d120f358612d73fc909f5bfa47e7bd082db0af0.1429841474.git.luto@kernel.org

Signed-off-by: Roman Pen <roman.penyaev@profitbricks.com>
Signed-off-by: Mikhail Sennikovskii <mikhail.sennikovskii@profitbricks.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Michael Chapman <mike@very.puzzling.org>
Cc: qemu-devel@nongnu.org
Message-Id: <20170601085604.12980-1-roman.penyaev@profitbricks.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-06-07 18:22:02 +02:00
..
Makefile.objs hax: add Darwin support 2017-01-19 22:07:46 +01:00
TODO Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
arch_dump.c hmp: fix "dump-quest-memory" segfault 2017-03-31 11:53:42 +01:00
arch_memory_mapping.c target/i386: enable A20 automatically in system management mode 2017-06-07 18:22:02 +02:00
bpt_helper.c target-i386: Fix eflags.TF/#DB handling of syscall/sysret insns 2016-12-22 16:01:04 +01:00
cc_helper.c target-i386: Use ctpop helper 2017-01-10 08:49:59 -08:00
cc_helper_template.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
cpu-qom.h i386: Define static "base" CPU model 2017-02-27 13:23:27 -03:00
cpu.c target/i386: use multiple CPU AddressSpaces 2017-06-07 18:22:02 +02:00
cpu.h target/i386: use multiple CPU AddressSpaces 2017-06-07 18:22:02 +02:00
excp_helper.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
fpu_helper.c linux-user: Add signal handling support for x86_64 2017-02-27 23:10:02 +01:00
gdbstub.c x86: Fix x86_64 'g' packet response to gdb from 32-bit mode. 2016-12-22 16:00:25 +01:00
hax-all.c migration: Mark CPU states dirty before incoming migration/loadvm 2017-06-06 08:53:24 +10:00
hax-darwin.c hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-darwin.h hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-i386.h hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-interface.h target/i386: Add Intel HAX files 2017-01-19 22:07:46 +01:00
hax-mem.c hax: Fix memory mapping de-duplication logic 2017-05-05 12:10:00 +02:00
hax-windows.c target/i386: Add Intel HAX files 2017-01-19 22:07:46 +01:00
hax-windows.h target/i386: Add Intel HAX files 2017-01-19 22:07:46 +01:00
helper.c target/i386: use multiple CPU AddressSpaces 2017-06-07 18:22:02 +02:00
helper.h target-i386: correctly propagate retaddr into SVM helpers 2017-02-16 18:37:01 +01:00
hyperv.c event_notifier: cleanups around event_notifier_set_handler 2017-01-16 17:52:35 +01:00
hyperv.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
int_helper.c target-i386: Use clz and ctz opcodes 2017-01-10 08:06:11 -08:00
kvm-stub.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
kvm.c i386/kvm: do not zero out segment flags if segment is unusable or not present 2017-06-07 18:22:02 +02:00
kvm_i386.h kvmclock: reduce kvmclock difference on migration 2016-12-22 16:00:56 +01:00
machine.c target/i386: use multiple CPU AddressSpaces 2017-06-07 18:22:02 +02:00
mem_helper.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
misc_helper.c target/i386/misc_helper: wrap BQL around another IRQ generator 2017-04-10 10:14:50 +01:00
monitor.c monitor: Fix crashes when using HMP commands without CPU 2017-02-21 18:29:01 +00:00
mpx_helper.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
ops_sse.h target-i386: Use ctpop helper 2017-01-10 08:49:59 -08:00
ops_sse_header.h target-i386: Use ctpop helper 2017-01-10 08:49:59 -08:00
seg_helper.c target-i386: defer VMEXIT to do_interrupt 2017-03-09 10:41:48 +00:00
shift_helper_template.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
smm_helper.c target/i386: use multiple CPU AddressSpaces 2017-06-07 18:22:02 +02:00
svm.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
svm_helper.c target-i386: defer VMEXIT to do_interrupt 2017-03-09 10:41:48 +00:00
trace-events Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
translate.c i386: fix read/write cr with icount option 2017-06-07 18:22:02 +02:00