Home | History | Annotate | Download | only in common
History log of /src/sys/compat/linux/common/linux_sched.c
RevisionDateAuthorComments
 1.85  19-Sep-2025  kre cl_args.stack_size is uint64_t (all architectures), on ILP32 (void *)
is 32 bits, as is (intptr_t). 32 bits added to 64 bits --> 64 bits,
which gcc complains about converting to a pointer. Add yet another cast.

Should fix ILP32 builds (eg: i386)
 1.84  19-Sep-2025  christos PR/59608: csaba mate: fix stack address and ignore sysvsem flag. makes the
latest jvm work again.
 1.83  03-Oct-2024  hannken Fix fallout from DPRINTF conversion.

Kernels ALL/i386 and ALL/amd64 compile again.
 1.82  01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.81  30-Sep-2024  kre Supply a missing cast, which fixes the i386 (other 32 bit too probably)
builds.

Note I used uintptr_t rather than intptr_t which other similar
lines nearby use - the int being converted to a ptr is uint64_t
so using unsigned seemed safer to me. Feel free to change it.

Not sure if the code will work though - linux's clone3() is
being emulated via its clone() sys call - I know nothing about
linux sys calls, but my impression of these two is that in
clone() the "stack" arg points at the logical stack start
(usually the highest addr in the stack segment - though there
are some systems with upward growing stacks) whereas for
clone3() it looks to me as if the stack arg is always intended
to be the lowest addr in the stack segment (with a new size
field added to compute the top). Simply copying that arg to the
clone() arg of the same name might not work. (I am surmising).
I'd expect the code to need to vary based upon in which direction
the architecture's stack grows. Maybe.
 1.80  29-Sep-2024  christos move clone3 to linux_sched.c and make it compile (need to fix XXX comments)
 1.79  07-Sep-2021  riastradh branches: 1.79.10;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.78  23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.77  14-May-2020  rin Fix previous; specify lwpid for curlpw in the case of pid == 0.

For linux_sys_sched_setaffinity, pid == 0 means the current thread.
On the other hand, for our native sys_sched_setaffinity, lid == 0
means all lwp's that belong to the process.
 1.76  29-Apr-2020  thorpej Fix proc / lwp lookup processing in linux_sys_sched_getaffinity()
and linux_sys_sched_setaffinity(). They were incorrect even before
the LWP ID changes, but those changes exposed the latent bugs.
 1.75  24-Apr-2020  thorpej Overhaul the way LWP IDs are allocated. Instead of each LWP having it's
own LWP ID space, LWP IDs came from the same number space as PIDs. The
lead LWP of a process gets the PID as its LID. If a multi-LWP process's
lead LWP exits, the PID persists for the process.

In addition to providing system-wide unique thread IDs, this also lets us
eliminate the per-process LWP radix tree, and some associated locks.

Remove the separate "global thread ID" map added previously; it is no longer
needed to provide this functionality.

Nudged in this direction by ad@ and chs@.
 1.74  19-Apr-2020  thorpej - Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs. It's now done
in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
 1.73  23-Nov-2019  ad branches: 1.73.6;
Minor scheduler cleanup:

- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.
 1.72  03-Oct-2019  kamil Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.
 1.71  16-Apr-2018  kamil branches: 1.71.2; 1.71.6;
Remove the rnewprocp argument from fork1(9)

It's now unused and it can cause use-after-free scenarios as noted by
<Mateusz Guzik>.

Reference: http://mail-index.netbsd.org/tech-kern/2017/09/08/msg022267.html

Sponsored by <The NetBSD Foundation>
 1.70  15-Apr-2018  kamil Remove unused variable p from linux_sys_clone()

After refactoring by <chs> in 2010 (r. 1.63) the p variable is no longer
used.

As noted by <Mateusz Guzik> its usage is also unsafe and might cause
use-after-free scenarios.

No functional change intended.

Reference: http://mail-index.netbsd.org/tech-kern/2017/09/08/msg022267.html

Sponsored by <The NetBSD Foundation>
 1.69  21-Apr-2017  christos branches: 1.69.4; 1.69.10;
- Propagate the signal mask from the ucontext_t to the newly created thread
as specified by _lwp_create(2)
- Reset the signal stack for threads created with _lwp_create(2)
 1.68  03-Jul-2015  christos branches: 1.68.2; 1.68.4;
PR/50021: Rin Okuyama: Fix linux affinity syscalls
XXX: pullup-7
 1.67  09-Nov-2014  maxv branches: 1.67.2;
Do not uselessly include <sys/malloc.h>.
 1.66  23-Jan-2014  njoly branches: 1.66.4;
Fix inverted pid/lid arguments in do_sched_{get,set}param calls.
 1.65  18-Aug-2011  christos branches: 1.65.2; 1.65.12; 1.65.16;
Better debugging.
 1.64  05-Jun-2011  dsl Delete some splurious commas and very unexpected trailing space
 1.63  07-Jul-2010  chs branches: 1.63.2; 1.63.6;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.62  01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.61  03-Sep-2009  njoly branches: 1.61.2; 1.61.4;
Use correct sched_setscheduler syscall 3rd argument type.
 1.60  23-Jun-2009  njoly sched_getaffinity(2) update:
- dynamically calculate the cpu mask size,
- return it upon success,
- fix generated cpu mask.
 1.59  18-Jun-2009  njoly In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.58  25-Oct-2008  christos branches: 1.58.4; 1.58.8; 1.58.10;
Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.57  07-May-2008  njoly branches: 1.57.2; 1.57.6;
Restore sched_native2linux() KASSERTs, i accidentally disabled in a
previous commit.
 1.56  05-May-2008  jmcneill Wrap debug printfs in #ifdef DEBUG_LINUX (hi njoly!)
 1.55  01-May-2008  njoly Add SCHED_FIFO/SCHED_RR support to sched_get_priority_{min,max}.
 1.54  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.53  24-Apr-2008  ad branches: 1.53.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.52  23-Apr-2008  ad Tweak previous.
 1.51  23-Apr-2008  ad Fix locking.
 1.50  29-Feb-2008  elad branches: 1.50.2;
In linux_sys_sched_getparam(), get the native policy too, so that we have
a better chance at properly converting the priority.

Noted by & okay yamt@.
 1.49  28-Feb-2008  elad Factor out the guts of get/setparam so it can be used from the compat code.

Make the FreeBSD and Linux compat code convert the parameters to their
native representation and call the native routines.

Remove KAUTH_PROCESS_SCHEDULER_GET/SET.

Update documentation and examples.

XXX: For now, only the Linux compat code does the priority conversion
XXX: right.

Linux priority conversion code from yamt@, thanks!

Okay yamt@.
 1.48  16-Feb-2008  elad branches: 1.48.2; 1.48.6;
Fold KAUTH_REQ_PROCESS_SCHEDULER_* to KAUTH_PROCESS_SCHEDULER_*. In other
words, don't pass an action and a request, and just use a single action to
indicate what is the operation in question.

This is the first step in fixing PR/37986, which calls for policy/priority
checking in the secmodel code. Right now we're lacking room for another
parameter required to make a decision, and this change makes room for such.
 1.47  23-Jan-2008  elad Tons of process scope changes.

- Add a KAUTH_PROCESS_SCHEDULER action, to handle scheduler related
requests, and add specific requests for set/get scheduler policy and
set/get scheduler parameters.

- Add a KAUTH_PROCESS_KEVENT_FILTER action, to handle kevent(2) related
requests.

- Add a KAUTH_DEVICE_TTY_STI action to handle requests to TIOCSTI.

- Add requests for the KAUTH_PROCESS_CANSEE action, indicating what
process information is being looked at (entry itself, args, env,
open files).

- Add requests for the KAUTH_PROCESS_RLIMIT action indicating set/get.

- Add requests for the KAUTH_PROCESS_CORENAME action indicating set/get.

- Make bsd44 secmodel code handle the newly added rqeuests appropriately.

All of the above make it possible to issue finer-grained kauth(9) calls in
many places, removing some KAUTH_GENERIC_ISSUSER requests.

- Remove the "CAN" from KAUTH_PROCESS_CAN{KTRACE,PROCFS,PTRACE,SIGNAL}.

Discussed with christos@ and yamt@.
 1.46  20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.45  08-Dec-2007  dsl branches: 1.45.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.44  19-Oct-2007  njoly branches: 1.44.2; 1.44.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.43  19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.42  15-Feb-2007  ad branches: 1.42.6; 1.42.18; 1.42.20; 1.42.24;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.
 1.41  09-Feb-2007  ad Acquire proclist_mutex before sending signals.
 1.40  09-Feb-2007  ad Merge newlock2 to head.
 1.39  05-Feb-2007  njoly Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
 1.38  05-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.37  16-Nov-2006  christos branches: 1.37.2;
__unused removal on arguments; approved by core.
 1.36  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.35  23-Aug-2006  dogcow branches: 1.35.2; 1.35.4;
move #ifdef up a few lines to prevent unused variable warning/error
 1.34  23-Aug-2006  manu 1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.33  23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.32  26-Jun-2006  manu Do not implement exit_group() the right way on platforms that do not
define LINUX_NPTL yet, that cause firefox-bin to fail.
 1.31  25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.30  14-May-2006  elad branches: 1.30.4;
integrate kauth.
 1.29  29-Nov-2005  jdolecek branches: 1.29.4; 1.29.6; 1.29.8; 1.29.10; 1.29.12;
undo linux_sys_exit_group() change _again_ - please do not commit known
broken code
 1.28  29-Nov-2005  manu Threads should not send a signal on exit.
 1.27  23-Nov-2005  manu - Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.26  11-Nov-2005  jdolecek branches: 1.26.2;
undo the linux_sys_exit_group() change for now - complete CLONE_THREAD support
is necessary for this to work properly
 1.25  09-Nov-2005  manu Fix build problem
 1.24  09-Nov-2005  manu Improve Linux exit_group emulation by sending a SIGKILL to all other
processes in the group instead of letting them live. It would be better
to properly terminate them.
 1.23  05-Nov-2005  manu ifdef out sched_{get|set}affinity for ports that don't use it yet. That
should fix build.
 1.22  05-Nov-2005  manu Implement Linux sched_{set|get}affinity
 1.21  05-Nov-2005  manu Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.20  04-Nov-2005  manu Implement Linux futex ang gettid
 1.19  22-Jun-2005  manu branches: 1.19.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.18  10-Sep-2004  wiz Fix typo in comment.
 1.17  09-Sep-2004  tron Next attempt to fix the RCS Id. *sigh*
 1.16  09-Sep-2004  tron Fix RCS Id lossage caused by last commit.
 1.15  09-Sep-2004  tron Finish linux_sys_exit_group() with a (never reached) "return" statement so
that GCC will actually compile this.
 1.14  08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.13  08-Sep-2004  jdolecek do more strict flag checking in clone(2) (matches what Linux does)
 1.12  18-Jan-2003  thorpej branches: 1.12.2;
Merge the nathanw_sa branch.
 1.11  22-Dec-2002  gmcgarry Use yield() for voluntary context switches.
 1.10  31-Mar-2002  christos branches: 1.10.6;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.9  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.8  13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7  25-Aug-2000  thorpej branches: 1.7.2; 1.7.4;
Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.6  28-May-2000  thorpej Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1(). In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
 1.5  30-Mar-2000  augustss branches: 1.5.2;
Kill register declarations.
 1.4  04-Dec-1999  tron Allow signal numbers upto 63 in clone(2) emulation.
 1.3  21-Oct-1999  itohy Add #include <machine/cpu.h> for need_resched() macro.
 1.2  11-Oct-1999  thorpej branches: 1.2.2; 1.2.4;
Fix typos in the license notice.
 1.1  04-Oct-1999  tron branches: 1.1.2;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.1.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1  15-Nov-1999  fvdl Sync with -current
 1.2.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.4.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.7  29-Dec-2002  thorpej Sync with HEAD.
 1.7.2.6  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.7.2.5  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.7.2.4  17-Apr-2002  nathanw Catch up to -current.
 1.7.2.3  08-Jan-2002  nathanw Catch up to -current.
 1.7.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.7.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.10.6.1  18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.12.2.4  11-Dec-2005  christos Sync with head.
 1.12.2.3  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.2  21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.1  18-Sep-2004  skrll Sync with HEAD.
 1.19.2.8  17-Mar-2008  yamt sync with head.
 1.19.2.7  27-Feb-2008  yamt sync with head.
 1.19.2.6  04-Feb-2008  yamt sync with head.
 1.19.2.5  21-Jan-2008  yamt sync with head
 1.19.2.4  27-Oct-2007  yamt sync with head.
 1.19.2.3  26-Feb-2007  yamt sync with head.
 1.19.2.2  30-Dec-2006  yamt sync with head.
 1.19.2.1  21-Jun-2006  yamt sync with head.
 1.26.2.1  29-Nov-2005  yamt sync with head.
 1.29.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.29.10.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.29.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.29.8.4  03-Sep-2006  yamt sync with head.
 1.29.8.3  11-Aug-2006  yamt sync with head
 1.29.8.2  26-Jun-2006  yamt sync with head.
 1.29.8.1  24-May-2006  yamt sync with head.
 1.29.6.1  01-Jun-2006  kardel Sync with head.
 1.29.4.1  09-Sep-2006  rpaulo sync with head
 1.30.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.35.4.2  10-Dec-2006  yamt sync with head.
 1.35.4.1  22-Oct-2006  yamt sync with head
 1.35.2.4  09-Feb-2007  ad Sync with HEAD.
 1.35.2.3  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.2.2  12-Jan-2007  ad Sync with head.
 1.35.2.1  18-Nov-2006  ad Sync with head.
 1.37.2.2  21-Jun-2009  bouyer Pull up following revision(s) (requested by njoly in ticket #1328):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.37.2.1  28-Mar-2007  jdc branches: 1.37.2.1.6;
Pull up revision 1.39 (requested by njoly in ticket #523).

Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
 1.37.2.1.6.1  21-Jun-2009  bouyer Pull up following revision(s) (requested by njoly in ticket #1328):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.42.24.1  25-Oct-2007  bouyer Sync with HEAD.
 1.42.20.3  23-Mar-2008  matt sync with HEAD
 1.42.20.2  09-Jan-2008  matt sync with HEAD
 1.42.20.1  06-Nov-2007  matt sync with HEAD
 1.42.18.2  09-Dec-2007  jmcneill Sync with HEAD.
 1.42.18.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.42.6.1  23-Oct-2007  ad Sync with head.
 1.44.4.1  26-Dec-2007  ad Sync with head.
 1.44.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.45.4.2  23-Jan-2008  bouyer Sync with HEAD.
 1.45.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.48.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.48.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.48.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.48.2.1  24-Mar-2008  keiichi sync with head.
 1.50.2.1  18-May-2008  yamt sync with head.
 1.53.2.5  11-Aug-2010  yamt sync with head.
 1.53.2.4  16-Sep-2009  yamt sync with head
 1.53.2.3  18-Jul-2009  yamt sync with head.
 1.53.2.2  04-May-2009  yamt sync with head.
 1.53.2.1  16-May-2008  yamt sync with head.
 1.57.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.57.2.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.57.2.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.58.10.1  19-Jun-2009  snj branches: 1.58.10.1.2;
Pull up following revision(s) (requested by njoly in ticket #822):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.58.10.1.2.1  21-Apr-2010  matt sync to netbsd-5
 1.58.8.1  23-Jul-2009  jym Sync with HEAD.
 1.58.4.1  19-Jun-2009  snj Pull up following revision(s) (requested by njoly in ticket #822):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.61.4.3  12-Jun-2011  rmind sync with head
 1.61.4.2  05-Mar-2011  rmind sync with head
 1.61.4.1  03-Jul-2010  rmind sync with head
 1.61.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.63.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.63.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.65.16.1  18-May-2014  rmind sync with head
 1.65.12.2  03-Dec-2017  jdolecek update from HEAD
 1.65.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.65.2.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.66.4.2  31-Dec-2016  snj Pull up following revision(s) (requested by rin in ticket #1343):
sys/compat/linux/common/linux_sched.c: revision 1.68
PR/50021: Rin Okuyama: Fix linux affinity syscalls
 1.66.4.1  17-Jan-2015  martin branches: 1.66.4.1.4;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.66.4.1.4.1  18-Jan-2017  skrll Sync with netbsd-5
 1.67.2.2  28-Aug-2017  skrll Sync with HEAD
 1.67.2.1  22-Sep-2015  skrll Sync with HEAD
 1.68.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.68.2.1  26-Apr-2017  pgoyette Sync with HEAD
 1.69.10.2  22-Apr-2018  pgoyette Sync with HEAD
 1.69.10.1  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.69.4.1  21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.71.6.1  03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.71.2.2  21-Apr-2020  martin Sync with HEAD
 1.71.2.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.73.6.2  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.73.6.1  20-Apr-2020  bouyer Sync with HEAD
 1.79.10.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed