Commit graph

265411 commits

Author SHA1 Message Date
Kristof Provost
5a1bc5f902 altq: Fix typo in features sysctl description
Reported by:	Jose Luis Duran

(cherry picked from commit 35dabb7b9c)
2021-07-31 10:12:01 +02:00
Kristof Provost
b0e7f371cd Add FEATURE sysctls for ALTQ disciplines
This will allow userspace to more easily figure out if ALTQ is built
into the kernel and what disciplines are supported.

Reviewed by:		donner@
Differential Revision:	https://reviews.freebsd.org/D28302

(cherry picked from commit e111d79806)
2021-07-31 10:12:01 +02:00
Warner Losh
b96680d9ca RELNOTES: add notes about awk updates
Direct commit to stable/13 to note user-visible changes in the awk
update.

Sponsored by:		Netflix
2021-07-30 17:04:53 -06:00
Jose Luis Duran
d2d322b012 Fix the pattern for changing PermitRootLogin
The previous pattern had the (harmless) side-effect of duplicating the
entry in the config file.

No functional change intended.

Reviewed by:	imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/510

(cherry picked from commit 73358cd2cf)
2021-07-30 17:02:13 -06:00
Yann Kerherve
2cbf9eff2d nanobsd: fix typo in NANO_WORLDDIR
Reviewed by:	imp
PR:		257299

(cherry picked from commit 5a9e5a5111)
2021-07-30 17:02:13 -06:00
Warner Losh
f4ed53c6f5 awk: Make -F '' and -v FS="" behave the same
IEEE Std 1003.1-2008 mandates that -F str be treated the same as -v
FS=str. For a null string, this was not the case. Since awk(1) documents
that a null string for FS has a specific behavior, make -F '' behave
consistently with -v FS="".

PR:			241441
Upstream issue:		https://github.com/onetrueawk/awk/issues/127
Upstream pull request:	https://github.com/onetrueawk/awk/pull/128
MFC After:		2 weeks
Sponsored by:		Netflix

(cherry picked from commit a2e3e11873)
2021-07-30 17:02:13 -06:00
Warner Losh
5193261c36 awk: Remove last markings we have on awk
We normally don't add $FreeBSD$ to contrib software. However, these
changes date back to the CVS era of source code management and have been
overlooked. Now that all these files are back to the same as the
upstream bsd-features branch, remove the FreeBSD specific changes, which
are now just $FreeBSD$ and the (FreeBSD) in the version string.

MFC After:		2 weeks
Sponsored by:		Netflix

(cherry picked from commit 5ab82b00cc)
2021-07-30 17:02:13 -06:00
Warner Losh
da30af61b5 awk: revert to upstream behavior for ranges for gawk compatibility
In 2005, FreeBSD changed one-true-awk to honor the locale's collating
order. This was billed as a temporary patch. It was also compatible with
the then-current behavior of gawk. That temporary patch has lasted 16
years now.

However, IEEE Std 1003.1-2008 changed the behaivor of ranges in regular
expressions outside of the "C" and "POSIX" locales to be undefined.

Starting in 2011, gawk 4.0 stopped using the locale for the range
regular expressions and used the traditional behavior only. The
maintainer had grown weary of answering why '[A-Z]' would sometimes
match lower-case expressions. The details about are explained here:
https://www.gnu.org/software/gawk/manual/html_node/Ranges-and-Locales.html

To restore compatibility with other implementaitons of awk, revert this
patch. FreeBSD is the odd-system out. It also has the nice side effect
of eliminating the last of our differences with upstream one-true-awk.

Reviewed by:		cy, rgrimes
MFC After:		2 weeks
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31114

(cherry picked from commit 628bd30ab5)
2021-07-30 17:02:12 -06:00
Warner Losh
ea4936b470 awk: Reduce diffs with upstream to almost nothing.
In the merge of 20210215, I left two merge conflicts #if 0'd by mistake
to check later rather than resolve them as part of the merge.  This code
turns out to be from the original one-true-awk import and not FreeBSD
specific, so remove them.

Remove a extra definition of HAT.

Remove a stylistic change that also appears to be a mismerge along the
way.

Remove FREEBSD-upgrade. Nobody has updated it since the original 2007
cvs import. It talks about old CVS branches that never made it into svn,
let alone git. New imports will follow the standard practices now, so
there's nothing left to document.

Move README to README.md and copy the README.md from upstream over.

This leaves just the $FreeBSD$ lines (which remain for the stable/12
merge) and the strcoll part of ru@'s r201989/d98dd8e5f94c as the only
diffs with upstream. FreeBSD also still has its own man page, which I
don't plan on changing. Once this commit is merged to stable/12, I plan
no further merges to stable/12. Sometime after that I'll remove the
$FreeBSD$ lines to reduce the diffs even more (though i want to make
sure plans won't change first). I also plan to talk to upstream about
this change...

MFC After:		2 weeks
Sponsored by:		Netflix

(cherry picked from commit f68a53dba9)
2021-07-30 17:02:12 -06:00
Warner Losh
a051259072 typo: becauce -> because
Noticed by:	Piotr P. Stefaniak
Sponsored by:	Netflix

(cherry picked from commit 2b720db8d4)
2021-07-30 17:02:07 -06:00
Warner Losh
631cf89fd4 boot: fix OBJS to not include BTX's crt0.o
According to comments in the Makefile, to make pxeboot work we need to
have crt0.o first. This is needed because the simplified loader in
pxeboot assumes that the startup code is at offset 0 in this binary. In
normal booting, the start address can be obtained from headers of the
binary, but since pxeboot encodes this as a pure binary, it has no way
of knowing where that is and assumes 0. Added comments to that effect
in the Makefile.

We've done this by adding it to OBJS before all the other .o's are
added. However, there's a problem. This also adds it to the CLEANFILES
variable, which causes it to be removed from multiple places. The
dependencies may also cause it to be re-built at a time that's after
boot2 is built. This causes installs to fail because at install time
boot2 is considered to be out of date and the programs to rebuild it are
no longer in the path.

Cope with this problem by just adding it to LDFLAGS instead.

Glanced at by:		kevans ("I thought that went in ages ago")
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D28876

(cherry picked from commit e713d3a013)
2021-07-30 17:00:17 -06:00
Kristof Provost
efe3bf0fb0 pf tests: make killstate:match more robust
Only lists the states relevant to the connection we're killing.
Sometimes there are IPv6 related states (due to the usual IPv6
background traffic of router solicitations, DAD, ...) that causes us to
think we failed to kill the state, which in turn caused the test to fail
intermittently.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 4e860bd5da)
2021-07-30 09:51:04 +02:00
Mark Johnston
057275e4be ktrace: Zero request structures when populating the pool
Otherwise uninitialized pad bytes may be copied into the ktrace log
file.

Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5c18bf9d5f)
2021-07-29 20:32:59 -04:00
Mark Johnston
3e148d6029 select: Define select_flags[] as const
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cae3f9dd01)
2021-07-29 20:32:59 -04:00
Mark Johnston
d364264b29 cdefs: Add a default definition for __nosanitizememory
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4cd7e82a4c)
2021-07-29 20:32:58 -04:00
Mark Johnston
61acafc6c6 rtld/arm64: Remove checks for undefined symbols when processing TPREL64
lld emits several GOT relocations referencing the null sumbol in libc.so
when compiled with -ftls-model=initial-exec.  This symbol is specified
to be undefined.

We generally do not handle dynamic TLS relocations against weak,
undefined symbols, so avoid printing a warning here.  This makes it
possible to compile libc.so using the initial-exec TLS model on arm64.

Reviewed by:	jrtc27, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f238ebd142)
2021-07-29 20:32:58 -04:00
Mark Johnston
9ac0aec3a3 lio_listio: Don't post a completion notification if none was requested
One is allowed to use LIO_NOWAIT without specifying a sigevent.  In this
case, lj->lioj_signal is left uninitialized, but several code paths
examine liov_signal.sigev_notify to figure out which notification to
post.  Unconditionally initialize that field to SIGEV_NONE.

Add a dumb test case which triggers the bug.

Reported by:	KMSAN+syzkaller
Reviewed by:	asomers
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2e5f615295)
2021-07-29 20:32:58 -04:00
Mark Johnston
24c558ca3c imgact_elf: Avoid redefining suword()
Otherwise this interferes with the definition for sanitizer
interceptors.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ebf9886654)
2021-07-29 20:32:58 -04:00
Mark Johnston
fdeacf8fdf acct: Zero pad bytes in accounting records
Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 90959dd1e5)
2021-07-29 20:32:58 -04:00
Mark Johnston
a67749ac45 vfs: Initialize "lastfail" in vfs_mountroot_wait()
This variable is only used to rate-limit "Root mount waiting for: ..."
messages using ppsratecheck().

Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 048cd371f3)
2021-07-29 20:32:58 -04:00
Mark Johnston
b76e41fca9 Add required sysctl name length checks to various handlers
Reported by:	KMSAN
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0dcef81de9)
2021-07-29 20:32:58 -04:00
Kevin Bowling
fe6803c18e ixgbe: Clean up ix_txrx
The intention here is to reduce differences with D30072.
The only functional change is logical simplification in
ixgbe_rx_checksum.

Reviewed by:	gallatin
Differential Revision:	https://reviews.freebsd.org/D30074

(cherry picked from commit 51e46835e1)
2021-07-29 17:27:24 -07:00
Kevin Bowling
ebdd2bc441 ixgbe: Print FW NVM and Option ROM versions
It can be useful for system operators to see this kind of information
when correlating issues or requesting support from the OEM or Intel for
hardware and firmware issues.

Reviewed by:	gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30178

(cherry picked from commit 7660e4ea5c)
2021-07-29 17:26:45 -07:00
Greg V
28ff0070f7 libpmc: Import AMD Zen 3 PMU events
Reviewed by:	mav, mhorne
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30965

(cherry picked from commit 8c2dd68caa)
2021-07-29 12:05:55 -03:00
Mitchell Horne
862ea25915 hwpmc_arm64: add a PMCDBG to the interrupt handler
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 13f5a3076b)
2021-07-29 12:05:55 -03:00
Mitchell Horne
83166f8714 arm64 support for pmu-events
8cc3815f:
hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE

Make it possible to specify event codes without an offset of
PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is
required to make use of event definitions from pmu-events.

Reviewed by:	ray (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30602

28dd6730:
libpmc: enable pmu_utils on arm64

This allows supported libpmc to query/select from the pmu-events table,
which may have a more complete set of events than what we define
manually. A future update to these definitions should greatly improve
this support. The alias table is empty for now, until this future import
is complete.

Add the Foundation's copyright for recent work on this file.

Reviewed by:	ray (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30603

27ea55fc:
libpmc/hwpmc: fix issues with arm64 pmu-events support

Due to a mis-merge, the changes committed to libpmc never called
pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be
used to carry the actual pmc event code anyway, as it is expected to
contain the index into the pmu event array (otherwise, it breaks event
name lookup in pmclog_get_event()). Add a new MD field,
pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc().

Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as
this is a union, not a struct. Restore the proper padding size.

Reviewed by:	luporl, ray, andrew
Fixes:		28dd6730a5 ("libpmc: enable pmu_utils on arm64")
Fixes:		8cc3815f02 ("hwpmc_arm64: accept raw event codes...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31221

(cherry picked from commit 8cc3815f02)
(cherry picked from commit 28dd6730a5)
(cherry picked from commit 27ea55fc65)
2021-07-29 12:02:05 -03:00
Mitchell Horne
d876c5a052 hwpmc_arm64: fill kern.hwpmc.cpuid
This will be used to detect supported pmu events. The expected format is
the MIDR register with the revision and variant fields masked. See also:
lib/libpmc/pmu-events/arch/arm64/mapfile.csv.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30601

(cherry picked from commit 5867cccdc4)
2021-07-29 12:01:11 -03:00
Mitchell Horne
a2d252f89f hwpmc_arm64.c: fix return style
In accordance to style(9).

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2129c8f677)
2021-07-29 12:01:10 -03:00
Mitchell Horne
87c9a2933b libpmc: make libpmc_pmu_utils.c more amenable to porting
The current version has every function stubbed out for !x86. Only two
functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform
dependent, so reduce the width of the ifdefs and remove some of the
stubs.

Reviewed by:	ray
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30532

(cherry picked from commit 0024f1aa77)
2021-07-29 12:01:10 -03:00
Mitchell Horne
6911f39887 libpmc: limit pmu-events to 64-bit powerpc
Although currently unused, there are only pmu event definitions for
POWER8 and POWER9. There is no sense in building these on 32-bit
platforms.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 507d68984a)
2021-07-29 12:01:10 -03:00
Mitchell Horne
440e5ecbe1 libpmc: use $MACHINE_CPUARCH
This is preferred over $MACHINE_ARCH for these types of checks, although
it makes no difference for amd64 or i386. No functional change intended.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 3864da302a)
2021-07-29 12:01:10 -03:00
Mitchell Horne
6b2ccad297 pmccontrol: improve -L with pmu-events
Check if the pmu utils are supported rather than carrying a
machine-dependent #ifdef.

Reviewed by:	gnn, ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30526

(cherry picked from commit 167cdaa7e3)
2021-07-29 12:01:10 -03:00
Mitchell Horne
b040b03d32 libpmc: eliminate pmc_pmu_stat_mode()
There is a single consumer, the pmc utility, that clearly has knowledge
of which counters it is expecting. Remove this function and have it
use common counter aliases instead.

Reviewed by:	gnn
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30528

(cherry picked from commit ec66cc955b)
2021-07-29 12:01:10 -03:00
Mitchell Horne
3a9b3a8470 libpmc: remove pe->alias
It has never been a part of upstream's struct pmu_event. The jevents
utility will not fill this field, so remove it.

Reviewed by:	gnn
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30530

(cherry picked from commit 0c915023db)
2021-07-29 12:01:10 -03:00
Mitchell Horne
b44f0bd410 libpmc: always generate libpmc_events.c
The jevents build tool will create an empty table if it doesn't find any
events, so we can remove the extra $MACHINE_CPUARCH checks.

Reviewed by:	gnn, ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30531

(cherry picked from commit 689c7e7975)
2021-07-29 12:01:10 -03:00
Mitchell Horne
b85044cea6 libpmc: remove unused 'isfixed' variable
Reviewed by:	gnn, emaste
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30529

(cherry picked from commit 0092642f86)
2021-07-29 12:01:09 -03:00
Mitchell Horne
eae121b18f libpmc: fix "instructions" alias on Intel
The typo prevents the counter from being allocated.

This fixes e.g. pmcstat -s instructions sleep 5

Reviewed by:	mizhka, gnn, ray, emaste
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30527

(cherry picked from commit bc1a6a9d69)
2021-07-29 12:01:09 -03:00
Mitchell Horne
96da64391d hwpmc: fix PMC_CPU_LAST
It is unused, but incorrect.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f59127dac5)
2021-07-29 12:01:09 -03:00
Mitchell Horne
dfb4fb4116 libpmc: fall-back to kernel tables if pmu-events fails
On x86, the pmu_events table is the source of truth for finding
supported events. However, events not found there may still be present
in the kernel's static event tables. For example, the pmc.soft(3) events
will never be available from pmu-events.

Update pmc_allocate() to search the legacy event tables if
pmc_pmu_pmcallocate() fails to return a result. This allows both event
sources to be consulted before giving up, thus restoring pmc.soft(3) and
pmc.tsc(3) on x86.

Reviewed by:	emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30216

(cherry picked from commit dfdc57e8aa)
2021-07-29 12:01:09 -03:00
Mitchell Horne
57caeb5109 libpmc: remove PMC_MDEP_TABLE logic
This logic was added for handling some of the complicated relationships
between events and x86 CPU models. Since that logic has been mostly
removed from libpmc(3) in favor of pmu-events, this no longer serves
much of a purpose. Mapping CPU types to event tables is already handled
by the switch statement in pmc_init().

Reviewed by:	ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30196

(cherry picked from commit da13ef6aa0)
2021-07-29 12:01:09 -03:00
Mitchell Horne
c0960dc8c6 libpmc: remove unused PMC_MDEP_INIT_INTEL_V2
All uses of this macro were removed in e92a1350b5. Remove
cpu_has_iaf_counters as well.

Reviewed by:	ray, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30195

(cherry picked from commit 4d8d74a4f5)
2021-07-29 12:01:09 -03:00
Andrew Turner
19135e372f arm64: Fix finding the pmc event ID
The lower pmc event bits were masked off to find the PMC event ID.
The doesn't work when there are more events. Switch it to use the
offser relative to the first event while also checking the ID is
in the expected range.

Reviewed by:	gnn, ray
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D29600

(cherry picked from commit 24b2f4ea49)
2021-07-29 12:00:37 -03:00
Mark Johnston
90ffac35b7 eli: Zero pad bytes that arise when certain auth algorithms are used
When authentication is configured, GELI ensures that the amount of data
per sector is a multiple of 16 bytes.  This is done in
eli_metadata_softc().  When the digest size is not a multiple of 16
bytes, this leaves some extra pad bytes at the end of every sector, and
they were not being zeroed before being written to disk.  In particular,
this happens with the HMAC/SHA1, HMAC/RIPEMD160 and HMAC/SHA384 data
authentication algorithms.

This change ensures that they are zeroed before being written to disk.

Reported by:	KMSAN
Reviewed by:	delphij, asomers
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0fcafe8516)
2021-07-29 08:12:22 -04:00
Mark Johnston
822c62b7db Assert that valid PTEs are not overwritten when installing a new PTP
amd64 and 32-bit ARM already had assertions to this effect.  Add them to
other pmaps.

Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b092c58c00)
2021-07-29 08:12:12 -04:00
Mark Johnston
9f43633dd0 pf: Constify tag name and queue name helper functions
No functional change intended.

Reviewed by:	kp
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 81f95106b8)
2021-07-29 08:12:01 -04:00
Yang Zhong
50b26566c7 mmc: Drain the intrhook in mmc_detach()
Buggy SD card drivers may attach and detach a mmc(4) driver instance in
quick succession.  In this case mmc(4) must disestablish its intrhook
callback during detach.  Thus, this change adds a call to
config_intrhook_drain(), which blocks or does nothing if the intrhook is
running or has already ran (the SD card was plugged in), and
disestablishes the hook if it hasn't ran yet (the SD card was not
plugged in).

PR:		254373
Reviewed by:	imp, manu, markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d5341d72a1)
2021-07-29 08:11:50 -04:00
Mark Johnston
3afad070bd man9: Update guarantees for userspace fetch/store operations
Platforms may either silently handle unaligned accesses or return an
error.  Atomicity is not guaranteed in this case, however.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit fd5827b178)
2021-07-29 08:11:39 -04:00
Mark Johnston
c2edab507e man9: Remove stray .In macros
Fixes:		9c11d8d483

(cherry picked from commit 18c696c001)
2021-07-29 08:11:30 -04:00
Mark Johnston
f9d3c6f4b5 nfsclient: Avoid copying uninitialized bytes into statfs
hst will be nul-terminated but the remaining space in the buffer is left
uninitialized.  Avoid copying the entire buffer to ensure that
uninitialized bytes are not leaked via statfs(2).

Reported by:	KMSAN
Reviewed by:	rmacklem
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 44de1834b5)
2021-07-29 08:11:16 -04:00
Mark Johnston
e504e98ab5 arm64: Print CPU features slightly earlier
In particular, print them before we release APs.  Otherwise they tend to
get mixed with other kernel messages.

Reviewed by:	andrew, manu
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit fa46a46a82)
2021-07-28 08:40:25 -04:00