]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoUpgrade to version 3.1.4
Stefan Eßer [Mon, 3 Aug 2020 19:20:26 +0000 (19:20 +0000)]
Upgrade to version 3.1.4

This version omits the printing of a copyright header in interactive mode
and the dc command now exits after execution of the commands passed via -e
or -f instead of switching to interactive mode. To pass further commands
via STDIN when dc has been invoked with -e or -f, add "-f -" to the
parameter list.

3 years agoUpgrade to version 3.1.4
Stefan Eßer [Mon, 3 Aug 2020 19:18:38 +0000 (19:18 +0000)]
Upgrade to version 3.1.4

This version omits the printing of a copyright header in interactive mode
and the dc command now exits after execution of the commands passed via -e
or -f instead of switching to interactive mode. To pass further commands
via STDIN when dc has been invoked with -e or -f, add "-f -" to the
parameter list.

3 years agoImport version 3.1.4
Stefan Eßer [Mon, 3 Aug 2020 18:55:39 +0000 (18:55 +0000)]
Import version 3.1.4

This version makes dc exit after processing all commands passed via -e or -f
instead of waiting for more input on STDIN (add "-f -" to the command line
to emulate the behavior of versionm 3.1.3 and earlier, if desired).

The version and copyright message are no longer printed for interactive
sessions as was the case with the prior implementation in the FreeBSD base
system.

Obtained from: https://git.yzena.com/gavin/bc

3 years agoAllow bootstrapping mtree on Linux systems
Alex Richardson [Mon, 3 Aug 2020 18:08:10 +0000 (18:08 +0000)]
Allow bootstrapping mtree on Linux systems

Linux glibc has a dummy lchmod that always fails and emitting a linker
warning when used. Don't fail the build due to that warning when
bootstrapping by setting LD_FATAL_WARNINGS=no.

Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D25930

3 years agoAllow building setmode.c on Linux/macOS
Alex Richardson [Mon, 3 Aug 2020 18:08:04 +0000 (18:08 +0000)]
Allow building setmode.c on Linux/macOS

We bootstrap this file to allow compiling FreeBSD on Linux systems since
some boostrap tools use setmode(). Unfortunately, glibc's sys/stat.h
declares a non-static getumask() function (which is unimplemented!) and
that conflicts with the local getumask() function. To work around this
simply use a different name here.

Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D25929

3 years agoPass the full CFLAGS to cpp for MKlib_gen.sh.
John Baldwin [Mon, 3 Aug 2020 17:53:15 +0000 (17:53 +0000)]
Pass the full CFLAGS to cpp for MKlib_gen.sh.

GCC's cpp was exiting immediately when it failed to find requested
includes (<ncurses_cfg.h> and <ncurses_defs.h>).  clang-cpp emitted an
error for the missing header files but continued processing the file
(thus not honoring any macros defined in the missing headers).

Arguably, the awk script is buggy since it doesn't check the return
value of the command it executes.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D25731

3 years agoAdd a GPIO driver for the Raspberry Pi firmware GPIOs
Andrew Turner [Mon, 3 Aug 2020 17:18:12 +0000 (17:18 +0000)]
Add a GPIO driver for the Raspberry Pi firmware GPIOs

These exist on the Raspberry Pi 3 and 4 and control and external IO
expander.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25858

3 years agoProvide more correct description for sysctl kern.smp.cores.
Konstantin Belousov [Mon, 3 Aug 2020 17:17:17 +0000 (17:17 +0000)]
Provide more correct description for sysctl kern.smp.cores.

Reported by: dewayne@heuristicsystems.com.au
PR: 248454
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoAllow the Raspberry Pi firmware driver to be a bus
Andrew Turner [Mon, 3 Aug 2020 16:43:40 +0000 (16:43 +0000)]
Allow the Raspberry Pi firmware driver to be a bus

There are child nodes in the device tree, e.g. the Raspberry Pi firmware
GPIO device. Add support for this to be a bus so we can attach these
children.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25848

3 years agoAllow child classes of simplebus to call attach directly
Andrew Turner [Mon, 3 Aug 2020 16:26:10 +0000 (16:26 +0000)]
Allow child classes of simplebus to call attach directly

Reduce code duplication when a bus is subclassed from simplebus by allowing
them to call simplebus_attach directly. This is useful when the child bus
will just implement the same calls.

As not all children will expect to have a ranges property, e.g. the
Raspberry Pi firmware, allow this property to be missing.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25925

3 years agoDo not mention portsnap(8) in ports.7
Mateusz Piotrowski [Mon, 3 Aug 2020 13:12:07 +0000 (13:12 +0000)]
Do not mention portsnap(8) in ports.7

As we are moving away from portsnap,
let's not recommend it in the manual page.

Reviewed by: bcr (manpages), mat (portmgr)
Differential Revision: https://reviews.freebsd.org/D25847

3 years agoDisable tests failing after r363679
Li-Wen Hsu [Mon, 3 Aug 2020 12:51:14 +0000 (12:51 +0000)]
Disable tests failing after r363679

PR: 248452
Sponsored by: The FreeBSD Foundation

3 years agolibc: Provide sub fp(s|g)etmask() implementations for RISC-V
Kristof Provost [Mon, 3 Aug 2020 12:48:51 +0000 (12:48 +0000)]
libc: Provide sub fp(s|g)etmask() implementations for RISC-V

RISC-V doesn't support floating-point exceptions.

RISC-V Instruction Set Manual: Volume I: User-Level ISA, 11.2 Floating-Point
Control and Status Register: "As allowed by the standard, we do not support
traps on floating-point exceptions in the base ISA, but instead require
explicit checks of the flags in software. We considered adding branches
controlled directly by the contents of the floating-point accrued exception
flags, but ultimately chose to omit these instructions to keep the ISA simple."

We still need these functions, because some applications (notably Perl) call
them, but we cannot provide a meaningful implementation.

Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D25740

3 years agoHandle Raspberry Pi 4 xhci firmware loading.
Andrew Turner [Mon, 3 Aug 2020 10:19:50 +0000 (10:19 +0000)]
Handle Raspberry Pi 4 xhci firmware loading.

The newer hardware revisions of the Raspberry Pi 4 removed the ability of
the VIA VL805 xhci controller to load its own firmware. Instead the
firmware must be installed at the appropriate time by the VideoCore
coprocessor.

Submitted by: Robert Crowston <crowston_protonmail.com>
Differential Revision: https://reviews.freebsd.org/D25261

3 years agovt(4): CONS_HISTORY/CONS_CLRHIST should operate on issuing terminal
Jason A. Harmening [Sun, 2 Aug 2020 20:18:37 +0000 (20:18 +0000)]
vt(4): CONS_HISTORY/CONS_CLRHIST should operate on issuing terminal

Currently the CONS_HISTORY and CONS_CLRHIST ioctls modify the state of the
active terminal instead of the terminal against which the ioctl was issued.
Because of the way vidcontrol(1) works, these are the same in most cases.
But a poorly-timed window switch can make them differ. This is reproducible
by issuing e.g. 'vidcontrol -s 2 && vidcontrol -C' to switch from vty 1 to
vty 2; teken will reset the cursor position on vty 1 but vt(4) will clear
the history buffer of vty 2, producing an interesting state of affairs.

Differential Revision: https://reviews.freebsd.org/D25564

3 years agoBump __FreeBSD_version after vnode layout changes
Mateusz Guzik [Sun, 2 Aug 2020 20:03:23 +0000 (20:03 +0000)]
Bump __FreeBSD_version after vnode layout changes

3 years agovfs: store precomputed namecache hash in the vnode
Mateusz Guzik [Sun, 2 Aug 2020 20:02:06 +0000 (20:02 +0000)]
vfs: store precomputed namecache hash in the vnode

This significantly speeds up path lookup, Cascade Lake doing access(2) on ufs
on /usr/obj/usr/src/amd64.amd64/sys/GENERIC/vnode_if.c, ops/s:
before: 2535298
after: 2797621

Over +10%.

The reversed order of computation here does not seem to matter for hash
distribution.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25921

3 years agovfs: shorten v_iflag and v_vflag
Mateusz Guzik [Sun, 2 Aug 2020 20:00:43 +0000 (20:00 +0000)]
vfs: shorten v_iflag and v_vflag

While here renumber VI_* flags to remove the gaps.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25921

3 years agovfs: move namecache initialisation into cache_vnode_init
Mateusz Guzik [Sun, 2 Aug 2020 19:42:06 +0000 (19:42 +0000)]
vfs: move namecache initialisation into cache_vnode_init

3 years agocore(5) appeared in Version 1 AT&T UNIX
Mateusz Piotrowski [Sun, 2 Aug 2020 16:59:14 +0000 (16:59 +0000)]
core(5) appeared in Version 1 AT&T UNIX

Based on the scans of manual pages available at
https://www.bell-labs.com/usr/dmr/www/man51.pdf,
which are a part of the following collection:
https://www.bell-labs.com/usr/dmr/www/1stEdman.html.

Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D25849

3 years agoDocument automatic handling of font height for BDF files
Mateusz Piotrowski [Sun, 2 Aug 2020 16:41:36 +0000 (16:41 +0000)]
Document automatic handling of font height for BDF files

PR: 248395
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>
Reviewed by: bcr, emaste, tsoome
Differential Revision: https://reviews.freebsd.org/D25907

3 years agoUnlocked getblk: Fix new false-positive assertion
Conrad Meyer [Sun, 2 Aug 2020 16:34:27 +0000 (16:34 +0000)]
Unlocked getblk: Fix new false-positive assertion

A free buf's lock may be held (temporarily) due to unlocked lookup, so
buf_alloc() must acquire it without LK_NOWAIT.  The unlocked getblk path
should unlock it promptly once it realizes the identity does not match
the buffer it was searching for.

Reported by: gallatin
Reviewed by: kib
Tested by: pho
X-MFC-With: r363482
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D25914

3 years agocred: add more asserts for td_realucred == td_ucred
Mateusz Guzik [Sat, 1 Aug 2020 16:02:32 +0000 (16:02 +0000)]
cred: add more asserts for td_realucred == td_ucred

3 years agoFix TX csum handling in if_mvneta
Marcin Wojtas [Sat, 1 Aug 2020 09:40:19 +0000 (09:40 +0000)]
Fix TX csum handling in if_mvneta

The mvneta device requires MVNETA_TX_CMD_L4_CHECKSUM_NONE bit to be set in the tx descriptor is checksum not required. However, mvneta_tx_set_csumflag() is not setting this flag currently, causing the hardware to randomly corrupt IP header during transmission.

This affects injected IPv4 packets that skips kernel IP stack processing (e.g. DHCP), as well as all IPv6 packets, since the driver currently does not offload csum for IPv6.

The fix is to remove all the early return paths from mvneta_tx_set_csumflag() which do not set the MVNETA_TX_CMD_L4_CHECKSUM_NONE flag.

PR: 248306
Submitted by: Mike Cui <cuicui@gmail.com>
Reported by: Mike Cui <cuicui@gmail.com>

3 years agoAdd missing dependency for cpsw module.
Michal Meloun [Sat, 1 Aug 2020 09:06:16 +0000 (09:06 +0000)]
Add missing dependency for cpsw module.

Reported by: mjg
MFC with: r363700

3 years agoBump __FreeBSD_version after making rights mandatory for NDINIT_ALL
Mateusz Guzik [Sat, 1 Aug 2020 06:37:26 +0000 (06:37 +0000)]
Bump __FreeBSD_version after making rights mandatory for NDINIT_ALL

3 years agocache: reshuffle struct cache_fpl and nameidata_saved
Mateusz Guzik [Sat, 1 Aug 2020 06:35:18 +0000 (06:35 +0000)]
cache: reshuffle struct cache_fpl and nameidata_saved

Shaves 16 bytes.

3 years agocache: mark climb_mount as __noinline
Mateusz Guzik [Sat, 1 Aug 2020 06:34:18 +0000 (06:34 +0000)]
cache: mark climb_mount as __noinline

3 years agovfs: inline NDINIT_ALL
Mateusz Guzik [Sat, 1 Aug 2020 06:33:38 +0000 (06:33 +0000)]
vfs: inline NDINIT_ALL

The routine takes more than 6 arguments, which on amd64 means some of
them have to be passed through the stack.

3 years agovfs: convert ni_rigthsneeded to a pointer
Mateusz Guzik [Sat, 1 Aug 2020 06:33:11 +0000 (06:33 +0000)]
vfs: convert ni_rigthsneeded to a pointer

Shaves 8 bytes of struct nameidata on 64-bit platforms.

3 years agovfs: make rights mandatory for NDINIT_ALL
Mateusz Guzik [Sat, 1 Aug 2020 06:32:25 +0000 (06:32 +0000)]
vfs: make rights mandatory for NDINIT_ALL

3 years agocapsicum: move global caps to caprights.h
Mateusz Guzik [Sat, 1 Aug 2020 06:31:58 +0000 (06:31 +0000)]
capsicum: move global caps to caprights.h

.. for easier inclusion

3 years agoMirror recommendation from Handbook to avoid linking conflicts when
Gregory Neil Shapiro [Sat, 1 Aug 2020 04:57:30 +0000 (04:57 +0000)]
Mirror recommendation from Handbook to avoid linking conflicts when
pulling in SASL libraries.

PR: 247959
Reported by: Scott Allendorf
MFC after: 3 days

3 years agoAdd optional support for ext_pgs mbufs to the NFS server's read, readlink
Rick Macklem [Fri, 31 Jul 2020 23:35:49 +0000 (23:35 +0000)]
Add optional support for ext_pgs mbufs to the NFS server's read, readlink
and getxattr operations.

This patch optionally enables generation of read, readlink and getxattr replies
in ext_pgs mbufs.  Since neither of ND_EXTPG or ND_TLS are currently ever set,
there is no change in semantics at this time.
It also corrects the message in a couple of panic()s that should never occur.

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.

3 years agoAdd iommu_domain_map_ops virtual table with map/unmap methods
Ruslan Bukin [Fri, 31 Jul 2020 23:02:17 +0000 (23:02 +0000)]
Add iommu_domain_map_ops virtual table with map/unmap methods
so x86 can support Intel DMAR and AMD IOMMU simultaneously.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25894

3 years agoFix compilation error for install.c in loader
Stephen J. Kiernan [Fri, 31 Jul 2020 16:08:25 +0000 (16:08 +0000)]
Fix compilation error for install.c in loader

Fix typo in interp_include() invocation (missing 'p')
Remove setting tftpip, as servip is used by the tftp code in libsa. There
is no separate tftpip global variable any more.

Obtained from: Juniper Networks, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25897

3 years agoPoint to rc(8) for more details about the autoboot variable
Mateusz Piotrowski [Fri, 31 Jul 2020 14:13:26 +0000 (14:13 +0000)]
Point to rc(8) for more details about the autoboot variable

Reviewed by: bcr, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25904

3 years agong_iface(4): Remove unsupported protocols.
Mark Johnston [Fri, 31 Jul 2020 14:08:54 +0000 (14:08 +0000)]
ng_iface(4): Remove unsupported protocols.

Update the ng_iface documentation and hooks to reflect the fact that the
node currently only supports IPv4 and v6 packets.

Reviewed by: Lutz Donnerhacke
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25862

3 years agong_iface(4): Set the current VNET before calling netisr_dispatch().
Mark Johnston [Fri, 31 Jul 2020 14:08:32 +0000 (14:08 +0000)]
ng_iface(4): Set the current VNET before calling netisr_dispatch().

This is normally handled by a netgraph thread, but netgraph messages may
be dispatched directly to a node, in which case no VNET is set before
ng_iface calls into the network stack.  Netgraph could probably handle
this more generally, but for now just be sure to set the current VNET in
ng_iface.

PR: 242406
Tested by: Michael Muenz <m.muenz@gmail.com>
Reviewed by: Lutz Donnerhacke
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25788

3 years ago<regex.h>: reserve a regcomp field for REG_POSIX
Kyle Evans [Fri, 31 Jul 2020 12:40:31 +0000 (12:40 +0000)]
<regex.h>: reserve a regcomp field for REG_POSIX

For libc regcomp, this will be a nop. libregex will take this to mean that
it needs to turn off GNU extensions, effectively switching it back to the
POSIX-compliant libc implementation at runtime.

3 years agoReplace magic numbers in Identify page register 0 with ATA definitions.
Peter Grehan [Fri, 31 Jul 2020 12:10:28 +0000 (12:10 +0000)]
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

3 years agoInclude virtio support in std.MALTA
Alex Richardson [Fri, 31 Jul 2020 11:28:09 +0000 (11:28 +0000)]
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

3 years agoThe recent changes to move the ref count increment
Randall Stewart [Fri, 31 Jul 2020 10:03:32 +0000 (10:03 +0000)]
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

3 years agoUPDATING: Add a note about running installworld twice
Kyle Evans [Fri, 31 Jul 2020 02:21:19 +0000 (02:21 +0000)]
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.

3 years agogetblk: Remove a non-sensical LK_NOWAIT | LK_SLEEPFAIL
Conrad Meyer [Fri, 31 Jul 2020 00:13:40 +0000 (00:13 +0000)]
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

3 years agogetblk: Avoid sleeping on wrong buf in lockless path
Conrad Meyer [Fri, 31 Jul 2020 00:07:01 +0000 (00:07 +0000)]
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

3 years agoImport PCG-C into sys/contrib
Conrad Meyer [Thu, 30 Jul 2020 23:54:25 +0000 (23:54 +0000)]
Import PCG-C into sys/contrib

The intended (future) use is to provide fast pseudo-random numbers in non-
cryptographic applications.

3 years agoDefinition for the 'removable media flag' from word 0 in the Identify page.
Peter Grehan [Thu, 30 Jul 2020 23:49:49 +0000 (23:49 +0000)]
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

3 years agoImport PCG-C master, 2019-07-18 (83252d9c23df9c82ecb42210afed61a7b42402d7)
Conrad Meyer [Thu, 30 Jul 2020 23:17:30 +0000 (23:17 +0000)]
Import PCG-C master, 2019-07-18 (83252d9c23df9c82ecb42210afed61a7b42402d7)

3 years agoFix tinderbox build after r363714
Mateusz Guzik [Thu, 30 Jul 2020 22:56:57 +0000 (22:56 +0000)]
Fix tinderbox build after r363714

3 years agocache: drop the useless numchecks counter
Mateusz Guzik [Thu, 30 Jul 2020 22:52:18 +0000 (22:52 +0000)]
cache: drop the useless numchecks counter

3 years agoFurther depessimize priv_check_cred_vfs_generation
Mateusz Guzik [Thu, 30 Jul 2020 22:14:04 +0000 (22:14 +0000)]
Further depessimize priv_check_cred_vfs_generation

3 years agofd: predict in fdrop
Mateusz Guzik [Thu, 30 Jul 2020 22:13:15 +0000 (22:13 +0000)]
fd: predict in fdrop

3 years agoip6_output(): Check the return value of in6_getlinkifnet().
Mark Johnston [Thu, 30 Jul 2020 17:43:23 +0000 (17:43 +0000)]
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

3 years agovfs: inline vops if there are no pre/post associated calls
Mateusz Guzik [Thu, 30 Jul 2020 15:50:51 +0000 (15:50 +0000)]
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

3 years agovfs: fold poll_no_poll into vop_nopoll
Mateusz Guzik [Thu, 30 Jul 2020 15:48:56 +0000 (15:48 +0000)]
vfs: fold poll_no_poll into vop_nopoll

The logic was almost completely present in vop_stdpoll anyway.

3 years agovfs: short-circuit the common case NDFREE calls
Mateusz Guzik [Thu, 30 Jul 2020 15:47:41 +0000 (15:47 +0000)]
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.

3 years agovfs: add support for WANTPARENT and LOCKPARENT to lockless lookup
Mateusz Guzik [Thu, 30 Jul 2020 15:45:11 +0000 (15:45 +0000)]
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

3 years agovfs: support negative entry promotion in lockless lookup
Mateusz Guzik [Thu, 30 Jul 2020 15:44:10 +0000 (15:44 +0000)]
vfs: support negative entry promotion in lockless lookup

Tested by: pho

3 years agovfs: add NOMACCHECK and AUDITVNODE2 to lockless lookup
Mateusz Guzik [Thu, 30 Jul 2020 15:43:16 +0000 (15:43 +0000)]
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

3 years agoMove Ti AM335x to dev/extres/clk framework.
Michal Meloun [Thu, 30 Jul 2020 14:45:05 +0000 (14:45 +0000)]
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

3 years agosed: fix hex_subst test after after r363679
Kyle Evans [Thu, 30 Jul 2020 13:36:24 +0000 (13:36 +0000)]
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.

3 years agodiff: fix side_by_side after r363679
Kyle Evans [Thu, 30 Jul 2020 13:33:45 +0000 (13:33 +0000)]
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

3 years agoPrevent framebuffer mmio space from being allocated to other devices on HyperV.
Wei Hu [Thu, 30 Jul 2020 07:26:11 +0000 (07:26 +0000)]
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

3 years agovfs: make sure startdir_used is always assigned to before use
Mateusz Guzik [Thu, 30 Jul 2020 07:11:08 +0000 (07:11 +0000)]
vfs: make sure startdir_used is always assigned to before use

CID: 1431070

3 years agoremove some long abandonded serial drivers (cy, rc, rp) since 2008
John-Mark Gurney [Thu, 30 Jul 2020 00:53:56 +0000 (00:53 +0000)]
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

3 years agoFix a logic error in uipc_ready_scan().
Mark Johnston [Thu, 30 Jul 2020 00:52:37 +0000 (00:52 +0000)]
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

3 years agoUPDATING / RELNOTES: Document new regcomp(3) behavior
Kyle Evans [Wed, 29 Jul 2020 23:59:35 +0000 (23:59 +0000)]
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.

3 years agoProperly handle a closed TLS socket with pending receive data.
John Baldwin [Wed, 29 Jul 2020 23:24:32 +0000 (23:24 +0000)]
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

3 years agoregex(3): Interpret many escaped ordinary characters as EESCAPE
Kyle Evans [Wed, 29 Jul 2020 23:21:56 +0000 (23:21 +0000)]
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

3 years agoAdd support for ext_pgs mbufs to nfsrvd_readdir() and nfsrvd_readdirplus().
Rick Macklem [Wed, 29 Jul 2020 22:58:08 +0000 (22:58 +0000)]
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.

3 years agoo Don't include headers from iommu.h, include them from the header
Ruslan Bukin [Wed, 29 Jul 2020 22:08:54 +0000 (22:08 +0000)]
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

3 years agoadd link to crypto(7) page, and drop a link to unrelated crypt(3) page..
John-Mark Gurney [Wed, 29 Jul 2020 21:15:06 +0000 (21:15 +0000)]
add link to crypto(7) page, and drop a link to unrelated crypt(3) page..

3 years agoRemove the volatile qualifier from busy_lock.
Mark Johnston [Wed, 29 Jul 2020 19:38:49 +0000 (19:38 +0000)]
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

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
Cy Schubert [Wed, 29 Jul 2020 19:36:24 +0000 (19:36 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 1 week

3 years agoFix !ACPI_DMAR build.
Ruslan Bukin [Wed, 29 Jul 2020 19:22:50 +0000 (19:22 +0000)]
Fix !ACPI_DMAR build.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25882

3 years agovfs: elide MAC-induced locking on rename if there are no relevant hoooks
Mateusz Guzik [Wed, 29 Jul 2020 17:05:31 +0000 (17:05 +0000)]
vfs: elide MAC-induced locking on rename if there are no relevant hoooks

3 years agovfs: honor error code returned by mac_vnode_check_rename_from
Mateusz Guzik [Wed, 29 Jul 2020 17:04:33 +0000 (17:04 +0000)]
vfs: honor error code returned by mac_vnode_check_rename_from

MFC after: 3 days

3 years agoFix build.
Ruslan Bukin [Wed, 29 Jul 2020 15:46:17 +0000 (15:46 +0000)]
Fix build.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25879

3 years agoo Move iommu_set_buswide_ctx, iommu_is_buswide_ctx to
Ruslan Bukin [Wed, 29 Jul 2020 13:23:27 +0000 (13:23 +0000)]
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

3 years agoAdd my entry to the calendar file
Daniel Ebdrup Jensen [Wed, 29 Jul 2020 11:19:57 +0000 (11:19 +0000)]
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

3 years agoOutline mentorship
Daniel Ebdrup Jensen [Wed, 29 Jul 2020 11:17:44 +0000 (11:17 +0000)]
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

3 years agoOnly try managing the regulator when EXT_RESOURCES is defined
Andrew Turner [Wed, 29 Jul 2020 08:24:40 +0000 (08:24 +0000)]
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

3 years agoAdd myself (rew) as src committer.
Robert Wing [Wed, 29 Jul 2020 05:27:19 +0000 (05:27 +0000)]
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

3 years agosshd: allow UseBlocklist alias for UseBlacklist
Ed Maste [Wed, 29 Jul 2020 00:34:24 +0000 (00:34 +0000)]
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

3 years agoWhen modifying LUN pass "special" options too.
Alexander Motin [Tue, 28 Jul 2020 22:32:50 +0000 (22:32 +0000)]
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.

3 years agoFixup some incorrect information and some comments. These changes
Christian S.J. Peron [Tue, 28 Jul 2020 20:06:16 +0000 (20:06 +0000)]
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

3 years agovm_page_xbusy_claim(): Use atomics to update busy lock state.
Mark Johnston [Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)]
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

3 years agoAdd further clarification on si_addr and si_trapno.
John Baldwin [Tue, 28 Jul 2020 17:09:15 +0000 (17:09 +0000)]
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

3 years agoo Move the buswide_ctxs bitmap to iommu_unit and rename related functions.
Ruslan Bukin [Tue, 28 Jul 2020 16:08:14 +0000 (16:08 +0000)]
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

3 years agops(1): Fix formatting of the "command" field for kernel threads.
Mark Johnston [Tue, 28 Jul 2020 15:26:19 +0000 (15:26 +0000)]
ps(1): Fix formatting of the "command" field for kernel threads.

When -H is specified, for kernel threads the command is formatted as
"<proc name>/<td name>" and truncated to MAXCOMLEN.  But each of the
proc name and td name may be up to MAXCOMLEN bytes in length.

Also handle the ki_moretdname field to ensure that the full thread name
gets printed.  This is already handled correctly when formatting for
"-o tdname".

Reported by: freqlabs
Reviewed by: freqlabs
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25840

3 years agoAdd a workaround for a bug when setting the Raspberry GIO config and state
Andrew Turner [Tue, 28 Jul 2020 11:32:45 +0000 (11:32 +0000)]
Add a workaround for a bug when setting the Raspberry GIO config and state

The Raspberry Pi GPIO config and state messages incorrectly return with
the tag length set to 0. We then check this value to have the response
flag set. Work around this by setting the response flag when setting the
GPIO config or state and this value is zero.

Sponsored by: Innovate UK

3 years agovirtio: fix mips regression introduced by r357596
Alfredo Dal'Ava Junior [Tue, 28 Jul 2020 11:23:37 +0000 (11:23 +0000)]
virtio: fix mips regression introduced by r357596

PowerPC support was fixed in r357596 by changing PCI bustag to BE as
part of the solution, but this caused regression on mips. This change
implements byte swapping of virtio PCI config area in the driver,
leaving lower layer untouched.

Submittnd by: Fernando Valle <fernando.valle@eldorado.org.br>
Reported by: arichardson
Reviewed by: alfredo, arichardson
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D25416

3 years agoAadd Raspberry Pi firmware messages to manage GPIOs
Andrew Turner [Tue, 28 Jul 2020 11:13:37 +0000 (11:13 +0000)]
Aadd Raspberry Pi firmware messages to manage GPIOs

Some GPIOs are managed by an external IO expaandder through the firmware.
Add the message details for these.

Sponsored by: Innovate UK

3 years ago- Cleanups related to sparc64 removal.
Yoshihiro Takahashi [Tue, 28 Jul 2020 10:58:37 +0000 (10:58 +0000)]
- Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D25831

3 years agoSwitch the bcm2835 cpufreq driver to use the firmware interface
Andrew Turner [Tue, 28 Jul 2020 10:45:29 +0000 (10:45 +0000)]
Switch the bcm2835 cpufreq driver to use the firmware interface

Use the new Raspberry Pi firmware driver in the cpufreq driver. It is
intended all drivers that need to interact with the firmware will move to
use the firmware driver, this is the first.

Reviewed by: manu
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25609

3 years agoMove the bcm2835 firmware driver earlier in the boot.
Andrew Turner [Tue, 28 Jul 2020 10:43:52 +0000 (10:43 +0000)]
Move the bcm2835 firmware driver earlier in the boot.

It will be needed by other eaarly drivers.

While here make the dependency of the mailbox formal with MODULE_DEPEND.

Reviewed by: manu
Sponsored by: Innovate UK

3 years agoRevert r363639 so I can use a more correct commit message
Andrew Turner [Tue, 28 Jul 2020 10:41:43 +0000 (10:41 +0000)]
Revert r363639 so I can use a more correct commit message

3 years agoMove the bcm2835 mailbox driver earlier in the boot
Andrew Turner [Tue, 28 Jul 2020 10:40:00 +0000 (10:40 +0000)]
Move the bcm2835 mailbox driver earlier in the boot

This will be needed before the firmware driver is loaded

3 years agoHave the bcm2835 firmware driver depend on the mailbox driver
Andrew Turner [Tue, 28 Jul 2020 10:37:58 +0000 (10:37 +0000)]
Have the bcm2835 firmware driver depend on the mailbox driver

The firmware driver uses the mailbox driver to communicate with the
firmware. Make this a more formal dependency.

Reviewed by: manu
Sponsored by: Innovate UK