]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMFC r364304:
Mark Johnston [Mon, 24 Aug 2020 13:54:41 +0000 (13:54 +0000)]
MFC r364304:
cpuset(1): Update the usage message.

3 years agoMFC r354732:
Edward Tomasz Napierala [Mon, 24 Aug 2020 13:52:47 +0000 (13:52 +0000)]
MFC r354732:

Support O_CLOEXEC in linux(4) open(2) and openat(2).

Sponsored by: The FreeBSD Foundation

3 years agoMFC r364300:
Mark Johnston [Mon, 24 Aug 2020 13:50:55 +0000 (13:50 +0000)]
MFC r364300:
asmc(4): Add support for MacBook7,1.

PR: 248693

3 years agoMFC r363564-r363567, r363575, r363835-r363837, r363842-r363843, r364232
Emmanuel Vadot [Mon, 24 Aug 2020 13:19:16 +0000 (13:19 +0000)]
MFC r363564-r363567, r363575, r363835-r363837, r363842-r363843, r364232

r363564:
linuxkpi: Include linux/sizes.h in dma-mapping.h

Linux does the same, this avoids ifdef or extra includes in ported drivers.

Reviewed by: emaste, hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25701

r363565:
linuxkpi: Include hardirq.h in preempt.h and lockdep.h in hardirq.h

Linux does the same, this avoids ifdef or extra includes in ported drivers.

Reviewed by: emaste, hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25702

r363566:
linuxkpi: Add taint* defines

This isn't used for us but allow us to port drivers more easily.

Reviewed by: hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25703

r363567:
Revert r363564

linux/sizes.h doesn't exists in base ... sorry.

r363575:
Fix r363565

lockdep.h needs sys/lock.h for LOCK_CLASS

r363835:
linuxkpi: Add linux/sizes.h

This file contain some defines for common sizes.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D25941

r363836:
linuxkpi: Add kref_put_lock

Same as kref_put but in addition to calling the rel function it will
acquire the lock first.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D25942

r363837:
linuxkpi: Add nested variant of mutex_lock_interruptible

We don't do anything with the _nesteds variant so just call mutex_lock_interruptible

Sponsoredby: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D25944

r363842:
linuxkpi: Add clear_bit_unlock

This calls clear_bit and adds a memory barrier.

Sponsored by: The FreeBSD Foundation

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D25943

r363843:
linuxkpi: Add time_after32 and time_before32

This compare two 32 bits times

Sponsored by: The FreeBSD Foundation
Reviewed by: kib, hselasky
Differential Revision: https://reviews.freebsd.org/D25700

r364232:
linuxkpi: Add a few wait_bit functions

The linux function does a lot more than that as multiple waitqueue could be fetch
from a static table based on the hash of the argument but since in DRM it's only used
in one place just add a single variable.
We will probably need to change that in the futur but it's ok with DRM even with current
linux.

Reviewed by: hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26054

3 years agoMFC r361450, r361452, r361550-r361551
Emmanuel Vadot [Mon, 24 Aug 2020 13:14:38 +0000 (13:14 +0000)]
MFC r361450, r361452, r361550-r361551

r361450:
linuxkpi: Add refcount.h

Implement some refcount functions needed by drm.
Just use the atomic_t struct and functions from linuxkpi for simplicity.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselsasky
Differential Revision: https://reviews.freebsd.org/D24985

r361452:
linuxkpi: Fix mod_timer and del_timer_sync

mod_timer is supposed to return 1 if the modified timer was pending, which
is exactly what callout_reset does so return the value after checking
that it's a correct one in case the api change.
del_timer_sync returns int so add a function and handle that.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24983

r361550:
linuxkpi: Add rcu_swap_protected

This macros swap an rcu pointer with a normal pointer.
The condition only seems to be used for debug/warning under linux, ignore
for now.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24954

r361551:
linuxkpi: Add kstrtou16

This function convert a char * to a u16.
Simply use strtoul and cast to compare for ERANGE

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24996

3 years agoMFC r361247, r361343, r361418-r361419, r361422, r361449
Emmanuel Vadot [Mon, 24 Aug 2020 12:59:55 +0000 (12:59 +0000)]
MFC r361247, r361343, r361418-r361419, r361422, r361449

r361247:
linuxkpi: Add irq_work.h

Since handlers are call in a thread context we can simply use a workqueue
to emulate those functions.
The DRM code was patched to do that already, having it in linuxkpi allows us
to not patch the upstream code.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24859

r361343:
linuxkpi: Add rcu_work functions

The rcu_work function helps to queue some work after waiting for a grace
period.
This is needed by DRM drivers.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24942

r361418:
libkern: Add arc4random_uniform

This variant get a random number up to the limit passed as the argument.
This is simply a copy of the libc version.

Sponsored-by: The FreeBSD Foundation
Reviewed by: cem, hselasky (previous version)
Differential Revision: https://reviews.freebsd.org/D24962

r361419:
linuxkpi: Add prandom_u32_max

This is just a wrapper around arc4random_uniform
Needed by DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by: cem, hselasky
Differential Revision: https://reviews.freebsd.org/D24961

r361422:
bbr: Use arc4random_uniform from libkern.

This unbreak LINT build

Reported by: jenkins, melifaro

r361449:
linuxkpi: Add __same_type and __must_be_array macros

The same_type macro simply wraps around builtin_types_compatible_p which
exist for both GCC and CLANG, which returns 1 if both types are the same.
The __must_be_array macros returns 1 if the argument is an array.

This is needed for DRM v5.3

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24953

3 years agoMFC r349750:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:59:15 +0000 (12:59 +0000)]
MFC r349750:

Return ENOTSUP for Linux FS_IOC_FIEMAP ioctl.

Linux man(1) calls it for no good reason; this avoids the console spam
(eg '(man): ioctl fd=4, cmd=0x660b ('f',11) is not implemented').

Sponsored by: The FreeBSD Foundation

3 years agoMFC r349746:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:57:03 +0000 (12:57 +0000)]
MFC r349746:

Fix linuxulator prlimit64(2) with pid == 0.  This makes 'ulimit -a'
return something reasonable, and helps linux binaries which attempt
to close all the files, eg apt(8).

Sponsored by: The FreeBSD Foundation

3 years agoMFC r362205:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:54:19 +0000 (12:54 +0000)]
MFC r362205:

Make Linux uname(2) return x86_64 to 32-bit apps.  This helps Steam.

PR: kern/240432
Analyzed by: Alex S <iwtcex@gmail.com>
Sponsored by: The FreeBSD Foundation

3 years agoMFC r362104:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:51:20 +0000 (12:51 +0000)]
MFC r362104:

Add compat.linux.debug sysctl, to make it possible to silence down
the debug messages. While here, clean up some variable naming.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r362015:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:49:51 +0000 (12:49 +0000)]
MFC r362015:

Make linux(4) set the openfiles soft resource limit to 1024 for Linux
applications, which often depend on this being the case.  There's a new
sysctl, compat.linux.default_openfiles, to control this behaviour.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r358673 by tijl:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:47:20 +0000 (12:47 +0000)]
MFC r358673 by tijl:

Move compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is
only defined by linux_common kernel module and not both linux and linux64
modules.

Reported by: Yuri Pankov <ypankov@fastmail.com>

3 years agoMFC r358483 by tijl:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:43:54 +0000 (12:43 +0000)]
MFC r358483 by tijl:

linuxulator: Map scheduler priorities to Linux priorities.

On Linux the valid range of priorities for the SCHED_FIFO and SCHED_RR
scheduling policies is [1,99].  For SCHED_OTHER the single valid priority is
0.  On FreeBSD it is [0,31] for all policies.  Programs are supposed to
query the valid range using sched_get_priority_(min|max), but of course some
programs assume the Linux values are valid.

This commit adds a tunable compat.linux.map_sched_prio.  When enabled
sched_get_priority_(min|max) return the Linux values and sched_setscheduler
and sched_(get|set)param translate between FreeBSD and Linux values.

Because there are more Linux levels than FreeBSD levels, multiple Linux
levels map to a single FreeBSD level, which means pre-emption might not
happen as it does on Linux, so the tunable allows to disable this behaviour.
It is enabled by default because I think it is unlikely that anyone runs
real-time software under Linux emulation on FreeBSD that critically relies
on correct pre-emption.

This fixes FMOD, a commercial sound library used by several games.

PR: 240043
Tested by: Alex S <iwtcex@gmail.com>

3 years agoMFC r357202:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:35:02 +0000 (12:35 +0000)]
MFC r357202:

Add compat.linux.ignore_ip_recverr sysctl.  This is a workaround
for missing IP_RECVERR setsockopt(2) support. Without it, DNS
resolution is broken for glibc >= 2.30 (glibc BZ #24047).

From the user point of view this fixes "yum update" on recent
CentOS 8.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r355820:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:33:42 +0000 (12:33 +0000)]
MFC r355820:

Add a hack to make ^T work for Linux binaries, enabled with
'compat.linux.preserve_vstatus=1' sysctl.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r362051:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:30:43 +0000 (12:30 +0000)]
MFC r362051:

Make linux(4) handle SO_REUSEPORT.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r357203:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:29:23 +0000 (12:29 +0000)]
MFC r357203:

Add TCP_CORK support to linux(4).  This fixes one of the things Nginx
trips over.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r357076:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:26:49 +0000 (12:26 +0000)]
MFC r357076:

Make linux(4) handle MAP_32BIT.

This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic);
previously would crash on "amd64_is_imm32" assert.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r362014:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:23:55 +0000 (12:23 +0000)]
MFC r362014:

Support SO_SNDBUFFORCE/SO_RCVBUFFORCE by aliasing them to the
standard SO_SNDBUF/SO_RCVBUF.  Mostly cosmetics, to get rid
of the warning during 'apt upgrade'.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r363322:
Edward Tomasz Napierala [Mon, 24 Aug 2020 12:20:55 +0000 (12:20 +0000)]
MFC r363322:

Make linux(4) support the BLKPBSZGET ioctl.  Oracle uses it.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r361007, r361138-r361140, r361245-r361246
Emmanuel Vadot [Mon, 24 Aug 2020 10:46:09 +0000 (10:46 +0000)]
MFC r361007, r361138-r361140, r361245-r361246

r361007:
linuxkpi: Add EBADRQC to errno.h

This is used in the amdgpu driver from Linux 5.2

Sponsored-by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24807

r361138:
linuxkpi: Add atomic_dec_and_mutex_lock

This function decrement the counter and if the result is 0 it acquires
the mutex and returns 1, if not it simply returns 0.
Needed by DRM from Linux v5.3

Sponsored-by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24847

r361139:
linuxkpi: Add __mutex_init

Same as mutex_init, the lock_class_key argument seems to be only used for
debug in Linux, simply ignore it for now.
Needed by DRM in Linux v5.3

Sponsored-by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24848

r361140:
linuxkpi: Add offsetofend macro

This calculate the offset of the end of the member in the given struct.
Needed by DRM in Linux v5.3

Sponsored-by: The FreeBSD Foudation
Differential Revision: https://reviews.freebsd.org/D24849

r361245:
linuxkpi: Add __init_waitqueue_head

The only difference with init_waitqueue_head is that the name and the
lock class key are provided but we don't use those so use init_waitqueue_head
directly.

Sponsored-by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24861

r361246:
linuxkpi: add pci_dev_present

pci_dev_present shows if a set of pci ids are present in the system.
It just wraps pci_find_device.
Needed by DRMv5.2

Submitted by: Austing Shafer (ashafer@badland.io)
Differential Revision: https://reviews.freebsd.org/D24796

3 years agoMFC r360787, r360851, r360870-r360872
Emmanuel Vadot [Mon, 24 Aug 2020 10:42:04 +0000 (10:42 +0000)]
MFC r360787, r360851, r360870-r360872

r360787:
linuxkpi: Add pci_iomap and pci_iounmap

Those function are use to map/unmap io region of a pci device.
Different resource can be mapped depending on the bar so use a
tailq to store them all.

Sponsored-by: The FreeBSD Foundation
Reviewed by: emaste, hselasky
Differential Revision: https://reviews.freebsd.org/D24696

r360851:
linuxkpi: Add bitmap_copy and bitmap_andnot

bitmap_copy simply copy the bitmaps, no idea why it exists.
bitmap_andnot is similar to bitmap_and but uses !src2.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D24782

r360870:
linuxkpi: Add bitmap_alloc and bitmap_free

This is a simple call to kmallock_array/kfree, therefore include linux/slab.h as
this is where the kmalloc_array/kfree definition is.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselsasky
Differential Revision: https://reviews.freebsd.org/D24794

r360871:
linuxkpi: Really add bitmap_alloc and bitmap_zalloc

This was missing in r360870

Sponsored-by: The FreeBSD Foundation
r360872:
qnlx: Do not redifines types.

r360870 added linux/slab.h into liunx/bitmap.h and this include linux/types.h
The qlnx driver is redefining some of those types so remove them and add an
explicit linux/types.h include.

Pointy hat: manu
Reported by: Austin Shafer <ashafer@badland.io>

3 years agoMFC r358176-r358177
Emmanuel Vadot [Mon, 24 Aug 2020 10:28:15 +0000 (10:28 +0000)]
MFC r358176-r358177

r358176:
linuxkpi: Add list_is_first function

This function just test if the element is the first of the list.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23766

r358177:
linuxkpi: Add str_has_prefix

This function test if the string str begins with the string pointed
at by prefix.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D23767

3 years agoMFC 364268:
Michael Tuexen [Mon, 24 Aug 2020 09:19:05 +0000 (09:19 +0000)]
MFC 364268:
Improve the handling of concurrent send() calls for SCTP sockets,
especially when having the explicit EOR mode enabled.

MFC r364270:
Remove a line which is needed and was added in
https://svnweb.freebsd.org/changeset/base/364268

3 years agoMFC r363456:
Michael Tuexen [Mon, 24 Aug 2020 09:15:52 +0000 (09:15 +0000)]
MFC r363456:
Clear the pointer to the socket when closing it also in case of
an ungraceful operation.
This fixes a use-after-free bug found and reported by Taylor
Brandstetter of Google by testing the userland stack.

3 years agoMFC r363440:
Michael Tuexen [Mon, 24 Aug 2020 09:14:32 +0000 (09:14 +0000)]
MFC r363440:
Detect and handle an invalid reassembly constellation, which results in
a memory leak.

Thanks to Felix Weinrank for finding this issue using fuzz testing the
userland stack.

3 years agoMFC r363323:
Michael Tuexen [Mon, 24 Aug 2020 09:13:06 +0000 (09:13 +0000)]
MFC r363323:
Add reference counts for inp/stcb/net when timers are running.
This avoids a use-after-free reported for the userland stack.
Thanks to Taylor Brandstetter for suggesting a patch for
the userland stack.

3 years agoMFC r363309:
Michael Tuexen [Mon, 24 Aug 2020 09:11:37 +0000 (09:11 +0000)]
MFC r363309:
Remove code which is not needed.

3 years agoMFC r363275:
Michael Tuexen [Mon, 24 Aug 2020 09:10:19 +0000 (09:10 +0000)]
MFC r363275:
Improve the locking of address lists by adding some asserts and
rearranging the addition of address such that the lock is not
given up during checking and adding.

3 years agoMFC r363194:
Michael Tuexen [Mon, 24 Aug 2020 09:06:46 +0000 (09:06 +0000)]
MFC r363194:
Improve the error handling in generating ASCONF chunks.
In case of errors, the cleanup was not consistent.
Thanks to Felix Weinrank for fuzzing the userland stack and making
me aware of the issue.

3 years agoMFC r363076:
Michael Tuexen [Mon, 24 Aug 2020 09:00:07 +0000 (09:00 +0000)]
MFC r363076:
Fix a use-after-free bug for the userland stack. The kernel
stack is not affected.
Thanks to Mark Wodrich from Google for finding and reporting the
bug.

3 years agoMFC r363046:
Michael Tuexen [Mon, 24 Aug 2020 08:58:45 +0000 (08:58 +0000)]
MFC r363046:
Optimize flushing of receive queues.
This addresses an issue found and reported for the userland stack in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21243

3 years agoMFC r363012:
Michael Tuexen [Mon, 24 Aug 2020 08:57:27 +0000 (08:57 +0000)]
MFC r363012:
Improve consistency.

3 years agoMFC r363011:
Michael Tuexen [Mon, 24 Aug 2020 08:41:22 +0000 (08:41 +0000)]
MFC r363011:
Fix error description.

3 years agoMFC r363010:
Michael Tuexen [Mon, 24 Aug 2020 08:40:10 +0000 (08:40 +0000)]
MFC r363010:
Don't accept FORWARD-TSN chunks when I-FORWARD-TSN was negotiated
and vice versa.

3 years agoMFC r363008:
Michael Tuexen [Mon, 24 Aug 2020 08:38:58 +0000 (08:38 +0000)]
MFC r363008:
Improve handling of PKTDROP chunks. This includes the input validation
to address two issues found by ossfuzz testing the userland stack:
* https://oss-fuzz.com/testcase-detail/5387560242380800
* https://oss-fuzz.com/testcase-detail/4887954068865024
and adding support for I-DATA chunks in addition to DATA chunks.

3 years agoMFC r362813:
Michael Tuexen [Mon, 24 Aug 2020 08:37:29 +0000 (08:37 +0000)]
MFC r362813:
Fix a bug introduced in https://svnweb.freebsd.org/changeset/base/362173

3 years agoMFC r362722:
Michael Tuexen [Mon, 24 Aug 2020 08:35:13 +0000 (08:35 +0000)]
MFC r362722:
Don't send packets containing ERROR chunks in response to unknown
chunks when being in a state where the verification tag to be used
is not known yet.

3 years agoMFC r362720:
Michael Tuexen [Mon, 24 Aug 2020 08:33:32 +0000 (08:33 +0000)]
MFC r362720:
Don't check ch for not being NULL, since that is true.

3 years agoMFC r362581:
Michael Tuexen [Mon, 24 Aug 2020 08:32:16 +0000 (08:32 +0000)]
MFC r362581:
Fix the acconting for fragmented unordered messages when using
interleaving.
This was reported for the userland stack in
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19321

3 years agoMFC r362563:
Michael Tuexen [Mon, 24 Aug 2020 08:30:36 +0000 (08:30 +0000)]
MFC r362563:
Fix alignment issue manifesting in the userland stack.

MFC r364353:
Fix two bugs I introduced in r362563.
Found by running syzkaller.

3 years agoMFC r362498:
Michael Tuexen [Mon, 24 Aug 2020 08:27:35 +0000 (08:27 +0000)]
MFC r362498:
No need to include netinet/sctp_crc32.h twice.

3 years agoMFC r362474:
Michael Tuexen [Mon, 24 Aug 2020 08:26:07 +0000 (08:26 +0000)]
MFC r362474:
Add include missing from my last commit.

3 years agoMFC r362473:
Michael Tuexen [Mon, 24 Aug 2020 08:25:00 +0000 (08:25 +0000)]
MFC r362473:
leanup the defintion of struct sctp_getaddresses. This stucture
is used by the IPPROTO_SCTP level socket options SCTP_GET_PEER_ADDRESSES
and SCTP_GET_LOCAL_ADDRESSES, which are used by libc to implement
sctp_getladdrs() and sctp_getpaddrs().
These changes allow an old libc to work on a newer kernel.

3 years agoMFC r362462:
Michael Tuexen [Mon, 24 Aug 2020 08:22:37 +0000 (08:22 +0000)]
MFC r362462:
Fix the build for an INET6 only configuration.
The fix from the last commit is actually needed twice...

3 years agoMFC r362454:
Michael Tuexen [Mon, 24 Aug 2020 08:20:49 +0000 (08:20 +0000)]
MFC r362454:
Set a variable also in the case of an INET6 only kernel

3 years agoMFC r362451:
Michael Tuexen [Mon, 24 Aug 2020 08:19:25 +0000 (08:19 +0000)]
MFC r362451:
Use a struct sockaddr_in or struct sockaddr_in6 as the option value
for the IPPROTO_SCTP level socket options SCTP_BINDX_ADD_ADDR and
SCTP_BINDX_REM_ADDR. These socket option are intended for internal
use only to implement sctp_bindx().
This is one user of struct sctp_getaddresses less.
struct sctp_getaddresses is strange and will be changed shortly.

3 years agoMFC r362448:
Michael Tuexen [Mon, 24 Aug 2020 08:16:07 +0000 (08:16 +0000)]
MFC r362448:
Cleanup the adding and deleting of addresses via sctp_bindx().

There is no need to use the association identifier, so remove it.
While there, cleanup the code a bit.

3 years agoMFC r362377:
Michael Tuexen [Mon, 24 Aug 2020 08:14:41 +0000 (08:14 +0000)]
MFC r362377:
Remove last argument of sctp_addr_mgmt_ep_sa(), since it is not used.

3 years agoMFC r362332:
Michael Tuexen [Mon, 24 Aug 2020 08:13:06 +0000 (08:13 +0000)]
MFC r362332:
Whitespace changes, not functional change intended.

3 years agoMFC r362277:
Michael Tuexen [Mon, 24 Aug 2020 08:11:47 +0000 (08:11 +0000)]
MFC r362277:
Allow the self reference to be NULL in case the timer was stopped.

3 years agoMFC r362178:
Michael Tuexen [Mon, 24 Aug 2020 08:10:27 +0000 (08:10 +0000)]
MFC r362178:
Allocate the mbuf for the signature in the COOKIE or the correct size.
While there, do also do some cleanups.

3 years agoMFC r362173:
Michael Tuexen [Mon, 24 Aug 2020 08:08:12 +0000 (08:08 +0000)]
MFC r362173:
Cleanups, no functional change.

3 years agoMFC r362155:
Michael Tuexen [Mon, 24 Aug 2020 08:01:09 +0000 (08:01 +0000)]
MFC r362155:
Remove usage of empty macro.

3 years agoMFC r362153:
Michael Tuexen [Mon, 24 Aug 2020 07:58:59 +0000 (07:58 +0000)]
MFC r362153:
Simpify a condition, no functional change.

3 years agoMFC r362107:
Michael Tuexen [Mon, 24 Aug 2020 07:57:29 +0000 (07:57 +0000)]
MFC r362107:
Whitespace change due to upstream cleanup.

3 years agoMFC r362106:
Michael Tuexen [Mon, 24 Aug 2020 07:55:46 +0000 (07:55 +0000)]
MFC r362106:
More cleanups due to ifdef cleanup done upstream.

3 years agoMFC r362090:
Michael Tuexen [Mon, 24 Aug 2020 07:53:14 +0000 (07:53 +0000)]
MFC r362090:
Small cleanup due to upstream ifdef cleanups.

3 years agoMFC r362054:
Michael Tuexen [Mon, 24 Aug 2020 07:42:50 +0000 (07:42 +0000)]
MFC r362054:
Non-functional changes due to upstream cleanup.

3 years agoMFC r364463: Fix CTL ioctl port creation error handling.
Alexander Motin [Mon, 24 Aug 2020 01:11:29 +0000 (01:11 +0000)]
MFC r364463: Fix CTL ioctl port creation error handling.

3 years agoMFC r361934:
Michael Tuexen [Sun, 23 Aug 2020 23:26:00 +0000 (23:26 +0000)]
MFC r361934:
Whitespace cleanups and removal of a stale comment.

3 years agoMFC r361895:
Michael Tuexen [Sun, 23 Aug 2020 23:24:38 +0000 (23:24 +0000)]
MFC r361895:
Retire SCTP_SO_LOCK_TESTING.

This was intended to test the locking used in the MacOS X kernel on a
FreeBSD system, to make use of WITNESS and other debugging infrastructure.
This hasn't been used for ages, to take it out to reduce the #ifdef
complexity.

3 years agoMFC r361877:
Michael Tuexen [Sun, 23 Aug 2020 23:22:55 +0000 (23:22 +0000)]
MFC r361877:
Fix typo in comment.

Submitted by Orgad Shaneh for the userland stack.

3 years agoMFC r361872:
Michael Tuexen [Sun, 23 Aug 2020 23:21:26 +0000 (23:21 +0000)]
MFC r361872:
Non-functional changes due to cleanup (upstream removing of Panda support)
of the code.

3 years agoMFC r361243:
Michael Tuexen [Sun, 23 Aug 2020 23:19:32 +0000 (23:19 +0000)]
MFC r361243:
Replace snprintf() by SCTP_SNPRINTF() and let SCTP_SNPRINTF() map
to snprintf() on FreeBSD. This allows to check for failures of snprintf()
on platforms other than FreeBSD kernel.

3 years agoMFC r361227:
Michael Tuexen [Sun, 23 Aug 2020 23:17:51 +0000 (23:17 +0000)]
MFC r361227:
Remove assignment without effect.

3 years agoMFC r361226:
Michael Tuexen [Sun, 23 Aug 2020 23:16:14 +0000 (23:16 +0000)]
MFC r361226:
Don't check an unsigned variable for being negative.

3 years agoMFC r361225:
Michael Tuexen [Sun, 23 Aug 2020 23:14:47 +0000 (23:14 +0000)]
MFC r361225:
Remove redundant assignment.

3 years agoMFC r361224:
Michael Tuexen [Sun, 23 Aug 2020 23:13:12 +0000 (23:13 +0000)]
MFC r361224:
Cleanup, no functional change intended.

3 years agoMFC r361222:
Michael Tuexen [Sun, 23 Aug 2020 23:11:53 +0000 (23:11 +0000)]
MFC r361222:
Avoid an integer underflow.

3 years agoMFC r361221:
Michael Tuexen [Sun, 23 Aug 2020 23:10:25 +0000 (23:10 +0000)]
MFC r361221:
Remove redundant check.

3 years agoMFC r361214:
Michael Tuexen [Sun, 23 Aug 2020 23:08:55 +0000 (23:08 +0000)]
MFC r361214:
Fix logical condition by looking at usecs.

This issue was found by cpp-check running on the userland stack.

3 years agoMFC r361213:
Michael Tuexen [Sun, 23 Aug 2020 23:02:51 +0000 (23:02 +0000)]
MFC r361213:
Whitespace change.

3 years agoMFC r361116:
Michael Tuexen [Sun, 23 Aug 2020 22:54:30 +0000 (22:54 +0000)]
MFC r361116:
Ensure that an stcb is not dereferenced when it is about to be
freed.
This issue was found by SYZKALLER.

3 years agoMFC r360885:
Michael Tuexen [Sun, 23 Aug 2020 22:52:47 +0000 (22:52 +0000)]
MFC r360885:
Ensure that the SCTP iterator runs with an stcb and inp, which belong to
each other.

3 years agoMFC r360878:
Michael Tuexen [Sun, 23 Aug 2020 22:50:59 +0000 (22:50 +0000)]
MFC r360878:
Ensure that we have a path when starting the T3 RXT timer.

MFC r360942:
Fix a copy and paste error introduced in r360878.

3 years agoMFC r360869:
Michael Tuexen [Sun, 23 Aug 2020 22:48:19 +0000 (22:48 +0000)]
MFC r360869:
Only drop DATA chunk with lower priorities as specified in RFC 7496.
This issue was found by looking at a reproducer generated by syzkaller.

3 years agoMFC r356170:
Edward Tomasz Napierala [Sun, 23 Aug 2020 22:47:08 +0000 (22:47 +0000)]
MFC r356170:

Implement Linux BLKGETSIZE64 ioctl.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r360671:
Michael Tuexen [Sun, 23 Aug 2020 22:40:38 +0000 (22:40 +0000)]
MFC r360671:
Avoid underflowing a variable, which would result in taking more
data from the stream queues then needed.

Thanks to Timo Voelker for finding this bug and providing a fix.

3 years agoMFC r360662:
Michael Tuexen [Sun, 23 Aug 2020 22:39:06 +0000 (22:39 +0000)]
MFC r360662:
Fix the computation of the numbers of entries of the mapping array to
look at when generating a SACK. This was wrong in case of sequence
numbers wrap arounds.

Thanks to Gwenael FOURRE for reporting the issue for the userland stack:
https://github.com/sctplab/usrsctp/issues/462

3 years agoMFC r360209:
Michael Tuexen [Sun, 23 Aug 2020 22:35:52 +0000 (22:35 +0000)]
MFC r360209:
Improve input validation when processing AUTH chunks.

Thanks to Natalie Silvanovich from Google for finding and reporting the
issue found by her in the SCTP userland stack.

3 years agoMFC r360193:
Michael Tuexen [Sun, 23 Aug 2020 22:34:15 +0000 (22:34 +0000)]
MFC r360193:
Improve input validation when processing AUTH chunks.

Thanks to Natalie Silvanovich from Google for finding and reporting the
issue found by her in the SCTP userland stack.

3 years agoMFC r359657:
Michael Tuexen [Sun, 23 Aug 2020 22:30:52 +0000 (22:30 +0000)]
MFC r359657:
Do more argument validation under INVARIANTS when starting/stopping
an SCTP timer.

3 years agoMFC r359410:
Michael Tuexen [Sun, 23 Aug 2020 22:28:19 +0000 (22:28 +0000)]
MFC r359410:
Small cleanup by using a variable just assigned.

3 years agoMFC r359405:
Michael Tuexen [Sun, 23 Aug 2020 22:26:38 +0000 (22:26 +0000)]
MFC r359405:
Handle integer overflows correctly when converting msecs and secs to
ticks and vice versa.
These issues were caught by recently added panic() calls on INVARIANTS
systems.

3 years agoMFC r359379:
Michael Tuexen [Sun, 23 Aug 2020 22:24:46 +0000 (22:24 +0000)]
MFC r359379:
Some more uint32_t cleanups, no functional change.

3 years agoMFC r363093:
Edward Tomasz Napierala [Sun, 23 Aug 2020 22:23:19 +0000 (22:23 +0000)]
MFC r363093:

Make linux stat(2) return the same st_dev for every devfs instance.
The reason for this is to work around an idiosyncrasy of glibc
getttynam(3) implementation: it checks whether st_dev returned for
fd 0 is the same as st_dev returned for the target of /proc/self/fd/0
symlink, and with linux chroots having their own devfs instance,
the check will fail if you chrooted into it.

PR: kern/240767
Sponsored by: The FreeBSD Foundation

3 years agoMFC r356172:
Edward Tomasz Napierala [Sun, 23 Aug 2020 22:21:36 +0000 (22:21 +0000)]
MFC r356172:

Make Linux stat(2) et al distinguish between block and character
devices.  It's required for LTP, among other things.  It's not
complete, but good enough for now.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r359306:
Michael Tuexen [Sun, 23 Aug 2020 22:19:39 +0000 (22:19 +0000)]
MFC r359306:
Remove an optimization, which was incorrect a couple of times and
therefore doesn't seem worth to be there.
In this case COOKIE where not retransmitted anymore, when the
socket was already closed.

3 years agoMFC r359305:
Michael Tuexen [Sun, 23 Aug 2020 22:17:29 +0000 (22:17 +0000)]
MFC r359305:
Improve consistency in debug output.

3 years agoMFC r359301:
Michael Tuexen [Sun, 23 Aug 2020 22:16:03 +0000 (22:16 +0000)]
MFC r359301:
Use consistent debug output.

3 years agoMFC r359300:
Michael Tuexen [Sun, 23 Aug 2020 22:13:57 +0000 (22:13 +0000)]
MFC r359300:
Don't restore the vnet too early in error cases.

3 years agoMFC r362052:
Edward Tomasz Napierala [Sun, 23 Aug 2020 22:12:55 +0000 (22:12 +0000)]
MFC r362052:

Improve the warnings.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r359288:
Michael Tuexen [Sun, 23 Aug 2020 22:09:20 +0000 (22:09 +0000)]
MFC r359288:
Only call panic when building with INVARIANTS.

3 years agoMFC r359287:
Michael Tuexen [Sun, 23 Aug 2020 22:07:49 +0000 (22:07 +0000)]
MFC r359287:
Another cleanup of the timer code. Also be more pedantic about the
parameters of the timer start and stop routines. Several inconsistencies
have been fixed in earlier commits. Now they will be catched when running
an INVARIANTS system.

3 years agoMFC r359234:
Michael Tuexen [Sun, 23 Aug 2020 22:05:57 +0000 (22:05 +0000)]
MFC r359234:
Cleanup the file and add two ASSERT variants for locks, which will be
used shortly.

3 years agoMFC r359195:
Michael Tuexen [Sun, 23 Aug 2020 22:04:02 +0000 (22:04 +0000)]
MFC r359195:
More timer cleanups, no functional change.

3 years agoMFC r359162:
Michael Tuexen [Sun, 23 Aug 2020 22:02:19 +0000 (22:02 +0000)]
MFC r359162:
Remove a set, but unused variable.

3 years agoMFC r359152:
Michael Tuexen [Sun, 23 Aug 2020 21:59:23 +0000 (21:59 +0000)]
MFC r359152:
Consistently provide arguments for timer start and stop routines.
This is another step in cleaning up timer handling.

3 years agoMFC r359151::
Michael Tuexen [Sun, 23 Aug 2020 21:57:24 +0000 (21:57 +0000)]
MFC r359151::
Cleanup the stream reset and asconf timer.