Home | History | Annotate | Download | only in common
History log of /src/sys/compat/linux/common/linux_misc.c
RevisionDateAuthorComments
 1.267  01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.266  29-Sep-2024  christos move clone3 to linux_sched.c and make it compile (need to fix XXX comments)
 1.265  28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.264  29-Jun-2024  christos From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.263  10-Feb-2024  andvar Fix various typos in comments, log messages and documentation.
 1.262  18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.261  30-Jul-2023  christos Add EPOLL_CLOEXEC (Theodore Preduta)
 1.260  29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.259  29-Jul-2023  rin compat/linux: aarch64 does not have epoll_create(2) nor epoll_wait(2)

Note that for Linux, new architectures like arm64 use MI system call
table in include/uapi/asm-generic/unistd.h, instead of MD syscall.tbl.

XXX
Too many ifdef's like this. We should be smarter...
 1.258  28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.257  10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.256  02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.255  25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.254  23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.253  20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.252  07-Sep-2021  riastradh 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.251  11-Jun-2020  ad branches: 1.251.2;
Counter tweaks:

- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one(). It has no users and doesn't save a whole lot.
For the cheap option, give cpu_count_sync() a boolean parameter indicating
that a cached value is okay, and rate limit the updates for cached values
to hz.
 1.250  11-Jun-2020  ad uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.249  03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.248  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.247  31-Dec-2019  ad branches: 1.247.6;
Rename uvm_free() -> uvm_availmem().
 1.246  21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.245  20-Sep-2019  kamil Avoid signed integer overflow when convering linux timeval to timespec

Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.
 1.244  24-Aug-2019  maxv I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.
 1.243  23-Aug-2019  maxv Fix info leaks in sysinfo().
 1.242  23-Aug-2019  maxv Fix info leaks.
 1.241  23-Aug-2019  maxv Fix info leaks.
 1.240  03-Sep-2018  riastradh branches: 1.240.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.239  28-Jul-2017  riastradh branches: 1.239.2; 1.239.4;
Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.238  06-May-2017  joerg branches: 1.238.2;
Extend the mmap(2) interface to allow requesting protections for later
use with mprotect(2), but without enabling them immediately.

Extend the mremap(2) interface to allow duplicating mappings, i.e.
create a second range of virtual addresses references the same physical
pages. Duplicated mappings can have different effective protections.

Adjust PAX mprotect logic to disallow effective protections of W&X, but
allow one mapping W and another X protections. This obsoletes using
temporary files for purposes like JIT.

Adjust PAX logic for mmap(2) and mprotect(2) to fail if W&X is requested
and not silently drop the X protection.

Improve test cases to ensure correct operation of the changed
interfaces.
 1.237  28-Jan-2017  christos branches: 1.237.4;
copy the terminating NUL (njoly)
 1.236  13-Jan-2017  christos branches: 1.236.2;
no namlen on linux
 1.235  13-Jan-2017  christos convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
 1.234  02-Jan-2017  manu Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.233  10-Nov-2016  christos GC WOPTSCHECKED
 1.232  31-Aug-2016  njoly Teach wait4 about WCONTINUED.
 1.231  14-Mar-2015  njoly branches: 1.231.2;
Support Linux MAP_LOCKED mmap flag.
 1.230  22-Nov-2014  njoly branches: 1.230.2;
Fix ppoll signature (int ->u_int)
 1.229  29-May-2014  njoly branches: 1.229.2; 1.229.4; 1.229.8;
For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.228  18-Nov-2013  chs branches: 1.228.2;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.227  10-Nov-2013  slp On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.
 1.226  24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.225  15-Sep-2013  njoly Make alpha use linux_sys_utimes() just like other archs.
 1.224  11-Aug-2013  pooka Allow to build in envs without USRSTACK (namely, rump kernels on powerpc).
TODO: all of the m*() calls are by definition incompatible with rump
kernels; including them is no great damage, but they're not useful either.
 1.223  15-Apr-2013  christos branches: 1.223.4;
alpha uses standard utimes.
 1.222  09-Apr-2013  pooka Fix COMPAT_LINUX32.
 1.221  08-Apr-2013  pooka support utimes on non-alpha linux platforms
 1.220  19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.219  14-Oct-2011  hannken branches: 1.219.2; 1.219.8; 1.219.12; 1.219.14; 1.219.16;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.218  02-Nov-2010  chs personality() now interprets its parameter as having
the base personality type in the low byte and
various flags in the upper bytes. for now just mask off
the flags to make sure the base type is one we accept.
store the current personality in the emuldata so that
we can return the expected value for PER_QUERY.
 1.217  11-Sep-2010  chs recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same. fixes part of PR 43695.
 1.216  07-Jul-2010  chs 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.215  24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.214  03-Mar-2010  he branches: 1.214.2;
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.213  05-Dec-2009  pooka branches: 1.213.2;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.212  24-Nov-2009  njoly Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.211  11-Nov-2009  rmind - selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.210  04-Nov-2009  rmind do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.209  22-Jul-2009  njoly Make compat linux/linux32 getdents(2) fail with ENOTDIR instead of
EINVAL when file descriptor does not refer to a directory.
 1.208  15-May-2009  pooka pad -> PAD
 1.207  29-Mar-2009  christos Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.206  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.205  19-Jan-2009  njoly branches: 1.205.2;
Small personality(2) update.
- Allow querying current personality.
- Use symbolic names instead of magic values.
 1.204  17-Jan-2009  njoly Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.203  11-Jan-2009  christos merge christos-time_t
 1.202  12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.201  24-Jun-2008  ad branches: 1.201.2; 1.201.4; 1.201.6; 1.201.10;
Replace references to getsock/getvnode.
 1.200  24-Jun-2008  gmcgarry ioctl commands are defined unsigned long, so cast cmd to unsigned long before comparison.
 1.199  28-May-2008  njoly branches: 1.199.2;
Add LINUX_TMPFS_SUPER_MAGIC, and map it to our tmpfs.
This makes sem_open/sem_unlink (POSIX named semaphores) work under
NPTL emulation.
 1.198  28-Apr-2008  martin branches: 1.198.2;
Remove clause 3 and 4 from TNF licenses
 1.197  24-Apr-2008  ad branches: 1.197.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.196  23-Apr-2008  ad Fix locking.
 1.195  04-Apr-2008  njoly branches: 1.195.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.194  21-Mar-2008  ad branches: 1.194.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.193  15-Jan-2008  njoly branches: 1.193.6;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.192  24-Dec-2007  njoly Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.191  21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.190  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.189  08-Dec-2007  dsl branches: 1.189.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.188  04-Dec-2007  dsl Remove all the __P
 1.187  26-Nov-2007  pooka branches: 1.187.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.186  08-Nov-2007  njoly Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
 1.185  07-Nov-2007  njoly Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.184  19-Oct-2007  njoly branches: 1.184.2;
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.183  17-Jul-2007  joerg branches: 1.183.6; 1.183.8; 1.183.12;
Add native mremap system call based on the UVM implementation for
Linux compat. Add code to enforce alignment of the new location.
Special thanks to wizd for helping with the man page.
 1.182  04-Jul-2007  dsl It seems that min(16,16) isn't a compile time constant.
So don't bother limiting the local arrays to NGROUPS, just use 16.
 1.181  30-Jun-2007  dsl Match updates to kauth_cred_set/getgroups.
 1.180  23-Jun-2007  dsl Simplify code to get/set 16bit group lists.
Cloned from ibcs2 copy (maybe I should have worked out somewhere to put this
as common code...)
 1.179  23-Jun-2007  dsl These now need sys/prot.h
 1.178  04-Jun-2007  dsl Fix select() without a timeout parameter.
 1.177  02-Jun-2007  dsl Call selcommon() directly instead of using the stackgap...
 1.176  12-May-2007  dsl There is no need to use the stackgap for get/setrlimit.
 1.175  10-May-2007  christos - linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.174  08-May-2007  dsl Remember to copy the rusage to the users buffer.
 1.173  07-May-2007  dsl Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
 1.172  30-Apr-2007  dsl Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.171  22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.170  11-Apr-2007  njoly - Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.169  23-Mar-2007  mrg implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
 1.168  14-Mar-2007  njoly branches: 1.168.2;
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
 1.167  04-Mar-2007  christos branches: 1.167.2; 1.167.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.166  09-Feb-2007  ad branches: 1.166.2;
Merge newlock2 to head.
 1.165  16-Nov-2006  christos branches: 1.165.2;
__unused removal on arguments; approved by core.
 1.164  14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.163  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.162  13-Sep-2006  manu branches: 1.162.2;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.161  01-Sep-2006  matt branches: 1.161.2;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.160  30-Aug-2006  he Allow this to build as an LKM by testing for _KERNEL_OPT before
including opt_ptrace.h.
 1.159  30-Aug-2006  matt Update to deal with options PTRACE
 1.158  23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.157  13-Jun-2006  christos change 20 to NZERO; pointed out by mrg.
 1.156  10-Jun-2006  christos PR/33671: Nicolas Joly: Add a getpriority syscall to account for the fact
that the linux getpriority is off by 20.
 1.155  07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.154  14-May-2006  elad branches: 1.154.2;
integrate kauth.
 1.153  10-May-2006  yamt don't allocate struct statvfs on stack as it's too large.
while i'm here, remove some unnecessary casts.
 1.152  17-Mar-2006  erh Fix Coverity issues 2321 and 2320. Make sure to free allocated memory.
 1.151  01-Mar-2006  yamt branches: 1.151.2; 1.151.4; 1.151.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.150  09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.149  31-Jan-2006  yamt branches: 1.149.2; 1.149.4;
linux_sys_mremap: validate flags.
 1.148  21-Jan-2006  yamt implement compat_linux mremap.
 1.147  11-Dec-2005  christos branches: 1.147.2;
merge ktrace-lwp.
 1.146  30-Nov-2005  rpaulo Remove the debugging printf left in linux_sys_getrlimit().
 1.145  23-Nov-2005  manu Remove a debug printf
 1.144  23-Nov-2005  manu - Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.143  07-Nov-2005  manu branches: 1.143.2;
Include linux_machdep.h so that LINUX_UNAME_ARCH ges defined (fixes
uname emulation)
 1.142  04-Nov-2005  manu Fix machine name returned by uname on Linux
 1.141  30-Oct-2005  chs add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
 1.140  10-Sep-2005  jmmv branches: 1.140.2;
Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).
 1.139  02-Jun-2005  drochner branches: 1.139.2;
more cast-qual fallout
 1.138  29-May-2005  christos - sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.137  03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.136  19-Apr-2005  christos PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.135  26-Feb-2005  perry branches: 1.135.2;
nuke trailing whitespace
 1.134  13-Nov-2004  christos branches: 1.134.4; 1.134.6;
Add ptyfs magic number and entry.
 1.133  07-Oct-2004  erh PR kern/27184: Have linux_sys_waitpid() call linux_sys_wait4() so the
supported options can't get out of sync. This add support for the
linux __WCLONE and __WALL options (NetBSD version: WALTSIG and WALLSIG)
Add a diagnostic check to see if the one unhandled option (__WNOTHREAD) is
specified.
This should prevent linux processes from losing their children and creating
tons of zombie processes.
 1.132  20-Sep-2004  jdolecek implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.131  19-Sep-2004  jdolecek Adjust struct statfs content to flag that the newer Linux kernel do
provide f_frsize. It cannot be actually used to GNU C statvfs() bug
in f_frsize != f_bsize case, so just keep pretending we don't support it.
Update comments and explain the situation in detail there.
 1.130  17-Sep-2004  skrll There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.129  13-Sep-2004  jdolecek bsd_to_linux_statfs():
- filesystem size is expressed in number of fragments, not blocks;
this fixes computed filesystem sizes for Linux df(1) and other Linux
binaries using statfs(2) for filesystems, which use different value
for frament and block, such as FFS
- use FS f_namemax instead of always using MAXNAMLEN
 1.128  29-Aug-2004  jdolecek handle mmap() request with MAP_GROWSDOWN flag (request for stack-like
grow-down auto extend segment) by allocating segment sized at
current stack size limit, and offsetting requested/returned address
as required

due to how normal virtual memory management work, allocating the
full sized stack memory segment up-front actually requires exactly same
amount of VA space and physical memory as the Linux 'grow' scheme and the
'grow' scheme is quite a lot more difficult to use in applications correctly,
so it's not very apparent why Linux introduced this feature at all

this fixes Thomas Klausner's Heroes3 crash, and might also
fix PR 26687 by Jan Schaumann
 1.127  08-Aug-2004  jdolecek linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size

this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.126  01-Aug-2004  jdolecek Linux returns ENOMEM (not EFAULT) if the address specified in mprotect()
is not part of process address space

this fixes Linux libgcc_s's stack executability setup
 1.125  21-Apr-2004  christos fix more statvfs1 fallout
 1.124  21-Apr-2004  christos s/statvfs/statvfs1/
 1.123  21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.122  04-Dec-2003  atatat branches: 1.122.2;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.121  29-Jun-2003  fvdl branches: 1.121.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.120  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.119  23-Jun-2003  christos PR/21948: Todd Vierling: Implement MAP_TRYFIXED for linux emulation.
 1.118  23-Jun-2003  christos PR/21937: Todd Vierling: Proper support for mmap2
 1.117  05-Mar-2003  dsl Use do_setresuid() to implement linux_sys_setresuid()
 1.116  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.115  16-Dec-2002  christos branches: 1.115.2;
Don't allow non-page-aligned offsets! So dumb. From Jason Ish, thanks.
 1.114  25-Nov-2002  thorpej Add ULL to a 64-bit integer constant.
 1.113  13-Nov-2002  jdolecek we now export information about CLK_TCK via ELF aux args, no need to
hardcode '100' for times(2) anymore; use 'hz' instead
 1.112  13-Nov-2002  jdolecek linux_sys_times(): if tms is NULL, just return the number of ticks since
boot, don't error out; this matches what Linux does

Fixes problem reported in kern/19027
 1.111  23-Sep-2002  simonb Put storage class first in "static const" declaration.
 1.110  20-Jun-2002  enami Don't copy from destination to destination.
 1.109  10-May-2002  tron branches: 1.109.2; 1.109.4;
Fix off by one error in check for size of field "d_off" in Linux
"dirent" structure.
 1.108  10-May-2002  tron Move implementation of linux_sys_getdents64() to source file for
Linux 64bit filesystem calls.
 1.107  10-Apr-2002  christos implement getdents64; my full java tree builds now.
 1.106  03-Apr-2002  fvdl Allocate the right size for the native gid_t array in setgroups16.
 1.105  31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.104  22-Mar-2002  christos gc debugging printfs.
 1.103  22-Mar-2002  christos nuke mmap2, cleanup mmap, add mprotect
 1.102  16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.101  20-Feb-2002  christos proper statfs emulation...
 1.100  18-Feb-2002  christos Resolve alpha compile issues:
- bug with order in args in mask conversion md code.
- flags can be both int and long on the alpha. kludge around that, by not
passing pointers to the conversion function.
- something is wrong with the toolchain look at the void * cast in copyout().
- sa_restorer is in a different place on the aplha. Deal with that, by not
initializing it as before. XXX: this should be changed in the MD signal
definition.
 1.99  18-Feb-2002  jdolecek Back off previous partially - make linux_release[] back 2.0.38
and linux_version[] "#0 Sun Apr 1 11:11:11 MET 2000";". Add a BIG
WARNING MESSAGE so that people won't break things changing this.
 1.98  17-Feb-2002  rafal There is no linux_sys_ugetrlimit on mips, so don't try building it (XXX: adds
icky ifdefs)
 1.97  15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.96  09-Dec-2001  chs replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names.
 1.95  13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.94  08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.93  18-Jul-2001  thorpej branches: 1.93.2;
Add support for the __WALL wait4(2) flag.
 1.92  04-Jun-2001  manu branches: 1.92.2;
Fixes by Chuck Silvers to make ptrace PEEKTEXT more 64 bit friendy
 1.91  03-Jun-2001  manu added a double cast to build on alpha
 1.90  02-Jun-2001  jdolecek Slighly improve the PTRACE_CONT comment
 1.89  27-May-2001  manu Fixed the return value of ptrace for PEEKTEXT and PEEKDATA: return value must
be a pointer to data, which holds the result. Linux's glibc undo this odd
operation to bring the standard ptrace behavior to userland.
 1.88  20-May-2001  manu Added powerpc status in a comment
 1.87  30-Mar-2001  jdolecek Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.86  16-Mar-2001  manu Removed an unused oldbrk variable in linux_sys_brk()
 1.85  15-Mar-2001  manu Made linux_sys_brk() cleaner (no functionnality change)
 1.84  15-Mar-2001  manu Fixed brk() emulation. We now keep track of the processes' idea of the
break value. See http://mail-index.netbsd.org/tech-kern/2001/03/15/0000.html
for more details.
 1.83  05-Jan-2001  fvdl branches: 1.83.2;
Set Linux version to 2.0.38 for now, until the clone + "real time signal"
problems are fixed.
 1.82  29-Dec-2000  fvdl Hardcode what the linux uname() calls return (Linux 2.2.5 is the current
value). A few major applications check for this (like VMware), and
there is no other way to trick them. Needs a more generic solution
eventually.
 1.81  27-Dec-2000  fvdl Use CHECK_ALT_* for chown and lchown, missed in my previous commit.
Get *id16 calls right; most can be passed through directly, but
some need the 16->32 check for -1 values.
 1.80  22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.79  21-Dec-2000  thorpej Only include the 16-bit uid/gid stuff if on i386 or m68k. This is a
little ugly, but hey, so is Linux.
 1.78  18-Dec-2000  fvdl Add seperate entries for 16 bit uid/gid calls, so that border cases
like 0xffff can be handled better (not done yet).
 1.77  13-Dec-2000  augustss Implement sysinfo.
 1.76  02-Dec-2000  jdolecek add emulation of linux swapoff(2)
 1.75  01-Dec-2000  jdolecek implement linux_sys_setdomainname()/linux_sys_swapon(), using code
from compat_09_sys_setdomainname()/compat_12_sys_swapon().
 1.74  01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.73  01-Nov-2000  jdolecek Linux LINUX_PTRACE_SINGLESTEP operation should have same
semantics as NetBSD's PT_STEP, so support it on archs which have it
under Linux, ptrace(PTRACE_CONT, pid, 0, 0) is used to continue the
traced process where it left off; adjust addr to (caddr_t) 1 so that
the NetBSD syscall code DTRT
some sligh const poisoning
 1.72  07-Sep-2000  fvdl In the case of MAP_ANON, Linux mmap ignores the fd argument completely.
So, always pass -1 to the native syscall in that case, to avoid
errors if a Linux app doesn't specify -1 as the fd (which some do).
 1.71  29-Jun-2000  mrg remove include of <vm/vm.h>
 1.70  26-Jun-2000  mrg remove redundant vm includes.
 1.69  30-Mar-2000  augustss branches: 1.69.4;
Kill register declarations.
 1.68  28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.67  18-Mar-2000  erh Add linux_sys_reboot.
 1.66  18-Mar-2000  erh Adjust linux_sys_ptrace_args to reflect inconsistencies across ports. Temporarily ifndef alpha around getfsuid since Linux/alpha doesn't seem to have it.
 1.65  13-Mar-2000  soren Fix doubled 'the's in comments.
 1.64  17-Feb-2000  abs Update patch from Witold Wnuk in PR 9335 to solve potential security
issue noted by tls.
 1.63  03-Feb-2000  abs Add Linux fsuid system calls - from Witold J. Wnuk in PR kern/9335
 1.62  16-Dec-1999  tron Move MI parts of ptrace(2) emulation to "linux_misc.c".
 1.61  05-Oct-1999  tron branches: 1.61.2; 1.61.8;
After linux_sys_clone() has been moved to "linux_sched.c" we don't need
to include "linux_sched.h" any more.
 1.60  04-Oct-1999  tron Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.59  15-Jul-1999  thorpej A few things to make the Linux clone(2) emulation work a bit better:
- When the exit signal is specified to be 0, don't just assume they
meant SIGCHLD. In the Linux world, this appears to mean "don't deliver
an exit signal at all".
- Simplify P_EXITSIG(); don't check against initproc here, just change
the exit signal to SIGCHLD if reparenting to initproc.

A very simple clone(2) test program now works, and the MpegTV package
starts, but doesn't run properly yet (I believe there is a separate
bug which keeps it from working properly).
 1.58  17-May-1999  thorpej Oops, completely forgot to translate the exit signal in clone(2).
 1.57  14-May-1999  thorpej Emulate the Linux {get,set}resuid(2) system calls.
 1.56  13-May-1999  thorpej Emulate the Linux clone(2) system call.
 1.55  13-May-1999  thorpej Fully emulate the Linux wait4(2) system call, including the __WCLONE
flag (which is equivalent to our new WALTSIG).
 1.54  05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.53  09-Feb-1999  christos branches: 1.53.2; 1.53.4;
const poisoning.
 1.52  16-Dec-1998  christos more defensive signal conversion, and fix a malloc sizeof(int) to sizeof(int *).
 1.51  04-Oct-1998  fvdl Fix pointer fuckup that made getdents() stop working.
 1.50  04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.49  03-Oct-1998  christos Attempt to fix the mess.
 1.48  01-Oct-1998  perry Add braces to shut up egcs
 1.47  01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46  11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45  08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44  18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43  07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42  02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41  24-Mar-1998  mycroft Fix typo in utime().
 1.40  03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38  20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37  14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36  21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35  10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34  10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33  10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32  04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31  27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30  07-Apr-1997  augustss Add Linux nice() syscall.
 1.29  10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28  23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27  20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26  04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25  03-Apr-1996  mycroft Add explicit return types.
 1.24  18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23  09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22  09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21  07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20  19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19  13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18  07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17  23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16  21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15  21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14  16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13  16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12  14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11  14-Aug-1995  mycroft Rearrange #includes.
 1.10  13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9  24-Jun-1995  christos Use compat_util.[ch].
 1.8  22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7  11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6  11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5  10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4  22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3  21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2  05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1  28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2  10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1  10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1  23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1  08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.53.4.2  02-Aug-1999  thorpej Update from trunk.
 1.53.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.53.2.1  15-Aug-2000  he Pull up revision 1.63 (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.61.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.61.2.6  21-Apr-2001  bouyer Sync with HEAD
 1.61.2.5  27-Mar-2001  bouyer Sync with HEAD.
 1.61.2.4  05-Jan-2001  bouyer Sync with HEAD
 1.61.2.3  08-Dec-2000  bouyer Sync with HEAD.
 1.61.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.61.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.69.4.3  01-May-2001  he Pull up revision 1.87 (via patch, requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.69.4.2  30-Mar-2001  he Pull up revisions 1.82-1.83 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.69.4.1  11-Sep-2000  fvdl Pull up revision 1.72:
In the case of MAP_ANON, Linux mmap ignores the fd argument completely.
So, always pass -1 to the native syscall in that case, to avoid
errors if a Linux app doesn't specify -1 as the fd (which some do).

approved by thorpej
 1.83.2.21  19-Dec-2002  thorpej Sync with HEAD.
 1.83.2.20  11-Dec-2002  thorpej Sync with HEAD.
 1.83.2.19  18-Oct-2002  nathanw Catch up to -current.
 1.83.2.18  01-Aug-2002  nathanw Catch up to -current.
 1.83.2.17  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.83.2.16  08-Jul-2002  nathanw Whitespace.
 1.83.2.15  20-Jun-2002  nathanw Catch up to -current.
 1.83.2.14  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.83.2.13  17-Apr-2002  nathanw LWPify.
 1.83.2.12  17-Apr-2002  nathanw Catch up to -current.
 1.83.2.11  01-Apr-2002  nathanw LWPify linux_sys_mprotect().
 1.83.2.10  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.83.2.9  28-Feb-2002  nathanw LWPify linux_{set/get}rlimit(); move and LWPify linux_sysctl().
 1.83.2.8  28-Feb-2002  nathanw Catch up to -current.
 1.83.2.7  08-Jan-2002  nathanw Catch up to -current.
 1.83.2.6  14-Nov-2001  nathanw Catch up to -current.
 1.83.2.5  21-Sep-2001  nathanw Catch up to -current.
 1.83.2.4  24-Aug-2001  nathanw Catch up with -current.
 1.83.2.3  21-Jun-2001  nathanw Catch up to -current.
 1.83.2.2  09-Apr-2001  nathanw Catch up with -current.
 1.83.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.92.2.7  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.92.2.6  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.92.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.92.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.92.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.92.2.2  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.92.2.1  03-Aug-2001  lukem update to -current
 1.93.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.109.4.5  26-Oct-2003  jmc Pullup rev 1.119 (ticket #1428)

Implement MAP_TRYFIXED for linux emulation.
 1.109.4.4  22-Oct-2003  jmc Pullup rev 1.118 (via patch) (requested by tv in ticket #1427)

Proper support for mmap2
 1.109.4.3  22-Oct-2003  jmc Pullup rev 115 (requested by tv in ticket #1426)

Don't allow non-page-aligned offsets.
 1.109.4.2  12-Dec-2002  he Pull up revision 1.112 (requested by jdolecek in ticket #987):
Correct linux_sys_times(): if tms is NULL, just return the
number of ticks since boot instead of returning error; this
matches what Linux does. Fixes PR#19027.
 1.109.4.1  21-Jun-2002  lukem Pull up revision 1.110 (requested by enami in ticket #331):
Don't copy from destination to destination.

[Fixes setrlimit in linux emulation]
 1.109.2.1  15-Jul-2002  gehenna catch up with -current.
 1.115.2.1  18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.121.2.12  11-Dec-2005  christos Sync with head.
 1.121.2.11  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.121.2.10  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.121.2.9  14-Nov-2004  skrll Sync with HEAD.
 1.121.2.8  19-Oct-2004  skrll Sync with HEAD
 1.121.2.7  24-Sep-2004  skrll Sync with HEAD.
 1.121.2.6  21-Sep-2004  skrll Fix the sync with head I botched.
 1.121.2.5  18-Sep-2004  skrll Sync with HEAD.
 1.121.2.4  03-Sep-2004  skrll Sync with HEAD
 1.121.2.3  12-Aug-2004  skrll Sync with HEAD.
 1.121.2.2  03-Aug-2004  skrll Sync with HEAD
 1.121.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.122.2.4  12-Nov-2004  jmc Pullup rev 1.133 (requested by christos in ticket #950)

Prevent linux processes from losing their children and creating
tons of zombie processes.
 1.122.2.3  05-Sep-2004  tron Pull up revision 1.128 (requested by jdolecek in ticket #810):
handle mmap() request with MAP_GROWSDOWN flag (request for stack-like
grow-down auto extend segment) by allocating segment sized at
current stack size limit, and offsetting requested/returned address
as required
due to how normal virtual memory management work, allocating the
full sized stack memory segment up-front actually requires exactly same
amount of VA space and physical memory as the Linux 'grow' scheme and the
'grow' scheme is quite a lot more difficult to use in applications correctly,
so it's not very apparent why Linux introduced this feature at all
this fixes Thomas Klausner's Heroes3 crash, and might also
fix PR 26687 by Jan Schaumann
 1.122.2.2  15-Aug-2004  tron Pull up revision 1.127 (requested by jdolecek in ticket #762):
linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size
this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.122.2.1  11-Aug-2004  jmc Pullup rev 1.126 (requested by jdolecek in ticket #740)

Linux returns ENOMEM (not EFAULT) if the address specified in mprotect()
is not part of process address space.
 1.134.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.134.4.1  29-Apr-2005  kent sync with -current
 1.135.2.2  01-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #924):
sys/compat/linux/common/linux_misc.c: revision 1.141
sys/compat/linux/common/linux_mmap.h: revision 1.17
add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
 1.135.2.1  01-Oct-2005  tron Pull up following revision(s) (requested by christos in ticket #838):
sys/compat/svr4/svr4_misc.c: revision 1.112
sys/compat/ibcs2/ibcs2_misc.c: revision 1.74
sys/compat/linux/common/linux_misc.c: revision 1.136
sys/compat/irix/irix_dirent.c: revision 1.14
sys/compat/sunos/sunos_misc.c: revision 1.132
sys/compat/svr4_32/svr4_32_misc.c: revision 1.31
sys/compat/sunos32/sunos32_misc.c: revision 1.30
sys/compat/linux/common/linux_file64.c: revision 1.26
PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.139.2.9  24-Mar-2008  yamt sync with head.
 1.139.2.8  21-Jan-2008  yamt sync with head
 1.139.2.7  07-Dec-2007  yamt sync with head
 1.139.2.6  15-Nov-2007  yamt sync with head.
 1.139.2.5  27-Oct-2007  yamt sync with head.
 1.139.2.4  03-Sep-2007  yamt sync with head.
 1.139.2.3  26-Feb-2007  yamt sync with head.
 1.139.2.2  30-Dec-2006  yamt sync with head.
 1.139.2.1  21-Jun-2006  yamt sync with head.
 1.140.2.1  02-Nov-2005  yamt sync with head.
 1.143.2.1  29-Nov-2005  yamt sync with head.
 1.147.2.3  18-Feb-2006  yamt sync with head.
 1.147.2.2  01-Feb-2006  yamt sync with head.
 1.147.2.1  31-Dec-2005  yamt adapt some random parts of kernel to uio_vmspace.
 1.149.4.3  01-Jun-2006  kardel Sync with head.
 1.149.4.2  22-Apr-2006  simonb Sync with head.
 1.149.4.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.149.2.1  09-Sep-2006  rpaulo sync with head
 1.151.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.151.6.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.151.4.6  11-May-2006  elad sync with head
 1.151.4.5  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.151.4.4  19-Apr-2006  elad sync with head.
 1.151.4.3  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.151.4.2  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.151.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.151.2.6  14-Sep-2006  yamt sync with head.
 1.151.2.5  03-Sep-2006  yamt sync with head.
 1.151.2.4  11-Aug-2006  yamt sync with head
 1.151.2.3  26-Jun-2006  yamt sync with head.
 1.151.2.2  24-May-2006  yamt sync with head.
 1.151.2.1  01-Apr-2006  yamt sync with head.
 1.154.2.1  19-Jun-2006  chap Sync with head.
 1.161.2.4  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.161.2.3  29-Dec-2006  ad Checkpoint work in progress.
 1.161.2.2  18-Nov-2006  ad Sync with head.
 1.161.2.1  24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.162.2.2  10-Dec-2006  yamt sync with head.
 1.162.2.1  22-Oct-2006  yamt sync with head
 1.165.2.3  12-Jun-2010  riz Pull up following revision(s) (requested by he in ticket #1387):
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/osf1/osf1_file.c: revision 1.38
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.165.2.2  20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.165.2.1  20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #581):
sys/compat/linux/common/linux_misc.c: revision 1.168
sys/compat/linux/arch/amd64/syscalls.master: revision 1.18
sys/compat/linux/common/linux_types.h: revision 1.25
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.6
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.87
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.
 1.166.2.5  17-May-2007  yamt sync with head.
 1.166.2.4  07-May-2007  yamt sync with head.
 1.166.2.3  15-Apr-2007  yamt sync with head.
 1.166.2.2  24-Mar-2007  yamt sync with head.
 1.166.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.167.4.1  11-Jul-2007  mjf Sync with head.
 1.167.2.5  20-Aug-2007  ad Sync with HEAD.
 1.167.2.4  15-Jul-2007  ad Sync with head.
 1.167.2.3  09-Jun-2007  ad Sync with head.
 1.167.2.2  27-May-2007  ad Sync with head.
 1.167.2.1  10-Apr-2007  ad Sync with head.
 1.168.2.1  29-Mar-2007  reinoud Pullup to -current
 1.183.12.2  13-Nov-2007  bouyer Sync with HEAD
 1.183.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.183.8.4  23-Mar-2008  matt sync with HEAD
 1.183.8.3  09-Jan-2008  matt sync with HEAD
 1.183.8.2  08-Nov-2007  matt sync with -HEAD
 1.183.8.1  06-Nov-2007  matt sync with HEAD
 1.183.6.4  09-Dec-2007  jmcneill Sync with HEAD.
 1.183.6.3  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.183.6.2  11-Nov-2007  joerg Sync with HEAD.
 1.183.6.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.184.2.4  18-Feb-2008  mjf Sync with HEAD.
 1.184.2.3  27-Dec-2007  mjf Sync with HEAD.
 1.184.2.2  08-Dec-2007  mjf Sync with HEAD.
 1.184.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.187.2.2  26-Dec-2007  ad Sync with head.
 1.187.2.1  08-Dec-2007  ad Sync with head.
 1.189.4.2  19-Jan-2008  bouyer Sync with HEAD
 1.189.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.193.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.193.6.3  29-Jun-2008  mjf Sync with HEAD.
 1.193.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.193.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.194.2.3  20-Nov-2008  christos merge with head.
 1.194.2.2  01-Nov-2008  christos Sync with head.
 1.194.2.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.195.2.2  04-Jun-2008  yamt sync with head
 1.195.2.1  18-May-2008  yamt sync with head.
 1.197.2.7  09-Oct-2010  yamt sync with head
 1.197.2.6  11-Aug-2010  yamt sync with head.
 1.197.2.5  11-Mar-2010  yamt sync with head
 1.197.2.4  19-Aug-2009  yamt sync with head.
 1.197.2.3  16-May-2009  yamt sync with head
 1.197.2.2  04-May-2009  yamt sync with head.
 1.197.2.1  16-May-2008  yamt sync with head.
 1.198.2.4  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.198.2.3  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.198.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.198.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.199.2.1  27-Jun-2008  simonb Sync with head.
 1.201.10.1  21-Apr-2010  matt sync to netbsd-5
 1.201.6.1  17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.201.4.3  28-Apr-2009  skrll Sync with HEAD.
 1.201.4.2  03-Mar-2009  skrll Sync with HEAD.
 1.201.4.1  19-Jan-2009  skrll Sync with HEAD.
 1.201.2.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.205.2.2  23-Jul-2009  jym Sync with HEAD.
 1.205.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.213.2.4  06-Nov-2010  uebayasi Sync with HEAD.
 1.213.2.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.213.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.213.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.214.2.2  05-Mar-2011  rmind sync with head
 1.214.2.1  03-Jul-2010  rmind sync with head
 1.219.16.1  19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.219.14.1  19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.219.12.4  03-Dec-2017  jdolecek update from HEAD
 1.219.12.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.219.12.2  23-Jun-2013  tls resync from head
 1.219.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.219.8.2  19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.219.8.1  14-Dec-2013  bouyer Pull up following revision(s) (requested by hauke in ticket #993):
sys/compat/linux/common/linux_misc.c: revision 1.227
On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.
 1.219.2.2  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.219.2.1  30-Oct-2012  yamt sync with head
 1.223.4.2  18-May-2014  rmind sync with head
 1.223.4.1  28-Aug-2013  rmind sync with head
 1.228.2.1  10-Aug-2014  tls Rebase.
 1.229.8.2  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.229.8.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.229.4.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.229.2.3  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.229.2.2  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.229.2.1  17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.230.2.5  28-Aug-2017  skrll Sync with HEAD
 1.230.2.4  05-Feb-2017  skrll Sync with HEAD
 1.230.2.3  05-Dec-2016  skrll Sync with HEAD
 1.230.2.2  05-Oct-2016  skrll Sync with HEAD
 1.230.2.1  06-Apr-2015  skrll Sync with HEAD
 1.231.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.231.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.236.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.237.4.1  11-May-2017  pgoyette Sync with HEAD
 1.238.2.3  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.238.2.2  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.238.2.1  09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.239.4.4  21-Apr-2020  martin Sync with HEAD
 1.239.4.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.239.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.239.4.1  10-Jun-2019  christos Sync with HEAD
 1.239.2.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.240.4.2  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.240.4.1  13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.247.6.1  20-Apr-2020  bouyer Sync with HEAD
 1.251.2.1  15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.

RSS XML Feed