summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_signal.c
Commit message (Collapse)AuthorAgeFilesLines
* Rework signal code to allow using it by other modules, like linprocfs:dchagin2015-05-241-85/+18
| | | | | | | | | | | | | | | | | 1. Linux sigset always 64 bit on all platforms. In order to move Linux sigset code to the linux_common module define it as 64 bit int. Move Linux sigset manipulation routines to the MI path. 2. Move Linux signal number definitions to the MI path. In general, they are the same on all platforms except for a few signals. 3. Map Linux RT signals to the FreeBSD RT signals and hide signal conversion tables to avoid conversion errors. 4. Emulate Linux SIGPWR signal via FreeBSD SIGRTMIN signal which is outside of allowed on Linux signal numbers. PR: 197216
* According to Linux man sigaltstack(3) shall return EINVAL if the ssdchagin2015-05-241-0/+26
| | | | | | | | | | | | | argument is not a null pointer, and the ss_flags member pointed to by ss contains flags other than SS_DISABLE. However, in fact, Linux also allows SS_ONSTACK flag which is simply ignored. For buggy apps (at least mono) ignore other than SS_DISABLE flags as a Linux do. While here move MI part of sigaltstack code to the appropriate place. Reported by: abi at abinet dot ru
* Use the BSD_TO_LINUX_SIGNAL() wherever there is no needdchagin2015-05-241-8/+3
| | | | | | to check the ABI as it is known. Differential Revision: https://reviews.freebsd.org/D1086
* Fix compilation with -DDEBUG option.dchagin2015-05-241-2/+2
| | | | | Differential Revision: https://reviews.freebsd.org/D1070 Reviewed by: trasz
* Disable i386 call for x86-64 Linux.dchagin2015-05-241-4/+8
| | | | | Differential Revision: https://reviews.freebsd.org/D1067 Reviewed by: trasz
* Implement rt_sigqueueinfo() system call.dchagin2015-05-241-0/+55
| | | | | Differential Revision: https://reviews.freebsd.org/D1047 Reviewed by: trasz
* Add a siginfo_t conversion function.dchagin2015-05-241-24/+101
| | | | | Differential Revision: https://reviews.freebsd.org/D1044 Reviewed by: emaste, trasz
* Switch linuxulator to use the native 1:1 threads.dchagin2015-05-241-45/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reasons: 1. Get rid of the stubs/quirks with process dethreading, process reparent when the process group leader exits and close to this problems on wait(), waitpid(), etc. 2. Reuse our kernel code instead of writing excessive thread managment routines in Linuxulator. Implementation details: 1. The thread is created via kern_thr_new() in the clone() call with the CLONE_THREAD parameter. Thus, everything else is a process. 2. The test that the process has a threads is done via P_HADTHREADS bit p_flag of struct proc. 3. Per thread emulator state data structure is now located in the struct thread and freed in the thread_dtor() hook. Mandatory holdig of the p_mtx required when referencing emuldata from the other threads. 4. PID mangling has changed. Now Linux pid is the native tid and Linux tgid is the native pid, with the exception of the first thread in the process where tid and pid are one and the same. Ugliness: In case when the Linux thread is the initial thread in the thread group thread id is equal to the process id. Glibc depends on this magic (assert in pthread_getattr_np.c). So for system calls that take thread id as a parameter we should use the special method to reference struct thread. Differential Revision: https://reviews.freebsd.org/D1039
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-1/+1
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* For realtime signals fill the sigval value.dchagin2011-02-151-0/+4
|
* Make a linux_rt_sigtimedwait() system call is actually working.dchagin2011-02-151-10/+6
| | | | | | | 1) Translate the native signal number in the appropriate Linux signal. 2) Remove bogus code, which can lead to a panic as it calls kern_sigtimedwait with same ksiginfo. 3) Return the corresponding signal number.
* Style(9) fix. Wrap long lines in linux_rt_sigtimedwait().dchagin2011-02-151-5/+8
|
* Style(9) fix.dchagin2011-01-231-1/+1
| | | | | Approved by: kib(mentor) MFC after: 1 month
* Tweak the in-kernel API for sending signals to threads:jhb2010-06-291-2/+2
| | | | | | | | | | - Rename tdsignal() to tdsendsignal() and make it private to kern_sig.c. - Add tdsignal() and tdksignal() routines that mirror psignal() and pksignal() except that they accept a thread as an argument instead of a process. They send a signal to a specific thread rather than to an individual process. Reviewed by: kib
* Signal 0 is used to check the permission for current process to signalkib2009-12-181-1/+1
| | | | | | | | | target one. Since r184058, linux_do_tkill() calls tdsignal() instead of kill(), without checking for validity of supplied signal number. Prevent panic when supplied signal is 0 by finishing work after checks. Found and tested by: scf MFC after: 3 days
* Replace AUDIT_ARG() with variable argument macros with a set more morerwatson2009-06-271-3/+3
| | | | | | | | | | | | | | specific macros for each audit argument type. This makes it easier to follow call-graphs, especially for automated analysis tools (such as fxr). In MFC, we should leave the existing AUDIT_ARG() macros as they may be used by third-party kernel modules. Suggested by: brooks Approved by: re (kib) Obtained from: TrustedBSD Project MFC after: 1 week
* Correctly fill siginfo for the signals delivered by linux tkill/tgkill.kib2008-10-191-24/+89
| | | | | | | | | | | | | | | | | | | | | 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
* MFp4 (112534):netchild2007-01-071-3/+1
| | | | | | | | | Dont lock em in a case of just using em->shared->group_pid because the group_pid never changes. Submitted by: rdivacky Reviewed by: kib Glanced at by: jhb
* MFp4 (112498):netchild2007-01-071-1/+1
| | | | | | Rename the locking flags to EMUL_DOLOCK and EMUL_DONTLOCK to prevent confusion. Submitted by: rdivacky
* Fix amd64 build.delphij2007-01-011-2/+2
| | | | Submitted by: Divacky Roman <xdivac02 stud fit vutbr cz>
* MFp4 (111746, 108671, 108945, 112352):netchild2006-12-311-0/+85
| | | | | | | | | - add linux utimes syscall [1] - add linux rt_sigtimedwait syscall [2] Submitted by: "Scot Hetzel" <swhetzel@gmail.com> [1] Submitted by: Bruce Becker <hostmaster@whois.gts.net> [2] PR: 93199 [2]
* Fix compile (use the right variable name).netchild2006-10-151-1/+1
|
* MFP4 (107868 - 107870):netchild2006-10-151-2/+2
| | | | | | Use a macro to test for a valid signal instead of doing it my hand everywhere. Submitted by: rdivacky
* Get rid of some nested includes.netchild2006-08-191-0/+1
| | | | | | Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb
* Move some stuff into headers where they belong.netchild2006-08-171-3/+0
| | | | | | Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb, ssouhlal
* Add the linux 2.6.x stuff (not used by default!):netchild2006-08-151-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - TLS - complete - pid/tid mangling - complete - thread area - complete - futexes - complete with issues - clone() extension - complete with some possible minor issues - mq*/timer*/clock* stuff - complete but untested and the mq* stuff is disabled when not build as part of the kernel with native FreeBSD mq* support (module support for this will come later) Tested with: - linux-firefox - works, tested - linux-opera - works, tested - linux-realplay - doesnt work, issue with futexes - linux-skype - doesnt work, issue with futexes - linux-rt2-demo - works, tested - linux-acroread - doesnt work, unknown reason (coredump) and sometimes issue with futexes - various unix utilities in linux-base-gentoo3 and linux-base-fc4: everything tried worked On amd64 not everything is supported like on i386, the catchup is planned for later when the remaining bugs in the new functions are fixed. To test this new stuff, you have to run sysctl compat.linux.osrelease=2.6.16 to switch back use sysctl compat.linux.osrelease=2.4.2 Don't switch while running a linux program, strange things may or may not happen. Sponsored by: Google SoC 2006 Submitted by: rdivacky Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
* Now that we don't have a linuxolator on alpha anymore:netchild2006-05-101-18/+0
| | | | | - unifdef __alpha__ - revert rev. 1.66 of linux_socket.c
* Implement rt_sigpending in the linuxolator.netchild2006-05-101-0/+28
| | | | | PR: 92671 Submitted by: Markus Niemist"o <markus.niemisto@gmx.net>
* Unbreak COMPAT_LINUX32 option support on amd64.ru2006-03-191-0/+2
| | | | Broken by: netchild
* Fixup some problems in my previous commit (COMPAT_43).netchild2006-03-181-2/+0
| | | | Pointyhat to: netchild
* Fix -Wundef.ru2005-12-041-1/+1
|
* Unbreak the kernel build. Pointy hat to: sobomax.njl2005-02-131-1/+1
|
* Backout previous change (disabling of security checks for signals deliveredsobomax2005-02-131-2/+2
| | | | | | in emulation layers), since it appears to be too broad. Requested by: rwatson
* Split out kill(2) syscall service routine into user-level and kernel part, thesobomax2005-02-131-1/+1
| | | | | | | | | | | | | | | | | former is callable from user space and the latter from the kernel one. Make kernel version take additional argument which tells if the respective call should check for additional restrictions for sending signals to suid/sugid applications or not. Make all emulation layers using non-checked version, since signal numbers in emulation layers can have different meaning that in native mode and such protection can cause misbehaviour. As a result remove LIBTHR from the signals allowed to be delivered to a suid/sugid application. Requested (sorta) by: rwatson MFC after: 2 weeks
* Match the LINUX32's style with existing styleobrien2005-01-141-5/+5
| | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic.
* Fix the 'DEBUG' argument code to unbreak the amd64 LINT build.obrien2004-08-161-1/+1
|
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariestjr2004-08-161-3/+14
| | | | | | | | | | | | | | | on AMD64, and the general case where the emulated platform has different size pointers than we use natively: - declare certain structure members as l_uintptr_t and use the new PTRIN and PTROUT macros to convert to and from native pointers. - declare some structures __packed on amd64 when the layout would differ from that used on i386. - include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h> if compiling with COMPAT_LINUX32. This will need to be revisited before 32-bit and 64-bit Linux emulation support can coexist in the same kernel. - other small scattered changes. This should be a no-op on i386 and Alpha.
* Use __FBSDID().obrien2003-06-101-2/+3
|
* Argh! We want to return the old signal set when the error return is zerojhb2003-04-281-1/+1
| | | | | | | (i.e. success), not non-zero (failure). Submitted by: tegge Pointy hat to: jhb
* Use a switch to convert the Linux sigprocmask flags to the equivalentjhb2003-04-251-3/+14
| | | | | | | | | | | FreeBSD flags instead of just adding one to the Linux flags. This should be identical to the previous version except that I have at least one report of this patch fixing problems people were having with Linux apps after my last commit to this file. It is safer to use the switch then to make assumptions about the flag values anyways, esp. since we currently use MD defines for the values of the flags and this is MI code. Tested by: Michael Class <michael_class@gmx.net>
* - Replace inline implementations of sigprocmask() with calls tojhb2003-04-221-29/+11
| | | | | | | kern_sigprocmask() in the various binary compatibility emulators. - Replace calls to sigsuspend(), sigaltstack(), sigaction(), and sigprocmask() that used the stackgap with calls to the corresponding kern_sig*() functions instead without using the stackgap.
* Don't hold the proc lock while performing sigset conversions on localjhb2003-04-171-1/+1
| | | | variables.
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-14/+15
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Add MPSAFE comment to linux_sigpending().tjr2003-02-161-0/+3
|
* Back our kernel support for reliable signal queues.jmallett2002-10-011-2/+1
| | | | Requested by: rwatson, phk, and many others
* First half of implementation of ksiginfo, signal queues, and such. Thisjmallett2002-09-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | gets signals operating based on a TailQ, and is good enough to run X11, GNOME, and do job control. There are some intricate parts which could be more refined to match the sigset_t versions, but those require further evaluation of directions in which our signal system can expand and contract to fit our needs. After this has been in the tree for a while, I will make in kernel API changes, most notably to trapsignal(9) and sendsig(9), to use ksiginfo more robustly, such that we can actually pass information with our (queued) signals to the userland. That will also result in using a struct ksiginfo pointer, rather than a signal number, in a lot of kern_sig.c, to refer to an individual pending signal queue member, but right now there is no defined behaviour for such. CODAFS is unfinished in this regard because the logic is unclear in some places. Sponsored by: New Gold Technology Reviewed by: bde, tjr, jake [an older version, logic similar]
* Use the new kern_* functions to avoid the need to store argumentsiedowse2002-09-011-17/+9
| | | | | | | | in the stack gap. This converts most VFS and signal related system calls, as well as select(). Discussed on: -arch Approved by: marcel
* Fix typo in the BSD copyright: s/withough/without/schweikh2002-06-021-1/+1
| | | | | Spotted and suggested by: des MFC after: 3 weeks
* Moved signal handling and rescheduling from userret() to ast() so thatbde2002-04-041-0/+3
| | | | | | | | | | | they aren't in the usual path of execution for syscalls and traps. The main complication for this is that we have to set flags to control ast() everywhere that changes the signal mask. Avoid locking in userret() in most of the remaining cases. Submitted by: luoqi (first part only, long ago, reorganized by me) Reminded by: dillon
OpenPOWER on IntegriCloud