qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 11/12] accel/tcg: Replace target_ulong with vaddr in page_


From: Richard Henderson
Subject: Re: [PATCH v3 11/12] accel/tcg: Replace target_ulong with vaddr in page_*()
Date: Mon, 26 Jun 2023 15:59:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 6/21/23 15:56, Anton Johansson via wrote:
Use vaddr for guest virtual addresses for functions dealing with page
flags.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
  accel/tcg/user-exec.c        | 44 +++++++++++++++++-------------------
  include/exec/cpu-all.h       | 10 ++++----
  include/exec/translate-all.h |  2 +-
  3 files changed, 27 insertions(+), 29 deletions(-)

This causes other failures, such as

https://gitlab.com/rth7680/qemu/-/jobs/4540151776#L4468

qemu-hppa: ../accel/tcg/user-exec.c:490: page_set_flags: Assertion `last <= GUEST_ADDR_MAX' failed.

which is caused by

#8  0x00005555556e5b77 in do_shmat (cpu_env=cpu_env@entry=0x555556274378,
    shmid=54, shmaddr=<optimized out>, shmflg=0)
    at ../src/linux-user/syscall.c:4598

4598        page_set_flags(raddr, raddr + shm_info.shm_segsz - 1,
4599                       PAGE_VALID | PAGE_RESET | PAGE_READ |
4600                       (shmflg & SHM_RDONLY ? 0 : PAGE_WRITE));

The host shm_info.shm_segsz is uint64_t, which means that the whole expression gets converted to uint64_t. With this patch, it is not properly truncated to a guest address.

In this particular case, raddr is signed (abi_long), which is a mistake. Fixing that avoids this particular error.

But since user-only is outside of the scope of this work, I'm going to drop this patch for now.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]