qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] linux-user: Rewrite target_shmat
@ 2024-02-23  3:03 Richard Henderson
  2024-02-23  3:03 ` [PATCH 1/3] linux-user/loongarch64: Remove TARGET_FORCE_SHMLBA Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Richard Henderson @ 2024-02-23  3:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, iii, richard.purdie, mjt

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.

There are a number of target page size != host page size and
target SHMLBA != host SHMLBA corner cases that are not implementable
without softmmu and a non-linear host to target address space.
I simply bail out in these situations and return EINVAL.

Based-on: <20240222204323.268539-1-richard.henderson@linaro.org>
("[PULL 00/39] tcg and linux-user patch queue")


r~


Richard Henderson (3):
  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                       | 146 ++++++++++++++++++------
 linux-user/strace.c                     |  23 ++++
 linux-user/strace.list                  |   2 +-
 4 files changed, 134 insertions(+), 44 deletions(-)

-- 
2.34.1



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

end of thread, other threads:[~2024-02-23 22:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23  3:03 [PATCH 0/3] linux-user: Rewrite target_shmat Richard Henderson
2024-02-23  3:03 ` [PATCH 1/3] linux-user/loongarch64: Remove TARGET_FORCE_SHMLBA Richard Henderson
2024-02-23  3:42   ` gaosong
2024-02-23  3:03 ` [PATCH 2/3] linux-user: Add strace for shmat Richard Henderson
2024-02-23  6:04   ` Richard Henderson
2024-02-23  3:03 ` [PATCH 3/3] linux-user: Rewrite target_shmat Richard Henderson
2024-02-23 11:35   ` Ilya Leoshkevich
2024-02-23 22:02     ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).