Commit Graph

254862 Commits

Author SHA1 Message Date
Toomas Soome
dba7640e44 ficl: instead of pad, emit can use local variable
Pad in forth is used as "scratchpad" and internal implementations
should not use it. Ficl does not really follow this rule and this can fire back.
emit has no need to use pad, we can use local variable instead.
2020-12-01 22:28:02 +00:00
Konstantin Belousov
71df6a153f rtld: bump r_debug.r_version to 1 from current 0.
Add r_ldbase.

Requested and reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D27429
2020-12-01 22:28:01 +00:00
Oleksandr Tymoshenko
523a67bbee [arm64] Parse ACPI _PXM property on ARM64 platform
Enable devices' NUMA proximity infromation parsing on ARM64 systems

Sponsored by:	Ampere Computing
Submitted by:	Klara, Inc.
2020-12-01 20:27:06 +00:00
Oleksandr Tymoshenko
014812b9be [arm64] Bump MAXMEMDOM value to 8 to match amd64
On some of the server-grade ARM64 machines the number of NUMA domains is higher
than 2. When booting GENERIC kernel on such machines the SRAT parser fails
leaving the system with a single domain. To make GENERIC kernel usable on those
server, match the parameter value with the one for amd64 arch.

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D27368
Sponsored by:	Ampere Computing
Submitted by:	Klara, Inc.
2020-12-01 20:10:55 +00:00
Mark Johnston
f2fb8af155 rtsold: Fix multiple buffer overflows
Approved by:	so
Security:	CVE-2020-25577
MFC after:	now
2020-12-01 19:34:44 +00:00
John Baldwin
3413f26245 Fix a couple of typos.
Submitted by:	rmacklem
2020-12-01 18:57:37 +00:00
Bjoern A. Zeeb
9d2d04462d USB umass: add quirk to not probe
Some USB WLAN devices have "on-board" storage showing up as umass
and making the root mount wait for a very long time.
The WLAN drivers know how to deal with that an issue an eject
command later when attaching themselves.
Introduce a quirk to not probe these devices as umass and avoid
hangs and confusion altogether.

Reviewed by:	hselasky, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27434
2020-12-01 18:24:06 +00:00
John Baldwin
4d16f94191 Use uintptr_t instead of uint64_t for pointers in stack frames.
Reviewed by:	andrew
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27361
2020-12-01 18:22:34 +00:00
John Baldwin
fdd947e4ce Use uintptr_t for pointers in stack frames.
This catches up to the changes made to struct unwind_state in r364180.

Reviewed by:	mhorne
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27360
2020-12-01 18:08:22 +00:00
John Baldwin
f2dceb474b Make stack_save*() more robust on MIPS.
- Validate any stack addresses read from against td_kstack before
  reading.  If an unwind operation would attempt to read outside the
  bounds of td_kstack, abort the unwind instead.

- For stack_save_td(), don't use the PC and SP from the current
  thread, instead read the PC and SP from pcb_context[].

- For stack_save(), use the current PC and SP of the current thread,
  not the values from pcb_regs (the horribly named td_frame of the
  outermost trapframe).  The result was that stack_trace() never
  logged _any_ kernel frames but only the frame from the saved
  userspace registers on entry from the kernel.

- Inline the one use of stack_register_fetch().

- Add a VALID_PC() helper macro and simplify types to remove
  excessive casts in stack_capture().

- Fix stack_capture() to work on compilers written in this century.
  Don't treat function epilogues as function prologues by skipping
  additions to SP when searching for a function start.

- Add some comments to stack_capture() and fix some style bugs.

Reviewed by:	arichardson
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27358
2020-12-01 17:17:22 +00:00
John Baldwin
5941edfcdc Add a kstack_contains() helper function.
This is useful for stack unwinders which need to avoid out-of-bounds
reads of a kernel stack which can trigger kernel faults.

Reviewed by:	kib, markj
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27356
2020-12-01 17:04:46 +00:00
Kristof Provost
c49747eaf2 pf tests: Re-enable panicing tests
We've fixed the vnet/epair cleanup race, so it is now safe to re-enable these
tests.

MFC after:	2 weeks
Sponsored by:	Modirum MDPay
2020-12-01 16:44:36 +00:00
Kristof Provost
7f883a9b5b net: Revert vnet/epair cleanup race mitigation
Revert the mitigation code for the vnet/epair cleanup race (done in r365457).
r368237 introduced a more reliable fix.

MFC after:	2 weeks
Sponsored by:	Modirum MDPay
2020-12-01 16:34:43 +00:00
Kristof Provost
e133271fc1 if: Fix panic when destroying vnet and epair simultaneously
When destroying a vnet and an epair (with one end in the vnet) we often
panicked. This was the result of the destruction of the epair, which destroys
both ends simultaneously, happening while vnet_if_return() was moving the
struct ifnet to its home vnet. This can result in a freed ifnet being re-added
to the home vnet V_ifnet list. That in turn panics the next time the ifnet is
used.

Prevent this race by ensuring that vnet_if_return() cannot run at the same time
as if_detach() or epair_clone_destroy().

PR:		238870, 234985, 244703, 250870
MFC after:	2 weeks
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D27378
2020-12-01 16:23:59 +00:00
Mark Johnston
dad22308a1 vmem: Revert r364744
A pair of bugs are believed to have caused the hangs described in the
commit log message for r364744:

1. uma_reclaim() could trigger reclamation of the reserve of boundary
   tags used to avoid deadlock.  This was fixed by r366840.
2. The loop in vmem_xalloc() would in some cases try to allocate more
   boundary tags than the expected upper bound of BT_MAXALLOC.  The
   reserve is sized based on the value BT_MAXMALLOC, so this behaviour
   could deplete the reserve without guaranteeing a successful
   allocation, resulting in a hang.  This was fixed by r366838.

PR:		248008
Tested by:	rmacklem
2020-12-01 16:06:31 +00:00
Martin Matuska
c3afd20f13 MFV r368207:
Update libarchive to 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

MFC after:	1 week
2020-12-01 15:53:12 +00:00
Martin Matuska
d5f2a5ff11 Update vendor/libarchive/dist to git 833821f55b1807cac22a63a58b759a7802df2fb7
Libarchive 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename
2020-12-01 10:36:46 +00:00
Michal Meloun
8bbe6af949 Remove duplicated SV_ASLR from the elf flags.
Reported by:	lattera
2020-12-01 09:18:18 +00:00
Michal Meloun
cf7c062932 Always use the __unused attribute even for potentially unused parameters.
Requested by:	ian, imp
MFC with:	r368167
2020-12-01 08:52:13 +00:00
Mitchell Horne
2e085395e1 efibootmgr: fix an incorrect error handling check
efivar_device_path_to_unix_path() returns standard error codes on
failure and zero on success. Checking for a return value less than zero
means that the actual failure cases won't be handled. This could
manifest as a segfault during the subsequent call to printf().

Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D27424
2020-11-30 22:16:11 +00:00
Alexander V. Chernikov
8db8bebf1f Move inner loop logic out of sysctl_sysctl_next_ls().
Refactor sysctl_sysctl_next_ls():
* Move huge inner loop out of sysctl_sysctl_next_ls() into a separate
 non-recursive function, returning the next step to be taken.
* Update resulting node oid parts only on successful lookup
* Make sysctl_sysctl_next_ls() return boolean success/failure instead of errno,
 slightly simplifying logic

Reviewed by:	freqlabs
Differential Revision:	https://reviews.freebsd.org/D27029
2020-11-30 21:59:52 +00:00
Alexander V. Chernikov
77df2c21cb Renumber NHR_* flags after NHR_IFAIF removal in r368127.
Suggested by:	rpokala
2020-11-30 21:42:55 +00:00
Gleb Smirnoff
4c91d6bc44 Print at least something when failing. 2020-11-30 21:05:31 +00:00
Matt Macy
ac042c65ae wireguard: fix zfs_ copy pasta in module init macro
Reported by: Jessica Clarke
2020-11-30 20:58:42 +00:00
Matt Macy
d0c96ffc59 Remove (dead) GPL copyright code from wireguard sources 2020-11-30 20:54:44 +00:00
Mark Johnston
e4b675c929 qat: Initialize the crypto device ID to -1 instead of 0
Otherwise qat_detach() may attempt to deregister an unrelated crypto
driver if an error occurs in qat_attach() before crypto_get_driverid()
is called, since 0 is a valid driver ID.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-30 20:53:45 +00:00
Mark Johnston
7695ced633 qat: Fix firmware module autoloading
If firmware_get() fails to find a loaded firmware image, it searches for
candidate KLDs to load.  It will search for a KLD containing a module
with the same name as the requested image, and failing that, will load a
KLD with the same basename as the requested image.

The module name given by fw_stub.awk is simply "<mangled KLD name>_fw".

QAT firmware modules contain two images, neither of which match either
of the names used during lookup, so automatic loading of firmware images
after mountroot does not work.  Work around this by using the same
string for the first image name and for the KLD basename.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-30 20:53:25 +00:00
Dimitry Andric
8459188a56 Add a few missed entries to ObsoleteFiles.inc:
* libzfs.so was bumped from 3 to 4 in r364746
* libcap_random.so.1 was removed in r350307, but its .so symlink was not
2020-11-30 19:18:50 +00:00
Konstantin Belousov
21a45add50 ffs: do not read full direct blocks if they are going to be overwritten.
BA_CLRBUF specifies that existing context of the block will be
completely overwritten by caller, so there is no reason to spend io
fetching existing data.  We do the same for indirect blocks.

Reported by:	tmunro
Reviewed by:	mckusick, tmunro
Tested by:	pho, tmunro
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D27353
2020-11-30 17:03:26 +00:00
Konstantin Belousov
ec5fed758c Ensure that threading library is initialized in pthread_mutex_init().
We need at least thr_malloc ready.  The situation is possible e.g. in case
of libthr being listed in DT_NEEDED before some of its consumers.

Reported and tested by:	lev
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-11-30 17:00:36 +00:00
Mark Johnston
991f23ef20 uma: Avoid allocating buckets with the cross-domain lock held
Allocation of a bucket can trigger a cross-domain free in the bucket
zone, e.g., if the per-CPU alloc bucket is empty, we free it and get
migrated to a remote domain.  This can lead to deadlocks since a bucket
zone may allocate buckets from itself or a pair of bucket zones could be
allocating from each other.

Fix the problem by dropping the cross-domain lock before allocating a
new bucket and handling refill races.  Use a list of empty buckets to
ensure that we can make forward progress.

Reported by:	imp, mjg (witness(9) warnings)
Discussed with:	jeff
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27341
2020-11-30 16:18:33 +00:00
Olivier Cochard
6b97a6e365 Fix compilation on head and while here:
- remove unwanted whitespaces
- remove useless function ifphys()
- fix the Makefile to install it into /usr/bin

PR:		250133
Reviewed by:	glebius, maxim
Approved by:	glebius
Differential Revision:	https://reviews.freebsd.org/D27155
2020-11-30 15:04:35 +00:00
Michal Meloun
b2e9e573a3 Unbreak r368167 in userland. Decorate unused arguments.
Reported by:	kp, tuexen, jenkins, and many others
MFC with:	r368167
2020-11-30 14:51:48 +00:00
Emmanuel Vadot
ca7ef91285 mmccam: Convert some printf to CAM_DEBUG
This not not useful if you are not debuging mmccam
2020-11-30 14:49:13 +00:00
Emmanuel Vadot
020df50904 arm: allwinner: aw_mmc: Add a sysctl for debuging
Add a new hw.aw_mmc.debug sysctl to help debugging the driver.
Bit 0 will debug card changes (removal, insertion, power up/down)
Bit 1 will debug ios changes
Bit 2 will debug interrupts received
Bit 3 will debug commands sent
2020-11-30 14:48:50 +00:00
Toomas Soome
93b18e3730 vt: if loader did pass the font via metadata, use it
The built in 8x16 font may be way too small with large framebuffer
resolutions, to improve readability, use loader provied font.
2020-11-30 11:45:47 +00:00
Hans Petter Selasky
ed2b70e8af Use function macro for sema_init() in the LinuxKPI to limit macro expansion scope.
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-30 09:47:53 +00:00
Toomas Soome
cb79418266 fix vmbus_fb_mmio_res after r368168
mixed efifb versus vbefb struct use did slip in by mistake.
2020-11-30 08:31:41 +00:00
Toomas Soome
a4a10b37d4 Add VT driver for VBE framebuffer device
Implement vt_vbefb to support Vesa Bios Extensions (VBE) framebuffer with VT.
vt_vbefb is built based on vt_efifb and is assuming similar data for
initialization, use MODINFOMD_VBE_FB to identify the structure vbe_fb
in kernel metadata.

struct vbe_fb, is populated by boot loader, and is passed to kernel via
metadata payload.

Differential Revision:	https://reviews.freebsd.org/D27373
2020-11-30 08:22:40 +00:00
Michal Meloun
52a832072d NVME: Don't try to swap data on little endian machines.
These swapping functions violate BUSDMA contract - we cannot write
to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least
from little endian machines until a better solution will be developed.

Reviewed by:	imp
MFC after:	3 weeks
2020-11-30 07:01:12 +00:00
Alexander V. Chernikov
d1d941c5b9 Remove RADIX_MPATH config option.
ROUTE_MPATH is the new config option controlling new multipath routing
 implementation. Remove the last pieces of RADIX_MPATH-related code and
 the config option.

Reviewed by:	glebius
Differential Revision:	https://reviews.freebsd.org/D27244
2020-11-29 19:43:33 +00:00
Matt Macy
2338da0373 Import kernel WireGuard support
Data path largely shared with the OpenBSD implementation by
Matt Dunwoodie <ncon@nconroy.net>

Reviewed by:	grehan@freebsd.org
MFC after:	1 month
Sponsored by:	Rubicon LLC, (Netgate)
Differential Revision:	https://reviews.freebsd.org/D26137
2020-11-29 19:38:03 +00:00
Konstantin Belousov
baa2cd58a6 Reduce MAXPHYS back to 128KB on 32bit architectures.
Some of them have limited KVA, like arm, which prevents startup from
allocating needed number of large pbufs.  Other, for instance i386,
are dis-balanced enough after 4/4 that blind bump is probably harmful
because it allows for much more in-flight io than other tunables are
ready for.

Requested by:	mmel
Reviewed by:	emaste, mmel
Sponsored by:	The FreeBSD Foundation
2020-11-29 19:06:32 +00:00
Michal Meloun
bd89101586 Store MPIDR register in pcpu.
MPIDR represents physical locality of given core and it should be used as
the only viable/robust connection between cpuid (which have zero relation to
cores topology) and external description (for example  in FDT).  It can be
used for determining which interrupt is associated to given per-CPU PMU
or by scheduler for determining big/little core or cluster topology.

MFC after: 3 weeks
2020-11-29 18:59:01 +00:00
Fernando Apesteguía
f2f1a2a0a0 iconv(1): Add EXAMPLE
Just a small example to show simple usage.

Approved by:	manpages (0mp@)
MFC after:	2 weeks
Differential Revision:		https://reviews.freebsd.org/D27385
2020-11-29 18:22:14 +00:00
Michal Meloun
7c6c12ebcd Remove unused options.
Marvell files and their related SOC_MV_<foo> options should be cleaned up
in another pass.
2020-11-29 17:42:32 +00:00
Michal Meloun
f72366f927 _ARM_ARCH_5E is always defined, we not support older CPUs. 2020-11-29 16:44:22 +00:00
Yuri Pankov
c5426ce3a6 security(7): fix copy/paste error and correct aslr oids
Submitted by:	Mina Galić <me_igalic.co>
Differential Revision:	https://reviews.freebsd.org/D27408
2020-11-29 16:29:40 +00:00
Andrew Turner
e0870cd468 Only set the PCI bus end when we are reducing it
We read the bus end value from the _CRS method. On some systems we need
to further limit it based on the MCFG table.

Support this by setting a default value, then update it if needed in the
_CRS table, and finally reduce it if it is past the end of the MCFG tabel.
This will allow for both systems that use either method to encode this
value.

This partially reverts r347929, removing the error printf.

Reviewed by:	philip
Tested by:	philip, Andrey Fesenko <f0andrey_gmail.com>
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D27274
2020-11-29 16:22:33 +00:00
Michal Meloun
b842cbbc01 Remove orphaned configs. 2020-11-29 15:39:54 +00:00