mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
The syscall emulation code previously wasn't interruptible via cpu_loop_exit(), as this construct relies on a longjmp target that is not live anymore in the syscall handling code. Consequently, longjmp() would operate on a (potentially overwritten) stale jump buffer. This patch adds an additional setjmp and the necessary handling around it to make longjmp() (and by proxy cpu_loop_exit() safe to call even within a syscall context. Reviewed-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Florian Hofhammer <florian.hofhammer@epfl.ch> Link: https://lore.kernel.org/qemu-devel/20260305-setpc-v5-v7-3-4c3adba52403@epfl.ch Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* QEMU internal errno values for implementing user-only POSIX.
|
|
*
|
|
* Copyright (c) 2003 Fabrice Bellard
|
|
* Copyright (c) 2021 Linaro, Ltd.
|
|
*/
|
|
|
|
#ifndef SPECIAL_ERRNO_H
|
|
#define SPECIAL_ERRNO_H
|
|
|
|
/*
|
|
* All of these are QEMU internal, not visible to the guest.
|
|
* They should be chosen so as to not overlap with any host
|
|
* or guest errno.
|
|
*/
|
|
|
|
/*
|
|
* This is returned when a system call should be restarted, to tell the
|
|
* main loop that it should wind the guest PC backwards so it will
|
|
* re-execute the syscall after handling any pending signals.
|
|
*/
|
|
#define QEMU_ERESTARTSYS 512
|
|
|
|
/*
|
|
* This is returned after a successful sigreturn syscall, to indicate
|
|
* that it has correctly set the guest registers and so the main loop
|
|
* should not touch them.
|
|
*/
|
|
#define QEMU_ESIGRETURN 513
|
|
|
|
/*
|
|
* This is returned after a plugin has used the qemu_plugin_set_pc API, to
|
|
* indicate that the plugin deliberately changed the PC and potentially
|
|
* modified the register values. The main loop should not touch the guest
|
|
* registers for this reason.
|
|
*/
|
|
#define QEMU_ESETPC 514
|
|
|
|
#endif /* SPECIAL_ERRNO_H */
|