]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agocontrib/bc: merge version 5.2.1 from vendor branch
Stefan Eßer [Tue, 30 Nov 2021 17:40:32 +0000 (18:40 +0100)]
contrib/bc: merge version 5.2.1 from vendor branch

Merge commit 'e63540eed295749528548c2e3a90f5a6e57275c8'

2 years agovendor/bc: import release 5.2.1
Stefan Eßer [Tue, 30 Nov 2021 17:33:40 +0000 (18:33 +0100)]
vendor/bc: import release 5.2.1

This release fixes two parse bugs when in POSIX standard mode. One of
these bugs was due to a quirk of the POSIX grammar, and the other was
because bc was too strict.

2 years agovendor/bc: import release 5.2.0
Stefan Eßer [Tue, 30 Nov 2021 17:26:22 +0000 (18:26 +0100)]
vendor/bc: import release 5.2.0

This version is imported only for documentary purposes since it does
not contain any changes that are relevant for the FreeBSD base system.

2 years agoif_stf: KASAN fix
Kristof Provost [Tue, 30 Nov 2021 15:30:22 +0000 (16:30 +0100)]
if_stf: KASAN fix

In in_stf_input() we grabbed a pointer to the IPv4 header and later did
an m_pullup() before we look at the IPv6 header. However, m_pullup()
could rearrange the mbuf chain and potentially invalidate the pointer to
the IPv4 header.

Avoid this issue by copying the IP header rather than getting a pointer
to it.

Reported by: markj, Jenkins (KASAN job)
Reviewed by: markj
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33192

2 years agoImplement GET_STACK_USAGE on remaining archs
Mitchell Horne [Thu, 25 Nov 2021 16:01:11 +0000 (12:01 -0400)]
Implement GET_STACK_USAGE on remaining archs

This definition enables callers to estimate remaining space on the
kstack, and take action on it. Notably, it enables optimizations in the
GEOM and netgraph subsystems to directly dispatch work items when there
is sufficient stack space, rather than queuing them for a worker thread.

Implement it for riscv, arm, and mips. Remove the #ifdefs, so it will
not go unimplemented elsewhere.

PR: 259157
Reviewed by: mav, kib, markj (previous version)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32580

2 years agoarm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE
Mitchell Horne [Tue, 30 Nov 2021 15:15:44 +0000 (11:15 -0400)]
arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE

We do not consider the space reserved for the pcb to be part of the
total kstack size, so it should not be included in the calculation of
the used stack size.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoi386: take pcb and fpu area into account in GET_STACK_USAGE
Mitchell Horne [Thu, 25 Nov 2021 15:54:33 +0000 (11:54 -0400)]
i386: take pcb and fpu area into account in GET_STACK_USAGE

On this platform, the pcb and FPU save area are allocated from the top
of each kernel stack, so they should be excluded from the calculation of
the total and used stack sizes.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32581

2 years agofw_stub: fix -Wunused-but-set-variable for firmware files
Bjoern A. Zeeb [Tue, 30 Nov 2021 14:23:18 +0000 (14:23 +0000)]
fw_stub: fix -Wunused-but-set-variable for firmware files

In case we are only embedding a single firmware image the variable
"parent" gets set but never used.  Add checks for the number of files
for it and only print it out if we are exceeding the single file count.
This fixes -Wunused-but-set-variable warnings for the majority of
firmware files in the tree.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

2 years agokern_tc: unify timecounter to bintime delta conversion
Andriy Gapon [Tue, 30 Nov 2021 13:23:23 +0000 (15:23 +0200)]
kern_tc: unify timecounter to bintime delta conversion

There are two places where we convert from a timecounter delta to
a bintime delta: tc_windup and bintime_off.
Both functions use the same calculations when the timecounter delta is
small.  But for a large delta (greater than approximately an equivalent
of 1 second) the calculations were different.  Both functions use
approximate calculations based on th_scale that avoid division.  Both
produce values slightly greater than a true value, calculated with
division by tc_frequency, would be.  tc_windup is slightly more
accurate, so its result is closer to the true value and, thus, smaller
than bintime_off result.

As a consequence there can be a jump back in time when time hands are
switched after a long period of time (a large delta).  Just before the
switch the time would be calculated with a large delta from
th_offset_count in bintime_off.  tc_windup does the switch using its own
calculations of a new th_offset using the large delta.  As explained
earlier, the new th_offset may end up being less than the previously
produced binuptime.  So, for a period of time new binuptime values may
be "back in time" comparing to values just before the switch.

Such a jump must never happen.  All the code assumes that the uptime is
monotonically nondecreasing and some code works incorrectly when that
assumption is broken.  For example, we have observed sleepq_timeout()
ignoring a timeout when the sbinuptime value obtained by the callout
code was greater than the expiration value, but the sbinuptime obtained
in sleepq_timeout() was less than it.  In that case the target thread
would never get woken up.

The unified calculations should ensure the monotonic property of the
uptime.

The problem is quite rare as normally tc_windup should be called HZ
times per second (typically 1000 or 100).  But it may happen in VMs on
very busy hypervisors where a VM's virtual CPU may not get an execution
time slot for a second or more.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Panzura LLC

2 years agomips: Fix a typo in a source code comment
Gordon Bergling [Tue, 30 Nov 2021 09:41:46 +0000 (10:41 +0100)]
mips: Fix a typo in a source code comment

- s/segement/segment/

MFC after: 3 days

2 years agompr(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 30 Nov 2021 09:40:50 +0000 (10:40 +0100)]
mpr(4): Fix a typo in a source code comment

- s/segement/segment/

MFC after: 3 days

2 years agoxen(4): Fix two typos in source code comments
Gordon Bergling [Tue, 30 Nov 2021 09:39:42 +0000 (10:39 +0100)]
xen(4): Fix two typos in source code comments

- s/segement/segment/

MFC after: 3 days

2 years agoelf(3): Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 09:38:34 +0000 (10:38 +0100)]
elf(3): Fix a typo in a sysctl description

- s/segement/segment/

MFC after: 3 days

2 years agonetinet: Fix a common typo in source code comments
Gordon Bergling [Tue, 30 Nov 2021 09:37:20 +0000 (10:37 +0100)]
netinet: Fix a common typo in source code comments

- s/segement/segment/

MFC after: 3 days

2 years agoficl: Fix a typo in a comment
Gordon Bergling [Tue, 30 Nov 2021 09:36:29 +0000 (10:36 +0100)]
ficl: Fix a typo in a comment

- s/segement/segment/

MFC after: 3 days

2 years agoif_hn: Fix a few typos in comments and a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 09:35:14 +0000 (10:35 +0100)]
if_hn: Fix a few typos in comments and a sysctl description

- s/segement/segment/

MFC after: 3 days

2 years agonvme(4): Correct a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 09:26:25 +0000 (10:26 +0100)]
nvme(4): Correct a typo in a sysctl description

- s/printting/printing/

MFC after: 3 days

2 years agoinet(3): Fix two typos in sysctl descriptions
Gordon Bergling [Tue, 30 Nov 2021 09:21:47 +0000 (10:21 +0100)]
inet(3): Fix two typos in sysctl descriptions

- s/sequental/sequential/

MFC after: 3 days

2 years agoMakefile.inc1: Silence an error in make packages
Juraj Lutter [Sun, 28 Nov 2021 20:44:13 +0000 (21:44 +0100)]
Makefile.inc1: Silence an error in make packages

Silence an error in "packages" target, like:

eval: /usr/src: Permission denied

on systems without subversion present.

Reviewed by: emaste
Approved by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33153

2 years agovfs: Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 06:28:40 +0000 (07:28 +0100)]
vfs: Fix a typo in a sysctl description

- s/dependecies/dependencies/

MFC after: 3 days

2 years agonetinet6: Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 06:24:44 +0000 (07:24 +0100)]
netinet6: Fix a typo in a sysctl description

- remove a double 'a'

MFC after: 3 days

2 years agotcp(4): Fix a typo in a sysctl description
Gordon Bergling [Tue, 30 Nov 2021 06:17:30 +0000 (07:17 +0100)]
tcp(4): Fix a typo in a sysctl description

- s/entires/entries/

MFC after: 3 days

2 years agoflex_spi: Support for FlexSPI Flash controller.
Wojciech Macek [Thu, 25 Nov 2021 09:36:55 +0000 (10:36 +0100)]
flex_spi: Support for FlexSPI Flash controller.

NXP FlexSPI is a complex SPI controller which provides
full offload for accessing NOR Flash.
Create a Flash driver which attaches to existing FreeBSD
infrastructure and exports generic READ and WRITE disk commands.
The Flash has to be identified first to configure controller
internals. For now, only one NOR Flash chip is supported.
Future commits shall either increase number of known chips
or implement SFDP mechanism which can be used by other Flash
drivers.

Sponsored by: Alstom
Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D33117

2 years agoAdd tests for posix_spawn_file_actions_add{chdir,fchdir}_np(3)
Konstantin Belousov [Sun, 28 Nov 2021 00:55:26 +0000 (02:55 +0200)]
Add tests for posix_spawn_file_actions_add{chdir,fchdir}_np(3)

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoDocument posix_spawn_file_actions_addclosefrom_np(3)
Konstantin Belousov [Sun, 28 Nov 2021 00:23:55 +0000 (02:23 +0200)]
Document posix_spawn_file_actions_addclosefrom_np(3)

Reviewed by:    kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn: add closefrom non-portable action
Konstantin Belousov [Sat, 27 Nov 2021 22:54:16 +0000 (00:54 +0200)]
posix_spawn: add closefrom non-portable action

Namely posix_spawn_file_actions_addclosefrom_np, in the form it is
provided by glibc.

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoDocument posix_spawn_file_actions_addchdir_np(3)
Konstantin Belousov [Sun, 28 Nov 2021 00:11:21 +0000 (02:11 +0200)]
Document posix_spawn_file_actions_addchdir_np(3)

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn: add chdir-related non-portable actions
Konstantin Belousov [Sat, 27 Nov 2021 22:49:03 +0000 (00:49 +0200)]
posix_spawn: add chdir-related non-portable actions

Namely posix_spawn_file_actions_addchdir_np and
posix_spawn_file_actions_addfchdir_np.

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc
Konstantin Belousov [Sun, 28 Nov 2021 00:16:26 +0000 (02:16 +0200)]
posix_spawn(3), posix_spawn_file_actions_addopen(3): use .Fo/.Fc

to wrap too long lines with function prototypes.

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn: style, use return ()
Konstantin Belousov [Sat, 27 Nov 2021 22:45:12 +0000 (00:45 +0200)]
posix_spawn: style, use return ()

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agoposix_spawn.c: format fae_action anon enum more stylish
Konstantin Belousov [Sat, 27 Nov 2021 22:36:19 +0000 (00:36 +0200)]
posix_spawn.c: format fae_action anon enum more stylish

Reviewed by: kevans, ngie (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33143

2 years agompsutil: Fix data truncation by too short buffers.
Alexander Motin [Tue, 30 Nov 2021 01:14:13 +0000 (20:14 -0500)]
mpsutil: Fix data truncation by too short buffers.

Length of some string buffers was insufficient for cases of more that
99 targets per HBA or slots per enclosure.  Some others are tuned just
for better alignment.  While there also fix output formatting issues.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

2 years agorc.conf(5): Add _limits, _login_class, and _oomprotect
Daniel Ebdrup Jensen [Tue, 18 May 2021 12:46:41 +0000 (14:46 +0200)]
rc.conf(5): Add _limits, _login_class, and _oomprotect

Add a few very useful variables that might easily be overlooked, since
they're only documented in rc.subr(8) which might not be the first place
that people look.

At least _oomprotect has existed since 11.0-RELEASE, and doesn't appear
to be very well-known. While the others aren't as new, in my estimation,
a lot more people would use them if they knew about them.

While here, also add a reference to rc.subr(8) and login.conf(5), and
sort the variables alphabetically.

Reported by:  Daniel Dettlaff <dmilith at gmail.com>
Reviewed by: ceri, gbe, 0mp, ygy, a.wolk, pauamma

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: mprotect does not take a const
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: mprotect does not take a const

The mprotect syscall decleration is not const.  I added this one
incorrectly in a944d28d0edf7ceb1bef4d789dfa4e8e18331658.

Reported by: kib
Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: make syscall and __syscall SYSMUX
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: make syscall and __syscall SYSMUX

Rather than combining the declearation of nosys with the registration
of SYS_syscall, declare syscall(2) and __syscall(2) with the new
SYSMUX type in syscalls.master and declare nosys directly.  This
eliminates the last use of syscall aliases in the tree.

Reviewed by: kib, imp

2 years agomakesyscalls: add a new SYSMUX type
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
makesyscalls: add a new SYSMUX type

This type is for system call multiplexers (syscall(2), __syscall(2))
that don't have a normal handler and instead are handled in the
machine-dependent syscall code.

Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: normalize exit
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: normalize exit

Declare the exit system call normally.  This results in the
implementation being named sys_exit rather than sys_sys_exit and
being decalred as returning an int.  Infact it does not return
at all because exit1 does not, so add an __unreachable() to let the
compiler know that.

Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:03:00 +0000 (22:03 +0000)]
syscalls: regen

2 years agosyscalls: normalize (get|set)rlimit
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: normalize (get|set)rlimit

Declare normal <foo>_args structs rather than going out of the way
to declare __<foo>_args.

Reviewed by: kib, imp

2 years agosyscalls: regen
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: regen

2 years agosyscalls: normalize orecvfrom and ogetsockname
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: normalize orecvfrom and ogetsockname

Declare o<foo>_args rather than reusing the equivalent <foo>_args
structs.  Avoiding the addition of a new type isn't worth the
gratutious differences.

Reviewed by: kib, imp

2 years agouipc: rework recvfrom, getsockname, getpeername
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
uipc: rework recvfrom, getsockname, getpeername

Stop using <foo>_args structs as part of internal kernel APIs.  Add
a kern_recvfrom and adjust getsockname and getpeername's equivalent
functions to take individual arguments rather than a uap pointer.

Adopt a convention from CheriBSD that a function interacting with
userspace pointers and sitting between the sys_<foo> syscall and
kern_<foo> implementation is named user_<foo>.

Reviewed by: kib, imp

2 years agosyscalls: correct a couple style issues
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: correct a couple style issues

Reviewed by: kib, imp

2 years agosyscalls: add missing SAL annotations
Brooks Davis [Mon, 29 Nov 2021 22:02:59 +0000 (22:02 +0000)]
syscalls: add missing SAL annotations

freebsd7_shmctl was missing an annotation

Reviewed by: kib, imp

2 years agoelf.5: Document compressed section headers
Mark Johnston [Mon, 29 Nov 2021 18:51:50 +0000 (13:51 -0500)]
elf.5: Document compressed section headers

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33138

2 years agolibelf: Link gelf_getchdr.3 to the build
Mark Johnston [Mon, 29 Nov 2021 18:51:38 +0000 (13:51 -0500)]
libelf: Link gelf_getchdr.3 to the build

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agomii/dp83822phy: Remove a declaration for a non-existent function
Mark Johnston [Mon, 29 Nov 2021 18:51:05 +0000 (13:51 -0500)]
mii/dp83822phy: Remove a declaration for a non-existent function

Fixes: 0c9156faeccb ("Introduce DP83822 PHY driver")

2 years agodummynet: Fix socket option length validation for IP_DUMMYNET3
Mark Johnston [Mon, 29 Nov 2021 18:50:30 +0000 (13:50 -0500)]
dummynet: Fix socket option length validation for IP_DUMMYNET3

The socket option handler tries to ensure that the option length is no
larger than some reasonable maximum, and no smaller than sizeof(struct
dn_id).  But the loaded option length is stored in an int, which is
converted to an unsigned integer for the comparison with a size_t, so
negative values are not caught and instead get passed to malloc().

Change the code to use a size_t for the buffer size.

Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33133

2 years agodummynet: Avoid an out-of-bounds read in do_config()
Mark Johnston [Mon, 29 Nov 2021 18:50:21 +0000 (13:50 -0500)]
dummynet: Avoid an out-of-bounds read in do_config()

do_config() processes a buffer of variable-length dummynet commands.
The loop which processes this buffer loads the fixed-length header
before checking whether there are any bytes left to read, so it performs
a 4-byte read past the end of the buffer before terminating.

Restructure the loop to avoid this.

Reported by: Jenkins (KASAN job)
Reviewed by: kp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33132

2 years agoext2: Check for e2fs_first_dblock in ext2_compute_sb_data()
Neel Chauhan [Tue, 16 Nov 2021 22:59:26 +0000 (14:59 -0800)]
ext2: Check for e2fs_first_dblock in ext2_compute_sb_data()

This prevents a kernel panic on a damaged ext2 superblock.

PR: 259107
Reported by: Robert Morris <rtm@lcs.mit.edu>
Differential Revision: https://reviews.freebsd.org/D33029

2 years agoUSB: add CYUSB330x to usbdevs
Bjoern A. Zeeb [Fri, 15 Oct 2021 10:46:58 +0000 (10:46 +0000)]
USB: add CYUSB330x to usbdevs

Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.

2 years agolinux(4): Fix "set but not used" warnings
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:44:40 +0000 (16:44 +0000)]
linux(4): Fix "set but not used" warnings

No functional changes.

Sponsored By: EPSRC

2 years agocfiscsi(4): Fix "set but not used" warning
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:44:12 +0000 (16:44 +0000)]
cfiscsi(4): Fix "set but not used" warning

No functional changes.

Sponsored By: EPSRC

2 years agocdceem(4): Fix "set but not used" warnings
Edward Tomasz Napierala [Mon, 29 Nov 2021 16:42:59 +0000 (16:42 +0000)]
cdceem(4): Fix "set but not used" warnings

No functional changes.

Sponsored By: EPSRC

2 years agoshutdown: unmount filesystems after swapoff
Konstantin Belousov [Sun, 28 Nov 2021 01:52:46 +0000 (03:52 +0200)]
shutdown: unmount filesystems after swapoff

Swap on file requires operational underlying mount, otherwise
swapoff_all() is guaranteed to panic due to the default strategy VOP for
reclaimed vnodes.

Reported and tested by: peterj
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33147

2 years agoswapoff_one(): only check free pages count manually turning swap off
Konstantin Belousov [Fri, 26 Nov 2021 23:22:27 +0000 (01:22 +0200)]
swapoff_one(): only check free pages count manually turning swap off

When swap is turned off due to system shutdown or reboot, ignore the
check.  Problem is that the check is not accurate by any means, free
page count can legitimately be low while system still able to page in
everything from the swap.  Then, we turn swap off if swapping on
real file or some non-standard geom provider, and typically panic
when system appears to actually need to unavailable page.

For syscall, it is better to be safe than sorry.

Reported and tested by: peterj
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33147

2 years agommc: Fix HS200/HS400 capability check
Kornel Duleba [Sun, 28 Nov 2021 11:24:07 +0000 (12:24 +0100)]
mmc: Fix HS200/HS400 capability check

HS200 and HS400 speeds can be enabled either with 1.2, or 1.8V signaling voltage.
Because of that we have four cabability flags: MMC_CAP_MMC_HS200_120,
MMC_CAP_MMC_HS200_180, MMC_CAP_MMC_HS400_120, MMC_CAP_MMC_HS400_180.

MMC logic only enables HS200/HS400 mode if both flags are set for the corresponding speed.
Fix that by being more permissive in host timing cap check.

Reviewed by: manu, mw
MFC after: 2 weeks
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D33130

2 years agocitrus_prop.c: do not ignore sign
Konstantin Belousov [Sun, 28 Nov 2021 03:03:49 +0000 (05:03 +0200)]
citrus_prop.c: do not ignore sign

In _citrus_prop_read_TYPE_func_ generated functions, do not ignore parsed
'-' sign, negate the value as appropriate.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33146

2 years agolibc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used
Konstantin Belousov [Sun, 28 Nov 2021 03:25:28 +0000 (05:25 +0200)]
libc/tests/stdlib/dynthr_mod/dynthr_mod.c: mark dummy as used

It receives the malloc() result, and we do not want the malloc() call
to be optimized out, which is allowed for hosted compiler.  Use dummy
for actual write though.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agonetbsd h_raw.c test: fake use of sum to avoid warning
Konstantin Belousov [Sun, 28 Nov 2021 03:35:45 +0000 (05:35 +0200)]
netbsd h_raw.c test: fake use of sum to avoid warning

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agot_mlock.c: Remove null_errno, it is write-only
Konstantin Belousov [Sun, 28 Nov 2021 03:28:29 +0000 (05:28 +0200)]
t_mlock.c: Remove null_errno, it is write-only

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only
Konstantin Belousov [Sun, 28 Nov 2021 03:16:08 +0000 (05:16 +0200)]
libc/stdio/vfwscanf.c::convert_wstring(): wcp0 is write-only

2 years agolibc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used
Konstantin Belousov [Sun, 28 Nov 2021 03:14:20 +0000 (05:14 +0200)]
libc/x86/__vdso_gettc.c::tsc_selector_idx(): cpu_id is calculated but not used

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoacl_delete_entry(): remove write-only variable
Konstantin Belousov [Sun, 28 Nov 2021 03:12:42 +0000 (05:12 +0200)]
acl_delete_entry(): remove write-only variable

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agosetproctitle_internal(): remove kbuf local, it is write-only
Konstantin Belousov [Sun, 28 Nov 2021 02:51:45 +0000 (04:51 +0200)]
setproctitle_internal(): remove kbuf local, it is write-only

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/rpc/getrpcent.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:53:05 +0000 (05:53 +0200)]
libc/rpc/getrpcent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/nscachedcli.c: remove write-only variables
Konstantin Belousov [Sun, 28 Nov 2021 03:57:12 +0000 (05:57 +0200)]
libc/net/nscachedcli.c: remove write-only variables

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/getservent.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:52:33 +0000 (05:52 +0200)]
libc/net/getservent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/getprotoent.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:48:05 +0000 (05:48 +0200)]
libc/net/getprotoent.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/getnetnamadr.c: Mark write-only variables as unused
Konstantin Belousov [Sun, 28 Nov 2021 03:45:52 +0000 (05:45 +0200)]
libc/net/getnetnamadr.c: Mark write-only variables as unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/net/gethostnamadr.c: mark write-only variables as __unused
Konstantin Belousov [Sun, 28 Nov 2021 03:22:24 +0000 (05:22 +0200)]
libc/net/gethostnamadr.c: mark write-only variables as __unused

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/gen/getpwent.c: plug warnings about write-only variables
Konstantin Belousov [Sun, 28 Nov 2021 02:50:18 +0000 (04:50 +0200)]
libc/gen/getpwent.c: plug warnings about write-only variables

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agolibc/gen/getgrent.c: plug warnings about write-only variables
Konstantin Belousov [Sun, 28 Nov 2021 02:46:56 +0000 (04:46 +0200)]
libc/gen/getgrent.c: plug warnings about write-only variables

The variables clang13 complains about take the results of var_arg() calls.
I decided to kept variables around, annotating their definitions with
__unused, to keep clear expected types of the varargs.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agorc.subr.8: Document changes to load_rc_config
Mateusz Piotrowski [Mon, 29 Nov 2021 15:02:32 +0000 (16:02 +0100)]
rc.subr.8: Document changes to load_rc_config

Since e27961a496322e2590da29f3c5fe710b269e6754, load_rc_config does not
require a service name as its first argument. This change was documented
in the rc.subr script in 0b9c2e7ac58caac0413aa36749e4c212514d142d. Let's
update the manual page as well.

MFC after: 3 days

2 years agoapic.4: Fix a typo
Mateusz Piotrowski [Sat, 27 Nov 2021 12:25:30 +0000 (13:25 +0100)]
apic.4: Fix a typo

MFC after: 3 days

2 years agotcp: Don't try to upgrade a read lock just for logging
Michael Tuexen [Fri, 26 Nov 2021 10:53:00 +0000 (11:53 +0100)]
tcp: Don't try to upgrade a read lock just for logging

Reviewed by: glebius, lstewart, rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D33098

2 years agopowerpc64le: add LINT64LE kernel config
Alfredo Dal'Ava Junior [Mon, 29 Nov 2021 15:08:26 +0000 (12:08 -0300)]
powerpc64le: add LINT64LE kernel config

Add configuration file to be used by "FreeBSD-<branch>-powerpc64le-LINT"
CI/Jenkins job

Reviewed by: lwhsu
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33136

2 years agofusefs: fix 32-bit build of the tests after 91972cfcddf
Alan Somers [Mon, 29 Nov 2021 03:34:32 +0000 (20:34 -0700)]
fusefs: fix 32-bit build of the tests after 91972cfcddf

MFC after: 2 weeks
MFC with: 91972cfcddf950d7a9c33df5a9171ada1805a144

2 years agoxhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.
Alexander Motin [Mon, 29 Nov 2021 02:29:26 +0000 (21:29 -0500)]
xhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.

MFC after: 2 weeks

2 years agofusefs: update atime on reads when using cached attributes
Alan Somers [Mon, 29 Nov 2021 01:53:31 +0000 (18:53 -0700)]
fusefs: update atime on reads when using cached attributes

When using cached attributes, whether or not the data cache is enabled,
fusefs must update a file's atime whenever it reads from it, so long as
it wasn't mounted with -o noatime.  Update it in-kernel, and flush it to
the server on close or during the next setattr operation.

The downside is that close() will now frequently trigger a FUSE_SETATTR
upcall.  But if you care about performance, you should be using
-o noatime anyway.

MFC after: 2 weeks
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D33145

2 years agofusefs: fix copy_file_range when extending a file
Alan Somers [Mon, 29 Nov 2021 01:35:58 +0000 (18:35 -0700)]
fusefs: fix copy_file_range when extending a file

When copy_file_range extends a file, it must update the cached file
size.

MFC after: 2 weeks
Reviewed by: rmacklem, pfg
Differential Revision: https://reviews.freebsd.org/D33151

2 years agonfs: Quiet a few "unused" warnings
Rick Macklem [Sun, 28 Nov 2021 23:48:51 +0000 (15:48 -0800)]
nfs: Quiet a few "unused" warnings

For most of these warnings, the variable is loaded
with data parsed out of an RPC messages.  In case
the data is useful in the future, I just marked
these with __unused.

2 years agofusefs: delete a redundant getnanouptime
Alan Somers [Sun, 28 Nov 2021 23:05:30 +0000 (16:05 -0700)]
fusefs: delete a redundant getnanouptime

It's been redundant since SVN r346060 added another getnanouptime just
above.

MFC after: 2 weeks

2 years agomotd: Fix Questions List address
Danilo G. Baio [Wed, 24 Nov 2021 00:49:14 +0000 (21:49 -0300)]
motd: Fix Questions List address

Following mailing lists migration from Mailman to Mlmmj.

https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
-->
https://lists.freebsd.org/subscription/freebsd-questions

Adding a short link (as we already have for Faq and Handbook), so all
links can be indented the same way.

Reviewed by: imp (earlier version)
Approved by: lwhsu
Differential Revision: https://reviews.freebsd.org/D33101

2 years agox86 GENERIC/MINIMAL: group sc(4) devices together
Ed Maste [Sun, 28 Nov 2021 19:11:56 +0000 (14:11 -0500)]
x86 GENERIC/MINIMAL: group sc(4) devices together

The vga and splash devices are part of the sc(4) system console. vt(4)
uses the vt_vga driver instead, and has some limited splash support
directly in vt_core.c.  Leave the sc(4) options in GENERIC/MINIMAL (for
now) but group them together under an sc(4) comment.

Sponsored by: The FreeBSD Foundation

2 years agoRemove options VESA from x86 MINIMAL
Ed Maste [Sun, 28 Nov 2021 19:10:28 +0000 (14:10 -0500)]
Remove options VESA from x86 MINIMAL

Followup to b8cf1c5c30a5, remove from MINIMAL in addition to GENERIC.

options VESA / vesa.ko provides VESA Bios Extensions (VBE) support for
the legacy sc(4) console.  It is not used by the default console, vt(4).

PR: 253733
Fixes: b8cf1c5c30a5 ("Remove options VESA from x86 GENERIC")
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

2 years agoiwlwifi: import Intel's iwlwifi/mvm driver.
Bjoern A. Zeeb [Sun, 28 Nov 2021 18:35:53 +0000 (18:35 +0000)]
iwlwifi: import Intel's iwlwifi/mvm driver.

Over the past few months we published multiple snapshots for this
Linux derived driver and it has become fairly stable in terms of
minimal local changes needed for new updates.

The current version is based on iwlwifi-next update at
cbaa6aeedee5f92dafa5982eceea2a1f98ce4f7d with the addition of
a hand full of files replaced for FreeBSD.

Given the lack of full license texts on non-local files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Do not yet hook this to the build until the remaining compat code
is all in.  Along with the firmware import this will make publishing
the last bits and final testing a lot easier.

Sponsored by:   The FreeBSD Foundation
Approved by:    core (imp) [1]
MFC after:      10 days

2 years agoiwlwifi: import firmware for Intel iwlwifi/mvm supported chipsets.
Bjoern A. Zeeb [Sun, 28 Nov 2021 18:34:19 +0000 (18:34 +0000)]
iwlwifi: import firmware for Intel iwlwifi/mvm supported chipsets.

Import the most recent versions of the firmware images for iwlwifi
chipsets supported by the "mvm" sub-driver.
This is based on linux-firmware at f5d519563ac9d2d1f382a817aae5ec5473811ac8.
The license of the firmware matches the previous iwnfw(4) and
iwmfw(4) firmware files and you can find a copy in
sys/contrib/dev/iwlwififw/LICENCE.iwlwifi_firmware .

Add build infrastructure to create the .ko files but do not yet hook
it up to the build until all parts are in the tree.
There is an open issue concerning kldxref that we need to resolve
(D32383).

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

2 years agopf: add pf_bcmp_state_key
Mateusz Guzik [Wed, 24 Nov 2021 17:25:18 +0000 (18:25 +0100)]
pf: add pf_bcmp_state_key

Reviewed by: kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33131

2 years agoOptionalObsoleteFiles: remove ping with INET & INET6 disabled
Ed Maste [Sun, 28 Nov 2021 18:23:29 +0000 (13:23 -0500)]
OptionalObsoleteFiles: remove ping with INET & INET6 disabled

Reported by: kevans
Fixes: a4ef9e58bc0c ("sbin: build ping if at least one of...")
Sponsored by: The FreeBSD Foundation

2 years agosbin: build ping if at least one of INET & INET6 is enabled
Ed Maste [Sun, 28 Nov 2021 17:50:13 +0000 (12:50 -0500)]
sbin: build ping if at least one of INET & INET6 is enabled

It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
in ping to make this case clear.

PR: 260082
Sponsored by: The FreeBSD Foundation

2 years agoRemove options VESA from x86 GENERIC
Ed Maste [Sat, 27 Nov 2021 20:27:45 +0000 (15:27 -0500)]
Remove options VESA from x86 GENERIC

options VESA / vesa.ko provides VESA Bios Extensions (VBE) support for
the legacy sc(4) console.  It is not used by the default console, vt(4).

There is a report[1] of an incompatibility between VESA and the Nvidia
driver breaking suspend/resume.  Since VESA is not used by the default
configuration anyway, just remove options VESA from GENERIC.  The kernel
module is still available and may be loaded by sc(4) users who want to
select a VBE mode.

(Note that vt(4) does not support selecting a VBE mode.  The loader can
set a VBE mode and vt(4) will use it via the vt_vbefb driver.)

[1] https://lists.freebsd.org/archives/freebsd-hackers/2021-November/000469.html

PR: 253733
Reported by: Stefan Blachmann [1]
Reviewed by: imp, manu, tsoome
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33141

2 years agolinker_kldload_busy(): allow recursion
Konstantin Belousov [Fri, 12 Nov 2021 19:45:06 +0000 (21:45 +0200)]
linker_kldload_busy(): allow recursion

Some drivers recursively loads modules by explicit calls to kldload
during initialization, which might occur during kldload.

PR: 259748
Reported and tested by: thj
Reviewed by: markj
Sponsored by: Nvidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32972

2 years agoDisable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack
Li-Wen Hsu [Sun, 28 Nov 2021 06:58:21 +0000 (14:58 +0800)]
Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack

PR: 259969
Sponsored by: The FreeBSD Foundation

2 years agonfscl: Disable use of the LookupOpen RPC
Rick Macklem [Sat, 27 Nov 2021 23:34:45 +0000 (15:34 -0800)]
nfscl: Disable use of the LookupOpen RPC

The LookupOpen RPC reduces the number of Open RPCs
needed.  Unfortunately, it breaks certain software
builds over NFS, so disable it until this is fixed.

The LookupOpen RPC is only used for NFSv4.1/4.2
mounts when the "oneopenown" mount option is
specified, so this should not affect many users.

2 years agovfs: fully lockless v_writecount adjustment
Mateusz Guzik [Fri, 26 Nov 2021 12:33:28 +0000 (13:33 +0100)]
vfs: fully lockless v_writecount adjustment

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D33128

2 years agovfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF
Mateusz Guzik [Tue, 18 May 2021 10:47:21 +0000 (12:47 +0200)]
vfs: replace the MNTK_TEXT_REFS flag with VIRF_TEXT_REF

This allows to stop maintaing the VI_TEXT_REF flag and consequently
opens up fully lockless v_writecount adjustment.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D33127