All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] linux-user: Fix siginfo_t contents when jumping to non-readable pages
@ 2022-08-05 16:09 Ilya Leoshkevich
  2022-08-05 16:09 ` [PATCH v2 1/4] accel/tcg: Invalidate translations when clearing PAGE_READ Ilya Leoshkevich
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Ilya Leoshkevich @ 2022-08-05 16:09 UTC (permalink / raw)
  To: Laurent Vivier, Eduardo Habkost, Marcel Apfelbaum,
	Philippe Mathieu-Daudé,
	Yanan Wang, Richard Henderson, Paolo Bonzini, David Hildenbrand,
	Peter Maydell
  Cc: qemu-devel, qemu-s390x, Christian Borntraeger, Ilya Leoshkevich

Hi,

I noticed that when we get a SEGV due to jumping to non-readable
memory, sometimes si_addr and program counter in siginfo_t are slightly
off. I tracked this down to the assumption that translators stop before
the end of a page, while in reality they may stop right after it.

Patch 1 fixes a minor invalidation issue, which may prevent SEGV from
happening altogether.
Patches 2-3 fix the main issue on x86_64 and s390x. Many other
architectures have fixed-size instructions and are not affected.
Patch 4 adds tests.

Best regards,
Ilya

v1: https://lists.gnu.org/archive/html/qemu-devel/2022-08/msg00822.html
v1 -> v2: Fix individual translators instead of translator_loop
          (Peter).

Ilya Leoshkevich (4):
  accel/tcg: Invalidate translations when clearing PAGE_READ
  target/s390x: Make translator stop before the end of a page
  target/i386: Make translator stop before the end of a page
  tests/tcg: Test siginfo_t contents when jumping to non-readable pages

 accel/tcg/translate-all.c        |  17 ++--
 include/exec/translator.h        |  10 +++
 target/i386/tcg/translate.c      |  42 ++++++++-
 target/s390x/tcg/translate.c     |  35 ++++----
 tests/tcg/multiarch/noexec.h     | 114 ++++++++++++++++++++++++
 tests/tcg/s390x/Makefile.target  |   1 +
 tests/tcg/s390x/noexec.c         | 145 +++++++++++++++++++++++++++++++
 tests/tcg/x86_64/Makefile.target |   3 +-
 tests/tcg/x86_64/noexec.c        | 116 +++++++++++++++++++++++++
 9 files changed, 461 insertions(+), 22 deletions(-)
 create mode 100644 tests/tcg/multiarch/noexec.h
 create mode 100644 tests/tcg/s390x/noexec.c
 create mode 100644 tests/tcg/x86_64/noexec.c

-- 
2.35.3



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-08-05 20:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 16:09 [PATCH v2 0/4] linux-user: Fix siginfo_t contents when jumping to non-readable pages Ilya Leoshkevich
2022-08-05 16:09 ` [PATCH v2 1/4] accel/tcg: Invalidate translations when clearing PAGE_READ Ilya Leoshkevich
2022-08-05 17:42   ` Peter Maydell
2022-08-05 17:55   ` Richard Henderson
2022-08-05 16:09 ` [PATCH v2 2/4] target/s390x: Make translator stop before the end of a page Ilya Leoshkevich
2022-08-05 19:13   ` Richard Henderson
2022-08-05 16:09 ` [PATCH v2 3/4] target/i386: " Ilya Leoshkevich
2022-08-05 20:19   ` Richard Henderson
2022-08-05 16:09 ` [PATCH v2 4/4] tests/tcg: Test siginfo_t contents when jumping to non-readable pages Ilya Leoshkevich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.