Home | History | Annotate | Download | only in common
History log of /src/sys/compat/linux/common/linux_socket.c
RevisionDateAuthorComments
 1.158  28-Jun-2025  christos PR/59486: csaba mate: Ignore IP_MULTICAST_ALL, since we don't have it.
Also, add -3 to return ENOPROTOOPT, more options and consistently whitespace
after define (the majority had define<space> so make them all the samr)
 1.157  27-Jun-2025  christos PR/59486: csaba mate: Ignore IP_MULTICAST_ALL, since we don't have it.
 1.156  01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.155  24-Dec-2022  andvar s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments.
 1.154  23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.153  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.152  03-Nov-2020  christos PR/55780: Bernd Sieker: setsockopt in Linux emulation misses some options
 1.151  24-Oct-2020  mgorny branches: 1.151.2;
Fix compat with Linux programs that use longer namelen for sockets

Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*. If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
 1.150  16-Jul-2020  msaitoh Don't accept negative value.

Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
 1.149  08-Sep-2019  maxv 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.148  24-Aug-2019  maxv Fix memory leak.
 1.147  24-Aug-2019  maxv Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().
 1.146  24-Aug-2019  maxv 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?
 1.145  18-Apr-2019  christos branches: 1.145.4;
Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.144  04-Feb-2019  mrg - avoid uninitialised memory usage
 1.143  14-Nov-2018  hannken Apply the recent fixes to {send,recv}mmsg() to their compat variants.
 1.142  10-May-2018  ozaki-r branches: 1.142.2;
Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.
 1.141  03-May-2018  christos Fix COMPAT_NETBSD32 cmsg handling:

1. alignment was wrong for > 1 message
2. macros were doing incorrect pointer comparisons, fortunately ending
the iteration early after the fists cmsg instead of crashing.
3. don't output 32 bit ktrace records for cmsg. 32 bit programs running
under emulation on 64 bit systems should produce 64 bit ktrace records
so that the native ktrace can handle the records; remove extra arguments
that are now not needed (the 32 bit msghdr).
4. output the correct type for cmsg trace records.
5. output all the cmsg records in traces instead of just the first one.

Welcome to 8.99.15 because of the argument removal.

XXX: Really all the code should be changed to use the CMSG_{FIRST,NXT}HDR
macros...
 1.140  16-Mar-2018  christos PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken

The sockargs refactoring broke it, because sockargs only works with a user
address. Added an argument to sockargs to indicate where the address is
coming from. Welcome to 8.99.14.
 1.139  22-Nov-2017  ozaki-r branches: 1.139.2;
Fix and make consistent of usages of psz/psref in ifconf variants
 1.138  14-Mar-2017  ozaki-r branches: 1.138.6;
Use if_acquire and if_release instead of using psref API directly

- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static
 1.137  03-Feb-2017  christos add sendmmsg and recvmmsg
 1.136  03-Feb-2017  christos handle accept4 for i386
 1.135  03-Feb-2017  martin Do not compile accept4 on i386, there is no such syscall in Linux.
 1.134  02-Feb-2017  christos implement accept4
 1.133  13-Sep-2016  martin branches: 1.133.2;
Make the ktrace record written by do_sys_sendmsg/do_sys_recvmsg overridable
by the caller. Use this in compat_netbsd32 to log the 32bit version, so
the 32bit userland kdump is happy.
 1.132  01-Aug-2016  ozaki-r Apply pserialize and psref to struct ifaddr and its variants

This change makes struct ifaddr and its variants (in_ifaddr and in6_ifaddr)
MP-safe by using pserialize and psref. At this moment, pserialize_perform
and psref_target_destroy are disabled because (1) we don't need them
because of softnet_lock (2) they cause a deadlock because of softnet_lock.
So we'll enable them when we remove softnet_lock in the future.
 1.131  07-Jul-2016  ozaki-r branches: 1.131.2;
Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.
 1.130  05-Jul-2016  ozaki-r Fix psref isn't released in a case of IFADDR_EMPTY
 1.129  16-Jun-2016  ozaki-r Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND
 1.128  15-Jun-2016  ozaki-r Protect if_byindex by pserialize
 1.127  12-May-2016  ozaki-r Protect ifnet list with psz and psref

The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
 1.126  24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.125  24-May-2015  rtr convert remaining linux_get_sa() users to use linux_get_sa_sb() and
pass the pointer to the sockaddr in msghdr.msg_name, while removing
the MSG_NAMEMBUF flag.

now that the original linux_get_sa() is unused remove it and to make
function names consistent again rename linux_get_sa_sb() to linux_get_sa().
 1.124  02-May-2015  rtr make connect syscall use sockaddr_big and modify pr_{send,connect}
nam parameter type from buf * to sockaddr *.

final commit for parameter type changes to protocol user requests

* bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect}
 1.123  03-Apr-2015  rtr * change pr_bind to accept struct sockaddr * instead of struct mbuf *
* update protocol bind implementations to use/expect sockaddr *
instead of mbuf *
* introduce sockaddr_big struct for storage of addr data passed via
sys_bind; sockaddr_big is of sufficient size and alignment to
accommodate all addr data sizes received.
* modify sys_bind to allocate sockaddr_big instead of using an mbuf.
* bump kernel version to 7.99.9 for change to pr_bind() parameter type.

Patch posted to tech-net@
http://mail-index.netbsd.org/tech-net/2015/03/15/msg005004.html

The choice to use a new structure sockaddr_big has been retained since
changing sockaddr_storage size would lead to unnecessary ABI change. The
use of the new structure does not preclude future work that increases
the size of sockaddr_storage and at that time sockaddr_big may be
trivially replaced.

Tested by mrg@ and myself, discussed with rmind@, posted to tech-net@
 1.122  26-Nov-2014  ozaki-r branches: 1.122.2;
Tweak ifconf variants

The tweaks make the code intention clear and make further changes easy.

No functional change.
 1.121  21-Nov-2014  ozaki-r Tweak linux_getifhwaddr

No functional change.
 1.120  09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.119  23-May-2014  njoly branches: 1.119.2;
Add a funtion that translate socket type value from Linux to NetBSD.
Use it for socket and socketpair syscalls.
 1.118  17-May-2014  rmind Replace open-coded access (and boundary checking) of ifindex2ifnet with
if_byindex() function.
 1.117  27-Jan-2014  njoly branches: 1.117.2;
Add basic IPV6 level socket options support (IPV6_V6ONLY).
 1.116  27-Jan-2014  njoly Add SO_SNDLOWAT, SO_RCVLOWAT and SO_ACCEPTCONN support for socket
options.
 1.115  11-Jan-2013  christos branches: 1.115.2;
Use copyin/copyout and linux-specific ifreq structures (they are the same
as the netbsd ones, but this disconnects them)
 1.114  20-Jun-2012  christos branches: 1.114.2;
print proper ktruser names depending on the emulation.
 1.113  15-Mar-2012  bouyer Do not read past end of array. Found by gcc -03
 1.112  20-Jan-2012  joerg Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.111  20-Dec-2011  christos - Eliminate so_nbio and turn it into a bit SS_NBIO in so_state.
- Introduce MSG_NBIO so that we can turn non blocking i/o on a per call basis
- Use MSG_NBIO to fix the XXX: multi-threaded issues on the fifo sockets.
- Don't set SO_CANTRCVMORE, if we were interrupted (perhaps do it for all
errors?).
 1.110  17-Jul-2011  christos branches: 1.110.2; 1.110.6;
fail early on socket domain+type combinations we don't support
 1.109  30-Jun-2011  wiz dependant -> dependent
 1.108  02-Nov-2010  chs update linux_sys_socket() to understand the flags that are now
included in the "type" parameter. in linux_sys_sendmsg(),
if we see an SCM_CREDENTIALS control message, just drop it
instead of giving an error. the linux and native versions of
the cred-passing operation are very different and some apps
(eg. linux pulseaudio library talking to a native server)
will work without the control data.
 1.107  28-Nov-2009  dsl branches: 1.107.2; 1.107.4;
Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
 1.106  13-Nov-2009  joerg Return the result of copyout. Reminded by Niolas Joly.
 1.105  13-Nov-2009  joerg Provide SIOCGIFNAME.
 1.104  17-Jun-2009  njoly Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.103  16-Jun-2009  njoly Add LINUX_CMSG_{SPACE,LEN} macros. Use then when calculating the
msg_controllen size, when converting the control message buffer from
native (previous version was missing the linux_cmsghdr size).
 1.102  16-Jun-2009  njoly For linux cmsg header copyout, use the linux structure size, not the
native one.
 1.101  16-Jun-2009  njoly Make compat linux sendmsg/recvmsg output msghdr and control messages
buffers with ktrace(1), just like the native functions.
 1.100  11-Jun-2009  njoly In sendmsg(2), do copy the msghdr structure before trying to use it.
 1.99  19-Nov-2008  ad branches: 1.99.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.98  06-Aug-2008  plunky branches: 1.98.2; 1.98.4; 1.98.6;
Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
 1.97  03-Jul-2008  njoly branches: 1.97.2;
Fix SIOCGIFCONF ioctl for 64bit platforms. Add a new linux_ifreq
structure and linux_getifconf function (cleaned up version from
compat_ifconf).

While here, update linux_getifhwaddr to use the new structure.

Ok by christos.
 1.96  24-Jun-2008  ad Replace references to getsock/getvnode.
 1.95  11-Jun-2008  njoly In linux_sys_sendto, do not unconditionnally set MSG_NAMEMBUF to
msg_flags; add it only if a target adress was provided and needs to be
converted.
 1.94  09-Jun-2008  njoly branches: 1.94.2;
Do set mbuf in all cases, even for salen value of 0; otherwise this
will make a panic later when trying to free memory from a random
adress.

XXX Need to revisit it later to avoid mbuf allocation in this case.
 1.93  29-Apr-2008  njoly branches: 1.93.2;
In linux_get_sa(), make salen parameter unsigned.
Avoid kernel DIAGNOSTIC 0 bytes uvm mapping assertion, for negative
values.
 1.92  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.91  24-Apr-2008  ad branches: 1.91.2;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
 1.90  23-Apr-2008  ad Fix locking.
 1.89  26-Mar-2008  ad branches: 1.89.2;
- Remove uneeded splsoftnet().
- Use fd_getsock().
 1.88  23-Mar-2008  ad linux_get_sa: fix botched fd handling.
 1.87  21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.86  06-Feb-2008  ad branches: 1.86.6;
Don't lock the socket to set/clear FNONBLOCK. Just set it atomically.
 1.85  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.84  08-Dec-2007  dsl branches: 1.84.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.83  05-Dec-2007  dyoung Use IFADDR_EMPTY().
 1.82  05-Dec-2007  dyoung Don't open-code queue(3) macros (x = ifnet.tqh_first; y =
x.if_list.tqe_next). Instead, use the macros themselves.

Use IFNET_FOREACH() and IFADDR_FOREACH().
 1.81  04-Dec-2007  dsl Remove all the __P
 1.80  19-Oct-2007  njoly branches: 1.80.2; 1.80.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.79  29-Aug-2007  dyoung branches: 1.79.4;
Constify: LLADDR() -> CLLADDR().
 1.78  26-Aug-2007  dyoung branches: 1.78.2;
Use satosdl().
 1.77  15-Aug-2007  ad Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.76  01-Jul-2007  dsl branches: 1.76.2; 1.76.6;
Fix long-term breakage in the definition of 'control' data for linux.
cmsg->cmsg_len is 'size_t' not 'socklen_t' - so it is 8 bytes on 64bit
platforms instead of 4. There is also never padding after the header.
Redo linux sendmsg() so that it stands a chance of getting it right.
Redo linux recvmsg() so that it process control data directly from the mbuf
list. Allowing it to hack the data without using the stackgap.
 1.75  06-Jun-2007  rjs Wrap ktrace calls with #ifdef KTRACE.
 1.74  02-Jun-2007  yamt wrap #include "opt_ktrace.h" by #ifdef _KERNEL_OPT.
 1.73  01-Jun-2007  dsl Split sys_bind() and sys_connect() so that compat code can use common code
once the 'address' has been copied into an mbuf.
Add extra flags for 'struct msghdr.msg_flags' to indicate that the address
and control are already in mbufs, and that the uio structure is in userspace
for sending data, rename sendit() to do_sys_sendmsg() to ensure no old code
passes in random flags.
Changes to compat code to use new functions - removing some stackgap use.
Fix a 'use after free' in compat_43_sys_recvmsg.
I ***THINK*** the code that converts 'cmsg' formatted data is borked!
svr4_stream.c ought to be generated from svr4_32_stream.c during the build.
 1.72  29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.71  04-Mar-2007  christos branches: 1.71.2; 1.71.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.70  11-Feb-2007  mlelstv branches: 1.70.2;
Make setsockopt return compatible error codes for AF_UNIX sockets.
 1.69  09-Feb-2007  ad Merge newlock2 to head.
 1.68  16-Nov-2006  christos branches: 1.68.2;
__unused removal on arguments; approved by core.
 1.67  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.66  02-Sep-2006  christos branches: 1.66.2; 1.66.4;
comment out impossible code
 1.65  23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.64  27-Jun-2006  pavel Use the new socket call for Linux and SVR4, because those systems (at
least Linux 2.4.31, Irix 6.5.20 and Solaris 10) use EAFNOSUPPORT.

Only the Linux emulation has been tested.

XXX somebody should audit the other emulations...
 1.63  26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.62  14-May-2006  elad branches: 1.62.4;
integrate kauth.
 1.61  12-May-2006  mrg use socklen_t when talking to the NetBSD side of things
 1.60  27-Mar-2006  dyoung Use __arraycount().
 1.59  09-Feb-2006  manu branches: 1.59.2; 1.59.4; 1.59.6;
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.58  11-Dec-2005  christos branches: 1.58.2; 1.58.4; 1.58.6;
merge ktrace-lwp.
 1.57  24-Sep-2005  christos factor out some of the osockaddr, omsghdr code.
 1.56  03-May-2005  manu branches: 1.56.2;
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.55  26-Feb-2005  perry nuke trailing whitespace
 1.54  24-Feb-2005  martin Fix number of elements calculation when converting socket options.
Fixes bugs 4 and 5 reported by Ted Unangst on tech-kern.
 1.53  12-Sep-2004  jdolecek branches: 1.53.4; 1.53.6;
if passed sockaddr has family AF_UNSPEC, use socket family of the socket
the sockaddr is used for

this fixes bind() problem in Linux version of Theocracy, testing
by Thomas Klausner
 1.52  05-Sep-2004  jdolecek linux_sa_get: g/c curproc use, we get the process as one of arguments
 1.51  29-Aug-2004  jdolecek in debug log, data dump is more useful unsigned
 1.50  25-Oct-2003  christos branches: 1.50.2;
Fix uninitialized variable warnings
 1.49  27-Jul-2003  jdolecek More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input, and to Linux
value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).

PR: 21577 by Todd Vierling
 1.48  27-Jul-2003  mrg add a cast appease gcc3.3
 1.47  23-Jul-2003  christos make credentials work on the i386 by passing the original msg structure.
(from Todd Vierling)
 1.46  29-Jun-2003  fvdl branches: 1.46.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.45  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.44  21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.43  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.42  29-Nov-2002  fvdl branches: 1.42.2;
Patch that actually works for previous, from Jaromir Dolecek.
 1.41  29-Nov-2002  itojun setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) for AF_INET6 sockets,
to meet with the default behavior of linux.
review: fvdl/christos
XXX interactions with net.inet6.ip6.v6only?
 1.40  28-Nov-2002  itojun minor KNF (indent)
 1.39  12-May-2002  jschauma branches: 1.39.4;
Linux does not implement SO_REUSEPORT, but allows reuse of a
host:port pair through SO_REUSEADDR even if the address is not a
multicast-address. Effectively, this means that we should use
SO_REUSEPORT when SO_REUSEADDR is set (from the linux process)
to allow Linux applications to not exit with EADDRINUSE.

(Previously erraneously applied to 1.5 branch; approved for
proper location by thorpej)
 1.38  08-Apr-2002  christos PR/16236: Joachim Koenig-Baltes: Linux emulation connect requires IPV6.
Apparently the sockaddr len fix was only compiled when IPV6 was enabled.
 1.37  29-Mar-2002  christos - #undef DPRINTF for files that are included from other files.
- more debugging for socketcalls
- fix sa_len if AF_INET; somehow we get passed 28 instead of 16?
 1.36  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.35  13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.34  08-Sep-2001  fvdl Allow the old-style sockaddr_in6 for v6 addresses for which the
scope id is irrelevant. Makes netscape6 for Linux work again,
which uses v4-mapped addresses to connect to v4 sites.
 1.33  04-Jul-2001  jdolecek branches: 1.33.2; 1.33.4;
remove no longer used variable
make 'osa' arg of linux_sa_get() const
 1.32  04-Jul-2001  jdolecek Do address family (AF_*) number translation for socket system calls which
pass socket address in our or out. This makes Linux programs using IPv6
working under emulation. This addresses kern/13279 by Jun-ichiro itojun Hagino.

Change sendmsg()/recvmsg() to expect the control information
to be passed the standard way (not 4.3BSD one, imlied by compat_43 code
or MSG_COMPAT). Linux uses different (arguably broken) CMSG_ALIGN() on some
architectures unfortunately, that would need to be handled eventually.

Also provide some other trivial stubs (like linux_sys_send()) to avoid
unneeded dependance on uipc_syscalls_43.c.
 1.31  25-Jun-2001  jdolecek linux_getifhwaddr(): use strncmp() to find out if if_name starts with 'eth',
it's more readable that way
 1.30  14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.29  29-Mar-2001  fvdl Don't do the ioctl call for the get hw addr case, all the work has
been done already.
 1.28  05-Feb-2001  chs branches: 1.28.2;
expose the definitions of MIN() and MAX() in sys/param.h to the kernel
and use those in favor of a dozen copies scattered around the source tree.
 1.27  29-Dec-2000  fvdl Allow the EJUSTRETURN hack for PTIOCLINUX-passed through ioctl calls.
 1.26  22-Dec-2000  fvdl Don't do the syscall with modified ioctl command if we've successfully
done a 'passthrough' ioctl.
 1.25  18-Dec-2000  fvdl Pass SIOC* calls that are done on devices (not sockets) through
without trying to interpret done, as is done on Linux. The device
will get them as PTIOCLINUX, with command and arg in the structure
passed in.
 1.24  03-May-2000  thorpej branches: 1.24.4;
Remove junk after #undef.
 1.23  30-Mar-2000  augustss Kill register declarations.
 1.22  12-Jan-2000  jdolecek Improve emulation of SIOCGIFHWADDR ioctl:
* when finding an interface, try the real name first before faking eth*
* Linux kernel returns ENODEV if the request goes to unknown interface,
so do the same here

This change makes Linux ICA client work.

Patch sent by Zdenek Salvet <salvet@ics.muni.cz> in kern/9169.
 1.21  17-Jul-1999  jtk branches: 1.21.2;
implement emulation of SIOCGIFHWADDR, PR 7997
 1.20  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.19  25-Mar-1999  sommerfe branches: 1.19.2; 1.19.4;
commit fix to PR7072: emulate linux non-blocking connect behavior more correctly
 1.18  04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.17  03-Oct-1998  christos Attempt to fix the mess.
 1.16  01-Oct-1998  erh Split linux/compat/linux_socket.c into common and multi-architechture parts. linux_socketcall.c contains the socketcall multiplexer.
 1.15  22-Dec-1996  fvdl Make this compile again, including Politically Correct const handling.
 1.14  05-Apr-1996  christos Prototyping changes.
 1.13  08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.12  07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11  19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10  14-Aug-1995  mycroft Rearrange #includes.
 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  28-May-1995  mycroft Need netinet/tcp.h.
 1.6  28-May-1995  mycroft Convert TCP socket options.
 1.5  28-May-1995  mycroft Fill in `name' argument to getsockopt() correctly.
 1.4  28-May-1995  mycroft Fix typo.
 1.3  28-May-1995  mycroft Convert IP socket options.
 1.2  28-May-1995  mycroft Get rid of damned `static's.
 1.1  28-Feb-1995  fvdl Added Linux compat code.
 1.19.4.2  02-Aug-1999  thorpej Update from trunk.
 1.19.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.19.2.1  15-Jan-2000  he Pull up revision 1.21 (via patch, requested by joda):
Implement the SIOCGIFHWADDR Linux ioctl, allowing installation
of Matlab (after convincing the install script it is running on
a supported platform).
 1.21.2.4  21-Apr-2001  bouyer Sync with HEAD
 1.21.2.3  11-Feb-2001  bouyer Sync with HEAD.
 1.21.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.21.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.24.4.4  12-May-2002  jschauma Undo my own bad - change did not belong into 1.5 branch. Sorry.
 1.24.4.3  11-May-2002  jschauma Linux does not implement SO_REUSEPORT, but allows reuse of a
host:port pair through SO_REUSEADDR even if the address is not a
multicast-address. Effectively, this means that we should use
SO_REUSEPORT when SO_REUSEADDR is set (from the linux process)
to allow Linux applications to not exit with EADDRINUSE.
 1.24.4.2  30-Mar-2001  he Pull up revision 1.29 (requested by fvdl):
Fix the SIOCGETHWADDR socket ioctl call; earlier it always returned
an error.
 1.24.4.1  30-Mar-2001  he Pull up revisions 1.25-1.26 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.28.2.14  11-Dec-2002  thorpej Sync with HEAD.
 1.28.2.13  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.28.2.12  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.28.2.11  20-Jun-2002  nathanw Catch up to -current.
 1.28.2.10  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.28.2.9  17-Apr-2002  nathanw Catch up to -current.
 1.28.2.8  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.28.2.7  14-Nov-2001  nathanw Catch up to -current.
 1.28.2.6  21-Sep-2001  nathanw Catch up to -current.
 1.28.2.5  24-Aug-2001  nathanw A few files and lwp/proc conversions I missed in the last big update.
GENERIC runs again.
 1.28.2.4  24-Aug-2001  nathanw Catch up with -current.
 1.28.2.3  21-Jun-2001  nathanw Catch up to -current.
 1.28.2.2  09-Apr-2001  nathanw Catch up with -current.
 1.28.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.33.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.33.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.33.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.33.2.1  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.39.4.3  22-Oct-2003  jmc Pullup revs 1.41-1.42 (requested by tv in ticket #1429)

setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) for AF_INET6 sockets,
to meet with the default behavior of linux.
 1.39.4.2  22-Oct-2003  jmc Pullup rev 1.49 (via patch) (requested by tv in ticket #1425)

More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input,
and to Linux value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).
 1.39.4.1  22-Oct-2003  jmc Pullup rev 1.46 (requested by tv in ticket #1425)

make credentials work on the i386 by passing the original msg structure.
 1.42.2.1  18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.46.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.46.2.7  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.46.2.6  21-Sep-2004  skrll Adapt to branch.
 1.46.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.46.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.46.2.3  03-Sep-2004  skrll Sync with HEAD
 1.46.2.2  03-Aug-2004  skrll Sync with HEAD
 1.46.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.50.2.1  20-Sep-2004  tron Pull up revision 1.53 (requested by jdolecek in ticket #844):
if passed sockaddr has family AF_UNSPEC, use socket family of the socket
the sockaddr is used for
this fixes bind() problem in Linux version of Theocracy, testing
by Thomas Klausner
 1.53.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.53.4.1  29-Apr-2005  kent sync with -current
 1.56.2.9  24-Mar-2008  yamt sync with head.
 1.56.2.8  11-Feb-2008  yamt sync with head.
 1.56.2.7  21-Jan-2008  yamt sync with head
 1.56.2.6  07-Dec-2007  yamt sync with head
 1.56.2.5  27-Oct-2007  yamt sync with head.
 1.56.2.4  03-Sep-2007  yamt sync with head.
 1.56.2.3  26-Feb-2007  yamt sync with head.
 1.56.2.2  30-Dec-2006  yamt sync with head.
 1.56.2.1  21-Jun-2006  yamt sync with head.
 1.58.6.2  01-Jun-2006  kardel Sync with head.
 1.58.6.1  22-Apr-2006  simonb Sync with head.
 1.58.4.1  09-Sep-2006  rpaulo sync with head
 1.58.2.1  18-Feb-2006  yamt sync with head.
 1.59.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.59.6.1  28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.59.4.3  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.59.4.2  19-Apr-2006  elad sync with head.
 1.59.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.59.2.4  03-Sep-2006  yamt sync with head.
 1.59.2.3  11-Aug-2006  yamt sync with head
 1.59.2.2  24-May-2006  yamt sync with head.
 1.59.2.1  01-Apr-2006  yamt sync with head.
 1.62.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.66.4.2  10-Dec-2006  yamt sync with head.
 1.66.4.1  22-Oct-2006  yamt sync with head
 1.66.2.2  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.66.2.1  18-Nov-2006  ad Sync with head.
 1.68.2.1  21-Feb-2007  tron Pull up following revision(s) (requested by mlelstv in ticket #447):
sys/compat/linux/common/linux_socket.c: revision 1.70
Make setsockopt return compatible error codes for AF_UNIX sockets.
 1.70.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.71.4.1  11-Jul-2007  mjf Sync with head.
 1.71.2.4  09-Oct-2007  ad Sync with head.
 1.71.2.3  20-Aug-2007  ad Sync with HEAD.
 1.71.2.2  15-Jul-2007  ad Sync with head.
 1.71.2.1  09-Jun-2007  ad Sync with head.
 1.76.6.4  09-Dec-2007  jmcneill Sync with HEAD.
 1.76.6.3  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.76.6.2  03-Sep-2007  jmcneill Sync with HEAD.
 1.76.6.1  16-Aug-2007  jmcneill Sync with HEAD.
 1.76.2.1  03-Sep-2007  skrll Sync with HEAD.
 1.78.2.3  23-Mar-2008  matt sync with HEAD
 1.78.2.2  09-Jan-2008  matt sync with HEAD
 1.78.2.1  06-Nov-2007  matt sync with HEAD
 1.79.4.1  25-Oct-2007  bouyer Sync with HEAD.
 1.80.4.2  26-Dec-2007  ad Sync with head.
 1.80.4.1  08-Dec-2007  ad Sync with head.
 1.80.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.80.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.80.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.84.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.86.6.5  17-Jan-2009  mjf Sync with HEAD.
 1.86.6.4  28-Sep-2008  mjf Sync with HEAD.
 1.86.6.3  29-Jun-2008  mjf Sync with HEAD.
 1.86.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.86.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.89.2.2  17-Jun-2008  yamt sync with head.
 1.89.2.1  18-May-2008  yamt sync with head.
 1.91.2.4  11-Mar-2010  yamt sync with head
 1.91.2.3  20-Jun-2009  yamt sync with head
 1.91.2.2  04-May-2009  yamt sync with head.
 1.91.2.1  16-May-2008  yamt sync with head.
 1.93.2.4  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.93.2.3  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.93.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.93.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.94.2.3  03-Jul-2008  simonb Sync with head.
 1.94.2.2  27-Jun-2008  simonb Sync with head.
 1.94.2.1  18-Jun-2008  simonb Sync with head.
 1.97.2.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.97.2.1  19-Oct-2008  haad Sync with HEAD.
 1.98.6.1  17-Jun-2009  bouyer branches: 1.98.6.1.2;
Pull up following revision(s) (requested by njoly in ticket #806):
sys/compat/linux/common/linux_socket.c: revision 1.100
In sendmsg(2), do copy the msghdr structure before trying to use it.
 1.98.6.1.2.1  21-Apr-2010  matt sync to netbsd-5
 1.98.4.2  28-Nov-2009  bouyer Pull up following revision(s) (requested by joerg in ticket #1147):
sys/compat/linux32/common/linux32_socket.c: revision 1.11, 1.12
sys/compat/linux/common/linux_socket.c: revision 1.105, 1.106
sys/compat/linux/common/linux_sockio.h: revision 1.17
sys/compat/linux32/common/linux32_sockio.h: revision 1.3
Provide SIOCGIFNAME.
Return the result of copyout. Reminded by Niolas Joly.
 1.98.4.1  17-Jun-2009  bouyer Pull up following revision(s) (requested by njoly in ticket #806):
sys/compat/linux/common/linux_socket.c: revision 1.100
In sendmsg(2), do copy the msghdr structure before trying to use it.
 1.98.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.99.4.1  23-Jul-2009  jym Sync with HEAD.
 1.107.4.1  05-Mar-2011  rmind sync with head
 1.107.2.1  06-Nov-2010  uebayasi Sync with HEAD.
 1.110.6.2  05-Apr-2012  mrg sync to latest -current.
 1.110.6.1  18-Feb-2012  mrg merge to -current.
 1.110.2.4  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.110.2.3  23-Jan-2013  yamt sync with head
 1.110.2.2  30-Oct-2012  yamt sync with head
 1.110.2.1  17-Apr-2012  yamt sync with head
 1.114.2.3  03-Dec-2017  jdolecek update from HEAD
 1.114.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.114.2.1  25-Feb-2013  tls resync with head
 1.115.2.2  18-May-2014  rmind sync with head
 1.115.2.1  17-Jul-2013  rmind Checkpoint work in progress:
- Move PCB structures under __INPCB_PRIVATE, adjust most of the callers
and thus make IPv4 PCB structures mostly opaque. Any volunteers for
merging in6pcb with inpcb (see rpaulo-netinet-merge-pcb branch)?
- Move various global vars to the modules where they belong, make them static.
- Some preliminary work for IPv4 PCB locking scheme.
- Make raw IP code mostly MP-safe. Simplify some of it.
- Rework "fast" IP forwarding (ipflow) code to be mostly MP-safe. It should
run from a software interrupt, rather than hard.
- Rework tun(4) pseudo interface to be MP-safe.
- Work towards making some other interfaces more strict.
 1.117.2.1  10-Aug-2014  tls Rebase.
 1.119.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.119.2.2  19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.119.2.1  17-Jan-2015  martin branches: 1.119.2.1.2; 1.119.2.1.6;
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.119.2.1.6.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.119.2.1.6.1  19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.119.2.1.2.1  19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.122.2.8  28-Aug-2017  skrll Sync with HEAD
 1.122.2.7  05-Feb-2017  skrll Sync with HEAD
 1.122.2.6  05-Oct-2016  skrll Sync with HEAD
 1.122.2.5  09-Jul-2016  skrll Sync with HEAD
 1.122.2.4  29-May-2016  skrll Sync with HEAD
 1.122.2.3  22-Sep-2015  skrll Sync with HEAD
 1.122.2.2  06-Jun-2015  skrll Sync with HEAD
 1.122.2.1  06-Apr-2015  skrll Sync with HEAD
 1.131.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.131.2.1  06-Aug-2016  pgoyette Sync with HEAD
 1.133.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.138.6.7  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.138.6.6  17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1576):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.138.6.5  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.138.6.4  19-Apr-2019  martin Pull up following revision(s) (requested by christos in ticket #1233):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.138.6.3  08-Dec-2018  martin Apply patch, requested by tsutsui in ticket #1132:

Different solution for the fix in

sys/compat/linux/common/linux_socket.c rev 1.140

The solution in -current could not be directly used as it required a kernel
version bump and broke the ABI. Work around it differently here.

Fixes linux emulation of sendto(2), PR 53103.
 1.138.6.2  12-May-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #818):

sys/compat/linux/common/linux_socket.c: revision 1.142
sys/compat/linux32/common/linux32_socket.c: revision 1.29

Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.
 1.138.6.1  30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #407):
sys/compat/linux32/common/linux32_socket.c: revision 1.28
sys/net/if.c: revision 1.400
sys/netipsec/key.c: revision 1.243
sys/compat/linux/common/linux_socket.c: revision 1.139
sys/netinet/ip_carp.c: revision 1.93
sys/netinet6/in6.c: revision 1.252
sys/netinet6/in6.c: revision 1.253
sys/netinet6/in6.c: revision 1.254
sys/net/if_spppsubr.c: revision 1.173
sys/net/if_spppsubr.c: revision 1.174
sys/compat/common/uipc_syscalls_40.c: revision 1.14
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Fix usage of FOREACH macro
key_sad.lock is held there so SAVLIST_WRITER_FOREACH is enough.
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)
Fix and make consistent of usages of psz/psref in ifconf variants
Remove unnecessary goto because there is no cleanup code to share (NFC)
Tweak a condition; we don't need to care ifacount to be negative
Fix a race condition of in6_ifinit
in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.
Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.
 1.139.2.3  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.139.2.2  21-May-2018  pgoyette Sync with HEAD
 1.139.2.1  22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.142.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.142.2.1  10-Jun-2019  christos Sync with HEAD
 1.145.4.4  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.145.4.3  08-Nov-2020  martin Pull up following revision(s) (requested by kamil in ticket #1127):

sys/compat/linux/common/linux_socket.c: revision 1.151

Fix compat with Linux programs that use longer namelen for sockets

Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*. If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
 1.145.4.2  17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1018):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.145.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.151.2.1  14-Dec-2020  thorpej Sync w/ HEAD.

RSS XML Feed