qemu-e2k/target/s390x
Ilya Leoshkevich 86131c71b1 target/s390x: Fix translation exception on illegal instruction
Hitting an uretprobe in a s390x TCG guest causes a SIGSEGV. What
happens is:

* uretprobe maps a userspace page containing an invalid instruction.
* uretprobe replaces the target function's return address with the
  address of that page.
* When tb_gen_code() is called on that page, tb->size ends up being 0
  (because the page starts with the invalid instruction), which causes
  virt_page2 to point to the previous page.
* The previous page is not mapped, so this causes a spurious
  translation exception.

tb->size must never be 0: even if there is an illegal instruction, the
instruction bytes that have been looked at must count towards tb->size.
So adjust s390x's translate_one() to act this way for both illegal
instructions and instructions that are known to generate exceptions.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20210416154939.32404-2-iii@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2021-05-20 14:19:30 +02:00
..
arch_dump.c target/s390x/arch_dump: Fix warning for the name field in the PT_NOTE section 2021-03-04 11:23:35 +01:00
cc_helper.c target/s390x: Improve SUB LOGICAL WITH BORROW 2020-12-21 18:11:33 +01:00
cpu_features_def.h
cpu_features_def.h.inc
cpu_features.c s390x: pv: Fence additional unavailable SCLP facilities for PV guests 2020-12-21 18:11:32 +01:00
cpu_features.h
cpu_models.c s390x/cpu_model: use official name for 8562 2021-03-15 11:01:23 +01:00
cpu_models.h
cpu-param.h
cpu-qom.h
cpu.c Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
cpu.h s390x: move S390_ADAPTER_SUPPRESSIBLE 2021-03-26 09:33:50 +01:00
crypto_helper.c
diag.c Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
excp_helper.c Do not include sysemu/sysemu.h if it's not really necessary 2021-05-02 17:24:50 +02:00
fpu_helper.c
gdbstub.c
gen-features.c
helper.c target/s390x: Improve SUB LOGICAL WITH BORROW 2020-12-21 18:11:33 +01:00
helper.h target/s390x: Store r1/r2 for page-translation exceptions during MVPG 2021-03-15 11:03:20 +01:00
insn-data.def target/s390x: Store r1/r2 for page-translation exceptions during MVPG 2021-03-15 11:03:20 +01:00
insn-format.def
int_helper.c
internal.h target/s390x: Improve SUB LOGICAL WITH BORROW 2020-12-21 18:11:33 +01:00
interrupt.c hw: Do not include qemu/log.h if it is not necessary 2021-05-02 17:24:50 +02:00
ioinst.c css: SCHIB measurement block origin must be aligned 2021-03-04 11:23:35 +01:00
kvm_s390x.h s390/kvm: fix diag318 propagation and reset functionality 2020-11-18 16:57:48 +01:00
kvm-stub.c s390/kvm: fix diag318 propagation and reset functionality 2020-11-18 16:57:48 +01:00
kvm.c s390x/kvm: Get rid of legacy_s390_alloc() 2021-03-15 11:01:23 +01:00
machine.c
mem_helper.c target/s390x: fix s390_probe_access to check PAGE_WRITE_ORG for writeability 2021-04-23 14:10:56 +01:00
meson.build
misc_helper.c s390x: Use strpadcpy for copying vm name 2021-01-21 11:19:45 +01:00
mmu_helper.c s390x: do not use ram_size global 2020-12-10 12:15:09 -05:00
s390-tod.h
sigp.c
tcg_s390x.h
tcg-stub.c
trace-events
trace.h
translate_vx.c.inc
translate.c target/s390x: Fix translation exception on illegal instruction 2021-05-20 14:19:30 +02:00
vec_fpu_helper.c
vec_helper.c
vec_int_helper.c
vec_string_helper.c
vec.h