summaryrefslogtreecommitdiff
path: root/sys/i386/linux/linux_ptrace.c
Commit message (Collapse)AuthorAgeFilesLines
* Correct proper nouns in the LinuxulatorEd Maste2018-02-221-1/+1
| | | | | | | | | | | - Capitalize Linux - Spell FreeBSD out in full - Address some style(9) on changed lines Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=329794
* Rationalize license text on Linuxolator filesEd Maste2018-02-161-15/+13
| | | | | | | | | | | | | | | Many licenses on Linuxolator files contained small variations from the standard FreeBSD license text. To avoid license proliferation switch to the standard 2-clause FreeBSD license for those files where I have permission from each of the listed copyright holders. Additional files waiting on permission from others are listed in review D14210. Approved by: kan, marcel, sos, rdivacky MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=329370
* sys/i386: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326260
* For i386, remove config options CPU_DISABLE_CMPXCHG, CPU_DISABLE_SSEKonstantin Belousov2017-02-031-12/+0
| | | | | | | | | | | | | | | | | | | | and device npx. This means that FPU is always initialized and handled when available, and SSE+ register file and exception are handled when available. This makes the kernel FPU code much easier to maintain by the cost of slight bloat for CPUs older than 25 years. CPU_DISABLE_CMPXCHG outlived its usefulness, see the removed comment explaining the original purpose. Suggested by and discussed with: bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Notes: svn path=/head/; revision=313154
* Rename PTRACE_SYSCALL to LINUX_PTRACE_SYSCALL.John Baldwin2016-07-161-2/+2
| | | | | | | Suggested by: kib Notes: svn path=/head/; revision=302921
* Rework signal code to allow using it by other modules, like linprocfs:Dmitry Chagin2015-05-241-2/+1
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=283474
* MFamd64: Add support for extended FPU states on i386. This includesJohn Baldwin2014-11-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | support for AVX on i386. - Similar to amd64, move the FPU save area out of the PCB and instead store saved FPU state in a variable-sized buffer after the PCB on the stack. - To support the variable PCB location, alter the locore code to only use the bottom-most page of proc0stack for init386(). init386() returns the correct stack pointer to locore which adjusts the stack for thread0 before calling mi_startup(). - Don't bother setting cr3 in thread0's pcb in locore before calling init386(). It wasn't used (init386() overwrote it at the end) and it doesn't work with the variable-sized FPU save area. - Remove the new-bus attachment from npx. This was only ever useful for external co-processors using IRQ13, but those have not been supported for several years. npxinit() is now called much earlier during boot (init386()) similar to amd64. - Implement PT_{GET,SET}XSTATE and I386_GET_XFPUSTATE. - npxsave() is now only called from context switch contexts so it can use XSAVEOPT. Differential Revision: https://reviews.freebsd.org/D1058 Reviewed by: kib Tested on: FreeBSD/i386 VM under bhyve on Intel i5-2520 Notes: svn path=/head/; revision=273995
* Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.hJohn Baldwin2013-01-291-0/+1
| | | | | | | | | | by moving bits that are MI out into headers in compat/linux. Reviewed by: Chagin Dmitry dmitry | gmail MFC after: 2 weeks Notes: svn path=/head/; revision=246085
* Introduce the x86 kernel interfaces to allow kernel code to useKonstantin Belousov2010-06-051-2/+2
| | | | | | | | | | | | | | | | | | | FPU/SSE hardware. Caller should provide a save area that is chained into the stack of the areas; pcb save_area for usermode FPU state is on top. The pcb now contains a pointer to the current FPU saved area, used during FPUDNA handling and context switches. There is also a facility to allow the kernel thread to use pcb save_area. Change the dreaded warnings "npxdna in kernel mode!" into the panics when FPU usage is not registered. KPI discussed with: fabient Tested by: pho, fabient Hardware provided by: Sentex Communications MFC after: 1 month Notes: svn path=/head/; revision=208833
* - Move all of the PS_ flags into either p_flag or td_flags.Jeff Roberson2007-09-171-2/+2
| | | | | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith) Notes: svn path=/head/; revision=172207
* Close some races between procfs/ptrace and exit(2):John Baldwin2006-02-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Reorder the events in exit(2) slightly so that we trigger the S_EXIT stop event earlier. After we have signalled that, we set P_WEXIT and then wait for any processes with a hold on the vmspace via PHOLD to release it. PHOLD now KASSERT()'s that P_WEXIT is clear when it is invoked, and PRELE now does a wakeup if P_WEXIT is set and p_lock drops to zero. - Change proc_rwmem() to require that the processing read from has its vmspace held via PHOLD by the caller and get rid of all the junk to screw around with the vmspace reference count as we no longer need it. - In ptrace() and pseudofs(), treat a process with P_WEXIT set as if it doesn't exist. - Only do one PHOLD in kern_ptrace() now, and do it earlier so it covers FIX_SSTEP() (since on alpha at least this can end up calling proc_rwmem() to clear an earlier single-step simualted via a breakpoint). We only do one to avoid races. Also, by making the EINVAL error for unknown requests be part of the default: case in the switch, the various switch cases can now just break out to return which removes a _lot_ of duplicated PRELE and proc unlocks, etc. Also, it fixes at least one bug where a LWP ptrace command could return EINVAL with the proc lock still held. - Changed the locking for ptrace_single_step(), ptrace_set_pc(), and ptrace_clear_single_step() to always be called with the proc lock held (it was a mixed bag previously). Alpha and arm have to drop the lock while the mess around with breakpoints, but other archs avoid extra lock release/acquires in ptrace(). I did have to fix a couple of other consumers in kern_kse and a few other places to hold the proc lock and PHOLD. Tested by: ps (1 mostly, but some bits of 2-4 as well) MFC after: 1 week Notes: svn path=/head/; revision=155922
* Remove the CPU_ENABLE_SSE option from the i386 and pc98 architectures,Xin LI2005-07-021-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | as they are already default for I686_CPU for almost 3 years, and CPU_DISABLE_SSE always disables it. On the other hand, CPU_ENABLE_SSE does not work for I486_CPU and I586_CPU. This commit has: - Removed the option from conf/options.* - Removed the option and comments from MD NOTES files - Simplified the CPU_ENABLE_SSE ifdef's so they don't deal with CPU_ENABLE_SSE from kernel configuration. (*) For most users, this commit should be largely no-op. If you used to place CPU_ENABLE_SSE into your kernel configuration for some reason, it is time to remove it. (*) The ifdef's of CPU_ENABLE_SSE are not removed at this point, since we need to change it to !defined(CPU_DISABLE_SSE) && defined(I686_CPU), not just !defined(CPU_DISABLE_SSE), if we really want to do so. Discussed on: -arch Approved by: re (scottl) Notes: svn path=/head/; revision=147741
* /* -> /*- for copyright notices, minor format tweaks as necessaryWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139790
* Fix the following race:David Schultz2004-10-011-3/+4
| | | | | | | | | | | | | | 1. Process p1 is currently being swapped in. 2. Process p2 calls linux_ptrace(PTRACE_GETFPXREGS, p1_pid, ...) 3. After acquiring a reference to FIRST_THREAD_IN_PROC(p1), p2 blocks in faultin() while p1 finishes being swapped in. This means p2 won't get back the lock on p1 until after p1's threads are runnable. 4. After p1 is swapped in, the first thread in p1 exits. 5. p2 now uses its dangling reference to p1's first thread. Notes: svn path=/head/; revision=136003
* Consistently use __inline instead of __inline__ as the former is an empty macroStefan Farfeleder2004-07-041-1/+1
| | | | | | | in <sys/cdefs.h> for compilers without support for inline. Notes: svn path=/head/; revision=131575
* Use __FBSDID().David E. O'Brien2003-06-021-2/+3
| | | | Notes: svn path=/head/; revision=115705
* Prefer the proc lock to sched_lock when testing PS_INMEM now that it isJohn Baldwin2003-04-221-16/+8
| | | | | | | safe to do so. Notes: svn path=/head/; revision=113868
* Sync up with changes to ptrace() and use P_SHOULDSTOP instead ofJohn Baldwin2003-04-151-1/+1
| | | | | | | | | a duplicate P_TRACED check. Submitted by: marcel Notes: svn path=/head/; revision=113517
* Clean up whitespace and remove register keyword.Dag-Erling Smørgrav2003-03-031-3/+3
| | | | Notes: svn path=/head/; revision=111798
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.Dag-Erling Smørgrav2003-03-031-10/+9
| | | | | | | Also clean up some egregious casts and incorrect use of sizeof. Notes: svn path=/head/; revision=111797
* Removed unused includes. Sorted includes. This is part of removingBruce Evans2002-09-151-5/+1
| | | | | | | | includes of <sys/user.h> for its pollution only. <sys/user.h> wasn't even used for its pollution here. Notes: svn path=/head/; revision=103352
* Include <machine/pcb.h> instead of depending on namespace pollution inBruce Evans2002-09-071-0/+1
| | | | | | | <sys/user.h>. Notes: svn path=/head/; revision=103073
* Automatically enable CPU_ENABLE_SSE (detect and enable SSE instructions)Peter Wemm2002-09-071-1/+10
| | | | | | | | | | | if compiling with I686_CPU as a target. CPU_DISABLE_SSE will prevent this from happening and will guarantee the code is not compiled in. I am still not happy with this, but gcc is now generating code that uses these instructions if you set CPUTYPE to p3/p4 or athlon-4/mp/xp or higher. Notes: svn path=/head/; revision=103064
* Split up ptrace() into a wrapper that does the copying to and fromIan Dowse2002-09-051-95/+52
| | | | | | | | | | user space and a kern_ptrace() implementation. Use the kern_*() version in the Linux emulation code to remove more stack gap uses. Approved by: des Notes: svn path=/head/; revision=102946
* Part 1 of KSE-IIIJulian Elischer2002-06-291-1/+1
| | | | | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals.. Notes: svn path=/head/; revision=99072
* o Fix race condition caused by doing ptrace() for permissionMarcel Moolenaar2002-05-191-24/+44
| | | | | | | | | | | | | | checking, followed by a lookup of the process. Do not call ptrace() for permission checking, but do it inline. Spotted by: rwatson o While here, copy-in arguments before we lock. This fixes a possible permanent lock. Reviewed by: rwatson Notes: svn path=/head/; revision=96955
* Sparkling new implementation of linux_ptrace. Slight tweaking byMarcel Moolenaar2002-05-191-0/+507
yours truly. PR: 33299 Submitted by: Alexander N. Kabaev <ak03@gte.com> Notes: svn path=/head/; revision=96888