]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agonetgraph/ng_source: Allow ng_source to inject into any netgraph network
Lutz Donnerhacke [Sun, 17 Jan 2021 20:35:28 +0000 (21:35 +0100)]
netgraph/ng_source: Allow ng_source to inject into any netgraph network

PR: 240530
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D21968

(cherry picked from commit 75e7ef74dfc12e01b1ef4706110d238639e04543)

3 years agoinetd: fix unix sockaddr's length assignment
Kyle Evans [Fri, 12 Feb 2021 19:19:43 +0000 (13:19 -0600)]
inetd: fix unix sockaddr's length assignment

unsz was always exactly '1' here due to an unfortunate mispositioning
of closing parenthesis. While it's generally irrelevant because bind(2)
is passed the (accurate) sep->se_ctrladdr_size instead, it's not very
helpful for anything locally that wants to use it rather than assuming
that sep->se_ctrladdr_size perfectly fits the end of sun_path.

Just drop unsz entirely and use the result of SUN_LEN() for it.

(cherry picked from commit 1253835121cb38fd93478849e32a4a4c13436fb2)

3 years agofmtree: add a deprecation notice to the manpage
Kyle Evans [Wed, 10 Feb 2021 15:10:52 +0000 (09:10 -0600)]
fmtree: add a deprecation notice to the manpage

Note that this mtree(8) is actually installed as fmtree(8), while
mtree(8) is located in ^/contrib/mtree -- thus, the reference to
mtree(8) makes a lot more sense in the context in which folks would
actually notice it. Shout-out to Ravi for pointing out that this may
not be an obvious fact.

Relnotes: yes

(cherry picked from commit 6fea22cebe5cb1e51e98c894a738bea910b7bc2f)

3 years agoMFC 57785538c6e0d7e8ca0f161ab95bae10fd304047 and
Cy Schubert [Sun, 7 Feb 2021 03:22:52 +0000 (19:22 -0800)]
MFC 57785538c6e0d7e8ca0f161ab95bae10fd304047 and
    1e811efbc591699b872bea42b9de419c373199df:

57785538c6e0d7e8ca0f161ab95bae10fd304047:

Simplify the FreeBSD check using __FreeBSD__ compiler macro.

Rather than rely on __FreeBSD_version, defined in sys/param.h, use
__FreeBSD__ defined by the compiler.

Reported by: emaste
MFC after: 1 week

(cherry picked from commit 57785538c6e0d7e8ca0f161ab95bae10fd304047)

1e811efbc591699b872bea42b9de419c373199df:

Fix non-IPv6 build post 57785538c6e0d7e8ca0f161ab95bae10fd304047.

57785538c6e0d7e8ca0f161ab95bae10fd304047 change the test for FreeBSD
from __FreeBSD_version to __FreeBSD__. However this test was performed
before sys/param.h was included, therefore __FreeBSD_version was never
defined. As the test was never true opt_random_ip_id.h was never included.

Submitted by: bdragon
Reported by: bdragon

(cherry picked from commit 1e811efbc591699b872bea42b9de419c373199df)

3 years agoMFC d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd:
Cy Schubert [Sun, 7 Feb 2021 03:15:27 +0000 (19:15 -0800)]
MFC d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd:

Simply FreeBSD check using __FreeBSD__ and remove OpenBSD

(cherry picked from commit d20f7a5a3da1aa5bccdabb89c181ca0c49385ecd)

3 years agoMFC 344f1083e128d8d41ca31853dac513ca3efd9d1f:
Cy Schubert [Fri, 5 Feb 2021 14:26:04 +0000 (06:26 -0800)]
MFC 344f1083e128d8d41ca31853dac513ca3efd9d1f:

ipfilter: Use the softn (NAT softc) host map size in ip_nat6 calculation.

The ipfilter NAT table host map size is a tunable that defaults to
a macro value defined at build time. HOSTMAP_SIZE is saved in softn
(the ipnat softc) at initialization. It can be tuned (changed) at runtime
using the ipf -T command. If the hostmap_size tunable is adjusted the
calculation to determine where to put new entries in the table was
incorrect. Use the tunable in the NAT softc instead of the static build
time value.

(cherry picked from commit 344f1083e128d8d41ca31853dac513ca3efd9d1f)

3 years agoMFC 10990cb46027b4cc4339540b1217117863b2cd15:
Cy Schubert [Wed, 3 Feb 2021 03:24:05 +0000 (19:24 -0800)]
MFC 10990cb46027b4cc4339540b1217117863b2cd15:

Simplify FreeBSD check.

(cherry picked from commit 10990cb46027b4cc4339540b1217117863b2cd15)

3 years agoMFC commit e673debe7db8ba95e4ee3b549d2570e71d19b596:
Cy Schubert [Wed, 3 Feb 2021 03:18:48 +0000 (19:18 -0800)]
MFC commit e673debe7db8ba95e4ee3b549d2570e71d19b596:

Simplify BSD macro tests.

All FreeBSD and NetBSD are BSD >= 199306 and have been for a long time.

(cherry picked from commit e673debe7db8ba95e4ee3b549d2570e71d19b596)

3 years agoMFC 0f34c80f376345b98a972940dd4757e58d7beb06:
Cy Schubert [Thu, 28 Jan 2021 05:50:04 +0000 (21:50 -0800)]
MFC 0f34c80f376345b98a972940dd4757e58d7beb06:

Replace the redundant MENTAT macro with SOLARIS.

MENTAT and SOLARIS are synonymous. Remove the extraneous duplicate
macro.

(cherry picked from commit 0f34c80f376345b98a972940dd4757e58d7beb06)

3 years agoCirrus-CI: use FreeBSD 12.2 image
Ed Maste [Mon, 15 Feb 2021 22:04:42 +0000 (17:04 -0500)]
Cirrus-CI: use FreeBSD 12.2 image

Direct commit to stable/12 as main has other changes here, using the
llvm package to avoid building the toolchain.

3 years agomca: Handle inconsistent CMCI capability reporting
Mark Johnston [Mon, 8 Feb 2021 19:42:54 +0000 (14:42 -0500)]
mca: Handle inconsistent CMCI capability reporting

A BIOS bug may apparently cause the BSP to report that it does not
implement CMCI, with some APs reporting that they do.  In this scenario,
avoid a NULL pointer dereference that occurs in cmci_monitor() because
cmc_state was not allocated by the BSP.

PR: 253272
Reported by: asomers, mmacy
Reviewed by: kib (previous version)

(cherry picked from commit b5770470276268acef21368b3e77a325df883500)

3 years agoFix incorrect powf(3) result with x near 1 and |y| much larger than 1
Steve Kargl [Mon, 8 Feb 2021 19:45:30 +0000 (20:45 +0100)]
Fix incorrect powf(3) result with x near 1 and |y| much larger than 1

This adjusts the check to trigger overflow/underflow to a slightly lower
value.

Before: powf(9.999995e-01, -1.342177e+08) -> inf
After:  powf(9.999995e-01, -1.342177e+08) -> 1.858724e+31

(cherry picked from commit 93fc67896550548f91b307dbe3053f11db5d4a8a)

Add test case for 93fc67896550 (incorrect powf(3) result)

This adds the test case to contrib/netbsd-tests/lib/libm/t_pow.c, as it
is currently the only place testing pow(3) and friends.

(cherry picked from commit 51af03328755c9095e94d20858a8d10acfe412ae)

3 years agousleep(3): replace 'process' with 'calling thread'
Konstantin Belousov [Thu, 11 Feb 2021 03:49:25 +0000 (05:49 +0200)]
usleep(3): replace 'process' with 'calling thread'

PR: 253395

(cherry picked from commit 4956af2a8f0d7723cb09c98e7f5295b156136f70)

3 years agotest_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()
Alex Richardson [Fri, 29 Jan 2021 09:28:40 +0000 (09:28 +0000)]
test_inf_inputs: Use atf_tc_expect_fail() instead of atf_tc_skip()

Reviewed By: lwhsu
Differential Revision: https://reviews.freebsd.org/D28396

(cherry picked from commit 4d2edf3af1dbd8a3e7cf1b22343a1ecfc2dd41ba)

Fix lib/msun's ctrig_test/test_inf_inputs test case with clang >= 10

This sprinkles a few strategic volatiles in an attempt to defeat clang's
optimization interfering with the expected floating-point exception
flags.

Reported by: lwhsu
PR: 244732

(cherry picked from commit ac76bc1145dd7f4476e5d982ce8f355f71015713)

3 years agoPrint DeviceHandle and PhysicalId in hex.
Alexander Motin [Fri, 5 Feb 2021 21:13:55 +0000 (16:13 -0500)]
Print DeviceHandle and PhysicalId in hex.

The first is actually a bitfield.  The second is printed in hex by
dmidecode, so uniformidy should be good.

MFC after: 1 week

(cherry picked from commit 92d0d6bb14d24abea0786edf546af316ff4a2afe)

3 years agoImprove ACPI_NFIT_CONTROL_REGION formatting.
Alexander Motin [Fri, 5 Feb 2021 15:07:37 +0000 (10:07 -0500)]
Improve ACPI_NFIT_CONTROL_REGION formatting.

MFC after: 1 week

(cherry picked from commit 35e39fd95fda64699b638192f3bab955d0f1cf0c)

3 years agogrep: fix -A handling in conjunction with -m match limitation
Kyle Evans [Mon, 8 Feb 2021 18:31:17 +0000 (12:31 -0600)]
grep: fix -A handling in conjunction with -m match limitation

The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately.  The
problem with exiting immediately is that -A processing only happens when
subsequent lines are processed and do not match.

The fix here is relatively easy; when bsdgrep matches a line, it resets
the 'tail' of the matching context to the value supplied to -A and
dumps anything that's been queued up for -B. After the current line has
been printed and tail is reset, we check our mcount and do what's
needed. Therefore, at the time that we decide we're doing nothing, we
know that 'tail' of the context is correct and we can simply continue
on if there's still more to pick up.

With this change, we still bail out immediately if there's been no -A
flag. If -A was supplied, we signal that we should continue on. However,
subsequent lines will not even bothere to try and process the line.  We
have reached the match count, so even if the next line would match then
we must process it if it hadn't. Thus, the loop in procfile() can
short-circuit and just process the line as a non-match until
procmatches() indicates that it's safe to stop.

A test has been added to reflect both that we should be picking up the
next line and that the next line should be considered a non-match even
if it should have been.

PR: 253350

(cherry picked from commit 3e2d96ac974db823255a6f40b90eeffa6e38d022)

3 years agogrep: turn off -w if -x is specified
Kyle Evans [Thu, 4 Feb 2021 21:35:58 +0000 (15:35 -0600)]
grep: turn off -w if -x is specified

-x overcomes -w in gnugrep, and it should here as well.  Flip it off as
needed to avoid confusing other parts of grep.

(cherry picked from commit 2373acbbb77d694b997d90f3251810c6edf5d6d8)

3 years agogrep: fix null pattern and empty pattern file behavior
Kyle Evans [Thu, 4 Feb 2021 21:26:45 +0000 (15:26 -0600)]
grep: fix null pattern and empty pattern file behavior

The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong.  Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns.  If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR: 253209

(cherry picked from commit f823c6dc730b0dd08b54a53be1d8fd587eee7021)

3 years agozgrep: fix exit status with multiple files
Eric van Gyzen [Thu, 1 Oct 2020 21:48:22 +0000 (21:48 +0000)]
zgrep: fix exit status with multiple files

zgrep should exit with success when given multiple files and the
pattern is found in at least one file.  Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

(cherry picked from commit 63c8336d4de15085d50c9d8c855cdc97ee018a04)

3 years agoacpi: limit the AMDI0020/AMDI0010 workaround to an option
Warner Losh [Mon, 8 Feb 2021 21:43:25 +0000 (14:43 -0700)]
acpi: limit the AMDI0020/AMDI0010 workaround to an option

It appears that production versions of EPYC firmware get the _STA method right
for these nodes. In fact, this workaround breaks on production hardware by
including too many uart nodes. This work around was for pre-release hardware
that wound up not having a large deployment. Move this work around to a kernel
option since the machines that needed it have been powered off and are difficult
to resurrect. Should there be a more significant deployment than is understood,
we can restrict it based on smbios strings.

Discussed with: mmacy@, seanc@, jhb@
MFC After: 3 days

(cherry picked from commit 35af933173d516101f4c44af328fbe2d6e587869)

3 years agonvdimm: Fix error path mis-free
Conrad Meyer [Wed, 2 Oct 2019 19:13:35 +0000 (19:13 +0000)]
nvdimm: Fix error path mis-free

(diff applied manually due to refactoring)

Regression introduced in r343629 when malloc result was renamed from spa to
spa_mapping and the 'spa' name was instead used to iterate a table, but the
free() target was not updated.

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

(cherry picked from commit 31f1c8fc84c850d73e74781126e12efceb50032b)

3 years agoUpgrade to OpenPAM Tabebuia.
Dag-Erling Smørgrav [Mon, 25 Feb 2019 18:41:16 +0000 (18:41 +0000)]
Upgrade to OpenPAM Tabebuia.

PR: 235903
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28528

(cherry picked from commit 23d17223345108c52b96dcc5d7e6dab29e95f3e9)

3 years agoreadelf: decode LA48 and ASG_DISABLE feature flags
Ed Maste [Wed, 3 Feb 2021 21:16:45 +0000 (16:16 -0500)]
readelf: decode LA48 and ASG_DISABLE feature flags

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e79b51e2b2e35d6256a1ef5311ce02ec4032d21f)

3 years agoMFC 7071734fae6019d1e3e44daf7deb4478582081cc:
Cy Schubert [Wed, 27 Jan 2021 15:25:00 +0000 (07:25 -0800)]
MFC 7071734fae6019d1e3e44daf7deb4478582081cc:

Indentation cleanup resulting from the cleanup of #ifdefs.

The conscious decision was made not to perform any indentation or
whitespace cleanup while cleaning out old redunant #ifdefs. The
reason for this was to avoid confusing future readers of history and
diffs with cosmetic changes, making bisection of any possible bugs
introduced more difficult. This commit cleans up the whitespace
detritus left behind from the previous #ifdef cleanup commits.

(cherry picked from commit 7071734fae6019d1e3e44daf7deb4478582081cc)

3 years agoMFC 4cd1807c7d2a67b633dd0c0bfde15091543a2514:
Cy Schubert [Tue, 26 Jan 2021 06:24:28 +0000 (22:24 -0800)]
MFC 4cd1807c7d2a67b633dd0c0bfde15091543a2514:

Retire the K&R/STD C __P prototype declarations.

In the old days when K&R C and STD C were each in use a workaround
(read hack) was required to allow the same code to work on each
without modification. All C compilers support STD C. We can finally
put the __P prototype to rest.

(cherry picked from commit 4cd1807c7d2a67b633dd0c0bfde15091543a2514)

3 years agortld: Fix null-pointer dereference
David Chisnall [Tue, 2 Feb 2021 14:06:33 +0000 (16:06 +0200)]
rtld: Fix null-pointer dereference

(cherry picked from commit 43d44842aef3972cc86ce673e84e31f372257b15)

3 years agoamd64 GENERIC: compile in mlx5en(4)
Konstantin Belousov [Wed, 3 Feb 2021 12:19:12 +0000 (14:19 +0200)]
amd64 GENERIC: compile in mlx5en(4)

(cherry picked from commit 5832a3e398642f721381dc2bdc8e954ae43c17a7)

3 years agocpucontrol(8): Fix display.
Konstantin Belousov [Fri, 5 Feb 2021 01:00:27 +0000 (03:00 +0200)]
cpucontrol(8): Fix display.

(cherry picked from commit 856789c123d69de86684c5aa1ad8a53427dd47fc)

3 years agoWITH_OFED build option: fix
Konstantin Belousov [Tue, 2 Feb 2021 13:01:26 +0000 (15:01 +0200)]
WITH_OFED build option: fix

(cherry picked from commit ff975f15d86001d5b948ab538de1e4aca852d2f5)

3 years agonfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write
Konstantin Belousov [Fri, 22 Jan 2021 21:47:06 +0000 (23:47 +0200)]
nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write

(cherry picked from commit aa8c1f8d84d2638a354e71f9593e978d00878243)
(cherry picked from commit bd01a69f4836994b50b492883fb5367db41fb506)

3 years agoelf: add some definitions for i386 and amd64 relocations
Konstantin Belousov [Sun, 17 Jan 2021 07:03:31 +0000 (09:03 +0200)]
elf: add some definitions for i386 and amd64 relocations

(cherry picked from commit f7d181543fd96a89b84878ddb2d5ac010fadd9b8)

3 years agox86 vdso gettc: Add RDTSCP support
Konstantin Belousov [Wed, 6 Jan 2021 15:05:09 +0000 (17:05 +0200)]
x86 vdso gettc: Add RDTSCP support

Tested by: pho

(cherry picked from commit cd240c9cf100bec3def38ceb4a320611b1d02693)
(cherry picked from commit 523d94dbeab5ccb1cce21b8cad350b700c3d01b2)

3 years agox86 vdso gettc: eliminate duplicated code in ifunc selectors.
Konstantin Belousov [Wed, 6 Jan 2021 15:00:48 +0000 (17:00 +0200)]
x86 vdso gettc: eliminate duplicated code in ifunc selectors.

Tested by: pho

(cherry picked from commit 5bf4bafd13a4044b7c3d2e8246684a597c6f2134)

3 years agox86 vdso gettc: reorganize ifunctions.
Konstantin Belousov [Tue, 5 Jan 2021 21:14:11 +0000 (23:14 +0200)]
x86 vdso gettc: reorganize ifunctions.

Tested by: pho

(cherry picked from commit de898cb96042a026ef703d81aea6cdf1ffce8f32)

3 years agotsc: add RDTSCP or faster variants of get_timecount()
Konstantin Belousov [Tue, 5 Jan 2021 21:00:14 +0000 (23:00 +0200)]
tsc: add RDTSCP or faster variants of get_timecount()

Tested by: pho

(cherry picked from commit 9e680e4005b77e3028d28377ee3722a5260f4422)
(cherry picked from commit a013e285dfd6b89b1908ca13febb0fdb0a7f3b1f)
(cherry picked from commit 9f47eeffa3cfdcb512e2011fb00fc23c7c1a7d75)

3 years agoAdd ddb 'show timecounter' command.
Konstantin Belousov [Mon, 18 Jan 2021 07:25:36 +0000 (09:25 +0200)]
Add ddb 'show timecounter' command.

(cherry picked from commit 36bcc44e2c578dd016940c9c5068c348e1d77f99)

3 years agox86 busdma_bounce: use malloc_domainset_aligned(9).
Konstantin Belousov [Thu, 14 Jan 2021 04:02:21 +0000 (06:02 +0200)]
x86 busdma_bounce: use malloc_domainset_aligned(9).

Tested by: pho

(cherry picked from commit f3ea417f96b011a7eb4f43e3142e572833287ef4)

3 years agoImplement malloc_domainset_aligned(9).
Konstantin Belousov [Thu, 14 Jan 2021 03:59:34 +0000 (05:59 +0200)]
Implement malloc_domainset_aligned(9).

Tested by: pho

(cherry picked from commit 3b15beb30b3b4ba17bae3d1d43c8c04ff862bb57)
(cherry picked from commit 0781c79d4872a84a8ebeee3b5eb5520a682b8e7b)
(cherry picked from commit 1ac7c34486ab9177c2472278739568d4607e1acc)

3 years agojobc: rework detection of orphaned groups.
Konstantin Belousov [Tue, 29 Dec 2020 00:41:56 +0000 (02:41 +0200)]
jobc: rework detection of orphaned groups.

Tested by: pho

For MFC, pg_jobc member is left in struct pgrp, but it is unused now.

(cherry picked from commit 5844bd058aed6f3d0c8cbbddd6aa95993ece0189)

3 years agokinfo_proc: move job-control related data collection into a new helper.
Konstantin Belousov [Thu, 31 Dec 2020 22:46:20 +0000 (00:46 +0200)]
kinfo_proc: move job-control related data collection into a new helper.

Tested by: pho

(cherry picked from commit cf4f802e77a3a438bce5335b67c88ac6f0e21a6e)

3 years agoLock proctree in around fill_kinfo_proc().
Konstantin Belousov [Thu, 31 Dec 2020 22:29:40 +0000 (00:29 +0200)]
Lock proctree in around fill_kinfo_proc().

Tested by: pho

(cherry picked from commit 4daea938130b4a219e01d678e9499f0bdb715f82)

3 years agopgrp: Prevent use after free.
Konstantin Belousov [Thu, 31 Dec 2020 13:44:32 +0000 (15:44 +0200)]
pgrp: Prevent use after free.

Tested by: pho

(cherry picked from commit ef739c7373d8b3833979ad471b31cb9e215411fd)

3 years agoMFC 85d8d30f9f70:
Hans Petter Selasky [Tue, 26 Jan 2021 14:01:38 +0000 (15:01 +0100)]
MFC 85d8d30f9f70:
Don't allow allocating a new send tag on an INP which is being torn down.
This fixes a potential send tag leak.

Reviewed by: rrs@
Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 85d8d30f9f7046f5e89295352ded49135b25fbe3)

3 years agoAdd a manual page for axp(4) / AMD 10G Ethernet driver
Gordon Bergling [Sun, 24 Jan 2021 13:57:16 +0000 (14:57 +0100)]
Add a manual page for axp(4) / AMD 10G Ethernet driver

Submitted by: Rajesh Kumar <rajesh1 dot kumar at amd dot com>
Reviewed by: bcr, brueffer, rpokala
Differential Revision: https://reviews.freebsd.org/D27800

(cherry picked from commit 1f73236b0302cdf47630c99687c2dfd4e514ab54)

3 years agoukbd(4): Push LED events in ioctl handler rather than in xfer callback
Vladimir Kondratyev [Thu, 24 Dec 2020 19:08:04 +0000 (22:08 +0300)]
ukbd(4): Push LED events in ioctl handler rather than in xfer callback

If LED state is set through evdev interface, than asynchronous nature
of USB transfer callback can lead to change of order of events echoed
back to userland as it causes LED events to be echoed with some lag.

Fix that with echoing of LED events synchronously in ioctl handler.

Reviewed by: hselasky
Obtained from: sysutils/iichid
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27750

(cherry picked from commit 30f34a519372ebce29c4439d0e6a7bc8c2df0566)

3 years agoukbd(4): Do not serialize evdev key events
Vladimir Kondratyev [Thu, 24 Dec 2020 18:56:33 +0000 (21:56 +0300)]
ukbd(4): Do not serialize evdev key events

Unlike AT keyboards, HID devices are able to send all pc105 key
states within a single report. Let evdev to transmit all key state
changes within a single report too.

Reviewed by: hselasky
Obtained from: sysutils/iichid
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27749

(cherry picked from commit 769935a4edf8a75805000900d44a66ad5d2eaabe)

3 years agopsm(4): Always initialize Synaptics touchpad report range with defaults
Vladimir Kondratyev [Tue, 22 Dec 2020 20:44:42 +0000 (23:44 +0300)]
psm(4): Always initialize Synaptics touchpad report range with defaults

Otherwise libinput refuses to recoginize some Synaptics touchpads with
"kernel bug: device has min == max on ABS_X" message in Xorg.log.

PR: 251149
Reported-by: Jens Grassel <freebsd-ports@jan0sch.de>
Tested-by: Jens Grassel <freebsd-ports@jan0sch.de>
MFC-after: 2 weeks
(cherry picked from commit 2ac1c1927258e649e3ca3269aea40fb4c63e2296)

3 years agoCorrect description for kern.proc.proc_td
Ed Maste [Tue, 2 Feb 2021 21:55:51 +0000 (16:55 -0500)]
Correct description for kern.proc.proc_td

kern.proc.proc_td returns the process table with an entry for each
thread.  Previously the description included "no threads", presumably
a cut-and-pasteo in 2648efa621748.

Description suggested by PauAmma.

PR: 253146
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

(cherry picked from commit edc374e7c41d3d9e28e0b3a76bc9ed021d7db571)

3 years agoRevert "opencrypto: Fix assignment of crypto completions to worker threads"
Mark Johnston [Thu, 4 Feb 2021 14:43:10 +0000 (09:43 -0500)]
Revert "opencrypto: Fix assignment of crypto completions to worker threads"

atomic_fetchadd_64 is not available on all platforms on stable/12.

This reverts commit 10ed8ab4ab9bd0239f2913ac2f35af9b9f76221d.

Reported by: Mark Millard

3 years agoipfw(8) crashes when ext6hdr option is omitted
Evgeniy Khramtsov [Mon, 1 Feb 2021 19:03:57 +0000 (20:03 +0100)]
ipfw(8) crashes when ext6hdr option is omitted

Verify that the option is passed, error out if it's not.
The problem can be trivially triggered with `ipfw add allow ext6hdr`.

PR: 253169
Reviewed by: kp@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28447

(cherry picked from commit 682c31db4ecfb8fc6cac0e8ad4945c03379ea3d1)

3 years agobridge: fix STP roles and protos strings
Jonah Caplan [Sat, 30 Jan 2021 13:54:09 +0000 (14:54 +0100)]
bridge: fix STP roles and protos strings

Add the missing commas that got lost in e5539fb618cc7.

PR: 252532
Reviewd by: kp@, donner@, freqlabs@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28425

(cherry picked from commit 88be0e11205e4a2dc77e29f7b4a2e82b8d7c9a5c)

3 years agocron(8): set the environment variables of the user and/or login class
Andrew Gierth [Wed, 5 Feb 2020 04:35:54 +0000 (04:35 +0000)]
cron(8): set the environment variables of the user and/or login class

Prior to processing environment variable set in the crontab file as those
should be of higher precedent, pull in the user or login class environment.

This is another supporting feature for allowing one to configure system-wide
settings that may affect both regular cron jobs as well as services.

This is the final part of D21481.

(cherry picked from commit 7466dbd684879cbe8d034f388f0c7da703e00c31)

3 years agoservice(8): set the environment of the "daemon" class before invoking
Andrew Gierth [Wed, 5 Feb 2020 04:32:49 +0000 (04:32 +0000)]
service(8): set the environment of the "daemon" class before invoking

As mentioned in r357562, this gives the user a single place to configure
environment variables that need to be used for various services -- the
"daemon" class -- for, e.g., configuring a system-wide HTTP proxy.

This is a part of D21481.

(cherry picked from commit 736a5a6d1dbbdae68eb102c2ba9c114aafd61821)

3 years agoinit(8): set environment variables from the "daemon" class as well
Andrew Gierth [Wed, 5 Feb 2020 04:27:44 +0000 (04:27 +0000)]
init(8): set environment variables from the "daemon" class as well

Specifically, when running /etc/rc. This allows one to specify via
login.conf(5) an environment that should be used when running services to
ease, e.g., setting up env vars for an HTTP proxy consistently across cron
and services alike.

Future changes will extend cron(8)/service(8) to use environment vars
pecified in login.conf(5) as well to promote a more cohesive experience.

This is a part of D21481.

(cherry picked from commit 21c1a93c048fdd9c276899e72dcb8dc93cc18e09)

3 years agologin.conf(5): set a default PATH for the daemon class
Andrew Gierth [Wed, 5 Feb 2020 04:27:08 +0000 (04:27 +0000)]
login.conf(5): set a default PATH for the daemon class

This is a sensible default used by, e.g., cron(8), and useful if one wanted
to honor it.

This is a part of D21481.

(cherry picked from commit ed6f64ff8a90eee579fefef510329b5e9f1f9a65)

3 years agoRemove FirstBurstLength limit for software iSCSI.
Alexander Motin [Thu, 21 Jan 2021 02:33:14 +0000 (21:33 -0500)]
Remove FirstBurstLength limit for software iSCSI.

For hardware offload solicited data may potentially be handled more
efficiently than unsolicited due to direct data placement.  Or there
can be some unsolicited write buffering limitations.  It may create
situations where FirstBurstLength limit is really useful.

Software driver though has no those factors, having to do memcopy()
any way and having no so hard limit on the temporary storage.  Same
time more active use of unsolicited transfers allows to avoid some
of Ready To Transfer (R2T) PDU round-trip times and processing.

This change effectively doubles from 64KB to 128KB the maximum size
of write command that can be transferred within one link RTT.  Tests
of (64KB, 128KB] QD1 writes mixed with simultaneous QD8 reads over
the same connection, increasing RTT, shows almost double write speed
and half latency, while we should be able to afford few megabytes of
RAM for additional buffering on a target these days.

Sponsored by: iXsystems, Inc.

(cherry picked from commit ff751ee05c939eceab25c26ad60b1d56f989aec9)

3 years agonewvers: tweak uname to be more useful
Warner Losh [Mon, 25 Jan 2021 19:53:31 +0000 (12:53 -0700)]
newvers: tweak uname to be more useful

The current uname is branch-cXXXX-gHASH

Three changes to make uname more useful.
1. Move from using git rev-list --count to git rev-lis --count --first-parent
   since that gives a better, incrementing number.
2. Report this count as 'nXXXXX' rather than 'cXXXXX' because c is part of
   a hash and we've changed the sematnics of XXXXX
3. Remove g to make HASH cut and pastable.

Durting review, #1 & #3 had the largest consensus. There was a diversity of
opinion on #2, but on the whole it was positive so I'll acknowledge the dissent,
but move forward with something seems to have support since the dissent was all
about what letter to use where I chose 'n'.

MFC After: 3 days
Reviewed by: rgrimes, emaste (earlier version)
Differential Revision: https://reviews.freebsd.org/D28338

(cherry picked from commit 8a51f14a7833fd14e1f125e63a0af9d260dcd287)

3 years agoopencrypto: Fix assignment of crypto completions to worker threads
Mark Johnston [Wed, 20 Jan 2021 01:34:35 +0000 (20:34 -0500)]
opencrypto: Fix assignment of crypto completions to worker threads

Since r336439 we simply take the session pointer value mod the number of
worker threads (ncpu by default).  On small systems this ends up
funneling all completion work through a single thread, which becomes a
bottleneck when processing IPSec traffic using hardware crypto drivers.
(Software drivers such as aesni(4) are unaffected since they invoke
completion handlers synchonously.)

Instead, maintain an incrementing counter with a unique value per
session, and use that to distribute work to completion threads.

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

(cherry picked from commit 98d788c867b9e1d7a7e290254443b87ea77d8ab1)

3 years agopf: Improve pf_rule input validation
Kristof Provost [Tue, 26 Jan 2021 07:56:51 +0000 (08:56 +0100)]
pf: Improve pf_rule input validation

Move the validation checks to pf_rule_to_krule() to reduce duplication.
This also makes the checks consistent across different ioctls.

Reported-by: syzbot+e9632d7ad17398f0bd8f@syzkaller.appspotmail.com
Reviewed by: tuexen@, donner@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28362

(cherry picked from commit 7a808c5ee3296fdb72d8e8bc6c7ad6f316a520ab)

3 years agolualoader: position hyphens at the beginning of character classes
Kyle Evans [Sun, 31 Jan 2021 15:51:39 +0000 (09:51 -0600)]
lualoader: position hyphens at the beginning of character classes

According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction
between ranges and classes is not defined and hyphens must be specified at
either the beginning or the end of a set if they are not escaped.

Move all such occurrences to the beginning.

(cherry picked from commit b24872cf7b13314669ed2136c0262bb2eb007695)

3 years agostand: lua: enhance lfs.dir() to speed up kernels_autodetect
Kyle Evans [Sun, 24 Jan 2021 01:32:38 +0000 (19:32 -0600)]
stand: lua: enhance lfs.dir() to speed up kernels_autodetect

This eliminates a lot of stat() calls that happen when lualoader renders the
menu with the default settings, and greatly speeds up rendering on my
laptop.

ftype is nil if loader/loader.efi hasn't been updated yet, falling back to
lfs.attributes() to test.

This is technically incompatible with lfs, but not in a particularly
terrible way.

(cherry picked from commit e25ee296c919d6567aa76058a7049eac974797fb)

3 years agocxgb(4): Remove assumption of physically contiguous mbufs.
Alexander Motin [Sun, 31 Jan 2021 17:46:57 +0000 (12:46 -0500)]
cxgb(4): Remove assumption of physically contiguous mbufs.

Investigation of iSCSI target data corruption reports brought me to
discovery that cxgb(4) expects mbufs to be physically contiguous, that
is not true after I've started using m_extaddref() in software iSCSI
for large zero-copy transmissions.  In case of fragmented memory the
driver transmitted garbage from pages following the first one due to
simple use of pmap_kextract() for the first pointer instead of proper
bus_dmamap_load_mbuf_sg().  Seems like it was done as some optimization
many years ago, and at very least it is wrong in a world of IOMMUs.

This patch just removes that optimization, plus limits packet coalescing
for mbufs crossing page boundary, also depending on assumption of one
segment per packet.

Sponsored by: iXsystems, Inc.

(cherry picked from commit 9dc7c250b8bd2d5e669c7633e189a700a02c0571)

3 years agofstyp(8): fix exfat detection
Conrad Meyer [Sun, 17 Jan 2021 19:55:06 +0000 (11:55 -0800)]
fstyp(8): fix exfat detection

In the presence of high-level errors (spec violations, bad boot blocks
checksum), report non-detection instead of detection.

PR: 252787 (related, but does not fully address)
(cherry picked from commit ddf61156132b610915325769cbb93ea11be0d433)

3 years agofstyp(8): Show exFAT volume labels with -l flag
Conrad Meyer [Sun, 22 Dec 2019 03:19:17 +0000 (03:19 +0000)]
fstyp(8): Show exFAT volume labels with -l flag

exfat is fundamentally the same design as fat32.  The superblock differs
marginally, and there are some additional optional features irrelevant to
fstype(8); the structure of dirents has changed slightly to enable, among
other things, larger files; the directory entries are no longer DOS 8.3
ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE.

(As a result, this change uses iconv to convert a found exfat volume label
to the user's locale.)

Locating the volume label is identical to FAT32: locate the root directory
and walk through dirents until you find a volume label.  Like FAT32, follow
the FAT chain between root directory clusters as necessary.

PR: 242225
Reported by: Victor Sudakov <vas AT sibptus.ru>

(cherry picked from commit 85b4c344c8c69ff7993bc0ac833aaf9a8108b88d)

fstyp(8): Fix WITHOUT_ICONV build

Reported by: olivier

(cherry picked from commit 5ab1cb52b21fdc5524bd970e9b5cdff21a5bcabf)

3 years agoixl: Permit 802.1ad frames to pass though the chip
Lutz Donnerhacke [Tue, 2 Feb 2021 14:42:38 +0000 (15:42 +0100)]
ixl: Permit 802.1ad frames to pass though the chip

This patch is a quick hack to change the internal Ethertype used
within the chip.  All frames with this type are dropped silently.
This patch allows you to overwrite the factory default 0x88a8, which
is used by IEEE 802.1ad VLAN stacking.

Reviewed by: kp, philip, brueffer
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D24179

(cherry picked from commit fa6662b3689eeb71cb63c2b230ca08e7342cabf0)

3 years agomarvell: ap806_clock: add missing frequency modes
Marcin Wojtas [Tue, 26 Jan 2021 10:49:35 +0000 (11:49 +0100)]
marvell: ap806_clock: add missing frequency modes

In the driver init routine the CPU clock frequency
value is obtained from a dedicated register. Until now
only part of the values were handled by the mv_ap806_clock
driver. Fix that by adding missing cases.

Submitted by: Zyta Szpak <zr@semihalf.com>
MFC after: 1 week
Obtained from: Semihalf
Sponsored by: Marvell

(cherry picked from commit a86b0839d7bf3fc06b1ae9c50e055b53c50a9d0b)

3 years agonetgraph/ng_tag: permit variable length data
Lutz Donnerhacke [Sat, 2 Jan 2021 13:58:17 +0000 (14:58 +0100)]
netgraph/ng_tag: permit variable length data

ng_tag(4) operate on arbitrary data of mbuf_tags(9).  Those structures
are padded to the next multiple of the alignment by the compiler.
Hence a valid argument has be at most as long as the data received.

PR: 241462
Reviewed by: kp
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D22140

(cherry picked from commit 7c7c231c14246a709270bf3f3a4593208e84d01a)

3 years agoMFC 064009e79462:
Hans Petter Selasky [Mon, 25 Jan 2021 10:22:55 +0000 (11:22 +0100)]
MFC 064009e79462:
Add support for enabling and disabling IFCAP_VLAN_HWTSO via
ifconfig(8) in mlx5en(4).

Sponsored by: Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 064009e79462dea517aa7f1a857fb4d5393caa69)

3 years agotmpfs: push VEXEC check into tmpfs_lookup()
Kyle Evans [Thu, 28 Jan 2021 14:27:28 +0000 (08:27 -0600)]
tmpfs: push VEXEC check into tmpfs_lookup()

vfs_cache_lookup() has already done the appropriate VEXEC check, therefore
we must not re-check in VOP_CACHEDLOOKUP.

This fixes O_SEARCH semantics on tmpfs and removes a redundant descent into
VOP_ACCESS() in the common case.

Reported-by: arichardson (via CheriBSD Jenkins CI)

(cherry picked from commit 0f919ed4ae4df082eefb517afe02752b1790afd3)

3 years agoDecode NFIT Platform Capabilities.
Alexander Motin [Mon, 25 Jan 2021 21:08:06 +0000 (16:08 -0500)]
Decode NFIT Platform Capabilities.

(cherry picked from commit 1b109c69ed625ebf292c1d16f7a3efcab96722e5)

3 years agoAdd missing newlines.
Alexander Motin [Thu, 28 Jan 2021 23:18:53 +0000 (18:18 -0500)]
Add missing newlines.

(cherry picked from commit 8fee65d0c70c99999b2fe5b49b267547b7ed2a49)

3 years agonetmap: simplify parameter passing
Vincenzo Maffione [Sun, 24 Jan 2021 21:59:02 +0000 (21:59 +0000)]
netmap: simplify parameter passing

Changes imported from the netmap github.

(cherry picked from commit ee0005f11f2b38a714bc66b7d79832108f6fee77)

3 years agoiflib: netmap: move per-packet operation out of fragments loop
Vincenzo Maffione [Sun, 24 Jan 2021 21:38:59 +0000 (21:38 +0000)]
iflib: netmap: move per-packet operation out of fragments loop

MFC after: 1 week

(cherry picked from commit f80efe5016ba01b2948ca1f0eb8fe34adab5b864)

3 years agoiflib: netmap: add support for NS_MOREFRAG
Vincenzo Maffione [Sun, 24 Jan 2021 21:12:41 +0000 (21:12 +0000)]
iflib: netmap: add support for NS_MOREFRAG

The NS_MOREFRAG flag can be set in a netmap slot to represent a
multi-fragment packet. Only the last fragment of a packet does
not have the flag set. On TX rings, the flag may be set by the
userspace application. The kernel will look at the flag and use it
to properly set up the NIC TX descriptors.
On RX rings, the kernel may set the flag if the packet received
was split across multiple netmap buffers. The userspace application
should look at the flag to know when the packet is complete.

Submitted by: rajesh1.kumar_amd.com
Reviewed by: vmaffione
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27799

(cherry picked from commit aceaccab659c9eb846fb21ff99be34434a9616c7)

3 years agoMFC 0e01ea872ee475d7aef11d21588504e2ef4eb32c:
Cy Schubert [Thu, 28 Jan 2021 05:52:08 +0000 (21:52 -0800)]
MFC 0e01ea872ee475d7aef11d21588504e2ef4eb32c:

Fix a typo.

(cherry picked from commit 0e01ea872ee475d7aef11d21588504e2ef4eb32c)

3 years agoMFC: 83edbc3cb54fba6b37a68270c232df7b785bd222
Cy Schubert [Fri, 15 Jan 2021 04:32:16 +0000 (20:32 -0800)]
MFC: 83edbc3cb54fba6b37a68270c232df7b785bd222

ipfilter: Retire pre-standard C support.

All C compilers in 2021 support standard C and architectures that did
not were retired long ago. Simplify by removing now redundant
pre-standard C code.

MFC after: 1 week

(cherry picked from commit 83edbc3cb54fba6b37a68270c232df7b785bd222)

3 years agolualoader: improve loader.conf var processing
Kyle Evans [Sun, 24 Jan 2021 19:25:34 +0000 (13:25 -0600)]
lualoader: improve loader.conf var processing

lualoader was previously not processing \ as escapes; this commit fixes
that and does better error checking on the value as well.

Additionally, loader.conf had some odd restrictions on values that make
little sense. Previously, lines like:

kernel=foo

Would simply be discarded with a malformed line complaint you might not
see unless you disable beastie.

lualoader tries to process these as well as it can and manipulates the
environment, while forthloader did minimal processing and constructed a
`set` command to do the heavy lifting instead. The lua approach was
re-envisioned from building a `set` command so that we can appropriately
reset the environment when, for example, boot environments change.

Lift the previous restrictions to allow unquoted values on the right hand
side of an expression.  Note that an unquoted value is effectively:

[A-Za-z0-9-][A-Za-z0-9-_.]*

This commit also stops trying to weirdly limit what it can handle in a
quoted value. Previously it only allowed spaces, alphanumeric, and
punctuation, which is kind of weird. Change it here to grab as much as it
can between two sets of quotes, then let processEnvVar() do the needful and
complain if it finds something malformed looking.

My extremely sophisticated test suite is as follows:

<<EOF
X_01_simple_string="simple"
X_02_escaped_string="s\imple"

X_03_unquoted_val=3
X_04_unquoted_strval=simple_test

X_05_subval="${X_03_unquoted_val}"
X_06_escaped_subval="\${X_03_unquoted_val}"

X_07_embedded="truth${X_03_unquoted_val}"
X_08_escaped_embedded="truth\${X_03_unquoted_val}"

X_09_unknown="${unknown_val}"
X_10_unknown_embedded="truth${unknown_val}"

X_11_crunchy="crunch$unknown_val crunch"
X_12_crunchy="crunch${unknown_val}crunch"

Y_01_badquote="te"lol"
Y_02_eolesc="lol\"
Y_02_noteolesc="lol\\"
Y_03_eolvar="lol$"
Y_03_noteolvar="lol\$"
Y_04_badvar="lol${"

exec="echo Done!"
EOF

Future work may provide a stub loader module in userland so that we can
formally test the loader scripts rather than sketchy setups like the above
in conjunction with the lua-* tools in ^/tools/boot.

(cherry picked from commit 576562856efbec31520aca6a1f72f2b11298e9a7)

3 years agostand: ensure that the efi directory's dependencies are correct
Kyle Evans [Wed, 27 Jan 2021 18:54:07 +0000 (12:54 -0600)]
stand: ensure that the efi directory's dependencies are correct

efi, like the various ${MACHINE} directories, should have a dependency on
the enabled interpreters.

The general rule here is that any top-level directory that has a program at
any depth within that includes loader.mk should add ${INTERP_DEPENDS} added
to its dependencies so that the appropriate ficl/lua bits are ready before
they begin.

Note that the only directories in-tree that require it but will not get it
in a more appropriate manner are i386 (on amd64), efi, and userboot. i386
and userboot are handled explicitly in Makefile.amd64 where they are added
to S.yes.

Reported-by: bcran
(cherry picked from commit 7012461c9bf6375cd0b14de16b3b4a753c5c1c7a)

3 years agosh/tests: Add a second kind of binary scripts without #!
Jilles Tjoelker [Sun, 3 Jan 2021 20:27:50 +0000 (21:27 +0100)]
sh/tests: Add a second kind of binary scripts without #!

One of the reasons for git commit
e0f5c1387df23c8c4811f5b24a7ef6ecac51a71a was to make "actually portable
executables" work. Add a test that is more like those.

MFC after: 1 week

(cherry picked from commit 52981a1694be7a70013e5149c020706c9b6411f9)

3 years agosh: Allow more scripts without #!
Jilles Tjoelker [Sat, 30 May 2020 16:00:49 +0000 (16:00 +0000)]
sh: Allow more scripts without #!

Austin Group bugs #1226 and #1250 changed the requirements for shell scripts
without #! (POSIX does not specify #!; this is about the shell execution
when execve(2) returns an [ENOEXEC] error).

POSIX says we shall allow execution if the initial part intended to be
parsed by the shell consists of characters and does not contain the NUL
character.  This allows concatenating a shell script (ending with exec or
exit) and a binary payload.

In order to reject common binary files such as PNG images, check that there
is a lowercase letter or expansion before the last newline before the NUL
character, in addition to the check for the newline character suggested by
POSIX.

(cherry picked from commit e0f5c1387df23c8c4811f5b24a7ef6ecac51a71a)

3 years agosh: Test that executing various binary files is rejected
Jilles Tjoelker [Mon, 30 Dec 2019 21:32:55 +0000 (21:32 +0000)]
sh: Test that executing various binary files is rejected

If executing a file fails with an [ENOEXEC] error, the shell executes the
file as a shell script, except that this execution may instead result in an
error message if the file is binary.

Per a recent Austin Group interpretation, we will need to change this to
allow a concatenation of a shell script and a binary payload. See
Austin Group bugs #1226 and #1250.

MFC after: 1 week

(cherry picked from commit 2a55bade0ed3e08a8c4f922df0ecf67d1ee32f53)

3 years agokevent(2): Bugfix for wrong EVFILT_TIMER timeouts
Jan Kokemüller [Sat, 9 Jan 2021 19:00:25 +0000 (20:00 +0100)]
kevent(2): Bugfix for wrong EVFILT_TIMER timeouts

When using NOTE_NSECONDS in the kevent(2) API, US_TO_SBT should be
used instead of NS_TO_SBT, otherwise the timeout results are
misleading.

PR: 252539
Reviewed by: kevans, kib
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D28067

(cherry picked from commit 4d0c33be634a929f323117f04e6b1670776f9e37)

3 years agoelfctl: prefix disable flags with "no"
Ed Maste [Wed, 13 Jan 2021 18:08:31 +0000 (13:08 -0500)]
elfctl: prefix disable flags with "no"

Some ELF feature flags indicate a request to opt-out of some feature,
for example NT_FREEBSD_FCTL_ASLR_DISABLE indicates that ASLR should be
disabled for the tagged binary.  Using "aslr" as the short name for the
flag is confusing as it seems to indicate a request for ASLR to be
enabled.  Rename "noaslr", and make a similar change for other opt-out
flags.

Reviewed by: bapt, manu, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28139

(cherry picked from commit c763f99d11fdc9641308124c4a030c90b6a7fdbb)

3 years agoelfctl: allow features to be specified by value
Ed Maste [Fri, 22 Jan 2021 17:22:35 +0000 (12:22 -0500)]
elfctl: allow features to be specified by value

This will allow elfctl on older releases to set bits that are not yet
known there, so that the binary will have the correct settings applied
if run on a later FreeBSD version.

PR: 252629 (related)
Suggested by: kib
Reviewed by: gbe (manpage, earlier), kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28284

(cherry picked from commit 86f33b5fcf6087bf4439881011b920ff99e6e300)

elfctl: fix typo from last-minute refactoring

Reported by: jkim

(cherry picked from commit f302fd1aa6730facd53a3f761e0a57302731b03e)

elfctl: Fix type errors.

Target value for val has uint32_t type, not uint, adjust used constant.
Change val type to unsigned so that left and right sides of comparision
operator do not expose different signed types of same range [*].

Switch to unsigned long long and strtoll(3) so that 0x80000000 is
accepted by conversion function [**].

Reported by: kargl [*]
Noted by: emaste [**]
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28301

(cherry picked from commit 9940ac808de7b7d4ed0408c3e739f667dca06d3b)

3 years agoelfctl: add backwards compatibility for "no" prefixes
Ed Maste [Wed, 13 Jan 2021 19:21:38 +0000 (14:21 -0500)]
elfctl: add backwards compatibility for "no" prefixes

I am going to prefix opt-out ELF feature flag names with "no" to make
their meaning more clear (review D28139), but there are some uses of the
existing names already (e.g., the PR referenced below).

For now accept the older, unprefixed name as well, and emit a warning.
We can revert this after FreeBSD 13 branches.

% elfctl -e +aslr foo
elfctl: interpreting aslr as noaslr; please specify noaslr

PR: 239873 (related)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28140

(cherry picked from commit 3dfcb70b6ae9bcb9fd6a66721bebdb8c6a53c329)

3 years agorctl(4): support throttling resource usage to 0
Jason A. Harmening [Wed, 30 Dec 2020 23:29:44 +0000 (15:29 -0800)]
rctl(4): support throttling resource usage to 0

For rate-based resources that support throttling (e.g.
readiops/writeips), this fixes a divide-by-zero panic when rctl(8)
passes 0 as the throttle value.  For these resources, treat
zero-throttle requests as requests to suspend forward progress as long
as possible using the duration specified in
kern.racct.rctl.throttle_max.

PR: 251803
Reported by: chris@cretaforce.gr

(cherry picked from commit e8a5a1ad7154dc34e3a5234267e19faa86d5ff33)

3 years agondis: Per user request, delay removal to 14
Brooks Davis [Mon, 25 Jan 2021 22:16:27 +0000 (22:16 +0000)]
ndis: Per user request, delay removal to 14

We will remove ndis shortly after the 13 branch.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D28049

(cherry picked from commit d7a7d6a7c3c6a9b6e03e4739df6801e2a0a296e9)

3 years agoVFS_QUOTACTL: Remove needless casts of arg
Brooks Davis [Mon, 25 Jan 2021 22:16:26 +0000 (22:16 +0000)]
VFS_QUOTACTL: Remove needless casts of arg

The argument is a void * so there's no need to cast it to caddr_t.

Update documentation to match function decleration.

Reviewed by: freqlabs
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27093

(cherry picked from commit 52e63ec2f1ddf76c9411b6833bc5d021457b5005)

3 years agocontrib/tzdata: import tzdata 2021a
Philip Paeps [Mon, 25 Jan 2021 00:18:14 +0000 (08:18 +0800)]
contrib/tzdata: import tzdata 2021a

Merge commit '4cd7e1071de16a7392b0e466287f13e9e6f2081a'

Changes: https://github.com/eggert/tz/blob/2021a/NEWS

(cherry picked from commit 8c5bef2eb24cb191c87712a56a9860d8c29415a0)

3 years agosafexcel: Simplify request allocation
Mark Johnston [Mon, 18 Jan 2021 22:07:56 +0000 (17:07 -0500)]
safexcel: Simplify request allocation

Rather than preallocating a set of requests and moving them between
queues during state transitions, maintain a shadow of the command
descriptor ring to track the driver context of each request.  This is
simpler and requires less synchronization between safexcel_process() and
the ring interrupt handler.

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit 1a6ffed5d73a22858182e68e629662afda1b9f6d)

3 years agosafexcel: Handle command/result descriptor exhaustion gracefully
Mark Johnston [Mon, 18 Jan 2021 22:07:56 +0000 (17:07 -0500)]
safexcel: Handle command/result descriptor exhaustion gracefully

Rather than returning a hard error in this case, return ERESTART so that
upper layers get a chance to retry the request (or drop it, depending on
the desired policy).

This case is hard to hit due to the somewhat low bound on queued
requests, but that will no longer be true after an upcoming change.

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit b7e27af36b7df05f4b6cdc706750413f3a048640)

3 years agosafexcel: Add counters for some resource exhaustion conditions
Mark Johnston [Mon, 18 Jan 2021 22:07:55 +0000 (17:07 -0500)]
safexcel: Add counters for some resource exhaustion conditions

This is useful when analyzing performance problems.

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit 0371c3faaa2412413d4fb44254b03124f97dfe66)

3 years agosafexcel: Dispatch requests to the current CPU's ring
Mark Johnston [Mon, 18 Jan 2021 22:07:55 +0000 (17:07 -0500)]
safexcel: Dispatch requests to the current CPU's ring

This gives better performance in some tests than the previous policy of
statically binding each session to a ring.

Sponsored by: Rubicon Communications, LLC (Netgate)

(cherry picked from commit e934d455ba37ea777bd32cdcb0f9754865f9e818)

3 years agogdb: only return signal values for powerpc's gdb_cpu_signal()
Mitchell Horne [Fri, 22 Jan 2021 18:56:56 +0000 (14:56 -0400)]
gdb: only return signal values for powerpc's gdb_cpu_signal()

Reviewed by: alfredo

(cherry picked from commit 57a543d8b85065f77e0b68162d09a03335970f90)

3 years agoarm64: gdb(4) machine-dependent bits
mhorne [Wed, 9 Dec 2020 20:38:42 +0000 (16:38 -0400)]
arm64: gdb(4) machine-dependent bits

Sponsored by: The FreeBSD Foundation

(cherry picked from commit bbfa199cbc1698631a0e932848e62dd76559d4d7)

3 years agoarm64: remove pcb_pc
mhorne [Mon, 21 Dec 2020 16:16:09 +0000 (12:16 -0400)]
arm64: remove pcb_pc

Reviewed by: markj, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5f66d5a313bf2b2254de92b2915e48e5cf528893)

3 years agoarm64: don't pass user trapframe to kdb_trap()
mhorne [Fri, 18 Dec 2020 18:43:52 +0000 (14:43 -0400)]
arm64: don't pass user trapframe to kdb_trap()

Reviewed by: jhb (slightly earlier version)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit e9bb4ce3d0e714d35b12ffdc7ecb56cade01f4a0)

3 years agoddb: add ability to print user registers
mhorne [Fri, 18 Dec 2020 20:06:46 +0000 (16:06 -0400)]
ddb: add ability to print user registers

Reviewed by: jhb (earlier version), markj, bcr (manpages)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 088a7eef95b1f1919fe6eee722a57c4d4e1e0656)

3 years agotcp: add sysctl to tolerate TCP segments missing timestamps
Michael Tuexen [Wed, 13 Jan 2021 21:48:17 +0000 (22:48 +0100)]
tcp: add sysctl to tolerate TCP segments missing timestamps

When timestamp support has been negotiated, TCP segements received
without a timestamp should be discarded. However, there are broken
TCP implementations (for example, stacks used by Omniswitch 63xx and
64xx models), which send TCP segments without timestamps although
they negotiated timestamp support.
This patch adds a sysctl variable which tolerates such TCP segments
and allows to interoperate with broken stacks.

Reviewed by: jtl@, rscheff@
Differential Revision: https://reviews.freebsd.org/D28142
Sponsored by: Netflix, Inc.
PR: 252449

(cherry picked from commit d2b3ceddccac60b563f642898e3a314647666a10)