From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu, richard.purdie@linuxfoundation.org,
mjt@tls.msk.ru, iii@linux.ibm.com
Subject: [PATCH v2 0/5] linux-user: Rewrite target_shmat
Date: Wed, 28 Feb 2024 10:25:13 -1000 [thread overview]
Message-ID: <20240228202518.33180-1-richard.henderson@linaro.org> (raw)
There are multiple issues with the implementation of shmat().
(1) With reserved_va, which is the default for 32-on-64-bit, we mmap the
entire guest address space. Unlike mmap, shmat refuses to replace an
existing mapping without setting SHM_REMAP. This is the original
subject of issue #115, though it quicky gets distracted by
something else.
(2) With target page size > host page size, and a shm area
that is not a multiple of the target page size, we leave
an unmapped hole that the target expects to be mapped.
This is the subject of
https://lore.kernel.org/qemu-devel/2no4imvz2zrar5kchz2l3oddqbgpj77jgwcuf7aritkn2ok763@i2mvpcihztho/
wherein qemu itself expects a mapping to exist, and
dies in open_self_maps_2.
So: reimplement the thing.
Changes for v2:
- Include Ilya's test case, which caught extra errors: Yay!
- Include x86_64 /proc/self/maps fix, which the test triggers.
- Dropped r-b for the shmat rewrite due to number of changes.
r~
Based-on: <20240222204323.268539-1-richard.henderson@linaro.org>
("[PULL 00/39] tcg and linux-user patch queue")
(Which is technically now out of date, waiting on the coredump
rewrite to solve -Wvla werrors.)
Ilya Leoshkevich (1):
tests/tcg: Check that shmat() does not break /proc/self/maps
Richard Henderson (4):
linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2,4}
linux-user/loongarch64: Remove TARGET_FORCE_SHMLBA
linux-user: Add strace for shmat
linux-user: Rewrite target_shmat
linux-user/loongarch64/target_syscall.h | 7 -
linux-user/mmap.c | 172 +++++++++++++++----
linux-user/strace.c | 23 +++
linux-user/syscall.c | 16 ++
tests/tcg/multiarch/linux/linux-shmat-maps.c | 55 ++++++
linux-user/strace.list | 2 +-
6 files changed, 231 insertions(+), 44 deletions(-)
create mode 100644 tests/tcg/multiarch/linux/linux-shmat-maps.c
--
2.34.1
next reply other threads:[~2024-02-28 20:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 20:25 Richard Henderson [this message]
2024-02-28 20:25 ` [PATCH v2 1/5] linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2, 4} Richard Henderson
2024-02-29 9:48 ` Philippe Mathieu-Daudé
2024-02-28 20:25 ` [PATCH v2 2/5] linux-user/loongarch64: Remove TARGET_FORCE_SHMLBA Richard Henderson
2024-02-28 20:25 ` [PATCH v2 3/5] linux-user: Add strace for shmat Richard Henderson
2024-03-01 13:34 ` Philippe Mathieu-Daudé
2024-02-28 20:25 ` [PATCH v2 4/5] linux-user: Rewrite target_shmat Richard Henderson
2024-02-28 20:25 ` [PATCH v2 5/5] tests/tcg: Check that shmat() does not break /proc/self/maps Richard Henderson
2024-02-29 12:27 ` [PATCH v2 0/5] linux-user: Rewrite target_shmat Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240228202518.33180-1-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=iii@linux.ibm.com \
--cc=laurent@vivier.eu \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.