mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
linux-user: fix pidfd_send_signal()
According to pidfd_send_signal(2), info argument can be a NULL pointer.
Fix strace to correctly manage ending comma in parameters.
Fixes: cc054c6f13
("linux-user: Add pidfd_open(), pidfd_send_signal() and pidfd_getfd() syscalls")
cc: Helge Deller <deller@gmx.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Helge Deller <deller@gmx.de>
Message-Id: <20221005163826.1455313-1-laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
eeed22916b
commit
46187d707e
2 changed files with 14 additions and 9 deletions
|
@ -3383,10 +3383,10 @@ print_pidfd_send_signal(CPUArchState *cpu_env, const struct syscallname *name,
|
||||||
|
|
||||||
unlock_user(p, arg2, 0);
|
unlock_user(p, arg2, 0);
|
||||||
} else {
|
} else {
|
||||||
print_pointer(arg2, 1);
|
print_pointer(arg2, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_raw_param("%u", arg3, 0);
|
print_raw_param("%u", arg3, 1);
|
||||||
print_syscall_epilogue(name);
|
print_syscall_epilogue(name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8679,16 +8679,21 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
||||||
#if defined(__NR_pidfd_send_signal) && defined(TARGET_NR_pidfd_send_signal)
|
#if defined(__NR_pidfd_send_signal) && defined(TARGET_NR_pidfd_send_signal)
|
||||||
case TARGET_NR_pidfd_send_signal:
|
case TARGET_NR_pidfd_send_signal:
|
||||||
{
|
{
|
||||||
siginfo_t uinfo;
|
siginfo_t uinfo, *puinfo;
|
||||||
|
|
||||||
p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t), 1);
|
if (arg3) {
|
||||||
if (!p) {
|
p = lock_user(VERIFY_READ, arg3, sizeof(target_siginfo_t), 1);
|
||||||
return -TARGET_EFAULT;
|
if (!p) {
|
||||||
|
return -TARGET_EFAULT;
|
||||||
|
}
|
||||||
|
target_to_host_siginfo(&uinfo, p);
|
||||||
|
unlock_user(p, arg3, 0);
|
||||||
|
puinfo = &uinfo;
|
||||||
|
} else {
|
||||||
|
puinfo = NULL;
|
||||||
}
|
}
|
||||||
target_to_host_siginfo(&uinfo, p);
|
|
||||||
unlock_user(p, arg3, 0);
|
|
||||||
ret = get_errno(pidfd_send_signal(arg1, target_to_host_signal(arg2),
|
ret = get_errno(pidfd_send_signal(arg1, target_to_host_signal(arg2),
|
||||||
&uinfo, arg4));
|
puinfo, arg4));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue