Linux user for 7.1 patches
The following changes since commit 5288bee45fbd33203b61f8c76e41b15bb5913e6e:
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-07-21 11:13:01 +0100)
are available in the Git repository at:
https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request
for you to fetch changes up to 6f200f51869ff0de7ea0343dd7104362e994b382:
linux-user: Use target abi_int type for pipefd[1] in pipe() (2022-07-25 10:42:11 +0200)
----------------------------------------------------------------
linux-user pull request 20220726
----------------------------------------------------------------
Helge Deller (3):
linux-user/hppa: Fix segfaults on page zero
linux-user: Unconditionally use pipe2() syscall
linux-user: Use target abi_int type for pipefd[1] in pipe()
linux-user/hppa/cpu_loop.c | 3 +++ linux-user/syscall.c | 13 ++----------- meson.build | 9 --------- 3 files changed, 5 insertions(+), 20 deletions(-)
Signature · 1 line
2.37.1
[PULL 3/3] linux-user: Use target abi_int type for pipefd[1] in pipe()
From: Helge Deller <[email protected]>
When writing back the fd[1] pipe file handle to emulated userspace memory, use sizeof(abi_int) as offset insted of the hosts's int type. There is no functional change in this patch.
Message-Id: <YtQ3Id6z8slpVr7r@p100>
--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +1 -1
@@ -1615,7 +1615,7 @@ static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes, }if (put_user_s32 (host_pipe[0 ], pipedes) - ||put_user_s32 (host_pipe[1 ], pipedes +sizeof (host_pipe[0 ]))) + ||put_user_s32 (host_pipe[1 ], pipedes +sizeof (abi_int)))return -TARGET_EFAULT ;return get_errno (ret); }
Signature · 1 line
2.37.1
[PULL 1/3] linux-user/hppa: Fix segfaults on page zero
In reply to Laurent VivierFrom: Helge Deller <[email protected]>
This program:
int main(void) { asm("bv %r0(%r0)"); return 0; }produces on real hppa hardware the expected segfault:
SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x3} --- killed by SIGSEGV +++
Segmentation fault
But when run on linux-user you get instead internal qemu errors:
ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached Bail out! ERROR: linux-user/hppa/cpu_loop.c:172:cpu_loop: code should not be reached
ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu) Bail out! ERROR: accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
Fix it by adding the missing case for the EXCP_IMP trap in cpu_loop() and raise a segfault.
Message-Id: <YtWNC56seiV6VenA@p100>
--- linux-user/hppa/cpu_loop.c | 3 +++ 1 file changed, 3 insertions(+)
linux-user/hppa/cpu_loop.c +3 -0
@@ -143,6 +143,9 @@ void cpu_loop(CPUHPPAState *env) env->iaoq_f = env->gr[31 ]; env->iaoq_b = env->gr[31 ] +4 ;break ; +case EXCP_IMP : +force_sig_fault (TARGET_SIGSEGV ,TARGET_SEGV_MAPERR , env->iaoq_f); +break ;case EXCP_ILL :force_sig_fault (TARGET_SIGILL ,TARGET_ILL_ILLOPN , env->iaoq_f);break ;
Signature · 1 line
2.37.1
[PULL 2/3] linux-user: Unconditionally use pipe2() syscall
In reply to Laurent VivierFrom: Helge Deller <[email protected]>
The pipe2() syscall is available on all Linux platforms since kernel 2.6.27, so use it unconditionally to emulate pipe() and pipe2().
Message-Id: <YtbZ2ojisTnzxN9Y@p100>
--- linux-user/syscall.c | 11 +---------- meson.build | 9 --------- 2 files changed, 1 insertion(+), 19 deletions(-)
linux-user/syscall.c +1 -10
@@ -1586,21 +1586,12 @@ static abi_long do_ppoll(abi_long arg1, abi_long arg2, abi_long arg3, }#endif -static abi_long do_pipe2 (int host_pipe[],int flags) -{ -#ifdef CONFIG_PIPE2 -return pipe2 (host_pipe, flags); -#else -return -ENOSYS ; -#endif -} -static abi_long do_pipe (CPUArchState *cpu_env,abi_ulong pipedes,int flags,int is_pipe2) {int host_pipe[2 ];abi_long ret; - ret = flags ?do_pipe2 (host_pipe, flags) :pipe (host_pipe); + ret =pipe2 (host_pipe, flags);if (is_error (ret))return get_errno (ret);
meson.build +0 -9
@@ -2026,15 +2026,6 @@ config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.links(gnu_source_prefix + ''' #else int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } #endif''')) -config_host_data.set('CONFIG_PIPE2', cc.links(gnu_source_prefix + ''' - #include <unistd.h> - #include <fcntl.h> - - int main(void) - { - int pipefd[2]; - return pipe2(pipefd, O_CLOEXEC); - }''')) config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + ''' #include <sys/mman.h> #include <stddef.h>
Signature · 1 line
2.37.1
Peter Maydell
AppliedQuoted 9 lines · Laurent Vivier
The following changes since commit
5288bee45fbd33203b61f8c76e41b15bb5913e6e:Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-07-21 11:13:01 +0100)
are available in the Git repository at:
https://gitlab.com/laurent_vivier/qemu.git tags/linux-user-for-7.1-pull-request
Quoted 8 lines
for you to fetch changes up to
6f200f51869ff0de7ea0343dd7104362e994b382:linux-user: Use target
abi_inttype for pipefd[1] inpipe()(2022-07-25 10:42:11 +0200)----------------------------------------------------------------
linux-user pull request 20220726----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.1
for any user-visible changes.
-- PMM