Commit Graph

259053 Commits

Author SHA1 Message Date
sebastien.bini
e5be21d19b sbin/veriexec: fixed parameter parsing of option -x
The -x parameter doesn't take any arguments. It says that all further
arguments are paths to check.

Reviewed by:	imp@
Sponsored by:	Netflix
Pull Request:	https://github.com/freebsd/freebsd-src/pull/443/files
2021-06-02 15:37:51 -06:00
Leandro Lupori
4a66b8083c powerpc: fix boot on pseries without hugepages
Commit 49c894ddce introduced an issue that prevented pseries boot,
when hugepages were not available to the guest. Now large page
info must be available before moea64_install is called, so this change
moves the code that scans large page sizes before the call.

Reviewed by:	jhibbits (IRC)
Sponsored by:	Instituto de Pesquisas Eldorado (eldorado.org.br)
2021-06-02 16:27:36 -03:00
Warner Losh
9f3d1a98dd regen after tweaks to getgroups and setgroups
Sponsored by:		Netflix
2021-06-02 13:24:50 -06:00
Warner Losh
bf26ea7755 t_getgroups: No longer expected to fail
Sponsored by:		Netflix
2021-06-02 13:24:47 -06:00
Moritz Buhl
4bc2174a1b kern: fail getgroup and setgroup with negative int
Found using
https://github.com/NetBSD/src/blob/trunk/tests/lib/libc/sys/t_getgroups.c

getgroups/setgroups want an int and therefore casting it to u_int
resulted in `getgroups(-1, ...)` not returning -1 / errno = EINVAL.

imp@ updated syscall.master and made changes markj@ suggested

PR:			189941
Tested by:		imp@
Reviewed by:		markj@
Pull Request:		https://github.com/freebsd/freebsd-src/pull/407
Differential Revision:	https://reviews.freebsd.org/D30617
2021-06-02 13:22:57 -06:00
Max Stucchi
1976e07954 Add bcm2710-rpi-cm3.dtb to the list of DTBs being added.
This allows to boot out of the box on the RPI COmpute Module 3 with 32G
of eMMC.

Tested by:		imp confirmed .dtb is in the rpi-firmware pkg
Reviewed by:		gjb@, imp@
Pull Request:		https://github.com/freebsd/freebsd-src/pull/452

Sponsored by:		Netflix
2021-06-02 11:28:01 -06:00
John Ko
7ef92163ab Allows user to specify an optional ZFSBOOT_POOL_SIZE for their zroot
The default is to create a zroot that consumes the whole disk because if
used with geli(8) this makes sense.

Without geli(8), I like to keep my data pool separate from my system
pool.

This is different than ZFSBOOT_BOOT_POOL_SIZE which is named bootpool.

Reviewed by:		allenjude
Pull Request:		https://github.com/freebsd/freebsd-src/pull/53
Differential Revision:	https://reviews.freebsd.org/D30588
2021-06-02 11:12:14 -06:00
Warner Losh
adfe427124 hptnr: use BLOB_OBJS for pre-built .o's
Sponsored by:		Netflix
2021-06-02 10:39:58 -06:00
Warner Losh
22ed04c203 hptmv: use BLOB_OBJS for pre-built .o's
Sponsored by:		Netflix
2021-06-02 10:39:58 -06:00
Warner Losh
455dff72fc hpt27xx: Use EXTRA_OBJS instead of OBJS
Sponsored by:		Netflix
Reviewed by:		emaste@
Differential Revision:	https://reviews.freebsd.org/D30616
2021-06-02 10:39:58 -06:00
Warner Losh
e8dca53aa0 kmod.mk: Allow extra objects to be specified in modules
OBJS are automatically added to CLEANFILES. For pre-built objects, this
is not desirable since it will delete the object from the source
tree. Introduce EXTRA_OBJS which list these object files, but aren't
added to clean files.

Sponsored by:		Netflix
Reviewed by:		emaste@
Differential Revision:	https://reviews.freebsd.org/D30615
2021-06-02 10:39:58 -06:00
Ceri Davies
774bb1c256 periodic: add support for .xz and .zcat compressed logs
Also improve temporary file usage in 200.accounting, add an xref to
zstd(1) to newsyslog.conf.5, and clarify in periodic.conf that
"daily accounting" means process accounting and "monthly accounting"
is login accounting.

PR:		253868
Reviewed by:	allanjude
Approved by:	blackend (mentor)
Differential Revision:	https://reviews.freebsd.org/D29267
2021-06-02 17:28:28 +01:00
Mateusz Guzik
c9f8dcda85 kqueue: replace kq_ncallouts loop with atomic_fetchadd 2021-06-02 15:14:58 +00:00
Rich Ercolani
a19ae1b099 vfs: fix MNT_SYNCHRONOUS check in vn_write
ca1ce50b2b ("vfs: add more safety against concurrent forced
unmount to vn_write") has a side effect of only checking MNT_SYNCHRONOUS
if O_FSYNC is set.

Reviewed By: mjg
Differential Revision: https://reviews.freebsd.org/D30610
2021-06-02 13:42:02 +00:00
Andrew Turner
2422138952 Fix the KCSAN_ENABLED check when building modules
The KCSAN_ENABLED variable is non-empty when the kernel is being built
with KCSAN. This allows us to disable modules that are known to be
broken.

There was a bug where we would check if it was defined. As this is
always the case the KCSAN_ENABLED variable would be set when building
modules so we would never build such a module. Fix this by checking
if the value is empty before passing it on to the module stage.

This doesn't affect how modules are built as the CFLAGS passed to
modules has the correct check.

Reported by:	rstone
Sponsored by:	Innovate UK
2021-06-02 10:59:19 +00:00
Andrew Turner
0a0d6ce34d Use the arm virtual counter in the arm64 loader
It exist on all ARMv8+ CPUs, and other boot loaders rely on it being
present.

Sponsored by:	Innovate UK
Differential Revision: https://reviews.freebsd.org/D30410
2021-06-02 10:58:20 +00:00
Emmanuel Vadot
25593adbc1 arm: allwinner: Add clock driver for Display Engine to the build
This is needed for drm
2021-06-02 10:17:16 +02:00
Marcin Wojtas
4fa977f854 sdhci_xenon: add UHS support
This patch adds the necessary methods resolution to the sdhci_xenon
driver which are required to configure UHS modes for SD/MMC devices.
Apart from the two generic routines, the custom sdhci_xenon_set_uhs_timing
function is responsible for setting the SDHCI_HOST_CONTROL2 register
with appropriate mode select values - in case of HS200 and HS400
they are non-standard.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30565
MFC after: 2 weeks
2021-06-02 09:55:20 +02:00
Marcin Wojtas
c80e2ca57e sdhci_xenon: improve the VCCQ voltage switch sequence
Improve the VCCQ voltage switch, so that to properly
handle the SDHCI_HOST_CONTROL2 register signaling
flags and along with manipulating the regulator.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30564
MFC after: 2 weeks
2021-06-02 09:55:20 +02:00
Marcin Wojtas
df86876284 sdhci_xenon: allow to properly disable the UHS signaling
Until now the "no-1-8-v" DT flag wrongly disabled the SDHCI_CAN_VDD_180
- slot 1.8V power supply capability, whereas it refers to the signaling
voltage. Fix the sdhci_xenon_read_4 and allow to disable the UHS modes
depending on the DT property or PHY slow mode. While at it - make sure
the unsupported 1.2V signaling is always disabled and not reported
in the bootverbose log.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30563
MFC after: 2 weeks
2021-06-02 09:55:19 +02:00
Marcin Wojtas
43e31350f8 sdhci_xenon: enable MMC FDT parsing
The mmc_fdt_parse allows to parse more MMC-related
FDT properties. Start using it. "wp-inverted" property,
VQMMC and newly added VMMC power supply parsing
is now done in a generic code.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30562
MFC after: 2 weeks
2021-06-02 09:55:19 +02:00
Marcin Wojtas
5652be30a3 sdhci: allow setting MMC capabilities before sdhci_init_slot
With this change the host controller drivers can set the MMC capabilities
(e.g. using mmc_fdt_parse() helper) before calling sdhci_init_slot().
This way the configuration dump (eg. in bootverbose) can include the
possible additional information.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30561
MFC after: 2 weeks
2021-06-02 09:55:19 +02:00
Marcin Wojtas
7d8700bc29 sdhci: extend bus_dma_tag boundary to 64-bit space
This patch adds support for the SDHCI_CAN_DO_64BIT
capability, so that to allow 64-bit DMA operation
for the controllers which support this feature.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30560
MFC after: 2 weeks
2021-06-02 09:55:19 +02:00
Marcin Wojtas
9cf66a0458 uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs
DBG2 ACPI table description [1] specifies three subtypes
related to 16550 UART:
0x0 - 16550 compatible
0x1 - 16550 subset
0x12 - 16550 compatible with parameters defined in Generic Address Structure (GAS)

It turned out however, that the Windows OS treats 0x0 subtype as
legacy x86 UART with 8-bit access. ARM SoCs can use types 0x1 (16550 with
fixed mmio32 access) or 0x12 (16550 with fully respected GAS contents).

Switch Marvell SoCs ACPI UART subtype to 0x1 - thanks to that the same firmware
can run properly with UART output in FreeBSD, Windows 10, Linux and ESXI
hypervisor. Tests showed the older firmware versions that use 0x0
UART subtype in SPCR table continue to display output properly.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table

Obtained from: Semihalf
Sponsored by: ARM
Differential revision: https://reviews.freebsd.org/D30386
MFC after: 2 weeks
2021-06-02 09:55:19 +02:00
Math Ieu
847b7d5054
Fix test case header function name
This restores the expected behavior (skip) when running with non-root user

MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D30584
2021-06-02 12:13:57 +08:00
Kyle Evans
2d741f33bd kern: ether_gen_addr: randomize on default hostuuid, too
Currently, this will still hash the default (all zero) hostuuid and
potentially arrive at a MAC address that has a high chance of collision
if another interface of the same name appears in the same broadcast
domain on another host without a hostuuid, e.g., some virtual machine
setups.

Instead of using the default hostuuid, just treat it as a failure and
generate a random LA unicast MAC address.

Reviewed by:	bz, gbe, imp, kbowling, kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D29788
2021-06-01 22:59:21 -05:00
Kyle Evans
e58a65ccda man: document ether_gen_addr(9)
This KPI is used to assign a MAC address to an interface that doesn't
already have one assigned.

Reviewed by:	bcr, gnn, imp, kbowling, kp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29787
2021-06-01 22:59:10 -05:00
Mark Johnston
8cd05b8833 amd64: Clear the local TSS when creating a new thread
Otherwise it is copied from the creating thread.  Then, if either thread
exits, the other is left with a dangling pointer, typically resulting in
a page fault upon the next context switch.

Reported by:	syzkaller
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30607
2021-06-01 19:38:22 -04:00
Mark Johnston
6cda627556 amd64: Relax the assertion added in commit 4a59cbc12
We only need to ensure that interrupts are disabled when handling a
fault from iret.  Otherwise it's possible to trigger the assertion
legitimately, e.g., by copying in from an invalid address.

Fixes:		4a59cbc12
Reported by:	pho
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30594
2021-06-01 19:38:09 -04:00
Mark Johnston
60a38abb89 pf: Avoid leaking pad bytes in struct pfr_astats when copying out
There is padding between pfr_astats.pfras_a and pfras_packets that was
not getting initialized.

Reported by:	KMSAN
Reviewed by:	kp, imp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30585
2021-06-01 19:37:50 -04:00
Mark Johnston
cbe59a6475 i386: Make setidt_disp a size_t instead of uintptr_t
setidt_disp is the offset of the ISR trampoline relative to the address
of the routines in exception.s, so uintptr_t is not quite right.

Also remove a bogus declaration I added in commit 18f55c67f7, it is not
required after all.

Reported by:	jrtc27
Reviewed by:	jrtc27, kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30590
2021-06-01 19:37:50 -04:00
Navdeep Parhar
211972cfb8 cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration.
Use the correct SGL limit within iw_cxgbe, firmwares >= 1.25.6.0 support
upto 512 entries per MR.

Obtained from:	Chelsio Communications
MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-06-01 14:38:31 -07:00
Navdeep Parhar
db15dbf880 cxgbe(4): Check if the firmware supports 512 SGL per FR MR.
Firmwares >= 1.25.6.0 support 512 SGL entries in a single memory
registration request.

Obtained from:	Chelsio Communications
MFC after:	1 week
Sponsored by:	Chelsio Communications
2021-06-01 14:38:31 -07:00
Pedro F. Giffuni
a45843c8ed fread: improve performance for unbuffered reads
We can use the buffer passed to fread(3) directly in the FILE *.
The buffer needs to be reset before each call to __srefill().
This preserves the expected behavior in all cases.

The change was found originally in OpenBSD and later adopted by NetBSD.

MFC after:	2 weeks
Obtained from:	OpenBSD (CVS 1.18)

Differential Revision:	https://reviews.freebsd.org/D30548
2021-06-01 16:00:28 -05:00
Kristof Provost
0f86492b09 pf: Fix more ioctl memory leaks
We must also remember to free nvlists added to a parent nvlist with
nvlist_append_nvlist_array().

More importantly, when nvlist_pack() allocates memory for us it does so
in the M_NVLIST zone, so we must free it with free(.., M_NVLIST). Using
free(.., M_TEMP) as we did silently failed to free the memory.

MFC after:	3 days
Reported by:	kib@
Tested by:	kib@
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D30595
2021-06-01 22:41:20 +02:00
David Bright
3df4c387d2 libsa: Fix infinite loop in bzipfs & gzipfs
A bug in the loader's bzipfs & gzipfs filesystems caused compressed
kernel and modules not to work on EFI systems with a veriexec-enabled
loader. Since the size of files in these filesystems are not known
_a priori_ `stat` would initialize the size to -1 and the loader would
then hang in an infinite loop while trying to seek (read) to the end
of file since the loop termination condition compares the current
offset to that negative target position.

Reviewers:	vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com)
Differential Revision:	https://reviews.freebsd.org/D30414
Sponsored by:	Dell EMC Isilon
MFC to:	     stable/12, stable/13
MFC after:   1 week
2021-06-01 11:08:20 -05:00
Ceri Davies
33764e3fd0 libexec/getty/ttys.5: document correct "dialup" flag.
This manpage has incorrectly documented the "dialup"
keyword as "dialin" since it was first added.  Correct that.

Approved by:	blackend (mentor)
MFC after:	12 days
2021-06-01 17:05:16 +01:00
David Bright
2f176a2b20 pciconf: Fix up pciconf -lc output
The pciconf command fails to emit newlines when particular ecap field
values are seen. Fix them up. This has been seen on several systems at
$JOB. The documentation for PCI capabilities says that capability
type 0 should not be used once the spec for PCI capabilities was
published, but that seems more wishful-thinking than reality. pciconf
also chooses not to print fields related to field values that are
zero, but it seems several of these fields are zero on actual
hardware.

Reviewed by:	vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com)
Sponsored by:	Dell EMC Isilon
Submitted by:	Robert Herndon (Robert.Herndon@dell.com)
Differential Revision: https://reviews.freebsd.org/D30441
2021-06-01 10:55:44 -05:00
Mark Johnston
283e60fb31 ktrace: Fix an inverted comparison added in commit f3851b235
Fixes:		f3851b235 ("ktrace: Fix a race with fork()")
Reported by:	dchagin, phk
2021-06-01 09:15:35 -04:00
Edward Tomasz Napierala
b501b2ae52 linux: export AT_HWCAP and AT_HWCAP2 on aarch64
The flag values seem to be the same between Linux and FreeBSD.
Comparing to a Linux VM on the same hardware, we're missing
HWCAP_EVTSTRM, HWCAP_CPUID, HWCAP_DCPOP, HWCAP_USCAT, HWCAP_PACA,
and HWCAP_PACG.

Reviewed By:	mhorne, emaste
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30540
2021-06-01 13:50:20 +01:00
Kristof Provost
ec7b47fc81 pf: Move provider declaration to pf.h
This simplifies life a bit, by not requiring us to repease the
declaration for every file where we want static probe points.

It also makes the gcc6 build happy.
2021-06-01 09:02:05 +02:00
Li-Wen Hsu
315674fb6a
Add freeze/thaw description to devctl(8)
This is a follow-up to 5fa2979791 .

PR:		256311
Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D29867
2021-06-01 12:33:12 +08:00
Rick Macklem
1d4afcaca2 nfsd: Delete extraneous NFSv4 root checks
There are several NFSv4.1/4.2 server operation functions which
have unneeded checks for the NFSv4 root being set up.
The checks are not needed because the operations always follow
a Sequence operation, which performs the check.

This patch deletes these checks, simplifying the code so
that a future patch that fixes the checks to conform with
RFC5661 Sec. 2.6 will be less extension.

MFC after:	2 weeks
2021-05-31 19:41:17 -07:00
Cy Schubert
25ecdc7d52 wpa: Restructure wpa build
The current WPA build assumes a flat namespace. However the latest sources
from w1.fi now have a duplicate config.c, in two separate subdirectories.
The flat namespace will overwrite config.o with the output from the most
recently modified config.c, of which there are two of them.

This commit resolves this problem by building each component in
wpa's src subdirectory tree into its own .a archive, just as the w1.fi
upstream build as used by the port does. The advantages of this approach
are:

1. Duplicate source file names, i.e. config.c in the wpa_supplicant
   direcory and another config.c in src/utils in the next wpa
   will result in both compiles writing to the same .o file.

2. This restructure simplifies maintanence. A develper needs only to add
   new files as identified by git status in the vendor branch to the
   appropriate Makefile within the usr.sbin/wpa tree. This also reduces
   time required to prepare a new import and should reduce error.

3. The new wpa build structure more closely represents the build as
   performed by the upstream tarball.

This is in preparation for the next wpa update from w1.fi.

Reviewed by:	philip
Tested by:	philip
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D30372
2021-05-31 19:39:16 -07:00
Mateusz Guzik
f4aa64528e tmpfs: save on relocking the allnode lock in tmpfs_free_node_locked 2021-05-31 23:21:15 +00:00
Mark Johnston
b2f9575646 ffs: Correct the input size check in sysctl_ffs_fsck()
Make sure we return an error if no input was specified, since
SYSCTL_IN() will report success in that case.

Reported by:	KMSAN
Reviewed by:	mckusick
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30586
2021-05-31 18:59:18 -04:00
Mark Johnston
f96603b56f tcp, udp: Permit binding with AF_UNSPEC if the address is INADDR_ANY
Prior to commit f161d294b we only checked the sockaddr length, but now
we verify the address family as well.  This breaks at least ttcp.  Relax
the check to avoid breaking compatibility too much: permit AF_UNSPEC if
the address is INADDR_ANY.

Fixes:		f161d294b
Reported by:	Bakul Shah <bakul@iitbombay.org>
Reviewed by:	tuexen
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30539
2021-05-31 18:53:34 -04:00
Mark Johnston
18f55c67f7 x86: Fix lapic_ipi_alloc() on i386
The loop which checks to see if "dynamic" IDT entries are allocated
needs to compare with the trampoline address of the reserved ISR.
Otherwise it will never succeed.

Reported by:	Harry Schmalzbauer <freebsd@omnilan.de>
Tested by:	Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30576
2021-05-31 18:51:14 -04:00
Mark Johnston
4a59cbc125 amd64: Avoid enabling interrupts when handling kernel mode prot faults
When PTI is enabled, we may have been on the trampoline stack when iret
faults.  So, we have to switch back to the regular stack before
re-entering trap().

trap() has the somewhat strange behaviour of re-enabling interrupts when
handling certain kernel-mode execeptions.  In particular, it was doing
this for exceptions raised during execution of iret.  When switching
away from the trampoline stack, however, the thread must not be migrated
to a different CPU.  Fix the problem by simply leaving interrupts
disabled during the window.

Reported by:	syzbot+6cfa544fd86ad4647ffc@syzkaller.appspotmail.com
Reported by:	syzbot+cfdfc9e5a8f28f11a7f5@syzkaller.appspotmail.com
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30578
2021-05-31 18:49:33 -04:00
jocki84
8790fe3058 Fix confusing example in paste(1)
Paste's man page contains an example for a reimplementation of
nl(1). This example uses the command line
    sed = myfile | paste -s -d '\t\n' - -
in order to concatenate consecutive lines with an intervening tab.

However, the way the example uses the switches -s and -d and two `dash`
input files is redundant. There are in fact two equivalent but simpler
ways to achieve the desired result:
    sed = myfile | paste -s -d '\t\n' -
uses the same style as the previous example, while
    sed = myfile | paste - -
is arguably even simpler and illustrates the final sentence of the
DESCRIPTION.

Reviewed by:		imp@
Pull Request:		https://github.com/freebsd/freebsd-src/pull/163
2021-05-31 16:12:44 -06:00