Commit Graph

267467 Commits

Author SHA1 Message Date
Bryan Drewery
36269b8231 Fix native-xtools build
Fixes		https://github.com/freebsd/poudriere/issues/894
Fixes:		d0c737e18 ("Makefile: Fix MAKEOBJDIRPREFIX command-line")
X-MFC-With:	d0c737e18
2021-08-03 08:22:14 -07:00
Baptiste Daroussin
c982a41a0c mtree: remove a leftover '..' in BSD.usr.dist making it inconsistent
Reported by:	Michael Butler <imb@protected-networks.net>
2021-08-03 17:06:31 +02:00
Baptiste Daroussin
8232bb3859 locales: fix typo preventing installation of collation for ru_RU.CP866 2021-08-03 14:37:26 +02:00
Baptiste Daroussin
184d64af13 locales: stop hardcoding the directories in the mtree
The framework knows how to create directories and tag them properly
for a the creation of a mtree, not need to hardcode all the locales
entries in bsd.usr.mk

This simplifies addition of new locales but also allow people building
with WITHOUT_LOCALES to end up with a directory full of empty files
2021-08-03 14:25:00 +02:00
Baptiste Daroussin
d3fd2cbbb7 nl_NL.ISO8859-1: reinstall the missing LC_MESSAGES 2021-08-03 12:13:52 +02:00
Gleb Smirnoff
29b4fa7876 hdaa: add missing break in hdac_pin_patch().
Fixes driver attach on my Thinkpad X1 Carbon, and likely on
many other ALC family devices.

Fixes:	ef790cc740
2021-08-03 03:09:32 -07:00
Kornel Duleba
dfcaa2c18b enetc_mdio: Support building the driver as a loadable module.
After recent arm64 GENERIC config cleanup the ENETC MDIO
in NXP LS1028A SoC should support being loaded as a module.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-08-03 12:07:49 +02:00
Kornel Duleba
5ad6d28cbe enetc: Support building the driver as a loadable module.
Function level reset has to be done in attach in order to put the
hardware in a known state before configuring it.
The order of DRIVER_MODULEs was changed to ensure that the miibus driver
is loaded when mii_attach is called.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-08-03 12:07:49 +02:00
Kornel Duleba
bfce69ae9a dtb: freescale: Add fsl-ls1028a-rdb to the build
With the recent inclusion of ENETC networking driver we now support this
board.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-08-03 12:07:49 +02:00
Marcin Wojtas
451bcf1b36 Introduce driver for Freescale Felix switch
It is found on boards equipped with LS1028A SoC.
802.1q VLAN grouping is supported.
An external MDIO device is used for communicating with PHYs.
The driver is built as a module by default, it is not included
in GENERIC kernel config.

Submitted by: Lukasz Hajec <lha@semihalf.com>
              Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30923
2021-08-03 12:07:49 +02:00
Kornel Duleba
f5b29d0f35 etherswitch: Add a new striptagingress port flag
Felix switch found in LS1028A supports stripping VLAN tag on
ingress, instead of egress. The striptag flag excepts the latter
behaviour.
Add a new flag to support the feature.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30922
2021-08-03 12:07:48 +02:00
Alex Richardson
428a32edba Use .sinclude for bsd.sanitizer.mk
We don't install this file since MK_ASAN/MK_UBSAN is only supported for
src builds. However, some ports also use bsd.lib.mk/bsd.prog.mk so we
should not fail the build if it can't be included.

Reported by:	jkim
Fixes:		7bc797e3f3 ("Add build system support for ASAN+UBSAN instrumentation")
2021-08-03 10:38:20 +01:00
Kyle Evans
04cc0c393c malloc(9): provide missing malloc_aligned implementation
Pointy hat:	kevans
Fixes:	6162cf885c ("malloc(9): Document/complete aligned variants")
2021-08-02 21:12:39 -05:00
Warner Losh
aaccfdde3d awk: Enable tests again
Since we now pass all 24 of the NetBSD awk tests, re-enable these tests.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31370
2021-08-02 15:53:26 -06:00
Warner Losh
d00131e154 clock_id: These symbols weren't in 4.4BSD, adjust copyright
Peter Wemm added the first CLOCK_* symbols in 0f5ed9f420 in 1997
after obtaining them from NetBSD. In NetBSD, jtc@netbsd.org committed
them in sys/sys/time.h rev 1.19 dated 1996/11/15, along with all the
system calls associated with 1003.1b. FreeBSD's values are, however,
different than NetBSD's today. The USL/UCB lawsuit was settled in 1994,
so these couldn't have been derived from material provided to University
of California covered in that settlement. This file does not need the
settlement disclaimer.

Furthermore, I rewrote most of the code (except the symbols and their
values) when merging it from time.h and sys/time.h. Most of the creative
content of the file is new, so update copyright to reflect that.

Reviewed by:	kaktus
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D31369
2021-08-02 15:50:32 -06:00
Adam Fenn
6162cf885c malloc(9): Document/complete aligned variants
Comments on a pending kvmclock driver suggested adding a
malloc_aligned() to complement malloc_domainset_aligned(); add it now,
and document both.

Reviewed by:	imp, kib, allanjude (manpages)
Differential Revision:	https://reviews.freebsd.org/D31004
2021-08-02 15:36:14 -05:00
Eric van Gyzen
428624130a Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING
The spinning start time is missing from the calculation due to a
misplaced #endif.  Return the #endif where it's supposed to be.

Submitted by:	Alexander Alexeev <aalexeev@isilon.com>
Reviewed by:	bdrewery, mjg
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31384
2021-08-02 14:44:23 -05:00
John Baldwin
d59f1c49e2 cxgbe tom: Permit rcv_nxt mismatches on FIN for iSCSI connections on T6.
The remote peer might send a FIN in the middle of a burst of data
PDUs.  In the case of T6 with data PDU completion moderation, the
driver would not have seen these PDUs since the final PDU in the burst
was never received resulting in a stale rcv_nxt when the FIN is
received.

While here, invert the logic in the condition to be more readable and
always set tp->rcv_nxt from the sequence number in the CPL.  This sets
the proper value of rcv_nxt for FINs on connections with data received
but not reported via a CPL (e.g. a partial iSCSI PDU burst interrupted
by a FIN).

Reported by:	Jithesh Arakkan @ Chelsio
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D30871
2021-08-02 09:41:27 -07:00
Kristof Provost
600745f1e2 pf: bound DIOCGETSTATES memory use
Similar to what we did earlier for DIOCGETSTATESV2 we only allocate
enough memory for a handful of states and copy those out, bit by bit,
rather than allocating memory for all states in one go.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-08-02 16:29:23 +02:00
Adam Fenn
8ca384eb1d devclass_alloc_unit: move "at" hint test to after device-in-use test
Only perform this expensive operation when the unit number is a
potential candidate (i.e. not already in use), thereby reducing device
scan time on systems with many devices, unit numbers, and drivers.

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#61
Differential Revision:	https://reviews.freebsd.org/D31381
2021-08-02 11:27:17 -05:00
Alex Richardson
9f1db6c555 Add missing bsd.linker.mk include after 31ba4ce889
This is needed for -DWITH_CLEAN builds since the cleandir phase does not
include bsd.linker.mk from bsd.compiler.mk
2021-08-02 16:38:39 +01:00
Alex Richardson
17d6371e4c Fix GCC and -DWITH_CLEAN build after 7bc797e3f3
Reported by:	kib
2021-08-02 16:03:05 +01:00
Alexander Motin
ca34553b6f sched_ule(4): Pre-seed sched_random().
I don't think it changes anything, but why not.

While there, make cpu_search_highest() use all 8 lower load bits for
noise, since it does not use cs_prefer and the code is not shared
with cpu_search_lowest() any more.

MFC after:	1 month
2021-08-02 10:55:28 -04:00
Alex Richardson
5c9cb96a23 Fix BUILD_WITH_STRICT_TMPPATH build after adding time to ITOOLS
This is needed after bbd16236e9 (and
99feb137f5).
2021-08-02 15:34:26 +01:00
Alex Richardson
31ba4ce889 Allow bootstrapping llvm-tblgen on macOS and Linux
This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan:	Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D31057
2021-08-02 14:36:03 +01:00
Alex Richardson
2de949cf85 Remove mkcsmapper_static and mkesdb_static from build-tools
Build them as part of the bootstrap-tools phase instead.

Reviewed by:	emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D28181
2021-08-02 14:33:25 +01:00
Alex Richardson
8185be3307 libc: Disable ASAN for certain string functions
They deliberately read out-of-bounds values to avoid byte-by-byte
loads and check multiple bytes at once. While this will work on x86,
it is flagged as an out-of-bounds read with ASAN, so we have to
disable instrumentation here. This also causes bounds errors for CHERI,
so in CheriBSD we use implementations that avoid OOB reads.

Differential Revision: https://reviews.freebsd.org/D31045
2021-08-02 14:33:24 +01:00
Alex Richardson
f0712132b6 Don't instrument the rdtsc ifunc when building with ASAN/UBSAN
The ifunc resolver is called before the sanitizer runtime is initialized,
so any instrumentation results in an immediate crash.

Reviewed By:	kib
Differential Revision: https://reviews.freebsd.org/D31046
2021-08-02 14:33:24 +01:00
Alex Richardson
5e9226f063 Fix build of stand/ when building world with ASAN
The userboot/test  program links against the default userspace libraries
(e.g. shared libgcc_s.so) that will be instrumented if WITH_ASAN is set.
All other programs link against libsa instead of libc and therefore can't
use the sanitizer runtime library. To fix the stand/ build with
sanitizers, we disable MK_ASAN/MK_UBSAN if -nostdlib is found in the
LDFLAGS (i.e. we are using libsa instead of libc).

Reviewed By:	imp, tsoome
Differential Revision: https://reviews.freebsd.org/D31047
2021-08-02 14:33:24 +01:00
Alex Richardson
c826e08841 Fix MK_TESTS build with MK_ASAN/MK_UBSAN
Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D31049
2021-08-02 14:33:24 +01:00
Alex Richardson
9efbe526e0 libthr: work around an ASAN false-positive
I got the following error with an ASAN-instrument libthr:

==803==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffcdb0 at pc 0x000801863396 bp 0x7ff8
READ of size 4 at 0x7fffffffcdb0 thread T0
    #0 0x801863395 in handle_signal /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:262:2
    #1 0x801860da2 in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:246:2

Address 0x7fffffffcdb0 is located in stack of thread T0 at offset 208 in frame
    #0 0x80186080f in thr_sighandler /local/scratch/alr48/cheri/freebsd/lib/libthr/thread/thr_sig.c:213

  This frame has 1 object(s):
    [32, 64) 'act' (line 216) <== Memory access at offset 208 overflows this variable
HINT: this may be a false positive if your program uses some custom stack

This seems like a false-positive since the line in question is
`SIGSETOR(actp->sa_mask, ucp->uc_sigmask);` and it complains about a read
operation (from the ucontext_t argument) so this indicates to me that ASAN
does not understand that thr_sighandler() is a signal handler.

Differential Revision: https://reviews.freebsd.org/D31074
2021-08-02 14:33:24 +01:00
Alex Richardson
7bc797e3f3 Add build system support for ASAN+UBSAN instrumentation
This adds two new options WITH_ASAN/WITH_UBSAN that can be set to
enable instrumentation of all binaries with AddressSanitizer and/or
UndefinedBehaviourSanitizer. This current patch is almost sufficient
to get a complete buildworld with sanitizer instrumentation but in
order to actually build and boot a system it depends on a few more
follow-up commits.

Reviewed By:	brooks, kib, markj
Differential Revision: https://reviews.freebsd.org/D31043
2021-08-02 14:33:24 +01:00
Alex Richardson
5f6c8ce245 tools/build: Don't redefine open() for the linux bootstrap
This is needed to bootstrap llvm-tblgen on Linux since LLVM calls
`::open(...)` which does not work if open is a statement macro.
Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools
user of those flags to deal with missing definitions.

Reviewed By:	jrtc27
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31226
2021-08-02 14:33:23 +01:00
Toomas Soome
1b1bb6f178 loader: tftp client should use server address from rootip
servip is set from bootp bp_siaddr (if present) and rootip is
set immediately from servip in tha sane bootp code.

However, the common/dev_net.c does only set rootip (based on
url processing etc). Therefore, we should also use rootip in tftp
reader.

Fixes hung tftp based boot when bp_siaddr is not provided.

MFC after: 1 week
2021-08-02 15:43:54 +03:00
Aleksandr Rybalko
aed2afeb51 Ignore ResourceProducer flag for:
o Arm CoreLink TM CMN-600 Coherent Mesh Network controller,
o Arm CoreLink DMC-620 Dynamic Memory Controller.

Sponsored by:	Ampere Computing LLC
Submitted by:	Klara Inc.
2021-08-02 14:11:20 +03:00
Ka Ho Ng
df95cc76af vmm: Bump vmname buffer in struct vm to VM_MAX_NAMELEN + 1
In hw.vmm.create sysctl handler the maximum length of vm name is
VM_MAX_NAMELEN. However in vm_create() the maximum length allowed is
only VM_MAX_NAMELEN - 1 chars. Bump the length of the internal buffer to
allow the length of VM_MAX_NAMELEN for vm name.

MFC after:	3 days
Reviewed by:	grehan
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31372
2021-08-02 17:55:08 +08:00
Roger Pau Monné
82bf6a2566 xen/timer: fix amd64 LINT kernel build
On amd64 XENHVM depends on the xentimer device for PVH early startup,
so both should be added or removed together (like the current
dependency with xenpci). Fix this by adding xentimer to NOTES and
updating the comments on the config files. Note that on i386 there's
no such dependency between xentimer and XENHVM, since there's no PVH
support.

While there also fix the MINIMAL i386 build to include the xentimer,
so it keeps the same functionality as before xentimer was split from
XENHVM.

Reported by: lwhsu
PR: 257549
Fixes: ae59812748 ('xen/timer: make xen timer optional')
2021-08-02 10:33:35 +02:00
Hans Petter Selasky
9340ebd404 Add missing file to sys/conf/files after 469884cf04 .
Found by:	vishwin@
Differential Revision:	https://reviews.freebsd.org/D29921
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-08-02 08:25:04 +02:00
Alexander Motin
8bb173fb5b sched_ule(4): Use trylock when stealing load.
On some load patterns it is possible for several CPUs to try steal
thread from the same CPU despite randomization introduced.  It may
cause significant lock contention when holding one queue lock idle
thread tries to acquire another one.  Use of trylock on the remote
queue allows both reduce the contention and handle lock ordering
easier.  If we can't get lock inside tdq_trysteal() we just return,
allowing tdq_idled() handle it.  If it happens in tdq_idled(), then
we repeat search for load skipping this CPU.

On 2-socket 80-thread Xeon system I am observing dramatic reduction
of the lock spinning time when doing random uncached 4KB reads from
12 ZVOLs, while IOPS increase from 327K to 403K.

MFC after:	1 month
2021-08-01 22:42:01 -04:00
Alexander Motin
2668bb2add sched_ule(4): Reduce duplicate search for load.
When sched_highest() called for some CPU group returns nothing, idle
thread calls it for the parent CPU group.  But the parent CPU group
also includes the CPU group we've just searched, and unless there is
a race going on, it is unlikely we find anything new this time.

Avoid the double search in case of parent group having only two sub-
groups (the most prominent case). Instead of escalating to the parent
group run the next search over the sibling subgroup and escalate two
levels up after if that fail too.  In case of more than two siblings
the difference is less significant, while searching the parent group
can result in better decision if we find several candidate CPUs.

On 2-socket 40-core Xeon system I am measuring ~25% reduction of CPU
time spent inside cpu_search_highest() in both SMT (2x20x2) and non-
SMT (2x20) cases.

MFC after:	1 month
2021-08-01 22:07:51 -04:00
Konstantin Belousov
665895db26 amd64 pmap_vm_page_alloc_check(): loose the assert
Current expression checks that vm_page_alloc(9) never returns a page
belonging to the preload area.  This is not true if something was freed
from there, for instance a preloaded module was unloaded, or ucode update
freed.

Only check that we never allow to allocate a page belonging to the kernel
proper, check against _end.

Reported and tested by:	dhw
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-08-02 03:28:33 +03:00
Bjoern A. Zeeb
56be282bc9 bhyve: net_backends, automatically IFF_UP tap devices
If you want communications with the outside world and tell bhyve to
create an interfaces then it should be usable as well.
Rather than relying on the sysctl net.link.tap.up_on_open automatically
try to IFF_UP the opened tap device.

MFC after:	10 days
Reviewed by:	markj, grehan
Differential Revision: https://reviews.freebsd.org/D31342
2021-08-01 20:50:53 +00:00
Warner Losh
fd2a4a31d9 awk: document updating
Fill in all the details to the standard process so they are hand in one
place and don't need to be re-remembered or rediscovered for the next
import.

Sponsored by:		Netflix
2021-08-01 11:31:50 -06:00
Warner Losh
818edf67bd RELNOTES: update the runing entry on awk.
Dig up the major commits and document the coming -Ft change.

Sponsored by:		Netflix
2021-08-01 11:08:53 -06:00
Warner Losh
23f24377b1 awk: Merge 20210729 from One True Awk upstream (0592de4a)
July 27, 2021:
	As per IEEE Std 1003.1-2008, -F "str" is now consistent with
	-v FS="str" when str is null. Thanks to Warner Losh.

July 24, 2021:
	Fix readrec's definition of a record. This fixes an issue
	with NetBSD's RS regular expression support that can cause
	an infinite read loop. Thanks to Miguel Pineiro Jr.

	Fix regular expression RS ^-anchoring. RS ^-anchoring needs to
	know if it is reading the first record of a file. This change
	restores a missing line that was overlooked when porting NetBSD's
	RS regex functionality. Thanks to Miguel Pineiro Jr.

	Fix size computation in replace_repeat() for special case
	REPEAT_WITH_Q. Thanks to Todd C. Miller.

Also, included the tests from upstream, though they aren't yet connected
to the tree.

Sponsored by:		Netflix
2021-08-01 10:22:39 -06:00
Warner Losh
f9002b8561 awk: bring in vendor branch from upstream 20210727
Changes since the last import:

July 27, 2021:
	As per IEEE Std 1003.1-2008, -F "str" is now consistent with
	-v FS="str" when str is null. Thanks to Warner Losh.

July 24, 2021:
	Fix readrec's definition of a record. This fixes an issue
	with NetBSD's RS regular expression support that can cause
	an infinite read loop. Thanks to Miguel Pineiro Jr.

	Fix regular expression RS ^-anchoring. RS ^-anchoring needs to
	know if it is reading the first record of a file. This change
	restores a missing line that was overlooked when porting NetBSD's
	RS regex functionality. Thanks to Miguel Pineiro Jr.

	Fix size computation in replace_repeat() for special case
	REPEAT_WITH_Q. Thanks to Todd C. Miller.

Also, for the first time, import all the tests.

Sponsored by:		Netflix
2021-08-01 10:04:30 -06:00
Konstantin Kukushkin
a61c24ddb7 udp: Fix soroverflow SOCKBUF unlocking
We hold the SOCKBUF_LOCK so use soroverflow_locked here.
This bug may manifest as a non-killable process stuck in [*so_rcv].

Approved by:	scottl
Reviewed by:	Roy Marples <roy@marples.name>
Fixes:	7045b1603b
MFC after:  10 days
Differential Revision:	https://reviews.freebsd.org/D31374
2021-08-01 08:07:33 -07:00
Konstantin Belousov
1a55a3a729 amd64 pmap_vm_page_alloc_check(): print more data for failed assert
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-08-01 16:42:02 +03:00
Alexander V. Chernikov
5b42b494d5 Fix typo in rib_unsibscribe<_locked>().
Submitted by:	Zhenlei Huang<zlei.huang at gmail.com>
Differential Revision: https://reviews.freebsd.org/D31356
2021-08-01 13:29:52 +00:00
Wolfram Schneider
bbd16236e9 add the time(1) command to the list of install tools
Reported by:	dhw
Approved by:	dhw
Differential Revision:	https://reviews.freebsd.org/D31373
2021-08-01 13:25:00 +00:00