Commit Graph

251823 Commits

Author SHA1 Message Date
Peter Grehan
f1c3dac414 Replace magic numbers in Identify page register 0 with ATA definitions.
No functional change. Verified with objdump output before/after.

Requested by:	rpokala
Reviewed by:	rpokala
MFC after:	3 weeks
2020-07-31 12:10:28 +00:00
Alex Richardson
74d677ebfd Include virtio support in std.MALTA
The MALTA kernel config is generally used for QEMU and having support
for VirtIO there by default is quite useful.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D25217
2020-07-31 11:28:09 +00:00
Randall Stewart
8315f1ea26 The recent changes to move the ref count increment
back from the end of the function created an issue.
If one of the routines returns NULL during setup
we have inp's with extra references (which is why
the increment was at the end).

Also the stack switch return code was being ignored
and actually has meaning if the stack cannot take over
it should return NULL.

Fix both of these situation by being sure to test the
return code and of course in any case of return NULL (there
are 3) make sure we properly reduce the ref count.

Sponsored by:	Netflix Inc.
Differential Revision:	https://reviews.freebsd.org/D25903
2020-07-31 10:03:32 +00:00
Kyle Evans
d6391a26d6 UPDATING: Add a note about running installworld twice
Some folks seem to be hitting issues with build orchestration; presumably
some of our .WAIT-removal optimizations are going awry, and they're ending
up with applications linked against new libc being installed before the new
libc.

Letting installworld complete the first time should ensure that the new libc
is installed by the end of it, then the second installworld will ensure
consistency as everything should succeed.
2020-07-31 02:21:19 +00:00
Conrad Meyer
d6a75d39e9 getblk: Remove a non-sensical LK_NOWAIT | LK_SLEEPFAIL
No functional change.

LK_SLEEPFAIL implies a behavior that is only possible if the lock operation can
sleep.  LK_NOWAIT prevents the lock operation from sleeping.

Discussed with:	kib
2020-07-31 00:13:40 +00:00
Conrad Meyer
59d13f6154 getblk: Avoid sleeping on wrong buf in lockless path
If the buffer identity changed during lookup, sleeping could introduce a
lock order reversal.  Since we do not know if the identity changed until we
get the lock, we must try-lock (LK_NOWAIT) only.  EINTR and ERESTART error
handling becomes irrelevant, as we no longer sleep.

Reported by:	kib
Reviewed by:	kib
X-MFC-With:	r363482
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D25898
2020-07-31 00:07:01 +00:00
Conrad Meyer
9119bafbaf Import PCG-C into sys/contrib
The intended (future) use is to provide fast pseudo-random numbers in non-
cryptographic applications.
2020-07-30 23:54:25 +00:00
Peter Grehan
872f4e99f4 Definition for the 'removable media flag' from word 0 in the Identify page.
This will be used to remove a magic number in the bhyve AHCI emulation.

Reported by:	rpokala
Reviewed by:	imp, rpokala
Approved by:	imp, rpokala
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D25893
2020-07-30 23:49:49 +00:00
Conrad Meyer
8ae93acf47 Import PCG-C master, 2019-07-18 (83252d9c23df9c82ecb42210afed61a7b42402d7) 2020-07-30 23:17:30 +00:00
Mateusz Guzik
5b0acaf75f Fix tinderbox build after r363714 2020-07-30 22:56:57 +00:00
Mateusz Guzik
cb90ef2875 cache: drop the useless numchecks counter 2020-07-30 22:52:18 +00:00
Mateusz Guzik
952759111e Further depessimize priv_check_cred_vfs_generation 2020-07-30 22:14:04 +00:00
Mateusz Guzik
551cf5ab71 fd: predict in fdrop 2020-07-30 22:13:15 +00:00
Mark Johnston
19afc65a7e ip6_output(): Check the return value of in6_getlinkifnet().
If the destination address has an embedded scope ID, make sure that it
corresponds to a valid ifnet before proceeding.  Otherwise a sendto()
with a bogus link-local address can trigger a NULL pointer dereference.

Reported by:	syzkaller
Reviewed by:	ae
Fixes:		r358572
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25887
2020-07-30 17:43:23 +00:00
Mateusz Guzik
848f8effdd vfs: inline vops if there are no pre/post associated calls
This removes a level of indirection from frequently used methods, most notably
VOP_LOCK1 and VOP_UNLOCK1.

Tested by:	pho
2020-07-30 15:50:51 +00:00
Mateusz Guzik
2e4f8220e8 vfs: fold poll_no_poll into vop_nopoll
The logic was almost completely present in vop_stdpoll anyway.
2020-07-30 15:48:56 +00:00
Mateusz Guzik
b1f910e02c vfs: short-circuit the common case NDFREE calls
Almost all consumers use the NDF_ONLY_PNBUF macro, making them avoidably branch
a lot in the NDFREE routine. Also note most of them should not need to call
any cleanup anyway as they don't request HASBUF.
2020-07-30 15:47:41 +00:00
Mateusz Guzik
404927357d vfs: add support for WANTPARENT and LOCKPARENT to lockless lookup
This makes the realpath syscall operational with the new lookup. Note that the
walk to obtain the full path name still takes locks.

Tested by:      pho
Differential Revision:	https://reviews.freebsd.org/D23917
2020-07-30 15:45:11 +00:00
Mateusz Guzik
8230d29357 vfs: support negative entry promotion in lockless lookup
Tested by:	pho
2020-07-30 15:44:10 +00:00
Mateusz Guzik
4057e3eaaa vfs: add NOMACCHECK and AUDITVNODE2 to lockless lookup
They are both nops since lookup does not progress with either mac or audit enabled.

Tested by:	pho
2020-07-30 15:43:16 +00:00
Michal Meloun
0050ea2415 Move Ti AM335x to dev/extres/clk framework.
Re-implement clocks for these SoC by using now standard extres/clk framework.
This is necessary for future expansion of these. The new  implementation
is (due to the size of the patch) only the initial (minimum) version.
It will be updated/expanded with a subsequent set of particular patches.

This patch is also not tested on OMAP4 based boards (BeagleBone),
so all possible issues should be (and will be) fixed by ASAP once
identified.

Submited by:		Oskar Holmlund (oskar.holmlund@ohdata.se)
Differential Revision:  https://reviews.freebsd.org/D25118
2020-07-30 14:45:05 +00:00
Kyle Evans
98369a6980 sed: fix hex_subst test after after r363679
r363679 is in-fact the future change referenced by the comment, helpfully
left and forgotten by kevans. Instead of just silently not matching, we
should now be erroring out with vigor.
2020-07-30 13:36:24 +00:00
Kyle Evans
ac05de1788 diff: fix side_by_side after r363679
It's currently unclear to me how this could have worked previously; \n here
is not a literal newline but actual '\' 'n', and was getting passed to the
underlying regex engine as such. regex(3) does not translate this to a
newline, and this became an error because we don't really allow escaping
of arbitrary ordinary characters anymore.

Run the pattern strings through printf to make sure we're dealing with real
newlines before passing them through to atf_check, which ultimately feeds
them directly to regcomp(3).

This fix is different than that will be needed for sed, in that this is the
proper way to inject newlines into search strings as long as regex(3)
won't combine \ + n as folks might expect.

Reported by:	Jenkins via lwhsu
MFC after:	1 week
2020-07-30 13:33:45 +00:00
Wei Hu
c565776195 Prevent framebuffer mmio space from being allocated to other devices on HyperV.
On Gen2 VMs, Hyper-V provides mmio space for framebuffer.
This mmio address range is not useable for other PCI devices.
Currently only efifb driver is using this range without reserving
it from system.
Therefore, vmbus driver reserves it before any other PCI device
drivers start to request mmio addresses.

PR:		222996
Submitted by:	weh@microsoft.com
Reported by:	dmitry_kuleshov@ukr.net
Reviewed by:	decui@microsoft.com
Sponsored by:	Microsoft
2020-07-30 07:26:11 +00:00
Mateusz Guzik
d3e63e8eb2 vfs: make sure startdir_used is always assigned to before use
CID:	1431070
2020-07-30 07:11:08 +00:00
John-Mark Gurney
aa6ea9b6ce remove some long abandonded serial drivers (cy, rc, rp) since 2008
Reviewed by:	phk (earlier version)
Reviewed by:	emaste (earlier version)
Reviewed by:	bcr (earlier version)
Reviewed by:	zeising (earlier version)
Differential Revision:	https://reviews.freebsd.org/D25874
2020-07-30 00:53:56 +00:00
Mark Johnston
1b778ba260 Fix a logic error in uipc_ready_scan().
When processing the last record in a socket buffer, take care to avoid a
NULL pointer dereference when advancing the record iterator.

Reported by:	syzbot+6a689cc9c27bd265237a@syzkaller.appspotmail.com
Fixes:		r359778
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-07-30 00:52:37 +00:00
Kyle Evans
d2090a40d0 UPDATING / RELNOTES: Document new regcomp(3) behavior
This is a breaking change that had a not-insignificant impact in ports, it
is worth documenting it well.
2020-07-29 23:59:35 +00:00
John Baldwin
0f70a1489d Properly handle a closed TLS socket with pending receive data.
If the remote end closes a TLS socket and the socket buffer still
contains not-yet-decrypted TLS records but no decrypted TLS records,
soreceive needs to block or fail with EWOULDBLOCK.  Previously it was
trying to return data and dereferencing a NULL pointer.

Reviewed by:	np
Sponsored by:	Chelsio
Differential Revision:	https://reviews.freebsd.org/D25838
2020-07-29 23:24:32 +00:00
Kyle Evans
adeebf4cd4 regex(3): Interpret many escaped ordinary characters as EESCAPE
In IEEE 1003.1-2008 [1] and earlier revisions, BRE/ERE grammar allows for
any character to be escaped, but "ORD_CHAR preceded by an unescaped
<backslash> character [gives undefined results]".

Historically, we've interpreted an escaped ordinary character as the
ordinary character itself. This becomes problematic when some extensions
give special meanings to an otherwise ordinary character
(e.g. GNU's \b, \s, \w), meaning we may have two different valid
interpretations of the same sequence.

To make this easier to deal with and given that the standard calls this
undefined, we should throw an error (EESCAPE) if we run into this scenario
to ease transition into a state where some escaped ordinaries are blessed
with a special meaning -- it will either error out or have extended
behavior, rather than have two entirely different versions of undefined
behavior that leave the consumer of regex(3) guessing as to what behavior
will be used or leaving them with false impressions.

This change bumps the symbol version of regcomp to FBSD_1.6 and provides the
old escape semantics for legacy applications, just in case one has an older
application that would immediately turn into a pumpkin because of an
extraneous escape that's embedded or otherwise critical to its operation.

This is the final piece needed before enhancing libregex with GNU extensions
and flipping the switch on bsdgrep.

[1] http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/

PR:		229925 (exp-run, courtesy of antoine)
Differential Revision:	https://reviews.freebsd.org/D10510
2020-07-29 23:21:56 +00:00
Rick Macklem
ea83d07e82 Add support for ext_pgs mbufs to nfsrvd_readdir() and nfsrvd_readdirplus().
This patch code that optionally (based on ND_TLS, never set yet) generates
readdir replies in ext_pgs mbufs.
To trim the list back, a new function that is ext_pgs aware called
nfsm_trimtrailing() replaces newnfs_trimtrailing().
newnfs_trimtrailing() is no longer used, but will be removed in a future
commit, since its removal does modify the internal kpi between the NFS
modules.

This is another in the series of commits that add support to the NFS client
and server for building RPC messages in ext_pgs mbufs with anonymous pages.
This is useful so that the entire mbuf list does not need to be
copied before calling sosend() when NFS over TLS is enabled.

Use of ext_pgs mbufs will not be enabled until the kernel RPC is updated
to handle TLS.
2020-07-29 22:58:08 +00:00
Ruslan Bukin
c8597a1f9f o Don't include headers from iommu.h, include them from the header
consumers instead;
o Order includes properly.

Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25878
2020-07-29 22:08:54 +00:00
John-Mark Gurney
40326c1718 add link to crypto(7) page, and drop a link to unrelated crypt(3) page.. 2020-07-29 21:15:06 +00:00
Mark Johnston
958d8f527c Remove the volatile qualifier from busy_lock.
Use atomic(9) to load the lock state.  Some places were doing this
already, so it was inconsistent.  In initialization code, the lock state
is still initialized with plain stores.

Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25861
2020-07-29 19:38:49 +00:00
Cy Schubert
12b2f3daaa Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after:	1 week
2020-07-29 19:36:24 +00:00
Ruslan Bukin
386f81fca7 Fix !ACPI_DMAR build.
Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25882
2020-07-29 19:22:50 +00:00
Mateusz Guzik
fad6dd772d vfs: elide MAC-induced locking on rename if there are no relevant hoooks 2020-07-29 17:05:31 +00:00
Mateusz Guzik
fd8c6a48ab vfs: honor error code returned by mac_vnode_check_rename_from
MFC after:	3 days
2020-07-29 17:04:33 +00:00
Ruslan Bukin
9abb926538 Fix build.
Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25879
2020-07-29 15:46:17 +00:00
Ruslan Bukin
1b0c9c21d9 o Move iommu_set_buswide_ctx, iommu_is_buswide_ctx to
the generic iommu busdma backend;
o Move bus_dma_iommu_set_buswide, bus_dma_iommu_load_ident
  prototypes to iommu.h.

Reviewed by:	kib
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D25866
2020-07-29 13:23:27 +00:00
Daniel Ebdrup Jensen
ee49c1d3e5 Add my entry to the calendar file
As part of onboarding, ensure that I'm listed in the FreeBSD calendar file,
while listening to Don't Take Away The Music by Tavares.

Reviewed by:	0mp, bcr
Approved by:	0mp (mentor), allanjude (mentor)
Differential Revision:	D25856
2020-07-29 11:19:57 +00:00
Daniel Ebdrup Jensen
eb83321d44 Outline mentorship
As part of onboarding and while listening to Holy Ghost by The Bar-Kays, outline
my mentorship. 0mp is mentor, with allanjude and bcr as co-mentor.

Reviewed by:	0mp, allanjude, bcr
Approved by:	0mp (mentor), allanjude (mentor), bcr (mentor)
Differential Revision:	D25855
2020-07-29 11:17:44 +00:00
Andrew Turner
65e305af3d Only try managing the regulator when EXT_RESOURCES is defined
Not all Raspberry Pi kernel configs define EXT_RESOURCES. Check for this
before trying to manage the regulator.

Sponsored by:	Innovate UK
2020-07-29 08:24:40 +00:00
Robert Wing
055f269472 Add myself (rew) as src committer.
Reviewed by:    kevans (mentor), allanjude (mentor)
Approved by:    kevans (mentor), allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D25837
2020-07-29 05:27:19 +00:00
Ed Maste
e426c74375 sshd: allow UseBlocklist alias for UseBlacklist
blacklistd has been renamed to blocklistd upstream, and a future
import into FreeBSD will follow that change.  Support the new name
as an alias in config files.

Reviewed by:	bz, delphij
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25865
2020-07-29 00:34:24 +00:00
Alexander Motin
3b11655c7e When modifying LUN pass "special" options too.
Before switching to nvlists CTL merged previous and new options, so
any options not passed just kept previous value.  Now CTL completely
replaces them, so we must pass everything still relevant.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2020-07-28 22:32:50 +00:00
Christian S.J. Peron
3008333d44 Fixup some incorrect information and some comments. These changes
were cherry picked up the upstream OpenBSD repository. At some point we
will look at doing another import, but the diffs are substantial and will
require some careful testing.

Differential Revision:	https://reviews.freebsd.org/D25021
MFC after:	2 weeks
Submitted by:	gbe
Reviewed by:	myself, bcr
2020-07-28 20:06:16 +00:00
Mark Johnston
f72e5be58a vm_page_xbusy_claim(): Use atomics to update busy lock state.
vm_page_xbusy_claim() could clobber the waiter bit.  For its original
use, kernel memory pages, this was not a problem since nothing would
ever block on the busy lock for such pages.  r363607 introduced a new
use where this could in principle be a problem.

Fix the problem by using atomic_cmpset to update the lock owner.  Since
this macro is defined only for INVARIANTS kernels the extra overhead
doesn't seem prohibitive.

Reported by:	vangyzen
Reviewed by:	alc, kib, vangyzen
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D25859
2020-07-28 19:50:39 +00:00
John Baldwin
b027b6637a Add further clarification on si_addr and si_trapno.
- In the initial description of si_addr, do not claim that it is
  always the faulting instruction.

- For si_addr, document that it is generally set to the PC for
  synchronous signals, but that it can be set to the the address of
  the faulting memory reference for some signals including SIGSEGV and
  SIGBUS.  In particular, while SIGSEGV generally sets si_addr to the
  faulting memory reference, SIGBUS can vary.  On some platforms, some
  SIGBUS signals set si_addr to the PC and other SIGBUS signals set
  si_addr to the faulting address depending on the specific hardware
  exception.

- For si_trapno, synchronous signals should set this to some value.

Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D25777
2020-07-28 17:09:15 +00:00
Ruslan Bukin
ea4c01156a o Move the buswide_ctxs bitmap to iommu_unit and rename related functions.
o Rename bus_dma_dmar_load_ident() as well.

Reviewed by:	kib
Sponsored by:	DARPA/AFRL
Differential Revision:	https://reviews.freebsd.org/D25852
2020-07-28 16:08:14 +00:00