Commit Graph

253055 Commits

Author SHA1 Message Date
Brooks Davis
29e1fceb73 Maintain a stack alignment of 16-bytes.
This violated the RISC-V 64-bit ABI.  On CheriBSD this manifested as
a trap when attempting to store 16-byte aligned types while zeroing
the stack.

Reported by:	CHERI, jrtc27
Reviewed by:	mhorne, br
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26327
2020-09-04 21:46:10 +00:00
Matt Macy
431004027d Update vendor openzfs to fd20a8 2020-09-04 21:31:58 +00:00
Mateusz Guzik
c86d2ba8a5 tmpfs: drop spurious cache_purge in tmpfs_reclaim
vgone already performs it.
2020-09-04 19:30:15 +00:00
Li-Wen Hsu
8e6b8fc655 Initialize len to avoid ENOMEM from sysctl(3).
PR:		248933
Sponsored by:	The FreeBSD Foundation
2020-09-04 19:24:27 +00:00
Mark Johnston
b6c3b1a92d Stop setting DEBUG_FLAGS in the zfs.ko Makefile.
Rely on system settings to decide whether or not to build with debug
symbols and extract them to a separate file.

Reported and tested by:	rm
2020-09-04 18:55:03 +00:00
Bjoern A. Zeeb
a16e001bd9 umass: enhance debugging
Investigating a hang I found having some more error information
available would be helpful, so be more verbose and also tell cam/xpt
status in case of error/panic.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26287
2020-09-04 18:29:59 +00:00
Bjoern A. Zeeb
ed75ef34d4 umass: fix a cam_sim leak in error case
While debugging a hang I noticed that in case of error in
umass_cam_attach_sim() we miss a cam_sim_free() call.
Added that to not leak resources.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision:	D26287
2020-09-04 18:26:35 +00:00
Bjoern A. Zeeb
7a7ca53f69 cam_sim: harmonize code related to acquiring a mtx
cam_sim_free(), cam_sim_release(), and cam_sim_hold() all assign
a mtx variable during declaration and then if NULL or the mtx is
held may re-asign the variable and/or acquire/release a lock.

Harmonize the code, avoiding double assignments and make it look
the same for all three function (with cam_sim_free() not needing
an extra case).

No functional changes intended.

Reviewed by:	imp; no-objections by: mav
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26286
2020-09-04 18:18:05 +00:00
Eric Joyner
1bd641af2b ice_ddp: Update package file to 1.3.16.0
This package is intended to be used with ice(4) version 0.26.16. That
update will happen in a forthcoming commit.

MFC after:	3 days
Sponsored by:	Intel Corporation
2020-09-04 17:37:58 +00:00
Andrew Gallatin
9675d8895a ktls: Check for a NULL send tag in ktls_cleanup()
When using ifnet ktls, and when ktls_reset_send_tag()
fails to allocate a replacement tag, it leaves
the tls session's snd_tag pointer NULL. ktls_cleanup()
tries to release the send tag, and will trip over
this NULL pointer and panic unless NULL is checked for.

Reviewed by:	jhb
Sponsored by:	Netflix
2020-09-04 17:36:15 +00:00
Gordon Bergling
cb55665190 fortune(6): Grammar fix for a hint on searching ports
PR:		249078
Submitted by:	PauAmma <pauamma at gundo dot com>
Reported by:	PauAmma <pauamma at gundo dot com>
MFC after:	3 days
2020-09-04 13:05:00 +00:00
Konstantin Belousov
6eeccaa91b Fix kern_copyin test.
Main part is that kern_copyin on amd64 after LA57 should query the top
of UVA for correct operations. In fact it should started doing that
after the workaround for AMD bug with IRET in the last user page was
fixed by reducing UVA by a page.

Also since we started calculating top of UVA, fix MIPS according to
the comment.

Reported by:	lwhsu
PR:	248933
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D26312
2020-09-04 12:52:16 +00:00
Stephen J. Kiernan
291124e3c0 Avoid collisions with function names in openssl headers.
Just using MD5, SHA1, RMD160 and SHA256 for defines collides with
functions of the same name in OpenSSL. This can cause compilation
issues in downstream consumers if they use OpenSSL for the hash
functions instead of libmd.

Reviewed by:	sjg
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D26321
2020-09-04 04:31:56 +00:00
Mark Johnston
46888dedc9 Add emulation support for the Linux kcov(4) ioctl API.
This makes it possible to run an unmodified Linux syzkaller executor
against the Linuxulator, and have it gather code coverage information.

Sponsored by:	The FreeBSD Foundation
2020-09-04 00:12:28 +00:00
John Baldwin
67dc6bed1f Quiet int-to-pointer-cast warnings on i386 with GCC 9.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D26200
2020-09-04 00:11:01 +00:00
Mitchell Horne
51bb2fccfd Remove a duplicate declaration
This is already declared in sys/file.h, which is included directly.
Compiling with GCC9 emits an error.

Discussed with: rmacklem
2020-09-03 22:40:51 +00:00
Alexander V. Chernikov
8f07963360 Fix regression for IPv6 loopback routes.
After nexthop introduction, loopback routes for the interface addresses
 were created without embedding actual interface index in the gateway.
 The latter is needed to pass the IPv6 scope during transmission via loopback..

Fix the regression by actually using passed gateway data with interface index.

Differential Revision:	https://reviews.freebsd.org/D26306
2020-09-03 22:24:52 +00:00
Rick Macklem
9c4368e73c Add entries for the OID used for NFS-over-TLS "user@domain".
The NFS-over-TLS server daemon (rpc.tlsservd) can optionally replace user
credentials in the RPC header with ones derived from a username specified
by the form "user@domain", if this exists in the client's X.509 v3 certificate.
Specifically, "user@domain" needs to be in the "otherName" component of
subjectjAltName, with a unique OID as assigned by this update.

This patch adds a subtree for the "otherName" component of subjectAltName in
X.509 v3 cerificates and a value for "user@domain" as used by NFS-over-TLS.

Reviewed by:	phk, gordon
Differential Revision:	https://reviews.freebsd.org/D26225
2020-09-03 20:42:30 +00:00
Andriy Gapon
137d26e8a3 mac_framework.h: fix build with DEBUG_VFS_LOCKS and !MAC
I have such a custom kernel configuration and its build failed with:
linking kernel.full
ld: error: undefined symbol: mac_vnode_assert_locked
>>> referenced by mac_framework.h:556 (/usr/devel/git/apu2c4/sys/security/mac/mac_framework.h:556)
>>>               tmpfs_vnops.o:(mac_vnode_check_stat)
>>> referenced by mac_framework.h:556 (/usr/devel/git/apu2c4/sys/security/mac/mac_framework.h:556)
>>>               vfs_default.o:(mac_vnode_check_stat)
>>> referenced by mac_framework.h:556 (/usr/devel/git/apu2c4/sys/security/mac/mac_framework.h:556)
>>>               ufs_vnops.o:(mac_vnode_check_stat)
2020-09-03 20:30:52 +00:00
Dimitry Andric
031db28b2b Merge commit f26fc568402f from llvm git (by me):
Eliminate the sizing template parameter N from CoalescingBitVector

  Since the parameter is not used anywhere, and the default size of 16
  apparently causes PR47359, remove it. This ensures that IntervalMap
  will automatically determine the optimal size, using its NodeSizer
  struct.

  Reviewed By: dblaikie

  Differential Revision: https://reviews.llvm.org/D87044

This should fix 'Assertion failed: (Elements + Grow <= Nodes * Capacity
&& "Not enough room for elements"), function distribute, file
/usr/src/contrib/llvm-project/llvm/lib/Support/IntervalMap.cpp, line
123.' when building the x11-toolkits/py-wxPython40 port on a i386 host.

Reported by:	zeising
MFC after:	6 weeks
X-MFC-With:	r364284
2020-09-03 18:34:01 +00:00
Dimitry Andric
a2a9ef4beb Add a few more files to libllvm, which are required when doing sanitized
builds, for example with -fsanitize=undefined.

MFC after:	6 weeks
X-MFC-With:	r364284
2020-09-03 18:27:13 +00:00
Dimitry Andric
32cb779461 Ensure zpool-features(5) doesn't get removed by make delete-old.
Apparently, somewhere in 2012 ZFS-on-FreeBSD moved it from section 5 to
7, but ZFS-on-Linux never did.
2020-09-03 18:21:58 +00:00
Mitchell Horne
7ea40e1dbf arm64: update the set of HWCAP definitions
This is in sync with what is defined for Linux 5.8. Note that all bits
in HWCAP are exhausted, and HWCAP2 has been added.

This also revealed an error in some of the existing definitions. We are
missing HWCAP_ASIMDHP, and as a result a portion of the HWCAP values are
shifted right by one bit. This will be fixed in an upcoming change, but
the values being added now are compatible with what Linux defines.

Reviewed by:	emaste, markj, manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26030
2020-09-03 17:07:58 +00:00
John Baldwin
2afeaad315 Various fixes to the load() function.
- Use getline() instead of fgetln().  This ensures the returned string
  is always null-terminated without losing the last character if the
  last line in a file doesn't have a newline.  Also, while fgetln says
  the returned buffer can be modified, that doesn't actually seem safe
  as the current implementation means you are modifying stdio's
  internal buffer.

- Remove a spurious if before an ATF_REQUIRE that was clearly supposed
  to be non-optional.

- Remove a pointless compare of 'ptr' against '\0' (really NULL) that
  duplicated the middle condition in the for().

- Once a comment is found, skip the rest of the line, not just the
  current word.

Reviewed by:	kevans
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26278
2020-09-03 14:50:15 +00:00
Andrew Turner
857ab36fc2 Switch to an empty ttbr0 pagetable when the MMU is enabled
We don't need these pagetables after the early boot. Remove the chance we
write to memory we didn't expect to and remove architectural undefined
behaviour.

Reviewed by:	alc (earlier version), mmel
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D22606
2020-09-03 10:11:12 +00:00
Li-Wen Hsu
7c570021c8 Temporarily skip sbin.bectl.bectl_test.* i386 kernel in CI
kldload zfs.ko on i386 hangs in CI

Sponsored by:	The FreeBSD Foundation
2020-09-03 08:16:57 +00:00
Andriy Gapon
e7fe5d60b1 move defintion of hw.i2c sysctl node from iicbb to iicbus
MFC after:	2 weeks
2020-09-03 08:02:19 +00:00
Andriy Gapon
0524c5fc82 twsi: no need to compare boolean with boolean constant
Testing the boolean directly is shorter and more idiomatic.

MFC after:	1 week
2020-09-03 08:01:21 +00:00
Andriy Gapon
d6adffa570 twsi: replace a couple of errno codes with i2c error codes
Reviewed by:	manu
MFC after:	1 week
2020-09-03 07:42:53 +00:00
Niclas Zeising
1f42dc843f drm2: Fix build after r365264
Fix the build after r365264, I forgot to exclude arm in one more place.

Reported by:	rpokala
Approved by:	manu (implicit, build fix)
MFC after:	3 days
X-MFC-With:	365264
Pointy-hat to:	zeising
2020-09-03 05:25:39 +00:00
Stephen J. Kiernan
2d012dff57 Avoid issues with STAGING by using LIBUCL_DIR for the source directory
variable name instead of LIBUCL (which would otherwise end up with the
staging directory used instead of the wanted source directory.)

Reviewed by:	sjg
Obtained from:	Juniper Networks, Inc.
2020-09-03 03:48:42 +00:00
Ed Maste
49492b213f mgb: correct macro argument name
mgb had a longstanding typo in function-like macro MGB_NEXT_RING_IDX's
argument, but the macro had no consumers.  r365061 introduced a use of
the macro, after which mgb failed to build.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2020-09-03 02:17:55 +00:00
Brooks Davis
18f917a90e Always report ENOSYS in init
While rare, encountering an unimplemented system call early in init is
catastrophic and difficult to debug.  Even after a SIGSYS handler is
registered, such configurations are problematic.  As such, always report
such events for pid 1 (following kern.lognosys if non-zero).

Reviewed by:	kevans, imp
Obtained from:	CheriBSD (plus suggestions from kevans)
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26288
2020-09-02 23:17:33 +00:00
John Baldwin
85b29fea3c Fix the variable name passed to OF_getprop().
Reported by:	tinderbox
2020-09-02 22:27:30 +00:00
John Baldwin
4d135bbd7f libifconfig now depends on libm due to usage of log10().
ld.bfd in particular requires -lm to come after libifconfig on the
command line when linking rescue.

Reviewed by:	freqlabs, adrian
Differential Revision:	https://reviews.freebsd.org/D26258
2020-09-02 22:10:08 +00:00
John Baldwin
875e04d716 Pass a valid mode with O_CREATE to open(2).
CheriABI is pickier about the arguments to open(2) and crashes with a
fault if a mode isn't passed to an open() when O_CREATE is specified.

Reported by:	CHERI
Reviewed by:	brooks
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26281
2020-09-02 21:17:54 +00:00
Brooks Davis
a449e81e00 Remove risky compatability with old kernels
The badsys() handler for SIGSYS was added as a transtion aid for kernels
lacking sysctl() in 1993.  It is unsafe and unsound so remove it rather
than running the risk of a privilege-dropping system call being silently
omitted.

This partially reverts SCCSID 6.12 (Berkeley) 03/03/93 "add code to
change the system security level".

Reviewed by:	mckusick, imp, kevans
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26289
2020-09-02 21:14:36 +00:00
John Baldwin
97bdc65f27 Don't assume objects in program sections have a size of a pointer.
The size of the object at 'addr' is unknown and might be smaller than
the size of a pointer (e.g. some x86 instructions are smaller than a
pointer).  Instead, just check that the address is in the bounds of
the program header.

Reported by:	CHERI (indirectly)
Reviewed by:	kib, brooks
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26279
2020-09-02 20:43:08 +00:00
John Baldwin
1a4531bc98 Compute the correct size of the string to move forward.
Previously this was counting the amount of spare room at the start of
the buffer that the string needed to move forward and passing that as
the number of bytes to copy to memmove rather than the length of the
string to be copied.

In the strfmon test in the test suite this caused the memmove to
overflow the allocated buffer by one byte which CHERI caught.

Reported by:	CHERI
Reviewed by:	kevans
Obtained from:	CheriBSD
MFC after:	1 week
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D26280
2020-09-02 20:04:26 +00:00
Mark Johnston
a2d704d19f Avoid unnecessary object locking in vm_page_grab_pages_unlocked().
We were needlessly acquiring the object lock to call
vm_page_grab_pages() even when all of the requested pages were looked up
locklessly.  Fix that, stop testing for count == 0 in
vm_page_grab_pages(), and add assertions to help catch this kind of
mistake.

Reported by:	cem
Reviewed by:	alc, cem, dougm, jeff
Differential Revision:	https://reviews.freebsd.org/D26304
2020-09-02 19:59:25 +00:00
Ian Lepore
ac07cdf8f7 In ltc430x(4), add the ability to configure control register 2 via FDT or
hints data.  Control register 2 holds the settings a user might want to
configure, such as the timeout value for idle busses and whether to enable
the mass-writes feature.

Also add hint support for disconnecting idle busses (which was already
supported using FDT data).

Update the manpage with the new features, and also split the hints section
into separate lists of required and optional hints.
2020-09-02 19:37:47 +00:00
Mateusz Guzik
b1a824b684 vfs: retire vholdl as a symbol
Similarly to vrefl in r364283.
2020-09-02 19:21:37 +00:00
Mateusz Guzik
2b4632aee9 vfs: purge cache entries early on vgone
There is no reason for them to linger across reclaim and it is an
invariant that doomed vnodes are not added to the namecache.
2020-09-02 19:21:10 +00:00
Li-Wen Hsu
0932ee9fa0 Temporarily skip tests panic i386 kernel in CI
lib.libbe.be_create.libbe_create
sbin.bectl.bectl_test.bectl_create

PR:		249055
Sponsored by:	The FreeBSD Foundation
2020-09-02 19:18:27 +00:00
Mark Johnston
a0efcf6400 Add sysctl(8) formatting for hw.pagesizes.
- Change the type of hw.pagesizes to OPAQUE, since it returns an array.
- Modify the handler to only truncate the returned length if the caller
  supplied an output buffer.  This allows use of the trick of passing a
  NULL output buffer to fetch the output size, while preserving
  compatibility if MAXPAGESIZES is increased.
- Add a "S,pagesize" formatter to sysctl(8).

Reviewed by:	alc, kib
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26239
2020-09-02 18:17:08 +00:00
Mark Johnston
847ab36bf2 Include the psind in data returned by mincore(2).
Currently we use a single bit to indicate whether the virtual page is
part of a superpage.  To support a forthcoming implementation of
non-transparent 1GB superpages, it is useful to provide more detailed
information about large page sizes.

The change converts MINCORE_SUPER into a mask for MINCORE_PSIND(psind)
values, indicating a mapping of size psind, where psind is an index into
the pagesizes array returned by getpagesizes(3), which in turn comes
from the hw.pagesizes sysctl.  MINCORE_PSIND(1) is equal to the old
value of MINCORE_SUPER.

For now, two bits are used to record the page size, permitting values
of MAXPAGESIZES up to 4.

Reviewed by:	alc, kib
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26238
2020-09-02 18:16:43 +00:00
Fernando Apesteguía
2825bf5b2a kldstat(8): Add EXAMPLES to the man page
Add EXAMPLES for all the flags

Approved by:	manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26283
2020-09-02 18:15:57 +00:00
Mark Johnston
2d838cd867 Add the MEM_EXTRACT_PADDR ioctl to /dev/mem.
This allows privileged userspace processes to find information about the
physical page backing a given mapping.  It is useful in applications
such as DPDK which perform some of their own memory management.

Reviewed by:	kib, jhb (previous version)
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D26237
2020-09-02 18:12:47 +00:00
Niclas Zeising
662c3e2084 drm2: Further improve deprecation message
Further improve the drm2 deprecation message, only displaying information
about the port for relevant architectures, and skipping the message
completely from arm, which uses some parts of drm2 still.

This is mostly intended to be merged to 12, since the base bits of drm2 on
FreeBSD 13 are only really used on arm.

Reviewed by:	manu, mmel
Approved by:	manu
MFC after:	3 days
X-MFC-with:	r364737
Differential Revision:	https://reviews.freebsd.org/D26275
2020-09-02 18:04:49 +00:00
Alan Somers
dc2541703c Fix output of nfsstat -cE in json or xml mode
Due to a copy/paste error, the "getacl" field was duplicated, but only in
XML or JSON mode, not in txt mode.

Discussed with:	rmacklem
MFC after:	1 week
Sponsored by:	Axcient
2020-09-02 17:36:30 +00:00