]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMFC: contrib/tzdata: import tzdata 2020f
Philip Paeps [Wed, 30 Dec 2020 04:50:26 +0000 (12:50 +0800)]
MFC: contrib/tzdata: import tzdata 2020f

Merge commit '96b88ac701b35ce68425046d4be8f51cb75b5d5b' into main

Changes: https://github.com/eggert/tz/blob/2020f/NEWS

(cherry picked from commit e35a01eec6926bfb5c088ca8961079b51a067bf3)

3 years agoDon't add -Wno-class-memaccess with older gcc.
Brooks Davis [Fri, 9 Aug 2019 23:50:57 +0000 (23:50 +0000)]
Don't add -Wno-class-memaccess with older gcc.

This is a gcc 8.0+ warning which needed to be silenced on for the riscv
build.  amd64-xtoolchain-gcc still uses gcc 6.4.0 and does not understand
this flag.

Reviewed by: asomers
Feedback from: imp
Differential Revision: https://reviews.freebsd.org/D21195

(cherry picked from commit 4a045a66fd912b0e28a0585dbd8991643ccc2cb0)

3 years agoImplement strerror_l().
Konstantin Belousov [Wed, 16 Dec 2020 09:02:09 +0000 (09:02 +0000)]
Implement strerror_l().

PR: 251651

MFC of r368692, r368723
(cherry picked from commit 675079b1ea61b310f3a42cb0d352a49c1780f89a)
(cherry picked from commit 65bf3043365bd86fc5d4d387ad0c42217f11330b)

3 years agoMFC r356352, r368272
Alan Somers [Sat, 4 Jan 2020 18:59:46 +0000 (18:59 +0000)]
MFC r356352, r368272

lio_listio_empty_nowait_thread sometimes does *not* hang.

The other tests consistently do hang though.

Sponsored by: DellEMC

(cherry picked from commit 0cb4586a0be3b1b5909b73b24798032ddf2f4002)

AIO tests: update expected failure messages after r368265

PR: 220398, 251515

(cherry picked from commit 23693bd8f3e36b4721d7b59d52154d3e3f49e3cd)

3 years ago[nvmecontrol] Fix type signedness warning-to-error on gcc-6.4
Adrian Chadd [Tue, 17 Nov 2020 17:12:28 +0000 (17:12 +0000)]
[nvmecontrol] Fix type signedness warning-to-error on gcc-6.4

This fixes a type signedness comparison warning-to-error on
gcc-6.4. The ternary operation casts it right but the actual
assignment doesn't.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26791

(cherry picked from commit 44c52406ced4cbba704f9bec588a8238d5a5ef32)

3 years ago[libnetmap] Fix 32 bit compilation under gcc-6.4
Adrian Chadd [Mon, 2 Nov 2020 15:01:37 +0000 (15:01 +0000)]
[libnetmap] Fix 32 bit compilation under gcc-6.4

Use uintptr_t to cast a uint64_t to a pointer type.
Yeah, it isn't technically correct for platforms with pointers
> 64 bits, but it's fine here.

This fixes 32 bit compat library builds on amd64 and also
mips32 builds.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D26790

(cherry picked from commit 26c29e743bbdbb82762540f72d4bc449bae2e092)

3 years ago[libsa] Fix typecast of pointer for st_dev
Adrian Chadd [Thu, 16 Apr 2020 23:29:49 +0000 (23:29 +0000)]
[libsa] Fix typecast of pointer for st_dev

This code was trying to use a pointer value for st_dev, which is definitely
not a pointer.  Instead, cast to uintptr_t so it becomes a non-pointer value
before casting it.

Tested: mips-gcc cross compile, mips32 build
(cherry picked from commit 6c88ef1c81fce18d6545c4ee8d0df32a25098770)

3 years agotftpd: tests: raise targeted cstd to c11
Kyle Evans [Thu, 5 Mar 2020 22:45:16 +0000 (22:45 +0000)]
tftpd: tests: raise targeted cstd to c11

r358556 added alignas() use to the functional tests, which isn't defined
until C11. Raise the -std to C11 to fix the build under freebsd-gcc{6,9}.

Reported by: mhorne, Jenkins/CI

(cherry picked from commit 924e10b809a9fcbc8688c1b5848f60b48e6103fe)

3 years agoAdd MODULE_PNP_INFO() to vmci(4). This allows devd(8) to load the
Hiroki Sato [Sun, 25 Aug 2019 18:46:10 +0000 (18:46 +0000)]
Add MODULE_PNP_INFO() to vmci(4).  This allows devd(8) to load the
kernel module automatically when FreeBSD is running on VMware.

Reviewed by: mp
Differential Revision: https://reviews.freebsd.org/D21182

(cherry picked from commit 639eac208771e9eb3d1141882514be35377abeee)

3 years agouplcom: add ATen/Prolific USB-232 Controller D USB ID
Ed Maste [Tue, 17 Nov 2020 18:28:20 +0000 (18:28 +0000)]
uplcom: add ATen/Prolific USB-232 Controller D USB ID

PR: 251166
Submitted by: marcus
MFC after: 2 weeks

(cherry picked from commit 46a5f8837dff05f6581b908170aeecb811f1e95e)

3 years agoUpdate GNU_DIFF knob descriptions
Ed Maste [Wed, 20 May 2020 17:20:48 +0000 (17:20 +0000)]
Update GNU_DIFF knob descriptions

After r317209 the WITH_/WITHOUT_GNU_DIFF knob controls only diff3;
diff is always BSD diff.

MFC after: 1 week

(cherry picked from commit e578c8c3b51fdfa8dd4eafd113457d516d447984)

3 years agoAdd some non-default src.conf(5) knob descriptions
Ed Maste [Wed, 21 Nov 2018 14:50:45 +0000 (14:50 +0000)]
Add some non-default src.conf(5) knob descriptions

Some WITH_/WITHOUT_ defaults will likey change in the future (e.g. as we
migrate to copyfree base system components).

Add non-default descriptions for the benefit of WIP branches.

(cherry picked from commit 0161256ccc89660285140ea2056441ec8e882831)

3 years agoLift scope of buf[] to make it extend to a potential access via *basename
Stefan Eßer [Thu, 10 Dec 2020 09:31:05 +0000 (09:31 +0000)]
Lift scope of buf[] to make it extend to a potential access via *basename

It can be assumed that the contents of the buffer was still allocated and
valid at the point of the out-of-scope access, so there was no security
issue in practice.

(cherry picked from commit 7483b9e4dcfb4c444f8b5d54117fb6c8c48c20e9)

3 years agocrunchgen: fix NULL-deref bug introduced in r364647
Alex Richardson [Fri, 4 Dec 2020 15:53:37 +0000 (15:53 +0000)]
crunchgen: fix NULL-deref bug introduced in r364647

While porting over the local changes from CheriBSD for upstreaming, I
accidentally committed a broken version of find_entry_point(): we have to
return NULL if the value is not found instead of a value with
ep->name == NULL, since the checks in main were changed to check ep instead
of ep->name for NULL.

This only matters if the crunched tool cannot be found using normal lookup
and one of the fallback paths is used, so it's unlikely to be triggered
in rescue. However, I noticed that one of our CheriBSD test scripts was
failing to run commands under `su` on minimal disk images where all
binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen.

This also updates the bootstrapping check in Makefile.inc1 to bootstrap
crunchgen up to the next version bump.

(cherry picked from commit f7ff7baaf62dd2e7b1f7b00c584cd4b968b4de1d)

3 years ago[rcorder] [crunch] Fix C function declarations to include void
Adrian Chadd [Mon, 21 Sep 2020 17:59:45 +0000 (17:59 +0000)]
[rcorder] [crunch] Fix C function declarations to include void

This fixes a compile issue under gcc6 which complains about
legacy style C function declarations.

(cherry picked from commit 0dcdda0984d779cd2024030535a7d270b18b273d)

3 years agosrc.conf(5): regenerate after GNU_GREP_COMPAT default change
Kyle Evans [Tue, 29 Dec 2020 15:58:21 +0000 (09:58 -0600)]
src.conf(5): regenerate after GNU_GREP_COMPAT default change

3 years agobuild: flip the bsdgrep default back to WITH_GNU_GREP_COMPAT
Kyle Evans [Tue, 29 Dec 2020 15:50:31 +0000 (09:50 -0600)]
build: flip the bsdgrep default back to WITH_GNU_GREP_COMPAT

libregex is a more functional provider of gnugrep compatibility.  Turn the
option back on by default for folks that opt to use bsdgrep.

This is a direct commit to stable/12, because the option was removed from
13.0 rather than cycling back through default-on.

3 years agobsdgrep: switch to libregex for GNU_GREP_COMPAT
Kyle Evans [Tue, 4 Aug 2020 02:47:24 +0000 (02:47 +0000)]
bsdgrep: switch to libregex for GNU_GREP_COMPAT

libregex is incomplete, but it's a bit less buggy than the in-base
libgnuregex and mostly OK.

While here, rename -DIWTH_GNU -> -DWITH_GNU_COMPAT; the option implies
that we're compatible with the GNU counterpart, not that we're including GNU
anything.

(cherry picked from commit cab7d341dcd98138443bbdb51649f966093a3a84)

3 years agolibi386: remove CLANG_NO_IAS workaround
Ed Maste [Sat, 20 Oct 2018 22:35:06 +0000 (22:35 +0000)]
libi386: remove CLANG_NO_IAS workaround

Clang's Integrated Assembler was previously disabled for i386 with the
note that it "doesn't grok .codeNN directives yet."  This is no longer
the case (and hasn't been for some time), and the assembled output .text
is identical between gas and IAS.

MFC after: 2 months
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 188b0da1ce6708f4168309f5b925f1c9df836bc7)

3 years agoMFC r368791: disk(9): Fix a few mandoc related errors
Gordon Bergling [Sat, 19 Dec 2020 09:55:02 +0000 (09:55 +0000)]
MFC r368791: disk(9): Fix a few mandoc related errors

- function name without markup: g_io_deliver()
- function name without markup: disk_gone()
- sections out of conventional order: Sh SEE ALSO
- referenced manual not found: Xr MAKE_DEV 9

Actually the man page of MAKE_DEV has never existed.

(cherry picked from commit 9512f75fa8608d150178116ad63672672331b5e8)

3 years agoMFC r360492 (by bcr):
Benedict Reuschling [Thu, 30 Apr 2020 11:17:29 +0000 (11:17 +0000)]
MFC r360492 (by bcr):

Add HISTORY sections to disk(9), driver(9), and epoch(9).

Submitted by: gbergling_gmail.com
Differential Revision: https://reviews.freebsd.org/D24243

(cherry picked from commit 8c63b2db53862c523bc2cb3f7c4d0243018eb3de)

3 years agoMFC r339889 (by glebius):
Gleb Smirnoff [Mon, 29 Oct 2018 22:10:52 +0000 (22:10 +0000)]
MFC r339889 (by glebius):

Add a note that epoch(9) may change, to untie our hands for any future MFCs.

Approved by: glebius

(cherry picked from commit 24929e2cccdc62b19edb66d5f71c62562a051c8c)

3 years agoMFC r368182:
Hans Petter Selasky [Mon, 30 Nov 2020 09:47:53 +0000 (09:47 +0000)]
MFC r368182:
Use function macro for sema_init() in the LinuxKPI to limit macro expansion scope.

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r368406:
Hans Petter Selasky [Mon, 7 Dec 2020 09:48:06 +0000 (09:48 +0000)]
MFC r368406:
Prefer using the MIN() function macro over the min() inline function
in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD
min() is a static inline function clamping its arguments to
"unsigned int".

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r368415:
Hans Petter Selasky [Mon, 7 Dec 2020 16:08:31 +0000 (16:08 +0000)]
MFC r368415:
Properly define the bool type in the BSD kernel shim.

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r368329 and r368341:
Hans Petter Selasky [Fri, 4 Dec 2020 14:50:55 +0000 (14:50 +0000)]
MFC r368329 and r368341:
Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel
shim code in line with the rest of the kernel, sys/x86/include/_types.h.

Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r368659 and r368664:
Hans Petter Selasky [Tue, 15 Dec 2020 12:05:07 +0000 (12:05 +0000)]
MFC r368659 and r368664:
Improve handling of alternate settings in the USB stack.

Allow setting the alternate interface number to fail when there is only
one alternate setting present, to comply with the USB specification.

Refactor how iface->num_altsetting is computed.

Bump the __FreeBSD_version due to change of core USB structure.

PR: 251856
Submitted by: Ma, Horse <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r368658:
Hans Petter Selasky [Tue, 15 Dec 2020 11:51:17 +0000 (11:51 +0000)]
MFC r368658:
Improve handling of alternate settings in the USB stack.

Limit the number of alternate settings to 256.
Else the alternate index variable may wrap around.

PR: 251856
Submitted by: Ma, Horse <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoMFC r368632:
Hans Petter Selasky [Mon, 14 Dec 2020 11:56:16 +0000 (11:56 +0000)]
MFC r368632:
Be bug compatible with other operating systems by allowing non-sequential
interface numbering for USB descriptors in userspace. Else certain USB
control requests using the interface number, won't be recognized by the
USB firmware.

Refer to section 9.2.3 in the USB 2.0 specification:
Interfaces are numbered from zero to one less than the number of concurrent interfaces
supported by the configuration.

PR: 251784
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agotools/tools/locale: skip control character widths
Yuri Pankov [Wed, 23 Dec 2020 12:49:25 +0000 (15:49 +0300)]
tools/tools/locale: skip control character widths

Do not explicitly encode control characters widths as 0
allowing wcwidth() to return the proper implicit value for
non-printable characters (-1).

Reported by: naddy

(cherry picked from commit f952bdf1425d6a877f99b5c5ca59f25fc8bedabe)

3 years agolibregex: implement GNU extensions
Kyle Evans [Tue, 4 Aug 2020 02:14:51 +0000 (02:14 +0000)]
libregex: implement GNU extensions

18a1e2e9: libregex: Implement a subset of the GNU extensions

The entire patch-set is not yet mature enough for commit, but this usable
subset is generally enough for googletest to be happy with and mostly map to
some existing concepts, so they're not as invasive.

The specific changes included here are:

- Branching in BREs with \|
- \w and \W for [[:alnum:]] and [^[:alnum:]] respectively
- \s and \S for [[:space:]] and [^[:space:]] respectively
- Additional quantifiers in BREs, \? and \+ (self-explanatory)

There's some #ifdef'd out work for allowing empty branches as a match-all.
This is a feature that's under assessment... future work will determine
how standard this behavior is and act accordingly.

61898cde: libregex: disable some of the unimplemented test cases for now

This should allow the tests to actually pass. Future work will uncomment the
unimplemented tests as they're implemented.

7518fb34: libc: regex: factor out ISBOW/ISEOW macros

These will be reused for \b (word boundary, which matches both sides).

No functional change.

ca53e5ae: libregex: implement \` and \' (begin-of-subj, end-of-subj)

These are GNU extensions, generally equivalent to ^ and $ except that the
new syntax will not match beginning of line after the first in a multi-line
expression or the end of line before absolute last in a multi-line
expression.

6b986646: libregex: implement \b and \B (word boundary, not word boundary)

This is the last of the needed GNU expressions before we can unleash bsdgrep
by default. \b is effectively an agnostic equivalent of \< and \>, while
\B will match every space that isn't making a transition from
nonchar -> char or char -> nonchar.

4afa7dd6: libc: regex: retire internal EMPTBR ("Empty branch present")

It was realized just a little too late that this was a hack that belonged in
individual regex(3)-using applications. It was surrounded in NOTYET and not
implemented in the engine, so remove it.

4f1efa30: libc: regex: partial revert of r368358 (6b986646)

MFC NOTE: Altered to match the legacy behavior of a\bc => abc.

Part of the libregex functionality leaked into the tests it shares with
the standard regex(3). Introduce a P flag to set the REG_POSIX cflag to
indicate that libc regex should effectively do nothing while libregex should
specifically run it in non-extended mode.

This unbreaks the libc/regex test run.

(cherry picked from commit 18a1e2e9b9f109a78c5a9274e4cfb4777801b4fb)
(cherry picked from commit 61898cde69374d5a9994e2074605bc4101aff72d)
(cherry picked from commit 7518fb346fe9603f99d2406a073b30fb8e4a270c)
(cherry picked from commit ca53e5aedfebcc1b4091b68e01b2d5cae923f85e)
(cherry picked from commit 6b986646d434baa21ae3d74d6a662ad206c7ddbd)
(cherry picked from commit 4afa7dd61a3a1454a5b3cf5e6de2029c7e2d9a84)
(cherry picked from commit 4f1efa309ca48a088595dd57969ae6a397dd49d1)

3 years agoregex(3): Interpret many escaped ordinary characters as EESCAPE
Kyle Evans [Wed, 29 Jul 2020 23:21:56 +0000 (23:21 +0000)]
regex(3): Interpret many escaped ordinary characters as EESCAPE

MFC NOTE: This only merged the infrastructure back, the new regcomp symbol
that actually interprets these as EESCAPE was *dropped*. This is purely to
make future commits for libregex easier to merge back so that we can choose
to use it.

In IEEE 1003.1-2008 [1] and earlier revisions, BRE/ERE grammar allows for
any character to be escaped, but "ORD_CHAR preceded by an unescaped
<backslash> character [gives undefined results]".

Historically, we've interpreted an escaped ordinary character as the
ordinary character itself. This becomes problematic when some extensions
give special meanings to an otherwise ordinary character
(e.g. GNU's \b, \s, \w), meaning we may have two different valid
interpretations of the same sequence.

To make this easier to deal with and given that the standard calls this
undefined, we should throw an error (EESCAPE) if we run into this scenario
to ease transition into a state where some escaped ordinaries are blessed
with a special meaning -- it will either error out or have extended
behavior, rather than have two entirely different versions of undefined
behavior that leave the consumer of regex(3) guessing as to what behavior
will be used or leaving them with false impressions.

This change bumps the symbol version of regcomp to FBSD_1.6 and provides the
old escape semantics for legacy applications, just in case one has an older
application that would immediately turn into a pumpkin because of an
extraneous escape that's embedded or otherwise critical to its operation.

This is the final piece needed before enhancing libregex with GNU extensions
and flipping the switch on bsdgrep.

[1] http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/

(cherry picked from commit adeebf4cd47c3e85155d92f386bda5e519b75ab2)

3 years ago<regex.h>: reserve a regcomp field for REG_POSIX
Kyle Evans [Fri, 31 Jul 2020 12:40:31 +0000 (12:40 +0000)]
<regex.h>: reserve a regcomp field for REG_POSIX

For libc regcomp, this will be a nop. libregex will take this to mean that
it needs to turn off GNU extensions, effectively switching it back to the
POSIX-compliant libc implementation at runtime.

(cherry picked from commit 7c5ec5fe6afb50ba5c83ad0b3dab036f91b7dafe)

3 years agoregex(3): belatedly document REG_POSIX from r363734
Kyle Evans [Tue, 4 Aug 2020 02:06:49 +0000 (02:06 +0000)]
regex(3): belatedly document REG_POSIX from r363734

My original patch included this documented, but it appears that I failed to
include the manpage update. Do so now.

(cherry picked from commit ba8b64de05d0df84ad9064be950ca38bc7bafe7d)

3 years agolib/libc/regex: fix build with REDEBUG defined
Yuri Pankov [Tue, 24 Sep 2019 12:21:01 +0000 (12:21 +0000)]
lib/libc/regex: fix build with REDEBUG defined

(cherry picked from commit 3c78771400e74f5bc54ee8e9a28fbf70190fd250)

3 years agogrep: replace the internal queue with a ring buffer
Kyle Evans [Wed, 9 Dec 2020 05:27:45 +0000 (05:27 +0000)]
grep: replace the internal queue with a ring buffer

We know up front how many items we can have in the queue (-B/Bflag), so
pay the cost of those particular allocations early on.

The reduced queue maintenance overhead seemed to yield about an ~8%
improvement for my earlier `grep -C8 -r closefrom .` test.

(cherry picked from commit df546c3b730d4abcace1da24226bd5f01280588e)

3 years agoMFC kern: cpuset: properly rebase when attaching to a jail
Kyle Evans [Wed, 25 Nov 2020 03:14:25 +0000 (03:14 +0000)]
MFC kern: cpuset: properly rebase when attaching to a jail

The current logic is a fine choice for a system administrator modifying
process cpusets or a process creating a new cpuset(2), but not ideal for
processes attaching to a jail.

Currently, when a process attaches to a jail, it does exactly what any other
process does and loses any mask it might have applied in the process of
doing so because cpuset_setproc() is entirely based around the assumption
that non-anonymous cpusets in the process can be replaced with the new
parent set.

This approach slightly improves the jail attach integration by modifying
cpuset_setproc() callers to indicate if they should rebase their cpuset to
the indicated set or not (i.e. cpuset_setproc_update_set).

If we're rebasing and the process currently has a cpuset assigned that is
not the containing jail's root set, then we will now create a new base set
for it hanging off the jail's root with the existing mask applied instead of
using the jail's root set as the new base set.

Note that the common case will be that the process doesn't have a cpuset
within the jail root, but the system root can freely assign a cpuset from
a jail to a process outside of the jail with no restriction. We assume that
that may have happened or that it could happen due to a race when we drop
the proc lock, so we must recheck both within the loop to gather up
sufficient freed cpusets and after the loop.

To recap, here's how it worked before in all cases:

0     4 <-- jail              0      4 <-- jail / process
|                             |
1                 ->          1
|
3 <-- process

Here's how it works now:

0     4 <-- jail             0       4 <-- jail
|                            |       |
1                 ->         1       5 <-- process
|
3 <-- process

or

0     4 <-- jail             0       4 <-- jail / process
|                            |
1 <-- process     ->         1

More importantly, in both cases, the attaching process still retains the
mask it had prior to attaching or the attach fails with EDEADLK if it's
left with no CPUs to run on or the domain policy is incompatible. The
author of this patch considers this almost a security feature, because a MAC
policy could grant PRIV_JAIL_ATTACH to an unprivileged user that's
restricted to some subset of available CPUs the ability to attach to a jail,
which might lift the user's restrictions if they attach to a jail with a
wider mask.

In most cases, it's anticipated that admins will use this to be able to,
for example, `cpuset -c -l 1 jail -c path=/ command=/long/running/cmd`,
and avoid the need for contortions to spawn a command inside a jail with a
more limited cpuset than the jail.

(cherry picked from commit d431dea5ac2aaab012f90182cf7ca13cc6dde5ea)

3 years agoMFC lualoader: module-manipulation commands
Kyle Evans [Sat, 12 Dec 2020 05:57:42 +0000 (05:57 +0000)]
MFC lualoader: module-manipulation commands

4634bb1f: lualoader: provide module-manipulation commands

Specifically, we have:
- enable-module
- disable-module
- toggle-module

These can be used to add/remove modules to be loaded or force modules to be
loaded in spite of modules_blacklist. In the typical case, a user is
expected to use them to recover an issue happening due to a module directive
they've added to their loader.conf or because they discover that they've
under-specified what to load.

10aeb6cd: lualoader: config: fix module enabled check

A last minute rewrite left this logically wrong; if it's present in
modules_blacklist, then we do not load it.

7ed84fa1: lualoader: cli: provide a show-module-options loader command

This effectively dumps everything lualoader knows about to the console using
the libsa pager; that particular lua interface was added in r368591.

A pager stub implementation has been added that just dumps the output as-is
as a compat shim for older loader binaries that do not have lpager. This
stub should be moved into a more appropriate .lua file if we add anything
else that needs the pager.

(cherry picked from commit 4634bb1f4052ff5f1c0a423fd8cce11396ca7fd2)
(cherry picked from commit 10aeb6cdab8fb09e2cc3ee2d8b2c68c395481c23)
(cherry picked from commit 7ed84fa14b00cdacfe9b43019cba7a14b33af352)

3 years agoMFC: stand: liblua: add a pager module
Kyle Evans [Sat, 12 Dec 2020 21:25:38 +0000 (21:25 +0000)]
MFC: stand: liblua: add a pager module

This is nearly a 1:1 mapping of the pager API from libsa.  The only real
difference is that pager.output() will accept any number of arguments and
coerce all of them to strings for output using luaL_tolstring (i.e. the
__tostring metamethod will be used).

The only consumer planned at this time is the upcoming "show-module-options"
implementation.

(cherry picked from commit 0a0d522b368b31ec51611b798047a75b52855f39)

3 years agoMFC kern: cpuset: allow jails to modify child jails' roots
Kyle Evans [Sat, 19 Dec 2020 03:30:06 +0000 (03:30 +0000)]
MFC kern: cpuset: allow jails to modify child jails' roots

This partially lifts a restriction imposed by r191639 ("Prevent a superuser
inside a jail from modifying the dedicated root cpuset of that jail") that's
perhaps beneficial after r192895 ("Add hierarchical jails."). Jails still
cannot modify their own cpuset, but they can modify child jails' roots to
further restrict them or widen them back to the modifying jails' own mask.

As a side effect of this, the system root may once again widen the mask of
jails as long as they're still using a subset of the parent jails' mask.
This was previously prevented by the fact that cpuset_getroot of a root set
will return that root, rather than the root's parent -- cpuset_modify uses
cpuset_getroot since it was introduced in r327895, previously it was just
validating against set->cs_parent which allowed the system root to widen
jail masks.

PR: 240687
(cherry picked from commit 54a837c8cca109ad0d7ecb4b93379086f6f49275)

3 years agoMFC freebsd-update: unconditionally regenerate passwd/login.conf files
Kyle Evans [Thu, 17 Dec 2020 03:42:54 +0000 (03:42 +0000)]
MFC freebsd-update: unconditionally regenerate passwd/login.conf files

The existing logic is nice in theory, but in practice freebsd-update will
not preserve the timestamps on these files. When doing a major upgrade, e.g.
from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and
we clobber the timestamp several times in the process of packaging up the
existing system into /var/db/freebsd-update/files and extracting for
comparisons. This leads to these files not getting regenerated when they're
most likely to be needed.

Measures could be taken to preserve timestamps, but it's unclear whether
the complexity and overhead of doing so is really outweighed by the marginal
benefit.

I observed this issue when pkg subsequently failed to install a package that
wanted to add a user, claiming that the user was removed in the process.
bapt@ pointed to this pre-existing bug with freebsd-update as the cause.

PR: 234014, 232921

(cherry picked from commit ebebc41e4cfe44b8e8fd881badf2fa2c4be65aa4)

3 years agoMFC r368794: driver(9): Fix a mandoc related issue
Gordon Bergling [Sat, 19 Dec 2020 10:18:21 +0000 (10:18 +0000)]
MFC r368794: driver(9): Fix a mandoc related issue

- sections out of conventional order: Sh SEE ALSO

(cherry picked from commit f37f378d35710da29463f0346deafe6eeb7648ea)

3 years agoMFC r368809: config: Fix a few mandoc related errors
Gordon Bergling [Sat, 19 Dec 2020 13:11:44 +0000 (13:11 +0000)]
MFC r368809: config: Fix a few mandoc related errors

- new sentence, new line
- no blank before trailing delimiter

(cherry picked from commit aeb0c721f5ce785d954c35d2609748e9cb8dd2d0)

3 years agoMFC r368800: devd.conf(5): Fix a mandoc related issue
Gordon Bergling [Sat, 19 Dec 2020 11:03:04 +0000 (11:03 +0000)]
MFC r368800: devd.conf(5): Fix a mandoc related issue

- sections out of conventional order: Sh SEE ALSO

(cherry picked from commit 226f43e757ff7a0f945f9deb0fb1481a752274bc)

3 years agoMFC r368816: trim(8): Fix a few issues reported by mandoc
Gordon Bergling [Sat, 19 Dec 2020 13:56:19 +0000 (13:56 +0000)]
MFC r368816: trim(8): Fix a few issues reported by mandoc

- new sentence, new line
- unusual Xr order: ioctl(2) after da(4)
- unusual Xr order: sysexits(3) after nda(4)

(cherry picked from commit a652079615ac3cb503e516e50246284bb4ad60eb)

3 years agoMFC r368815: zonectl(8): Fix a few issues reported by mandoc
Gordon Bergling [Sat, 19 Dec 2020 13:51:46 +0000 (13:51 +0000)]
MFC r368815: zonectl(8): Fix a few issues reported by mandoc

- Add missing quotation mark for a comment above the .Dd
- inserting missing end of block: Sh breaks Bd
- skipping paragraph macro: Pp before Bl
- skipping paragraph macro: Pp before Bd
- empty block: Bd

(cherry picked from commit 8ef235787bcf90735e76bd476084f1ff016b7619)

3 years agoMFC r368796: ofw_bus_is_compatible(9): Fix a few mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 10:24:36 +0000 (10:24 +0000)]
MFC r368796: ofw_bus_is_compatible(9): Fix a few mandoc related issues

- missing comma before name: Nm ofw_bus_is_compatible_strict
- missing comma before name: Nm ofw_bus_node_is_compatible
- missing comma before name: Nm ofw_bus_search_compatible
- skipping paragraph macro: Pp after Sh

(cherry picked from commit 8bf0ef84d9c1aef72ba64f4dcbebb2a38edcf183)

3 years agoMFC r368814: nfsv4(4): Fix a few issues reported by mandoc
Gordon Bergling [Sat, 19 Dec 2020 13:45:39 +0000 (13:45 +0000)]
MFC r368814: nfsv4(4): Fix a few issues reported by mandoc

- new sentence, new line
- function name without markup: rtalloc()
- function name without markup: VOP_RECLAIM()

(cherry picked from commit 749ddf491b4370300a2edbd47aed9ee1b5d71178)

3 years agoMFC r368812: mpsutil(8): Remove trailing whitespace
Gordon Bergling [Sat, 19 Dec 2020 13:23:26 +0000 (13:23 +0000)]
MFC r368812: mpsutil(8): Remove trailing whitespace

(cherry picked from commit 84572415b4b55354811282cbc184f4a46f6952a1)

3 years agoMFC r368813: bluetooth: Fix a mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 13:36:59 +0000 (13:36 +0000)]
MFC r368813:  bluetooth: Fix a mandoc related issues

- new sentence, new line
- sections out of conventional order: Sh FILES
- unusual Xr order: bthost(1) after bthidd(8)
- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order: Sh EXIT STATUS

(cherry picked from commit 60ee05db4b19763137c399a0d79509af14e7440a)

3 years agoMFC r368797: ofw_bus_status_okay(9): Fix a few mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 10:26:40 +0000 (10:26 +0000)]
MFC r368797: ofw_bus_status_okay(9): Fix a few mandoc related issues

- missing comma before name: Nm ofw_bus_status_okay
- missing comma before name: Nm ofw_bus_node_status_okay
- skipping paragraph macro: Pp after Sh

(cherry picked from commit 0492f4030d2bd657fe9831ddf2a1e4b6204e4840)

3 years agoMFC r368793: bhnd_erom(9): Fix a few mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 10:15:58 +0000 (10:15 +0000)]
MFC r368793:  bhnd_erom(9): Fix a few mandoc related issues

- skipping paragraph macro: Pp before Bl
- skipping paragraph macro: Pp after Ss
- skipping paragraph macro: Pp at the end of Ss
- unusual Xr punctuation: none before bhnd_driver_get_erom_class(9)
- unusual Xr punctuation: none before bus_space(9)

(cherry picked from commit a549eb675bcdf5e0a35b49baa6f3ef0856dcba41)

3 years agoMFC r368795: fail(9): Fix a few mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 10:20:22 +0000 (10:20 +0000)]
MFC r368795: fail(9): Fix a few mandoc related issues

- function name without markup: return()
- function name without markup: print()

(cherry picked from commit 501de9c0c1a4f78cd4f5986eea809554f8490d66)

3 years agoMFC r368792: bhnd(9): Fix a few mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 10:11:37 +0000 (10:11 +0000)]
MFC r368792: bhnd(9): Fix a few mandoc related issues

- skipping paragraph macro: Pp before Bl
- skipping paragraph macro: Pp at the end of Ss
- missing section argument: Xr device_set_desc
- unusual Xr punctuation: none before bhnd_erom(9)

(cherry picked from commit 05419da506c699f52d60cc7afe86263146778f87)

3 years agoMFC r368807: patch(1): Fix a few mandoc related issues
Gordon Bergling [Sat, 19 Dec 2020 13:00:17 +0000 (13:00 +0000)]
MFC r368807: patch(1): Fix a few mandoc related issues

- no blank before trailing delimiter

(cherry picked from commit a2f1c81b286c528a8efedf224a13e476dba1de42)

3 years agoMFC r368805: ident(1): Normalizing date format
Gordon Bergling [Sat, 19 Dec 2020 12:54:00 +0000 (12:54 +0000)]
MFC r368805: ident(1): Normalizing date format

(cherry picked from commit a5b4dfcfbc707b2306f7a11fdc0d14af5c79081a)

3 years agoMFC r368808: devctl(8): Correct "sections out of conventional order" error
Gordon Bergling [Sat, 19 Dec 2020 13:05:54 +0000 (13:05 +0000)]
MFC r368808: devctl(8): Correct "sections out of conventional order" error

(cherry picked from commit 267d86e15dbc9156c35ea07a5d8063013758431c)

3 years agoMFC r368806: uname(1): Fix a typo in the man page date
Gordon Bergling [Sat, 19 Dec 2020 12:55:27 +0000 (12:55 +0000)]
MFC r368806: uname(1): Fix a typo in the man page date

(cherry picked from commit 3f6cdd59fecf4077256e37d7de7f9db3ac0e72e2)

3 years agoMFC _umtx_op: documentation and libsysdecode/kdump/truss decoding (32-bit)
Kyle Evans [Wed, 9 Dec 2020 03:20:51 +0000 (03:20 +0000)]
MFC _umtx_op: documentation and libsysdecode/kdump/truss decoding (32-bit)

e04a83a3: _umtx_op(2): document recent addition of 32bit compat flags

This was part of D27325.

3b27074b: libsysdecode: decode _UMTX_OP flags

Assume that UMTX_OP with a double underbar following is a flag, while any
underbar+alphanumeric combination immeiately following is an op.

This was a part of D27325.

c2679dd7: kdump/truss: decode new _umtx_op flags

In both cases, print the flag bits first followed by the command.

Output now looks something like this:

(ktrace)
_umtx_op(0x8605f7008,0xf<UMTX_OP_WAIT_UINT_PRIVATE>,0,0,0)
_umtx_op(0x9fffdce8,0x80000003<UMTX_OP__32BIT|UMTX_OP_WAKE>,0x1,0,0)

(truss)
_umtx_op(0x7fffffffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)
_umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)

(cherry picked from commit e04a83a3e1b40fc7c41b5938d2e432ba01facd74)
(cherry picked from commit 3b27074b252cae3c7aee8f05f0c968dd26fa055b)
(cherry picked from commit c2679dd779bb75f51682cde5eb55a291b72d7900)

3 years agoiflib: Avoid leaking the freelist bitmaps upon driver detach
Mark Johnston [Mon, 7 Dec 2020 14:53:14 +0000 (14:53 +0000)]
iflib: Avoid leaking the freelist bitmaps upon driver detach

Submitted by: Sai Rajesh Tallamraju <stallamr@netapp.com>
Sponsored by: NetApp, Inc.

(cherry picked from commit c065d4e5e9f27743126dcdfcf6d1c7fa36a693c0)

3 years agoiflib: Detach tasks upon device registration failure
Mark Johnston [Mon, 7 Dec 2020 14:52:57 +0000 (14:52 +0000)]
iflib: Detach tasks upon device registration failure

In some error paths we would fail to detach from the iflib taskqueue
groups.  Also move the detach code into its own subroutine instead of
duplicating it.

Submitted by: Sai Rajesh Tallamraju <stallamr@netapp.com>
Sponsored by: NetApp, Inc.

(cherry picked from commit 102540192c7195c99722869a11a48868e9116e91)

3 years agoFix the ipfw service status output when ipfw.ko isn't loaded
Mark Johnston [Fri, 18 Dec 2020 16:02:28 +0000 (16:02 +0000)]
Fix the ipfw service status output when ipfw.ko isn't loaded

(cherry picked from commit 5120612664fbc54d69ee1a21d0abcbab58712709)

3 years agoMFC r368676: jail: show symbolic jailparam flags
Jamie Gritton [Tue, 15 Dec 2020 20:56:35 +0000 (20:56 +0000)]
MFC r368676: jail: show symbolic jailparam flags

Bugfix to not hide jailparam flags, which for example changes the output
"vnet=2" to the less opaque "vnet=inherit"

Reported by: kevans

3 years agoMFC kern: _umtx_op: introduce 32-bit/i386 flags for operations
Kyle Evans [Sun, 22 Nov 2020 05:47:45 +0000 (05:47 +0000)]
MFC kern: _umtx_op: introduce 32-bit/i386 flags for operations

This patch takes advantage of the consolidation that happened to provide two
flags that can be used with the native _umtx_op(2): UMTX_OP___32BIT and
UMTX_OP__I386.

UMTX_OP__32BIT iindicates that we are being provided with 32-bit structures.
Note that this flag alone indicates a 64bit time_t, since this is the
majority case.

UMTX_OP__I386 has been provided so that we can emulate i386 as well,
regardless of whether the host is amd64 or not.

Both imply a different set of copyops in sysumtx_op. freebsd32__umtx_op
simply ignores the flags, since it's already doing a 32-bit operation and
it's unlikely we'll be running an emulator under compat32. Future work
could consider it, but the author sees little benefit.

This will be used by qemu-bsd-user to pass on all _umtx_op calls to the
native interface as long as the host/target endianness matches, effectively
eliminating most if not all of the remaining unresolved deadlocks for most.

This version changed a fair amount from what was under review, mostly in
response to refactoring of the prereq reorganization and battle-testing
it with qemu-bsd-user.  The main changes are as follows:

1.) The i386 flag got renamed to omit '32BIT' since this is redundant.
2.) The flags are now properly handled on 32-bit platforms to emulate other
    32-bit platforms.
3.) Robust list handling was fixed, and the 32-bit functionality that was
    previously gated by COMPAT_FREEBSD32 is now unconditional.
4.) Robust list handling was also improved, including the error reported
    when a process has already registered 32-bit ABI lists and also
    detecting if native robust lists have already been registered. Both
    scenarios now return EBUSY rather than EINVAL, because the input is
    technically valid but we're too busy with another ABI's lists.

libsysdecode/kdump/truss support will go into review soon-ish, along with
the associated manpage update.

(cherry picked from commit e0cb5b2a776208d70b8463c063a126893fafa101)

3 years agoMFC kern: _umtx_op: compat32 refactoring
Kyle Evans [Tue, 17 Nov 2020 03:36:58 +0000 (03:36 +0000)]
MFC kern: _umtx_op: compat32 refactoring

63ecb272: umtx_op: reduce redundancy required for compat32

All of the compat32 variants are substantially the same, save for
copyin/copyout (mostly). Apply the same kind of technique used with kevent
here by having the syscall routines supply a umtx_copyops describing the
operations needed.

umtx_copyops carries the bare minimum needed- size of timespec and
_umtx_time are used for determining if copyout is needed in the sem2_wait
case.

bd4bcd14: Fix !COMPAT_FREEBSD32 kernel build

One of the last shifts inadvertently moved these static assertions out of a
COMPAT_FREEBSD32 block, which the relevant definitions are limited to.

Fix it.

27a9392d: _umtx_op: fix robust lists after r367744

A copy-pasto left us copying in 24-bytes at the address of the rb pointer
instead of the intended target.

15eaec6a: _umtx_op: move compat32 definitions back in

These are reasonably compact, and a future commit will blur the compat32
lines by supporting 32-bit operations with the native _umtx_op.

60e60e73: freebsd32: take the _umtx_op struct definitions back

Providing these in freebsd32.h facilitates local testing/measuring of the
structs rather than forcing one to locally recreate them. Sanity checking
offsets/sizes remains in kern_umtx.c where these are typically used.

(cherry picked from commit 63ecb272a00c6f084a33db1c6ad3e925d4dcf015)
(cherry picked from commit bd4bcd14e3eae6f70790be65e862f89e2596b9af)
(cherry picked from commit 27a9392d543933f1aaa4e4ddae2a1585a72db1b2)
(cherry picked from commit 15eaec6a5c04b1cce7594cd1278600d7a57efc5a)
(cherry picked from commit 60e60e73fd9d185d62c36a499e21c124629eb8ba)

3 years agoCast sv_stackgap argument
Konstantin Belousov [Sat, 26 Dec 2020 00:16:29 +0000 (02:16 +0200)]
Cast sv_stackgap argument

to minimally intrusively handle difference between 12 and HEAD.
On all supported architectures representation of longs and pointers
is same.

Reported by: bdragon

3 years agoMFC r366192:
Michal Meloun [Sun, 27 Sep 2020 09:12:36 +0000 (09:12 +0000)]
MFC r366192:

Don't try to print EFI memeory map if it doesn't exist.
(cherry picked from commit 0e417b55d56639a1e9bc4062dfe8020b621899c7)

3 years agobin/setfacl: Remove unused headers.
Xin LI [Sat, 12 Dec 2020 02:26:43 +0000 (02:26 +0000)]
bin/setfacl: Remove unused headers.

(cherry picked from commit dd1ce6c7f19ad7ccd2eb9be78655238ae1b4ea5e)

3 years agobin/stty: Remove unneeded headers.
Xin LI [Sat, 12 Dec 2020 02:24:33 +0000 (02:24 +0000)]
bin/stty: Remove unneeded headers.

(cherry picked from commit 3601af4da2686fd29335abce8859205b64c312dd)

3 years agoMFC r364447:
Brandon Bergren [Fri, 21 Aug 2020 03:31:01 +0000 (03:31 +0000)]
MFC r364447:

[PowerPC] Fix translation-related crashes during startup

After spending a lot of time trying to track down what was going on, I have
isolated the "black screen" failures when using boot1 to boot a G4 machine.

It turns out we were replacing the traps before installing the temporary
BAT entry for the bottom of physical memory. That meant that until the MMU
was bootstrapped, the cached translations were the only thing keeping us
from losing.

Throwing boot1 into the mix was affecting execution flow enough to cause us
to hit an uncached page and crash.

Fix this by properly setting up the initial BAT entry at the same time we
are replacing the OpenFirmware traps, so we can continue executing in
segment 0 until the rest of the DMAP has been set up.

A second thing discovered while researching this is that we were entering a
BAT region for segment 16. It turns out this range was a) considered part
of KVA, and b) has firmware mappings with varying attributes.

If we ever accessed an unmapped page in segment 16, it would cause a BAT
entry to be installed for the whole segment, which would bypass the
existing mappings until it was flushed out again.

Instead, translate the OFW memory attributes into VM memory attributes and
install the ranges into the kernel address space properly.

Reviewed by: adalava
MFC after: 3 weeks
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D25547

(cherry picked from commit f10baa404986adb5733fd5745d467a8f69409ce3)

3 years agoMFC r361703:
Brandon Bergren [Mon, 1 Jun 2020 19:40:59 +0000 (19:40 +0000)]
MFC r361703:

[PowerPC] Fix build-id note on powerpc64 kernel

Due to the ordering of the powerpc64 linker script, we were discarding
all notes before emitting .note.gnu.build-id. This had the effect of
generating an empty build id section and breaking the kern.build_id
sysctl added in r348611.

powerpc and powerpcspe are uneffected.

PR: 246430
Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit 30dc2aebd7e88d43d620bba765edd21fcd20f3be)

3 years agoMFC r361024:
Brandon Bergren [Thu, 14 May 2020 04:00:35 +0000 (04:00 +0000)]
MFC r361024:

[PowerPC] Fix wrong instructions in _savegpr_X.

We were accidentally using stfd instead of stw in our SAVEGPR macro.

This has almost certainly been causing crashes when compiling with -Os.

Reviewed by: jhibbits (in irc)
Sponsored by: Tag1 Consulting, Inc.

(cherry picked from commit 3dbb9df36bdb0a7e8e00f24f94fa06a802a3eeee)

3 years agoMFC r355876 (by cem):
Conrad Meyer [Wed, 18 Dec 2019 06:22:28 +0000 (06:22 +0000)]
MFC r355876 (by cem):

acpi(4): Add _CID to PNP info string

While a given ACPI device may have 0-N compatibility IDs, in practice most
seem to have 0 or 1.  If one is present, emit it as part of the PNP info
string associated with a device.  This could enable MODULE_PNP_INFO-based
automatic kldload for ACPI drivers associated with a given _CID (but without
a good _HID or _UID identifier).

Reviewed by: imp, jhb
Differential Revision: https://reviews.freebsd.org/D22846

(cherry picked from commit 359a5f96a1685f6779e7ddbe5daafd67e73a066e)

3 years agoMFC r368775:
Konstantin Belousov [Sat, 19 Dec 2020 01:46:47 +0000 (01:46 +0000)]
MFC r368775:
Remove redundand redefinion, fixing build.

(cherry picked from commit 15575436693e953816a18acd4d9c0bf35d8ca39c)

3 years agoMFC: contrib/tzdata: import tzdata 2020e
Philip Paeps [Fri, 25 Dec 2020 15:16:38 +0000 (23:16 +0800)]
MFC: contrib/tzdata: import tzdata 2020e

Changes: https://github.com/eggert/tz/blob/2020e/NEWS

(cherry picked from commit dc505d53dcc15636aea9df8c03298f8c32147fa9)

3 years agoMFC r368772:
Konstantin Belousov [Fri, 18 Dec 2020 23:14:39 +0000 (23:14 +0000)]
MFC r368772:
Add ELF flag to disable ASLR stack gap.

PR: 239873

(cherry picked from commit 673e2dd652156342009930cf1f7d15623e4a543a)

3 years agoMFC r368771:
Konstantin Belousov [Fri, 18 Dec 2020 23:11:27 +0000 (23:11 +0000)]
MFC r368771:
proc.h: Reformat P_ and P2_ definitions.

(cherry picked from commit c5354d593df9a5b97b6c4b1d9999915d93c8e103)

3 years agoMFC r368749:
Konstantin Belousov [Fri, 18 Dec 2020 03:46:50 +0000 (03:46 +0000)]
MFC r368749:
pci_iov: When pci_iov_detach(9) is called, destroy VF children
instead of bailing out with EBUSY if there are any.

(cherry picked from commit 94f5c1cc7186ae555b962d2450cc17e06fd4fda0)

3 years agonl_langinfo(3): document recognized item names
Yuri Pankov [Thu, 17 Dec 2020 02:33:52 +0000 (02:33 +0000)]
nl_langinfo(3): document recognized item names

While here, remove .Tn macro usage (prompted by mandoc lint).

PR: 251468

(cherry picked from commit 3cd6e2390cae6395f0a873612818cb7ee4a1749e)

3 years agoxargs: compile yesexpr as ERE
Yuri Pankov [Sat, 12 Dec 2020 15:38:32 +0000 (15:38 +0000)]
xargs: compile yesexpr as ERE

yesexpr is an extended regular expression for quite some time now,
use appropriate flag when compiling it.

PR: 238762

(cherry picked from commit 0d2dcf2166f77fab2af39d9e89bff157ffc0ca5b)

3 years agoMFC: 0ebcbcc0efdd (svn r368734:
Cy Schubert [Thu, 17 Dec 2020 19:50:41 +0000 (19:50 +0000)]
MFC: 0ebcbcc0efdd (svn r368734:

Update the unbound version number from r368478.

Updating the version number is an extra manual step.

Pointy hat to: cy
Reported by: Herbert J. Skuhra <herbert _ gojira.at>

(cherry picked from commit 0ebcbcc0efdd733b11311c840c47cc22f83c7408)

3 years agoMFC r368735:
Konstantin Belousov [Thu, 17 Dec 2020 19:51:39 +0000 (19:51 +0000)]
MFC r368735:
Fix a race in tty_signal_sessleader() with unlocked read of s_leader.

(cherry picked from commit 551e205f6dfa469f4f32a166ee3fb691201d27a7)

3 years agoMFC r357940 (by mjg), r365932 (by jrtc27):
Konstantin Belousov [Thu, 24 Dec 2020 10:56:16 +0000 (12:56 +0200)]
MFC r357940 (by mjg), r365932 (by jrtc27):
Make atomic_load_ptr type-aware
atomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr

(cherry picked from commit 082a6b2a92888cf799c7a0408a78e2d7ad9320bb)
(cherry picked from commit 7d54cc9165a3990849b60835c85ddb388905e1b7)

3 years agoApply upstream fix 08968baec1122a58bb90d8f97ad948a75f8a5d69:
Xin LI [Fri, 18 Dec 2020 04:23:20 +0000 (04:23 +0000)]
Apply upstream fix 08968baec1122a58bb90d8f97ad948a75f8a5d69:

Fix error cases when udp-connect is set and send() returns an error

Obtained from: unbound git

(cherry picked from commit 7341cb0cd1cb6a5bf03c955ce04107b86b186613)

3 years agoMFC r354991-r354992 (by lwhsu)
Ryan Libby [Sat, 19 Dec 2020 08:16:33 +0000 (08:16 +0000)]
MFC r354991-r354992 (by lwhsu)

r354991:
Fix GCC build.

Sponsored by: The FreeBSD Foundation

r354992:
Initialize variable bitstr

r354991 removed variable-sized object initializing on defining.  For the safe
reason, manually initialize the members to 0.

Sponsored by: The FreeBSD Foundation

3 years agoMFC r349848 (by lwhsu):
Ryan Libby [Sat, 19 Dec 2020 04:28:25 +0000 (04:28 +0000)]
MFC r349848 (by lwhsu):

- Fix gcc build for superio(4)
- Change string mapping of SUPERIO_DEV_NONE to distinguish from SUPERIO_DEV_MAX

Reviewed by: imp
Discussed with: avg, imp, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20880

3 years agoMFC r368745:
Ryan Libby [Sat, 19 Dec 2020 04:24:05 +0000 (04:24 +0000)]
MFC r368745:

ice: quiet -Wredundant-decls

Reapply r364240 after driver update in r365617.

Reviewed by: lwhsu
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27561

3 years agoMFC r368564:
Ryan Libby [Sat, 19 Dec 2020 04:22:26 +0000 (04:22 +0000)]
MFC r368564:

qat: quiet -Wredundant-decls

Reviewed by: markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27554

3 years agoMFC r368563:
Ryan Libby [Sat, 19 Dec 2020 04:21:15 +0000 (04:21 +0000)]
MFC r368563:

ntb: quiet gcc -Wreturn-type

Reviewed by: cem, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27553

3 years agoMFC r347628:
Ryan Libby [Sat, 19 Dec 2020 04:18:49 +0000 (04:18 +0000)]
MFC r347628:

x86: spell vpxor %zmm0 as vpxord

Fix gcc/gas amd64 & i386 build after r347566.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20264

3 years agoMFC r343672 (by vangyzen):
Ryan Libby [Sat, 19 Dec 2020 04:09:21 +0000 (04:09 +0000)]
MFC r343672 (by vangyzen):

rtld: pacify -Wmaybe-uninitialized from gcc6

Sponsored by: Dell EMC Isilon

3 years agoMFC r343671 (by vangyzen):
Ryan Libby [Sat, 19 Dec 2020 04:05:08 +0000 (04:05 +0000)]
MFC r343671 (by vangyzen):

libm: squelch -Woverflow from gcc6

Sponsored by: Dell EMC Isilon

3 years agoMFC r368391: if_em.ko: fix module build outside of kernel build environment
Eugene Grosbein [Fri, 18 Dec 2020 12:40:19 +0000 (12:40 +0000)]
MFC r368391: if_em.ko: fix module build outside of kernel build environment

3 years agoMFC r368148: fix hastd(8)
Eugene Grosbein [Fri, 18 Dec 2020 12:20:29 +0000 (12:20 +0000)]
MFC r368148: fix hastd(8)

hastd(8) assumes it has no extra file descriptors opened
and aborts otherwise, so call closefrom() early.

PR: 227461

3 years agoMFC r368593:
Michael Tuexen [Fri, 18 Dec 2020 10:13:28 +0000 (10:13 +0000)]
MFC r368593:
Clean up more resouces of an existing SCTP association in case of
a restart.
This fixes a use-after-free scenario, which was reported by Felix
Wilhelm from Google in case a peer is able to modify the cookie.
However, this can also be triggered by an assciation restart under
some specific conditions.

MFC r368622:
Harden the handling of outgoing streams in case of an restart or INIT
collision. This avouds an out-of-bounce access in case the peer can
break the cookie signature. Thanks to Felix Wilhelm from Google for
reporting the issue.

3 years agoMFC r368394:
Michael Tuexen [Fri, 18 Dec 2020 10:08:11 +0000 (10:08 +0000)]
MFC r368394:
When dropping packets (RRQ or WRQ) for debugging, report the send
operation as successful. Reporting a failure stops the transfer
instead of using timeouts.

MFC r368521:
Fix the TFTP client when performing a RRQ for files smaller than 512 bytes
and the server not sending an OACK:
* Close the file.
* Report the correct the number of received blocks.

MFC r368647:
Improve the counting of blocks used to transfer a file from the
server to the client in case of not using an OACK: Don't miss
the first block in case of it is not also the last one.

MFC r368657:
When receiving a file having a length, which is a mulitple of the blocksize,
close the file once it is received.

3 years agoMFC r350739-r350740 (by cem)
Ryan Libby [Fri, 18 Dec 2020 08:40:33 +0000 (08:40 +0000)]
MFC r350739-r350740 (by cem)

r350739:
Disable useless -Wformat-zero-length

It is part of -Wformat, which is enabled by -Wall.  Empty format strings are
well defined and it is perfectly reasonable to expect them in a formatting
interface.

r350740:
r350739 try #2

For some inexplicable reason, C++ compilers reject the -Wno- flag, and also
(ab)use CWARNFLAGS.

Reported by: imp

3 years agoMFC r357019:
Ryan Libby [Fri, 18 Dec 2020 08:29:38 +0000 (08:29 +0000)]
MFC r357019:

uma: fix zone domain overlaying pcpu cache with disabled cpus

UMA zone structures have two arrays at the end which are sized according
to the machine: an array of CPU count length, and an array of NUMA
domain count length.  The CPU counting was wrong in the case where some
CPUs are disabled (when mp_ncpus != mp_maxid + 1), and this caused the
second array to be overlaid with the first.

Reported by: olivier
Reviewed by: jeff, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23318

3 years agoMFC r368550:
Guangyuan Yang [Fri, 18 Dec 2020 02:41:12 +0000 (02:41 +0000)]
MFC r368550:

Fix a grammar error on locate(1).

While here, also fix a useless .Tn reported by mandoc.

PR: 251746
Sumbitted by: David Schlachter <fbsd-bugzilla@schlachter.ca>

3 years agoMFC r368519:
Robert Wing [Thu, 17 Dec 2020 19:49:17 +0000 (19:49 +0000)]
MFC r368519:

Add deprecation notice for bvmconsole and bvmdebug.

Now that bhyve(8) supports UART, bvmconsole and bvmdebug are no longer needed.

Mark the '-b' and '-g' flag as deprecated for bhyve(8).

These will be removed/gone in 13.