Home | History | Annotate | Download | only in common
History log of /src/sys/compat/linux32/common/linux32_socket.c
RevisionDateAuthorComments
 1.32  24-Dec-2022  andvar s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments.
 1.31  16-Jul-2020  msaitoh Don't accept negative value.

Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
 1.30  18-Apr-2019  christos branches: 1.30.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.29  10-May-2018  ozaki-r branches: 1.29.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.28  22-Nov-2017  ozaki-r branches: 1.28.2;
Fix and make consistent of usages of psz/psref in ifconf variants
 1.27  14-Mar-2017  ozaki-r branches: 1.27.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.26  01-Aug-2016  ozaki-r branches: 1.26.2;
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.25  07-Jul-2016  ozaki-r branches: 1.25.2;
Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.
 1.24  05-Jul-2016  ozaki-r Fix psref isn't released in a case of IFADDR_EMPTY
 1.23  16-Jun-2016  ozaki-r Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND
 1.22  15-Jun-2016  ozaki-r Protect if_byindex by pserialize
 1.21  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.20  24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.19  26-Nov-2014  ozaki-r branches: 1.19.2;
Tweak ifconf variants

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

No functional change.
 1.18  17-May-2014  rmind branches: 1.18.2; 1.18.4; 1.18.8;
Replace open-coded access (and boundary checking) of ifindex2ifnet with
if_byindex() function.
 1.17  11-Jan-2013  christos branches: 1.17.2; 1.17.10;
Use copyin/copyout and linux-specific ifreq structures (they are the same
as the netbsd ones, but this disconnects them)
 1.16  15-Mar-2012  bouyer branches: 1.16.2;
Do not read past end of array. Found by gcc -03
 1.15  12-Dec-2009  njoly branches: 1.15.12; 1.15.16;
Add missing semicolons after NETBSD32TOx_UAP macro calls.
 1.14  10-Dec-2009  njoly Add SIOCGIFMTU support.
 1.13  10-Dec-2009  njoly Do not give native requests to netbsd32_ioctl(), use the compat
netbsd32 equivalent instead.
 1.12  13-Nov-2009  joerg Return the result of copyout. Reminded by Niolas Joly.
 1.11  13-Nov-2009  joerg Provide SIOCGIFNAME.
 1.10  19-Nov-2008  ad 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.9  23-Jul-2008  njoly branches: 1.9.2; 1.9.4; 1.9.8;
Add linux32_getifconf, following recent linux_getifconf addition.
 1.8  27-Jun-2008  njoly branches: 1.8.2;
Add SIOCGIFHWADDR support.
Tested by Cem Kayali.
 1.7  24-Jun-2008  njoly Fix SIOCGIFCONF ioctl under compat linux32.
 1.6  19-Jun-2008  christos an attempt at linux32_ioctl_socket().
 1.5  20-Dec-2007  dsl branches: 1.5.6; 1.5.10; 1.5.12; 1.5.14;
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.4  08-Dec-2007  dsl branches: 1.4.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.3  09-Feb-2007  ad branches: 1.3.18; 1.3.20; 1.3.28;
Merge newlock2 to head.
 1.2  13-Sep-2006  manu 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.1  09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
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.1.22.2  09-Sep-2006  rpaulo sync with head
 1.1.22.1  09-Feb-2006  rpaulo file linux32_socket.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.2  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.20.1  18-Nov-2006  ad Sync with head.
 1.1.16.5  21-Jan-2008  yamt sync with head
 1.1.16.4  26-Feb-2007  yamt sync with head.
 1.1.16.3  30-Dec-2006  yamt sync with head.
 1.1.16.2  21-Jun-2006  yamt sync with head.
 1.1.16.1  09-Feb-2006  yamt file linux32_socket.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2  22-Apr-2006  simonb Sync with head.
 1.1.10.1  09-Feb-2006  simonb file linux32_socket.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1  14-Sep-2006  yamt sync with head.
 1.1.2.2  18-Feb-2006  yamt sync with head.
 1.1.2.1  09-Feb-2006  yamt file linux32_socket.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.28.1  26-Dec-2007  ad Sync with head.
 1.3.20.1  09-Jan-2008  matt sync with HEAD
 1.3.18.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.4.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.5.14.2  28-Jul-2008  simonb Sync with head.
 1.5.14.1  27-Jun-2008  simonb Sync with head.
 1.5.12.4  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.12.3  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.12.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.5.12.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.5.10.2  11-Mar-2010  yamt sync with head
 1.5.10.1  04-May-2009  yamt sync with head.
 1.5.6.3  17-Jan-2009  mjf Sync with HEAD.
 1.5.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.5.6.1  29-Jun-2008  mjf Sync with HEAD.
 1.8.2.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.2.1  19-Oct-2008  haad Sync with HEAD.
 1.9.8.1  21-Apr-2010  matt sync to netbsd-5
 1.9.4.1  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.9.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.15.16.1  05-Apr-2012  mrg sync to latest -current.
 1.15.12.2  23-Jan-2013  yamt sync with head
 1.15.12.1  17-Apr-2012  yamt sync with head
 1.16.2.3  03-Dec-2017  jdolecek update from HEAD
 1.16.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.2.1  25-Feb-2013  tls resync with head
 1.17.10.1  10-Aug-2014  tls Rebase.
 1.17.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.18.8.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.18.4.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.18.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.19.2.5  28-Aug-2017  skrll Sync with HEAD
 1.19.2.4  05-Oct-2016  skrll Sync with HEAD
 1.19.2.3  09-Jul-2016  skrll Sync with HEAD
 1.19.2.2  29-May-2016  skrll Sync with HEAD
 1.19.2.1  22-Sep-2015  skrll Sync with HEAD
 1.25.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.25.2.1  06-Aug-2016  pgoyette Sync with HEAD
 1.26.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.27.6.4  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.27.6.3  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.27.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.27.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.28.2.1  21-May-2018  pgoyette Sync with HEAD
 1.29.2.1  10-Jun-2019  christos Sync with HEAD
 1.30.4.1  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.

RSS XML Feed