2003-02-18 23:55:36 +01:00
|
|
|
/*
|
2003-03-23 02:06:05 +01:00
|
|
|
* Emulation of Linux signals
|
2007-09-16 23:08:06 +02:00
|
|
|
*
|
2003-02-18 23:55:36 +01:00
|
|
|
* Copyright (c) 2003 Fabrice Bellard
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-07-16 22:47:01 +02:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2003-02-18 23:55:36 +01:00
|
|
|
*/
|
2016-01-26 19:17:02 +01:00
|
|
|
#include "qemu/osdep.h"
|
2016-05-27 16:51:59 +02:00
|
|
|
#include "qemu/bitops.h"
|
2003-02-18 23:55:36 +01:00
|
|
|
#include <sys/ucontext.h>
|
2009-04-07 08:57:11 +02:00
|
|
|
#include <sys/resource.h>
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2003-03-23 21:17:16 +01:00
|
|
|
#include "qemu.h"
|
2015-11-13 13:52:21 +01:00
|
|
|
#include "trace.h"
|
2018-04-24 21:26:16 +02:00
|
|
|
#include "signal-common.h"
|
2003-03-23 02:06:05 +01:00
|
|
|
|
2008-05-31 18:11:38 +02:00
|
|
|
static struct target_sigaction sigact_table[TARGET_NSIG];
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2007-09-16 23:08:06 +02:00
|
|
|
static void host_signal_handler(int host_signum, siginfo_t *info,
|
2003-03-23 02:06:05 +01:00
|
|
|
void *puc);
|
|
|
|
|
2020-02-12 13:56:57 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* System includes define _NSIG as SIGRTMAX + 1,
|
|
|
|
* but qemu (like the kernel) defines TARGET_NSIG as TARGET_SIGRTMAX
|
|
|
|
* and the first signal is SIGHUP defined as 1
|
|
|
|
* Signal number 0 is reserved for use as kill(pid, 0), to test whether
|
|
|
|
* a process exists without sending it a signal.
|
|
|
|
*/
|
|
|
|
QEMU_BUILD_BUG_ON(__SIGRTMAX + 1 != _NSIG);
|
2009-03-30 01:18:20 +02:00
|
|
|
static uint8_t host_to_target_signal_table[_NSIG] = {
|
2003-07-13 19:33:54 +02:00
|
|
|
[SIGHUP] = TARGET_SIGHUP,
|
|
|
|
[SIGINT] = TARGET_SIGINT,
|
|
|
|
[SIGQUIT] = TARGET_SIGQUIT,
|
|
|
|
[SIGILL] = TARGET_SIGILL,
|
|
|
|
[SIGTRAP] = TARGET_SIGTRAP,
|
|
|
|
[SIGABRT] = TARGET_SIGABRT,
|
2003-09-30 23:10:14 +02:00
|
|
|
/* [SIGIOT] = TARGET_SIGIOT,*/
|
2003-07-13 19:33:54 +02:00
|
|
|
[SIGBUS] = TARGET_SIGBUS,
|
|
|
|
[SIGFPE] = TARGET_SIGFPE,
|
|
|
|
[SIGKILL] = TARGET_SIGKILL,
|
|
|
|
[SIGUSR1] = TARGET_SIGUSR1,
|
|
|
|
[SIGSEGV] = TARGET_SIGSEGV,
|
|
|
|
[SIGUSR2] = TARGET_SIGUSR2,
|
|
|
|
[SIGPIPE] = TARGET_SIGPIPE,
|
|
|
|
[SIGALRM] = TARGET_SIGALRM,
|
|
|
|
[SIGTERM] = TARGET_SIGTERM,
|
|
|
|
#ifdef SIGSTKFLT
|
|
|
|
[SIGSTKFLT] = TARGET_SIGSTKFLT,
|
|
|
|
#endif
|
|
|
|
[SIGCHLD] = TARGET_SIGCHLD,
|
|
|
|
[SIGCONT] = TARGET_SIGCONT,
|
|
|
|
[SIGSTOP] = TARGET_SIGSTOP,
|
|
|
|
[SIGTSTP] = TARGET_SIGTSTP,
|
|
|
|
[SIGTTIN] = TARGET_SIGTTIN,
|
|
|
|
[SIGTTOU] = TARGET_SIGTTOU,
|
|
|
|
[SIGURG] = TARGET_SIGURG,
|
|
|
|
[SIGXCPU] = TARGET_SIGXCPU,
|
|
|
|
[SIGXFSZ] = TARGET_SIGXFSZ,
|
|
|
|
[SIGVTALRM] = TARGET_SIGVTALRM,
|
|
|
|
[SIGPROF] = TARGET_SIGPROF,
|
|
|
|
[SIGWINCH] = TARGET_SIGWINCH,
|
|
|
|
[SIGIO] = TARGET_SIGIO,
|
|
|
|
[SIGPWR] = TARGET_SIGPWR,
|
|
|
|
[SIGSYS] = TARGET_SIGSYS,
|
|
|
|
/* next signals stay the same */
|
|
|
|
};
|
|
|
|
|
2020-02-12 13:56:57 +01:00
|
|
|
static uint8_t target_to_host_signal_table[TARGET_NSIG + 1];
|
|
|
|
|
|
|
|
/* valid sig is between 1 and _NSIG - 1 */
|
2009-04-16 17:17:02 +02:00
|
|
|
int host_to_target_signal(int sig)
|
2003-02-18 23:55:36 +01:00
|
|
|
{
|
2020-02-12 13:56:57 +01:00
|
|
|
if (sig < 1 || sig >= _NSIG) {
|
2008-05-30 20:05:19 +02:00
|
|
|
return sig;
|
2020-02-12 13:56:57 +01:00
|
|
|
}
|
2003-07-13 19:33:54 +02:00
|
|
|
return host_to_target_signal_table[sig];
|
2003-02-18 23:55:36 +01:00
|
|
|
}
|
|
|
|
|
2020-02-12 13:56:57 +01:00
|
|
|
/* valid sig is between 1 and TARGET_NSIG */
|
2008-05-30 20:05:19 +02:00
|
|
|
int target_to_host_signal(int sig)
|
2003-02-18 23:55:36 +01:00
|
|
|
{
|
2020-02-12 13:56:57 +01:00
|
|
|
if (sig < 1 || sig > TARGET_NSIG) {
|
2008-05-30 20:05:19 +02:00
|
|
|
return sig;
|
2020-02-12 13:56:57 +01:00
|
|
|
}
|
2003-07-13 19:33:54 +02:00
|
|
|
return target_to_host_signal_table[sig];
|
2003-02-18 23:55:36 +01:00
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
static inline void target_sigaddset(target_sigset_t *set, int signum)
|
2008-05-31 00:37:07 +02:00
|
|
|
{
|
|
|
|
signum--;
|
|
|
|
abi_ulong mask = (abi_ulong)1 << (signum % TARGET_NSIG_BPW);
|
|
|
|
set->sig[signum / TARGET_NSIG_BPW] |= mask;
|
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
static inline int target_sigismember(const target_sigset_t *set, int signum)
|
2008-05-31 00:37:07 +02:00
|
|
|
{
|
|
|
|
signum--;
|
|
|
|
abi_ulong mask = (abi_ulong)1 << (signum % TARGET_NSIG_BPW);
|
|
|
|
return ((set->sig[signum / TARGET_NSIG_BPW] & mask) != 0);
|
|
|
|
}
|
|
|
|
|
2018-04-24 21:26:16 +02:00
|
|
|
void host_to_target_sigset_internal(target_sigset_t *d,
|
|
|
|
const sigset_t *s)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
2020-02-12 13:56:57 +01:00
|
|
|
int host_sig, target_sig;
|
2008-05-31 00:37:07 +02:00
|
|
|
target_sigemptyset(d);
|
2020-02-12 13:56:57 +01:00
|
|
|
for (host_sig = 1; host_sig < _NSIG; host_sig++) {
|
|
|
|
target_sig = host_to_target_signal(host_sig);
|
|
|
|
if (target_sig < 1 || target_sig > TARGET_NSIG) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (sigismember(s, host_sig)) {
|
|
|
|
target_sigaddset(d, target_sig);
|
2008-05-31 00:37:07 +02:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
void host_to_target_sigset(target_sigset_t *d, const sigset_t *s)
|
2004-06-19 18:58:13 +02:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigset_t d1;
|
2004-06-19 18:58:13 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
host_to_target_sigset_internal(&d1, s);
|
|
|
|
for(i = 0;i < TARGET_NSIG_WORDS; i++)
|
2011-08-12 19:57:41 +02:00
|
|
|
d->sig[i] = tswapal(d1.sig[i]);
|
2004-06-19 18:58:13 +02:00
|
|
|
}
|
|
|
|
|
2018-04-24 21:26:16 +02:00
|
|
|
void target_to_host_sigset_internal(sigset_t *d,
|
|
|
|
const target_sigset_t *s)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
2020-02-12 13:56:57 +01:00
|
|
|
int host_sig, target_sig;
|
2008-05-31 00:37:07 +02:00
|
|
|
sigemptyset(d);
|
2020-02-12 13:56:57 +01:00
|
|
|
for (target_sig = 1; target_sig <= TARGET_NSIG; target_sig++) {
|
|
|
|
host_sig = target_to_host_signal(target_sig);
|
|
|
|
if (host_sig < 1 || host_sig >= _NSIG) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (target_sigismember(s, target_sig)) {
|
|
|
|
sigaddset(d, host_sig);
|
2008-05-31 00:37:07 +02:00
|
|
|
}
|
2016-05-12 19:47:27 +02:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
void target_to_host_sigset(sigset_t *d, const target_sigset_t *s)
|
2004-06-19 18:58:13 +02:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigset_t s1;
|
2004-06-19 18:58:13 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0;i < TARGET_NSIG_WORDS; i++)
|
2011-08-12 19:57:41 +02:00
|
|
|
s1.sig[i] = tswapal(s->sig[i]);
|
2004-06-19 18:58:13 +02:00
|
|
|
target_to_host_sigset_internal(d, &s1);
|
|
|
|
}
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2007-10-14 18:27:31 +02:00
|
|
|
void host_to_target_old_sigset(abi_ulong *old_sigset,
|
2003-03-23 02:06:05 +01:00
|
|
|
const sigset_t *sigset)
|
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigset_t d;
|
2003-07-13 19:33:54 +02:00
|
|
|
host_to_target_sigset(&d, sigset);
|
|
|
|
*old_sigset = d.sig[0];
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2007-09-16 23:08:06 +02:00
|
|
|
void target_to_host_old_sigset(sigset_t *sigset,
|
2007-10-14 18:27:31 +02:00
|
|
|
const abi_ulong *old_sigset)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
2009-10-01 23:12:16 +02:00
|
|
|
target_sigset_t d;
|
2003-07-13 19:33:54 +02:00
|
|
|
int i;
|
|
|
|
|
|
|
|
d.sig[0] = *old_sigset;
|
|
|
|
for(i = 1;i < TARGET_NSIG_WORDS; i++)
|
|
|
|
d.sig[i] = 0;
|
|
|
|
target_to_host_sigset(sigset, &d);
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2016-05-27 16:51:49 +02:00
|
|
|
int block_signals(void)
|
|
|
|
{
|
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
sigset_t set;
|
|
|
|
|
|
|
|
/* It's OK to block everything including SIGSEGV, because we won't
|
|
|
|
* run any further guest code before unblocking signals in
|
|
|
|
* process_pending_signals().
|
|
|
|
*/
|
|
|
|
sigfillset(&set);
|
|
|
|
sigprocmask(SIG_SETMASK, &set, 0);
|
|
|
|
|
2016-06-13 23:57:58 +02:00
|
|
|
return atomic_xchg(&ts->signal_pending, 1);
|
2016-05-27 16:51:49 +02:00
|
|
|
}
|
|
|
|
|
2014-03-14 15:36:55 +01:00
|
|
|
/* Wrapper for sigprocmask function
|
|
|
|
* Emulates a sigprocmask in a safe way for the guest. Note that set and oldset
|
2016-05-27 16:51:49 +02:00
|
|
|
* are host signal set, not guest ones. Returns -TARGET_ERESTARTSYS if
|
|
|
|
* a signal was already pending and the syscall must be restarted, or
|
|
|
|
* 0 on success.
|
|
|
|
* If set is NULL, this is guaranteed not to fail.
|
2014-03-14 15:36:55 +01:00
|
|
|
*/
|
|
|
|
int do_sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
|
|
|
|
{
|
2016-05-27 16:51:49 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
|
|
|
|
if (oldset) {
|
|
|
|
*oldset = ts->signal_mask;
|
|
|
|
}
|
2014-03-14 15:36:56 +01:00
|
|
|
|
|
|
|
if (set) {
|
2016-05-27 16:51:49 +02:00
|
|
|
int i;
|
2014-03-14 15:36:56 +01:00
|
|
|
|
2016-05-27 16:51:49 +02:00
|
|
|
if (block_signals()) {
|
|
|
|
return -TARGET_ERESTARTSYS;
|
|
|
|
}
|
2014-03-14 15:36:56 +01:00
|
|
|
|
|
|
|
switch (how) {
|
|
|
|
case SIG_BLOCK:
|
2016-05-27 16:51:49 +02:00
|
|
|
sigorset(&ts->signal_mask, &ts->signal_mask, set);
|
2014-03-14 15:36:56 +01:00
|
|
|
break;
|
|
|
|
case SIG_UNBLOCK:
|
2016-05-27 16:51:49 +02:00
|
|
|
for (i = 1; i <= NSIG; ++i) {
|
|
|
|
if (sigismember(set, i)) {
|
|
|
|
sigdelset(&ts->signal_mask, i);
|
|
|
|
}
|
2014-03-14 15:36:56 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SIG_SETMASK:
|
2016-05-27 16:51:49 +02:00
|
|
|
ts->signal_mask = *set;
|
2014-03-14 15:36:56 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
|
|
|
}
|
|
|
|
|
2016-05-27 16:51:49 +02:00
|
|
|
/* Silently ignore attempts to change blocking status of KILL or STOP */
|
|
|
|
sigdelset(&ts->signal_mask, SIGKILL);
|
|
|
|
sigdelset(&ts->signal_mask, SIGSTOP);
|
2014-03-14 15:36:56 +01:00
|
|
|
}
|
2016-05-27 16:51:49 +02:00
|
|
|
return 0;
|
2014-03-14 15:36:55 +01:00
|
|
|
}
|
|
|
|
|
2018-05-27 21:02:17 +02:00
|
|
|
#if !defined(TARGET_NIOS2)
|
2016-05-27 16:51:49 +02:00
|
|
|
/* Just set the guest's signal mask to the specified value; the
|
|
|
|
* caller is assumed to have called block_signals() already.
|
|
|
|
*/
|
2018-04-24 21:26:16 +02:00
|
|
|
void set_sigmask(const sigset_t *set)
|
2016-05-27 16:51:46 +02:00
|
|
|
{
|
2016-05-27 16:51:49 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
|
|
|
|
ts->signal_mask = *set;
|
2016-05-27 16:51:46 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-04-11 21:23:47 +02:00
|
|
|
/* sigaltstack management */
|
|
|
|
|
|
|
|
int on_sig_stack(unsigned long sp)
|
|
|
|
{
|
2019-07-25 15:16:45 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
|
|
|
|
return (sp - ts->sigaltstack_used.ss_sp
|
|
|
|
< ts->sigaltstack_used.ss_size);
|
2018-04-11 21:23:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int sas_ss_flags(unsigned long sp)
|
|
|
|
{
|
2019-07-25 15:16:45 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
|
|
|
|
return (ts->sigaltstack_used.ss_size == 0 ? SS_DISABLE
|
2018-04-11 21:23:47 +02:00
|
|
|
: on_sig_stack(sp) ? SS_ONSTACK : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
abi_ulong target_sigsp(abi_ulong sp, struct target_sigaction *ka)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* This is the X/Open sanctioned signal stack switching.
|
|
|
|
*/
|
2019-07-25 15:16:45 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
|
2018-04-11 21:23:47 +02:00
|
|
|
if ((ka->sa_flags & TARGET_SA_ONSTACK) && !sas_ss_flags(sp)) {
|
2019-07-25 15:16:45 +02:00
|
|
|
return ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
|
2018-04-11 21:23:47 +02:00
|
|
|
}
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void target_save_altstack(target_stack_t *uss, CPUArchState *env)
|
|
|
|
{
|
2019-07-25 15:16:45 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
|
|
|
|
|
|
|
__put_user(ts->sigaltstack_used.ss_sp, &uss->ss_sp);
|
2018-04-11 21:23:47 +02:00
|
|
|
__put_user(sas_ss_flags(get_sp_from_cpustate(env)), &uss->ss_flags);
|
2019-07-25 15:16:45 +02:00
|
|
|
__put_user(ts->sigaltstack_used.ss_size, &uss->ss_size);
|
2018-04-11 21:23:47 +02:00
|
|
|
}
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
/* siginfo conversion */
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
static inline void host_to_target_siginfo_noswap(target_siginfo_t *tinfo,
|
2003-03-23 17:49:39 +01:00
|
|
|
const siginfo_t *info)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
2012-09-15 20:34:20 +02:00
|
|
|
int sig = host_to_target_signal(info->si_signo);
|
2016-05-27 16:51:59 +02:00
|
|
|
int si_code = info->si_code;
|
|
|
|
int si_type;
|
2003-03-23 17:49:39 +01:00
|
|
|
tinfo->si_signo = sig;
|
|
|
|
tinfo->si_errno = 0;
|
2008-05-31 14:14:21 +02:00
|
|
|
tinfo->si_code = info->si_code;
|
2012-09-15 20:34:20 +02:00
|
|
|
|
2016-06-13 12:22:05 +02:00
|
|
|
/* This memset serves two purposes:
|
|
|
|
* (1) ensure we don't leak random junk to the guest later
|
|
|
|
* (2) placate false positives from gcc about fields
|
|
|
|
* being used uninitialized if it chooses to inline both this
|
|
|
|
* function and tswap_siginfo() into host_to_target_siginfo().
|
|
|
|
*/
|
|
|
|
memset(tinfo->_sifields._pad, 0, sizeof(tinfo->_sifields._pad));
|
|
|
|
|
2016-05-27 16:51:59 +02:00
|
|
|
/* This is awkward, because we have to use a combination of
|
|
|
|
* the si_code and si_signo to figure out which of the union's
|
|
|
|
* members are valid. (Within the host kernel it is always possible
|
|
|
|
* to tell, but the kernel carefully avoids giving userspace the
|
|
|
|
* high 16 bits of si_code, so we don't have the information to
|
|
|
|
* do this the easy way...) We therefore make our best guess,
|
|
|
|
* bearing in mind that a guest can spoof most of the si_codes
|
|
|
|
* via rt_sigqueueinfo() if it likes.
|
|
|
|
*
|
|
|
|
* Once we have made our guess, we record it in the top 16 bits of
|
|
|
|
* the si_code, so that tswap_siginfo() later can use it.
|
|
|
|
* tswap_siginfo() will strip these top bits out before writing
|
|
|
|
* si_code to the guest (sign-extending the lower bits).
|
|
|
|
*/
|
|
|
|
|
|
|
|
switch (si_code) {
|
|
|
|
case SI_USER:
|
|
|
|
case SI_TKILL:
|
|
|
|
case SI_KERNEL:
|
|
|
|
/* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
|
|
|
|
* These are the only unspoofable si_code values.
|
|
|
|
*/
|
|
|
|
tinfo->_sifields._kill._pid = info->si_pid;
|
|
|
|
tinfo->_sifields._kill._uid = info->si_uid;
|
|
|
|
si_type = QEMU_SI_KILL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Everything else is spoofable. Make best guess based on signal */
|
|
|
|
switch (sig) {
|
|
|
|
case TARGET_SIGCHLD:
|
|
|
|
tinfo->_sifields._sigchld._pid = info->si_pid;
|
|
|
|
tinfo->_sifields._sigchld._uid = info->si_uid;
|
|
|
|
tinfo->_sifields._sigchld._status
|
2016-05-12 19:47:27 +02:00
|
|
|
= host_to_target_waitstatus(info->si_status);
|
2016-05-27 16:51:59 +02:00
|
|
|
tinfo->_sifields._sigchld._utime = info->si_utime;
|
|
|
|
tinfo->_sifields._sigchld._stime = info->si_stime;
|
|
|
|
si_type = QEMU_SI_CHLD;
|
|
|
|
break;
|
|
|
|
case TARGET_SIGIO:
|
|
|
|
tinfo->_sifields._sigpoll._band = info->si_band;
|
|
|
|
tinfo->_sifields._sigpoll._fd = info->si_fd;
|
|
|
|
si_type = QEMU_SI_POLL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
|
|
|
|
tinfo->_sifields._rt._pid = info->si_pid;
|
|
|
|
tinfo->_sifields._rt._uid = info->si_uid;
|
|
|
|
/* XXX: potential problem if 64 bit */
|
|
|
|
tinfo->_sifields._rt._sigval.sival_ptr
|
2016-05-12 19:47:27 +02:00
|
|
|
= (abi_ulong)(unsigned long)info->si_value.sival_ptr;
|
2016-05-27 16:51:59 +02:00
|
|
|
si_type = QEMU_SI_RT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2003-03-23 17:49:39 +01:00
|
|
|
}
|
2016-05-27 16:51:59 +02:00
|
|
|
|
|
|
|
tinfo->si_code = deposit32(si_code, 16, 16, si_type);
|
2003-03-23 17:49:39 +01:00
|
|
|
}
|
|
|
|
|
2018-04-24 21:26:16 +02:00
|
|
|
void tswap_siginfo(target_siginfo_t *tinfo,
|
|
|
|
const target_siginfo_t *info)
|
2003-03-23 17:49:39 +01:00
|
|
|
{
|
2016-05-27 16:51:59 +02:00
|
|
|
int si_type = extract32(info->si_code, 16, 16);
|
|
|
|
int si_code = sextract32(info->si_code, 0, 16);
|
|
|
|
|
|
|
|
__put_user(info->si_signo, &tinfo->si_signo);
|
|
|
|
__put_user(info->si_errno, &tinfo->si_errno);
|
|
|
|
__put_user(si_code, &tinfo->si_code);
|
|
|
|
|
|
|
|
/* We can use our internal marker of which fields in the structure
|
|
|
|
* are valid, rather than duplicating the guesswork of
|
|
|
|
* host_to_target_siginfo_noswap() here.
|
|
|
|
*/
|
|
|
|
switch (si_type) {
|
|
|
|
case QEMU_SI_KILL:
|
|
|
|
__put_user(info->_sifields._kill._pid, &tinfo->_sifields._kill._pid);
|
|
|
|
__put_user(info->_sifields._kill._uid, &tinfo->_sifields._kill._uid);
|
|
|
|
break;
|
|
|
|
case QEMU_SI_TIMER:
|
|
|
|
__put_user(info->_sifields._timer._timer1,
|
|
|
|
&tinfo->_sifields._timer._timer1);
|
|
|
|
__put_user(info->_sifields._timer._timer2,
|
|
|
|
&tinfo->_sifields._timer._timer2);
|
|
|
|
break;
|
|
|
|
case QEMU_SI_POLL:
|
|
|
|
__put_user(info->_sifields._sigpoll._band,
|
|
|
|
&tinfo->_sifields._sigpoll._band);
|
|
|
|
__put_user(info->_sifields._sigpoll._fd,
|
|
|
|
&tinfo->_sifields._sigpoll._fd);
|
|
|
|
break;
|
|
|
|
case QEMU_SI_FAULT:
|
|
|
|
__put_user(info->_sifields._sigfault._addr,
|
|
|
|
&tinfo->_sifields._sigfault._addr);
|
|
|
|
break;
|
|
|
|
case QEMU_SI_CHLD:
|
|
|
|
__put_user(info->_sifields._sigchld._pid,
|
|
|
|
&tinfo->_sifields._sigchld._pid);
|
|
|
|
__put_user(info->_sifields._sigchld._uid,
|
|
|
|
&tinfo->_sifields._sigchld._uid);
|
|
|
|
__put_user(info->_sifields._sigchld._status,
|
|
|
|
&tinfo->_sifields._sigchld._status);
|
|
|
|
__put_user(info->_sifields._sigchld._utime,
|
|
|
|
&tinfo->_sifields._sigchld._utime);
|
|
|
|
__put_user(info->_sifields._sigchld._stime,
|
|
|
|
&tinfo->_sifields._sigchld._stime);
|
|
|
|
break;
|
|
|
|
case QEMU_SI_RT:
|
|
|
|
__put_user(info->_sifields._rt._pid, &tinfo->_sifields._rt._pid);
|
|
|
|
__put_user(info->_sifields._rt._uid, &tinfo->_sifields._rt._uid);
|
|
|
|
__put_user(info->_sifields._rt._sigval.sival_ptr,
|
|
|
|
&tinfo->_sifields._rt._sigval.sival_ptr);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
2003-03-23 17:49:39 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-01 23:12:16 +02:00
|
|
|
void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info)
|
2003-03-23 17:49:39 +01:00
|
|
|
{
|
2016-06-13 12:22:05 +02:00
|
|
|
target_siginfo_t tgt_tmp;
|
|
|
|
host_to_target_siginfo_noswap(&tgt_tmp, info);
|
|
|
|
tswap_siginfo(tinfo, &tgt_tmp);
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
/* XXX: we support only POSIX RT signals are used. */
|
2007-07-12 00:48:58 +02:00
|
|
|
/* XXX: find a solution for 64 bit (additional malloced data is needed) */
|
2009-10-01 23:12:16 +02:00
|
|
|
void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
2016-05-27 16:52:01 +02:00
|
|
|
/* This conversion is used only for the rt_sigqueueinfo syscall,
|
|
|
|
* and so we know that the _rt fields are the valid ones.
|
|
|
|
*/
|
|
|
|
abi_ulong sival_ptr;
|
|
|
|
|
|
|
|
__get_user(info->si_signo, &tinfo->si_signo);
|
|
|
|
__get_user(info->si_errno, &tinfo->si_errno);
|
|
|
|
__get_user(info->si_code, &tinfo->si_code);
|
|
|
|
__get_user(info->si_pid, &tinfo->_sifields._rt._pid);
|
|
|
|
__get_user(info->si_uid, &tinfo->_sifields._rt._uid);
|
|
|
|
__get_user(sival_ptr, &tinfo->_sifields._rt._sigval.sival_ptr);
|
|
|
|
info->si_value.sival_ptr = (void *)(long)sival_ptr;
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2008-12-18 23:44:13 +01:00
|
|
|
static int fatal_signal (int sig)
|
|
|
|
{
|
|
|
|
switch (sig) {
|
|
|
|
case TARGET_SIGCHLD:
|
|
|
|
case TARGET_SIGURG:
|
|
|
|
case TARGET_SIGWINCH:
|
|
|
|
/* Ignored by default. */
|
|
|
|
return 0;
|
|
|
|
case TARGET_SIGCONT:
|
|
|
|
case TARGET_SIGSTOP:
|
|
|
|
case TARGET_SIGTSTP:
|
|
|
|
case TARGET_SIGTTIN:
|
|
|
|
case TARGET_SIGTTOU:
|
|
|
|
/* Job control signals. */
|
|
|
|
return 0;
|
|
|
|
default:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-07 08:57:11 +02:00
|
|
|
/* returns 1 if given signal should dump core if not handled */
|
|
|
|
static int core_dump_signal(int sig)
|
|
|
|
{
|
|
|
|
switch (sig) {
|
|
|
|
case TARGET_SIGABRT:
|
|
|
|
case TARGET_SIGFPE:
|
|
|
|
case TARGET_SIGILL:
|
|
|
|
case TARGET_SIGQUIT:
|
|
|
|
case TARGET_SIGSEGV:
|
|
|
|
case TARGET_SIGTRAP:
|
|
|
|
case TARGET_SIGBUS:
|
|
|
|
return (1);
|
|
|
|
default:
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-12 13:56:56 +01:00
|
|
|
static void signal_table_init(void)
|
|
|
|
{
|
2020-02-12 13:56:58 +01:00
|
|
|
int host_sig, target_sig, count;
|
2020-02-12 13:56:56 +01:00
|
|
|
|
|
|
|
/*
|
2020-02-12 13:56:58 +01:00
|
|
|
* Signals are supported starting from TARGET_SIGRTMIN and going up
|
|
|
|
* until we run out of host realtime signals.
|
|
|
|
* glibc at least uses only the lower 2 rt signals and probably
|
|
|
|
* nobody's using the upper ones.
|
|
|
|
* it's why SIGRTMIN (34) is generally greater than __SIGRTMIN (32)
|
2020-02-12 13:56:56 +01:00
|
|
|
* To fix this properly we need to do manual signal delivery multiplexed
|
|
|
|
* over a single host signal.
|
2020-02-12 13:56:58 +01:00
|
|
|
* Attempts for configure "missing" signals via sigaction will be
|
|
|
|
* silently ignored.
|
2020-02-12 13:56:56 +01:00
|
|
|
*/
|
2020-02-12 13:56:58 +01:00
|
|
|
for (host_sig = SIGRTMIN; host_sig <= SIGRTMAX; host_sig++) {
|
|
|
|
target_sig = host_sig - SIGRTMIN + TARGET_SIGRTMIN;
|
|
|
|
if (target_sig <= TARGET_NSIG) {
|
|
|
|
host_to_target_signal_table[host_sig] = target_sig;
|
|
|
|
}
|
|
|
|
}
|
2020-02-12 13:56:56 +01:00
|
|
|
|
|
|
|
/* generate signal conversion tables */
|
2020-02-12 13:56:58 +01:00
|
|
|
for (target_sig = 1; target_sig <= TARGET_NSIG; target_sig++) {
|
|
|
|
target_to_host_signal_table[target_sig] = _NSIG; /* poison */
|
|
|
|
}
|
2020-02-12 13:56:56 +01:00
|
|
|
for (host_sig = 1; host_sig < _NSIG; host_sig++) {
|
|
|
|
if (host_to_target_signal_table[host_sig] == 0) {
|
|
|
|
host_to_target_signal_table[host_sig] = host_sig;
|
|
|
|
}
|
|
|
|
target_sig = host_to_target_signal_table[host_sig];
|
2020-02-12 13:56:57 +01:00
|
|
|
if (target_sig <= TARGET_NSIG) {
|
|
|
|
target_to_host_signal_table[target_sig] = host_sig;
|
|
|
|
}
|
2020-02-12 13:56:56 +01:00
|
|
|
}
|
2020-02-12 13:56:58 +01:00
|
|
|
|
|
|
|
if (trace_event_get_state_backends(TRACE_SIGNAL_TABLE_INIT)) {
|
|
|
|
for (target_sig = 1, count = 0; target_sig <= TARGET_NSIG; target_sig++) {
|
|
|
|
if (target_to_host_signal_table[target_sig] == _NSIG) {
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
trace_signal_table_init(count);
|
|
|
|
}
|
2020-02-12 13:56:56 +01:00
|
|
|
}
|
|
|
|
|
2003-02-18 23:55:36 +01:00
|
|
|
void signal_init(void)
|
|
|
|
{
|
2016-05-27 16:51:49 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
2003-02-18 23:55:36 +01:00
|
|
|
struct sigaction act;
|
2008-05-31 18:11:38 +02:00
|
|
|
struct sigaction oact;
|
2020-02-12 13:56:56 +01:00
|
|
|
int i;
|
2008-05-31 18:11:38 +02:00
|
|
|
int host_sig;
|
2003-02-18 23:55:36 +01:00
|
|
|
|
2020-02-12 13:56:56 +01:00
|
|
|
/* initialize signal conversion tables */
|
|
|
|
signal_table_init();
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2016-05-27 16:51:49 +02:00
|
|
|
/* Set the signal mask from the host mask. */
|
|
|
|
sigprocmask(0, 0, &ts->signal_mask);
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
sigfillset(&act.sa_mask);
|
2003-02-18 23:55:36 +01:00
|
|
|
act.sa_flags = SA_SIGINFO;
|
|
|
|
act.sa_sigaction = host_signal_handler;
|
2008-05-31 18:11:38 +02:00
|
|
|
for(i = 1; i <= TARGET_NSIG; i++) {
|
2020-02-04 17:11:04 +01:00
|
|
|
#ifdef CONFIG_GPROF
|
2020-02-12 13:56:57 +01:00
|
|
|
if (i == TARGET_SIGPROF) {
|
2019-05-02 16:58:46 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
#endif
|
2008-05-31 18:11:38 +02:00
|
|
|
host_sig = target_to_host_signal(i);
|
|
|
|
sigaction(host_sig, NULL, &oact);
|
|
|
|
if (oact.sa_sigaction == (void *)SIG_IGN) {
|
|
|
|
sigact_table[i - 1]._sa_handler = TARGET_SIG_IGN;
|
|
|
|
} else if (oact.sa_sigaction == (void *)SIG_DFL) {
|
|
|
|
sigact_table[i - 1]._sa_handler = TARGET_SIG_DFL;
|
|
|
|
}
|
|
|
|
/* If there's already a handler installed then something has
|
|
|
|
gone horribly wrong, so don't even try to handle that case. */
|
2008-12-18 23:44:13 +01:00
|
|
|
/* Install some handlers for our own use. We need at least
|
|
|
|
SIGSEGV and SIGBUS, to detect exceptions. We can not just
|
|
|
|
trap all signals because it affects syscall interrupt
|
|
|
|
behavior. But do trap all default-fatal signals. */
|
|
|
|
if (fatal_signal (i))
|
2008-05-31 18:11:38 +02:00
|
|
|
sigaction(host_sig, &act, NULL);
|
2003-02-18 23:55:36 +01:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2016-07-28 17:44:49 +02:00
|
|
|
/* Force a synchronously taken signal. The kernel force_sig() function
|
|
|
|
* also forces the signal to "not blocked, not ignored", but for QEMU
|
|
|
|
* that work is done in process_pending_signals().
|
|
|
|
*/
|
2018-04-24 21:26:16 +02:00
|
|
|
void force_sig(int sig)
|
2016-07-28 17:44:49 +02:00
|
|
|
{
|
|
|
|
CPUState *cpu = thread_cpu;
|
|
|
|
CPUArchState *env = cpu->env_ptr;
|
|
|
|
target_siginfo_t info;
|
|
|
|
|
|
|
|
info.si_signo = sig;
|
|
|
|
info.si_errno = 0;
|
|
|
|
info.si_code = TARGET_SI_KERNEL;
|
|
|
|
info._sifields._kill._pid = 0;
|
|
|
|
info._sifields._kill._uid = 0;
|
|
|
|
queue_signal(env, info.si_signo, QEMU_SI_KILL, &info);
|
|
|
|
}
|
2016-07-28 17:44:47 +02:00
|
|
|
|
|
|
|
/* Force a SIGSEGV if we couldn't write to memory trying to set
|
|
|
|
* up the signal frame. oldsig is the signal we were trying to handle
|
|
|
|
* at the point of failure.
|
|
|
|
*/
|
2018-03-02 13:31:11 +01:00
|
|
|
#if !defined(TARGET_RISCV)
|
2018-04-24 21:26:16 +02:00
|
|
|
void force_sigsegv(int oldsig)
|
2016-07-28 17:44:47 +02:00
|
|
|
{
|
|
|
|
if (oldsig == SIGSEGV) {
|
|
|
|
/* Make sure we don't try to deliver the signal again; this will
|
2016-07-28 17:44:49 +02:00
|
|
|
* end up with handle_pending_signal() calling dump_core_and_abort().
|
2016-07-28 17:44:47 +02:00
|
|
|
*/
|
|
|
|
sigact_table[oldsig - 1]._sa_handler = TARGET_SIG_DFL;
|
|
|
|
}
|
2016-07-28 17:44:50 +02:00
|
|
|
force_sig(TARGET_SIGSEGV);
|
2016-07-28 17:44:47 +02:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
|
2018-03-02 13:31:11 +01:00
|
|
|
#endif
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
/* abort execution with signal */
|
2016-07-28 17:44:49 +02:00
|
|
|
static void QEMU_NORETURN dump_core_and_abort(int target_sig)
|
2003-03-23 02:06:05 +01:00
|
|
|
{
|
2013-08-26 18:14:44 +02:00
|
|
|
CPUState *cpu = thread_cpu;
|
|
|
|
CPUArchState *env = cpu->env_ptr;
|
|
|
|
TaskState *ts = (TaskState *)cpu->opaque;
|
2009-04-07 08:57:11 +02:00
|
|
|
int host_sig, core_dumped = 0;
|
2009-04-15 18:18:38 +02:00
|
|
|
struct sigaction act;
|
2015-11-13 13:52:21 +01:00
|
|
|
|
2009-12-04 14:16:32 +01:00
|
|
|
host_sig = target_to_host_signal(target_sig);
|
2015-11-13 13:52:21 +01:00
|
|
|
trace_user_force_sig(env, target_sig, host_sig);
|
2013-06-09 19:47:04 +02:00
|
|
|
gdb_signalled(env, target_sig);
|
2009-04-15 18:18:38 +02:00
|
|
|
|
2009-04-07 08:57:11 +02:00
|
|
|
/* dump core if supported by target binary format */
|
2009-12-04 14:16:32 +01:00
|
|
|
if (core_dump_signal(target_sig) && (ts->bprm->core_dump != NULL)) {
|
2009-04-07 08:57:11 +02:00
|
|
|
stop_all_tasks();
|
|
|
|
core_dumped =
|
2013-06-09 19:47:04 +02:00
|
|
|
((*ts->bprm->core_dump)(target_sig, env) == 0);
|
2009-04-07 08:57:11 +02:00
|
|
|
}
|
|
|
|
if (core_dumped) {
|
|
|
|
/* we already dumped the core of target process, we don't want
|
|
|
|
* a coredump of qemu itself */
|
|
|
|
struct rlimit nodump;
|
|
|
|
getrlimit(RLIMIT_CORE, &nodump);
|
|
|
|
nodump.rlim_cur=0;
|
|
|
|
setrlimit(RLIMIT_CORE, &nodump);
|
|
|
|
(void) fprintf(stderr, "qemu: uncaught target signal %d (%s) - %s\n",
|
2009-12-04 14:16:32 +01:00
|
|
|
target_sig, strsignal(host_sig), "core dumped" );
|
2009-04-07 08:57:11 +02:00
|
|
|
}
|
|
|
|
|
2011-04-28 17:20:32 +02:00
|
|
|
/* The proper exit code for dying from an uncaught signal is
|
2009-04-15 18:18:38 +02:00
|
|
|
* -<signal>. The kernel doesn't allow exit() or _exit() to pass
|
|
|
|
* a negative value. To get the proper exit code we need to
|
|
|
|
* actually die from an uncaught signal. Here the default signal
|
|
|
|
* handler is installed, we send ourself a signal and we wait for
|
|
|
|
* it to arrive. */
|
|
|
|
sigfillset(&act.sa_mask);
|
|
|
|
act.sa_handler = SIG_DFL;
|
2014-02-17 19:55:32 +01:00
|
|
|
act.sa_flags = 0;
|
2009-04-15 18:18:38 +02:00
|
|
|
sigaction(host_sig, &act, NULL);
|
|
|
|
|
|
|
|
/* For some reason raise(host_sig) doesn't send the signal when
|
|
|
|
* statically linked on x86-64. */
|
|
|
|
kill(getpid(), host_sig);
|
|
|
|
|
|
|
|
/* Make sure the signal isn't masked (just reuse the mask inside
|
|
|
|
of act) */
|
|
|
|
sigdelset(&act.sa_mask, host_sig);
|
|
|
|
sigsuspend(&act.sa_mask);
|
|
|
|
|
|
|
|
/* unreachable */
|
2010-03-13 15:18:50 +01:00
|
|
|
abort();
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
/* queue a signal so that it will be send to the virtual CPU as soon
|
|
|
|
as possible */
|
2016-07-28 17:44:46 +02:00
|
|
|
int queue_signal(CPUArchState *env, int sig, int si_type,
|
|
|
|
target_siginfo_t *info)
|
2003-02-18 23:55:36 +01:00
|
|
|
{
|
2019-03-23 00:07:18 +01:00
|
|
|
CPUState *cpu = env_cpu(env);
|
2013-08-26 18:14:44 +02:00
|
|
|
TaskState *ts = cpu->opaque;
|
2003-03-23 02:06:05 +01:00
|
|
|
|
2015-11-13 13:52:21 +01:00
|
|
|
trace_user_queue_signal(env, sig);
|
2016-05-27 16:51:52 +02:00
|
|
|
|
2016-07-28 17:44:46 +02:00
|
|
|
info->si_code = deposit32(info->si_code, 16, 16, si_type);
|
2016-05-27 16:51:59 +02:00
|
|
|
|
2016-05-27 16:51:53 +02:00
|
|
|
ts->sync_signal.info = *info;
|
|
|
|
ts->sync_signal.pending = sig;
|
2016-05-27 16:51:52 +02:00
|
|
|
/* signal that a new signal is pending */
|
|
|
|
atomic_set(&ts->signal_pending, 1);
|
|
|
|
return 1; /* indicates that the signal was queued */
|
2003-03-23 17:49:39 +01:00
|
|
|
}
|
|
|
|
|
2016-05-12 19:47:46 +02:00
|
|
|
#ifndef HAVE_SAFE_SYSCALL
|
|
|
|
static inline void rewind_if_in_safe_syscall(void *puc)
|
|
|
|
{
|
|
|
|
/* Default version: never rewind */
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-09-16 23:08:06 +02:00
|
|
|
static void host_signal_handler(int host_signum, siginfo_t *info,
|
2003-03-23 17:49:39 +01:00
|
|
|
void *puc)
|
|
|
|
{
|
2013-06-09 19:47:04 +02:00
|
|
|
CPUArchState *env = thread_cpu->env_ptr;
|
2019-03-23 00:07:18 +01:00
|
|
|
CPUState *cpu = env_cpu(env);
|
2016-05-27 16:51:53 +02:00
|
|
|
TaskState *ts = cpu->opaque;
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
int sig;
|
2009-10-01 23:12:16 +02:00
|
|
|
target_siginfo_t tinfo;
|
2016-05-27 16:51:49 +02:00
|
|
|
ucontext_t *uc = puc;
|
2016-05-27 16:51:53 +02:00
|
|
|
struct emulated_sigtable *k;
|
2003-03-23 17:49:39 +01:00
|
|
|
|
|
|
|
/* the CPU emulator uses some host signals to detect exceptions,
|
2009-01-03 14:14:52 +01:00
|
|
|
we forward to it some signals */
|
2008-12-18 23:44:13 +01:00
|
|
|
if ((host_signum == SIGSEGV || host_signum == SIGBUS)
|
2009-01-03 14:14:52 +01:00
|
|
|
&& info->si_code > 0) {
|
2003-06-15 22:05:50 +02:00
|
|
|
if (cpu_signal_handler(host_signum, info, puc))
|
2003-03-23 17:49:39 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get target signal number */
|
|
|
|
sig = host_to_target_signal(host_signum);
|
|
|
|
if (sig < 1 || sig > TARGET_NSIG)
|
|
|
|
return;
|
2015-11-13 13:52:21 +01:00
|
|
|
trace_user_host_signal(env, host_signum, sig);
|
2016-05-12 19:47:46 +02:00
|
|
|
|
|
|
|
rewind_if_in_safe_syscall(puc);
|
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
host_to_target_siginfo_noswap(&tinfo, info);
|
2016-05-27 16:51:53 +02:00
|
|
|
k = &ts->sigtab[sig - 1];
|
|
|
|
k->info = tinfo;
|
|
|
|
k->pending = sig;
|
|
|
|
ts->signal_pending = 1;
|
|
|
|
|
|
|
|
/* Block host signals until target signal handler entered. We
|
|
|
|
* can't block SIGSEGV or SIGBUS while we're executing guest
|
|
|
|
* code in case the guest code provokes one in the window between
|
|
|
|
* now and it getting out to the main loop. Signals will be
|
|
|
|
* unblocked again in process_pending_signals().
|
2016-06-14 13:49:18 +02:00
|
|
|
*
|
|
|
|
* WARNING: we cannot use sigfillset() here because the uc_sigmask
|
|
|
|
* field is a kernel sigset_t, which is much smaller than the
|
|
|
|
* libc sigset_t which sigfillset() operates on. Using sigfillset()
|
|
|
|
* would write 0xff bytes off the end of the structure and trash
|
|
|
|
* data on the struct.
|
|
|
|
* We can't use sizeof(uc->uc_sigmask) either, because the libc
|
|
|
|
* headers define the struct field with the wrong (too large) type.
|
2016-05-27 16:51:53 +02:00
|
|
|
*/
|
2016-06-14 13:49:18 +02:00
|
|
|
memset(&uc->uc_sigmask, 0xff, SIGSET_T_SIZE);
|
2016-05-27 16:51:53 +02:00
|
|
|
sigdelset(&uc->uc_sigmask, SIGSEGV);
|
|
|
|
sigdelset(&uc->uc_sigmask, SIGBUS);
|
2016-05-27 16:51:49 +02:00
|
|
|
|
2016-05-27 16:51:53 +02:00
|
|
|
/* interrupt the virtual CPU as soon as possible */
|
|
|
|
cpu_exit(thread_cpu);
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2007-10-20 22:23:07 +02:00
|
|
|
/* do_sigaltstack() returns target values and errnos. */
|
2007-11-11 15:26:47 +01:00
|
|
|
/* compare linux/kernel/signal.c:do_sigaltstack() */
|
|
|
|
abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp)
|
2007-09-27 15:57:58 +02:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct target_sigaltstack oss;
|
2019-07-25 15:16:45 +02:00
|
|
|
TaskState *ts = (TaskState *)thread_cpu->opaque;
|
2007-09-27 15:57:58 +02:00
|
|
|
|
|
|
|
/* XXX: test errors */
|
2007-11-11 15:26:47 +01:00
|
|
|
if(uoss_addr)
|
2007-09-27 15:57:58 +02:00
|
|
|
{
|
2019-07-25 15:16:45 +02:00
|
|
|
__put_user(ts->sigaltstack_used.ss_sp, &oss.ss_sp);
|
|
|
|
__put_user(ts->sigaltstack_used.ss_size, &oss.ss_size);
|
2007-09-27 15:57:58 +02:00
|
|
|
__put_user(sas_ss_flags(sp), &oss.ss_flags);
|
|
|
|
}
|
|
|
|
|
2007-11-11 15:26:47 +01:00
|
|
|
if(uss_addr)
|
2007-09-27 15:57:58 +02:00
|
|
|
{
|
2007-11-11 15:26:47 +01:00
|
|
|
struct target_sigaltstack *uss;
|
|
|
|
struct target_sigaltstack ss;
|
2014-08-12 20:53:40 +02:00
|
|
|
size_t minstacksize = TARGET_MINSIGSTKSZ;
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* ELF V2 for PPC64 has a 4K minimum stack size for signal handlers */
|
|
|
|
struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
|
|
|
|
if (get_ppc64_abi(image) > 1) {
|
|
|
|
minstacksize = 4096;
|
|
|
|
}
|
|
|
|
#endif
|
2007-09-27 15:57:58 +02:00
|
|
|
|
2018-12-13 23:37:37 +01:00
|
|
|
ret = -TARGET_EFAULT;
|
2014-04-23 10:26:34 +02:00
|
|
|
if (!lock_user_struct(VERIFY_READ, uss, uss_addr, 1)) {
|
2007-09-27 15:57:58 +02:00
|
|
|
goto out;
|
2014-04-23 10:26:34 +02:00
|
|
|
}
|
|
|
|
__get_user(ss.ss_sp, &uss->ss_sp);
|
|
|
|
__get_user(ss.ss_size, &uss->ss_size);
|
|
|
|
__get_user(ss.ss_flags, &uss->ss_flags);
|
2007-11-11 15:26:47 +01:00
|
|
|
unlock_user_struct(uss, uss_addr, 0);
|
2007-09-27 15:57:58 +02:00
|
|
|
|
2018-12-13 23:37:37 +01:00
|
|
|
ret = -TARGET_EPERM;
|
|
|
|
if (on_sig_stack(sp))
|
2007-09-27 15:57:58 +02:00
|
|
|
goto out;
|
|
|
|
|
2018-12-13 23:37:37 +01:00
|
|
|
ret = -TARGET_EINVAL;
|
|
|
|
if (ss.ss_flags != TARGET_SS_DISABLE
|
2007-09-27 15:57:58 +02:00
|
|
|
&& ss.ss_flags != TARGET_SS_ONSTACK
|
|
|
|
&& ss.ss_flags != 0)
|
|
|
|
goto out;
|
|
|
|
|
2018-12-13 23:37:37 +01:00
|
|
|
if (ss.ss_flags == TARGET_SS_DISABLE) {
|
2007-09-27 15:57:58 +02:00
|
|
|
ss.ss_size = 0;
|
|
|
|
ss.ss_sp = 0;
|
2018-12-13 23:37:37 +01:00
|
|
|
} else {
|
2007-10-20 22:23:07 +02:00
|
|
|
ret = -TARGET_ENOMEM;
|
2014-08-12 20:53:40 +02:00
|
|
|
if (ss.ss_size < minstacksize) {
|
2007-09-27 15:57:58 +02:00
|
|
|
goto out;
|
2014-08-12 20:53:40 +02:00
|
|
|
}
|
2018-12-13 23:37:37 +01:00
|
|
|
}
|
2007-09-27 15:57:58 +02:00
|
|
|
|
2019-07-25 15:16:45 +02:00
|
|
|
ts->sigaltstack_used.ss_sp = ss.ss_sp;
|
|
|
|
ts->sigaltstack_used.ss_size = ss.ss_size;
|
2007-09-27 15:57:58 +02:00
|
|
|
}
|
|
|
|
|
2007-11-11 15:26:47 +01:00
|
|
|
if (uoss_addr) {
|
2007-10-20 22:23:07 +02:00
|
|
|
ret = -TARGET_EFAULT;
|
2007-11-11 15:26:47 +01:00
|
|
|
if (copy_to_user(uoss_addr, &oss, sizeof(oss)))
|
2007-09-27 15:57:58 +02:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = 0;
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-05-27 16:51:54 +02:00
|
|
|
/* do_sigaction() return target values and host errnos */
|
2003-03-23 02:06:05 +01:00
|
|
|
int do_sigaction(int sig, const struct target_sigaction *act,
|
|
|
|
struct target_sigaction *oact)
|
|
|
|
{
|
2008-05-31 18:11:38 +02:00
|
|
|
struct target_sigaction *k;
|
2004-01-04 18:15:59 +01:00
|
|
|
struct sigaction act1;
|
|
|
|
int host_sig;
|
2007-10-20 22:23:07 +02:00
|
|
|
int ret = 0;
|
2003-03-23 02:06:05 +01:00
|
|
|
|
2020-02-12 13:56:58 +01:00
|
|
|
trace_signal_do_sigaction_guest(sig, TARGET_NSIG);
|
|
|
|
|
2016-05-27 16:51:54 +02:00
|
|
|
if (sig < 1 || sig > TARGET_NSIG || sig == TARGET_SIGKILL || sig == TARGET_SIGSTOP) {
|
|
|
|
return -TARGET_EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (block_signals()) {
|
|
|
|
return -TARGET_ERESTARTSYS;
|
|
|
|
}
|
|
|
|
|
2003-03-23 02:06:05 +01:00
|
|
|
k = &sigact_table[sig - 1];
|
|
|
|
if (oact) {
|
2013-01-05 01:39:32 +01:00
|
|
|
__put_user(k->_sa_handler, &oact->_sa_handler);
|
|
|
|
__put_user(k->sa_flags, &oact->sa_flags);
|
2017-10-31 13:53:52 +01:00
|
|
|
#ifdef TARGET_ARCH_HAS_SA_RESTORER
|
2013-01-05 01:39:32 +01:00
|
|
|
__put_user(k->sa_restorer, &oact->sa_restorer);
|
2007-05-13 15:58:00 +02:00
|
|
|
#endif
|
2013-01-05 01:39:32 +01:00
|
|
|
/* Not swapped. */
|
2008-05-31 18:11:38 +02:00
|
|
|
oact->sa_mask = k->sa_mask;
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
if (act) {
|
2008-05-31 18:11:38 +02:00
|
|
|
/* FIXME: This is not threadsafe. */
|
2013-01-05 01:39:32 +01:00
|
|
|
__get_user(k->_sa_handler, &act->_sa_handler);
|
|
|
|
__get_user(k->sa_flags, &act->sa_flags);
|
2017-10-31 13:53:52 +01:00
|
|
|
#ifdef TARGET_ARCH_HAS_SA_RESTORER
|
2013-01-05 01:39:32 +01:00
|
|
|
__get_user(k->sa_restorer, &act->sa_restorer);
|
2007-05-13 15:58:00 +02:00
|
|
|
#endif
|
2013-01-05 01:39:32 +01:00
|
|
|
/* To be swapped in target_to_host_sigset. */
|
2008-05-31 18:11:38 +02:00
|
|
|
k->sa_mask = act->sa_mask;
|
2004-01-04 18:15:59 +01:00
|
|
|
|
|
|
|
/* we update the host linux signal state */
|
|
|
|
host_sig = target_to_host_signal(sig);
|
2020-02-12 13:56:58 +01:00
|
|
|
trace_signal_do_sigaction_host(host_sig, TARGET_NSIG);
|
|
|
|
if (host_sig > SIGRTMAX) {
|
|
|
|
/* we don't have enough host signals to map all target signals */
|
|
|
|
qemu_log_mask(LOG_UNIMP, "Unsupported target signal #%d, ignored\n",
|
|
|
|
sig);
|
|
|
|
/*
|
|
|
|
* we don't return an error here because some programs try to
|
|
|
|
* register an handler for all possible rt signals even if they
|
|
|
|
* don't need it.
|
|
|
|
* An error here can abort them whereas there can be no problem
|
|
|
|
* to not have the signal available later.
|
|
|
|
* This is the case for golang,
|
|
|
|
* See https://github.com/golang/go/issues/33746
|
|
|
|
* So we silently ignore the error.
|
|
|
|
*/
|
|
|
|
return 0;
|
|
|
|
}
|
2004-01-04 18:15:59 +01:00
|
|
|
if (host_sig != SIGSEGV && host_sig != SIGBUS) {
|
|
|
|
sigfillset(&act1.sa_mask);
|
|
|
|
act1.sa_flags = SA_SIGINFO;
|
2008-05-31 18:11:38 +02:00
|
|
|
if (k->sa_flags & TARGET_SA_RESTART)
|
2004-01-04 18:15:59 +01:00
|
|
|
act1.sa_flags |= SA_RESTART;
|
|
|
|
/* NOTE: it is important to update the host kernel signal
|
|
|
|
ignore state to avoid getting unexpected interrupted
|
|
|
|
syscalls */
|
2008-05-31 18:11:38 +02:00
|
|
|
if (k->_sa_handler == TARGET_SIG_IGN) {
|
2004-01-04 18:15:59 +01:00
|
|
|
act1.sa_sigaction = (void *)SIG_IGN;
|
2008-05-31 18:11:38 +02:00
|
|
|
} else if (k->_sa_handler == TARGET_SIG_DFL) {
|
2008-12-18 23:44:13 +01:00
|
|
|
if (fatal_signal (sig))
|
|
|
|
act1.sa_sigaction = host_signal_handler;
|
|
|
|
else
|
|
|
|
act1.sa_sigaction = (void *)SIG_DFL;
|
2004-01-04 18:15:59 +01:00
|
|
|
} else {
|
|
|
|
act1.sa_sigaction = host_signal_handler;
|
|
|
|
}
|
2007-10-20 22:23:07 +02:00
|
|
|
ret = sigaction(host_sig, &act1, NULL);
|
2004-01-04 18:15:59 +01:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
2007-10-20 22:23:07 +02:00
|
|
|
return ret;
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
|
2016-07-06 16:09:29 +02:00
|
|
|
static void handle_pending_signal(CPUArchState *cpu_env, int sig,
|
|
|
|
struct emulated_sigtable *k)
|
2016-05-27 16:51:43 +02:00
|
|
|
{
|
2019-03-23 00:07:18 +01:00
|
|
|
CPUState *cpu = env_cpu(cpu_env);
|
2016-05-27 16:51:43 +02:00
|
|
|
abi_ulong handler;
|
2016-05-27 16:51:49 +02:00
|
|
|
sigset_t set;
|
2016-05-27 16:51:43 +02:00
|
|
|
target_sigset_t target_old_set;
|
|
|
|
struct target_sigaction *sa;
|
|
|
|
TaskState *ts = cpu->opaque;
|
2003-03-23 02:06:05 +01:00
|
|
|
|
2015-11-13 13:52:21 +01:00
|
|
|
trace_user_handle_signal(cpu_env, sig);
|
2003-03-23 02:06:05 +01:00
|
|
|
/* dequeue signal */
|
2016-05-27 16:51:52 +02:00
|
|
|
k->pending = 0;
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2013-06-27 19:49:31 +02:00
|
|
|
sig = gdb_handlesig(cpu, sig);
|
2005-04-17 21:16:13 +02:00
|
|
|
if (!sig) {
|
2008-12-18 23:44:13 +01:00
|
|
|
sa = NULL;
|
|
|
|
handler = TARGET_SIG_IGN;
|
|
|
|
} else {
|
|
|
|
sa = &sigact_table[sig - 1];
|
|
|
|
handler = sa->_sa_handler;
|
2005-04-17 21:16:13 +02:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
|
2020-02-04 03:54:14 +01:00
|
|
|
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
|
2016-07-18 19:12:24 +02:00
|
|
|
print_taken_signal(sig, &k->info);
|
|
|
|
}
|
|
|
|
|
2003-03-23 02:06:05 +01:00
|
|
|
if (handler == TARGET_SIG_DFL) {
|
2008-12-18 23:44:13 +01:00
|
|
|
/* default handler : ignore some signal. The other are job control or fatal */
|
|
|
|
if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) {
|
|
|
|
kill(getpid(),SIGSTOP);
|
|
|
|
} else if (sig != TARGET_SIGCHLD &&
|
|
|
|
sig != TARGET_SIGURG &&
|
|
|
|
sig != TARGET_SIGWINCH &&
|
|
|
|
sig != TARGET_SIGCONT) {
|
2016-07-28 17:44:49 +02:00
|
|
|
dump_core_and_abort(sig);
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
|
|
|
} else if (handler == TARGET_SIG_IGN) {
|
|
|
|
/* ignore sig */
|
|
|
|
} else if (handler == TARGET_SIG_ERR) {
|
2016-07-28 17:44:49 +02:00
|
|
|
dump_core_and_abort(sig);
|
2003-03-23 02:06:05 +01:00
|
|
|
} else {
|
2003-03-23 17:49:39 +01:00
|
|
|
/* compute the blocked signals during the handler execution */
|
2016-05-27 16:51:49 +02:00
|
|
|
sigset_t *blocked_set;
|
|
|
|
|
2008-05-31 18:11:38 +02:00
|
|
|
target_to_host_sigset(&set, &sa->sa_mask);
|
2003-03-23 17:49:39 +01:00
|
|
|
/* SA_NODEFER indicates that the current signal should not be
|
|
|
|
blocked during the handler */
|
2008-05-31 18:11:38 +02:00
|
|
|
if (!(sa->sa_flags & TARGET_SA_NODEFER))
|
2003-03-23 17:49:39 +01:00
|
|
|
sigaddset(&set, target_to_host_signal(sig));
|
2007-09-17 10:09:54 +02:00
|
|
|
|
2003-03-23 17:49:39 +01:00
|
|
|
/* save the previous blocked signal state to restore it at the
|
|
|
|
end of the signal execution (see do_sigreturn) */
|
2016-05-27 16:51:49 +02:00
|
|
|
host_to_target_sigset_internal(&target_old_set, &ts->signal_mask);
|
|
|
|
|
|
|
|
/* block signals in the handler */
|
|
|
|
blocked_set = ts->in_sigsuspend ?
|
|
|
|
&ts->sigsuspend_mask : &ts->signal_mask;
|
|
|
|
sigorset(&ts->signal_mask, blocked_set, &set);
|
|
|
|
ts->in_sigsuspend = 0;
|
2003-03-23 17:49:39 +01:00
|
|
|
|
2003-03-30 23:02:40 +02:00
|
|
|
/* if the CPU is in VM86 mode, we restore the 32 bit values */
|
2007-04-06 10:56:50 +02:00
|
|
|
#if defined(TARGET_I386) && !defined(TARGET_X86_64)
|
2003-03-30 23:02:40 +02:00
|
|
|
{
|
|
|
|
CPUX86State *env = cpu_env;
|
|
|
|
if (env->eflags & VM_MASK)
|
|
|
|
save_v86_state(env);
|
|
|
|
}
|
|
|
|
#endif
|
2003-03-23 17:49:39 +01:00
|
|
|
/* prepare the stack frame of the virtual CPU */
|
2018-04-24 21:26:35 +02:00
|
|
|
#if defined(TARGET_ARCH_HAS_SETUP_FRAME)
|
|
|
|
if (sa->sa_flags & TARGET_SA_SIGINFO) {
|
2016-05-27 16:51:52 +02:00
|
|
|
setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env);
|
2018-04-24 21:26:35 +02:00
|
|
|
} else {
|
2008-05-31 18:11:38 +02:00
|
|
|
setup_frame(sig, sa, &target_old_set, cpu_env);
|
2018-04-24 21:26:35 +02:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
/* These targets do not have traditional signals. */
|
|
|
|
setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env);
|
2013-02-10 19:30:42 +01:00
|
|
|
#endif
|
2016-05-27 16:51:45 +02:00
|
|
|
if (sa->sa_flags & TARGET_SA_RESETHAND) {
|
2008-05-31 18:11:38 +02:00
|
|
|
sa->_sa_handler = TARGET_SIG_DFL;
|
2016-05-27 16:51:45 +02:00
|
|
|
}
|
2003-02-18 23:55:36 +01:00
|
|
|
}
|
2003-03-23 02:06:05 +01:00
|
|
|
}
|
2016-05-27 16:51:44 +02:00
|
|
|
|
|
|
|
void process_pending_signals(CPUArchState *cpu_env)
|
|
|
|
{
|
2019-03-23 00:07:18 +01:00
|
|
|
CPUState *cpu = env_cpu(cpu_env);
|
2016-05-27 16:51:44 +02:00
|
|
|
int sig;
|
|
|
|
TaskState *ts = cpu->opaque;
|
2016-05-27 16:51:49 +02:00
|
|
|
sigset_t set;
|
|
|
|
sigset_t *blocked_set;
|
2016-05-27 16:51:44 +02:00
|
|
|
|
2016-05-27 16:51:49 +02:00
|
|
|
while (atomic_read(&ts->signal_pending)) {
|
|
|
|
/* FIXME: This is not threadsafe. */
|
|
|
|
sigfillset(&set);
|
|
|
|
sigprocmask(SIG_SETMASK, &set, 0);
|
|
|
|
|
2016-07-28 17:44:45 +02:00
|
|
|
restart_scan:
|
2016-05-27 16:51:53 +02:00
|
|
|
sig = ts->sync_signal.pending;
|
|
|
|
if (sig) {
|
|
|
|
/* Synchronous signals are forced,
|
|
|
|
* see force_sig_info() and callers in Linux
|
|
|
|
* Note that not all of our queue_signal() calls in QEMU correspond
|
|
|
|
* to force_sig_info() calls in Linux (some are send_sig_info()).
|
|
|
|
* However it seems like a kernel bug to me to allow the process
|
|
|
|
* to block a synchronous signal since it could then just end up
|
|
|
|
* looping round and round indefinitely.
|
|
|
|
*/
|
|
|
|
if (sigismember(&ts->signal_mask, target_to_host_signal_table[sig])
|
|
|
|
|| sigact_table[sig - 1]._sa_handler == TARGET_SIG_IGN) {
|
|
|
|
sigdelset(&ts->signal_mask, target_to_host_signal_table[sig]);
|
|
|
|
sigact_table[sig - 1]._sa_handler = TARGET_SIG_DFL;
|
|
|
|
}
|
|
|
|
|
2016-07-06 16:09:29 +02:00
|
|
|
handle_pending_signal(cpu_env, sig, &ts->sync_signal);
|
2016-05-27 16:51:53 +02:00
|
|
|
}
|
|
|
|
|
2016-05-27 16:51:49 +02:00
|
|
|
for (sig = 1; sig <= TARGET_NSIG; sig++) {
|
|
|
|
blocked_set = ts->in_sigsuspend ?
|
|
|
|
&ts->sigsuspend_mask : &ts->signal_mask;
|
|
|
|
|
|
|
|
if (ts->sigtab[sig - 1].pending &&
|
|
|
|
(!sigismember(blocked_set,
|
2016-05-27 16:51:53 +02:00
|
|
|
target_to_host_signal_table[sig]))) {
|
2016-07-06 16:09:29 +02:00
|
|
|
handle_pending_signal(cpu_env, sig, &ts->sigtab[sig - 1]);
|
2016-07-28 17:44:45 +02:00
|
|
|
/* Restart scan from the beginning, as handle_pending_signal
|
|
|
|
* might have resulted in a new synchronous signal (eg SIGSEGV).
|
|
|
|
*/
|
|
|
|
goto restart_scan;
|
2016-05-27 16:51:49 +02:00
|
|
|
}
|
2016-05-27 16:51:44 +02:00
|
|
|
}
|
2016-05-27 16:51:49 +02:00
|
|
|
|
|
|
|
/* if no signal is pending, unblock signals and recheck (the act
|
|
|
|
* of unblocking might cause us to take another host signal which
|
|
|
|
* will set signal_pending again).
|
|
|
|
*/
|
|
|
|
atomic_set(&ts->signal_pending, 0);
|
|
|
|
ts->in_sigsuspend = 0;
|
|
|
|
set = ts->signal_mask;
|
|
|
|
sigdelset(&set, SIGSEGV);
|
|
|
|
sigdelset(&set, SIGBUS);
|
|
|
|
sigprocmask(SIG_SETMASK, &set, 0);
|
|
|
|
}
|
|
|
|
ts->in_sigsuspend = 0;
|
2016-05-27 16:51:44 +02:00
|
|
|
}
|