diff options
author | kib <kib@FreeBSD.org> | 2008-10-19 10:02:26 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2008-10-19 10:02:26 +0000 |
commit | 29ccf7d1668ab3c3e3e82c53dbf69d4c5a9be824 (patch) | |
tree | b27837b90bdbe0e63b7ff72ce0c5c2b29bb7cbd5 /sys/i386/linux | |
parent | 40d90afbe6bf6ae24e4859c61cb929f3f0ccc441 (diff) | |
download | FreeBSD-src-29ccf7d1668ab3c3e3e82c53dbf69d4c5a9be824.zip FreeBSD-src-29ccf7d1668ab3c3e3e82c53dbf69d4c5a9be824.tar.gz |
Correctly fill siginfo for the signals delivered by linux tkill/tgkill.
It is required for async cancellation to work.
Fix PROC_LOCK leak in linux_tgkill when signal delivery attempt is made
to not linux process.
Do not call em_find(p, ...) with p unlocked.
Move common code for linux_tkill() and linux_tgkill() into
linux_do_tkill().
Change linux siginfo_t definition to match actual linux one. Extend
uid fields to 4 bytes from 2. The extension does not change structure
layout and is binary compatible with previous definition, because i386
is little endian, and each uid field has 2 byte padding after it.
Reported by: Nicolas Joly <njoly pasteur fr>
Submitted by: dchangin
MFC after: 1 month
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linux.h | 32 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 4 |
2 files changed, 22 insertions, 14 deletions
diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 4f2dbe9..6b11e84 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -80,6 +80,8 @@ typedef l_long l_suseconds_t; typedef l_long l_time_t; typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; +typedef l_int l_timer_t; +typedef l_int l_mqd_t; typedef struct { l_int val[2]; @@ -374,6 +376,11 @@ struct l_ucontext { #define LINUX_SI_MAX_SIZE 128 #define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3) +typedef union l_sigval { + l_int sival_int; + l_uintptr_t sival_ptr; +} l_sigval_t; + typedef struct l_siginfo { l_int lsi_signo; l_int lsi_errno; @@ -383,34 +390,37 @@ typedef struct l_siginfo { struct { l_pid_t _pid; - l_uid16_t _uid; + l_uid_t _uid; } _kill; struct { - l_uint _timer1; - l_uint _timer2; + l_timer_t _tid; + l_int _overrun; + char _pad[sizeof(l_uid_t) - sizeof(l_int)]; + l_sigval_t _sigval; + l_int _sys_private; } _timer; struct { l_pid_t _pid; /* sender's pid */ - l_uid16_t _uid; /* sender's uid */ - union sigval _sigval; + l_uid_t _uid; /* sender's uid */ + l_sigval_t _sigval; } _rt; struct { l_pid_t _pid; /* which child */ - l_uid16_t _uid; /* sender's uid */ + l_uid_t _uid; /* sender's uid */ l_int _status; /* exit code */ l_clock_t _utime; l_clock_t _stime; } _sigchld; struct { - void *_addr; /* Faulting insn/memory ref. */ + l_uintptr_t _addr; /* Faulting insn/memory ref. */ } _sigfault; struct { - l_int _band; /* POLL_IN,POLL_OUT,POLL_MSG */ + l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ l_int _fd; } _sigpoll; } _sifields; @@ -418,6 +428,9 @@ typedef struct l_siginfo { #define lsi_pid _sifields._kill._pid #define lsi_uid _sifields._kill._uid +#define lsi_tid _sifields._timer._tid +#define lsi_overrun _sifields._timer._overrun +#define lsi_sys_private _sifields._timer._sys_private #define lsi_status _sifields._sigchld._status #define lsi_utime _sifields._sigchld._utime #define lsi_stime _sifields._sigchld._stime @@ -825,9 +838,6 @@ struct l_desc_struct { #define LINUX_CLOCK_REALTIME_HR 4 #define LINUX_CLOCK_MONOTONIC_HR 5 -typedef int l_timer_t; -typedef int l_mqd_t; - #define LINUX_CLONE_VM 0x00000100 #define LINUX_CLONE_FS 0x00000200 #define LINUX_CLONE_FILES 0x00000400 diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 91f943d..a3acfc9 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -323,9 +323,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) frame.sf_ucontext = &fp->sf_sc; /* Fill in POSIX parts */ - frame.sf_si.lsi_signo = sig; - frame.sf_si.lsi_code = code; - frame.sf_si.lsi_addr = ksi->ksi_addr; + ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig); /* * Build the signal context to be used by sigreturn. |