]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoAdd a few macroses for conversion between DMAR unit, domain, ctx
Ruslan Bukin [Tue, 4 Aug 2020 20:51:05 +0000 (20:51 +0000)]
Add a few macroses for conversion between DMAR unit, domain, ctx
and IOMMU unit, domain, ctx.

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

3 years agorms: fix typo: bitmamp -> bitmap
Mateusz Guzik [Tue, 4 Aug 2020 20:31:03 +0000 (20:31 +0000)]
rms: fix typo: bitmamp -> bitmap

Reported by: kib

3 years agommccam: Hold the periph during init
Emmanuel Vadot [Tue, 4 Aug 2020 20:04:00 +0000 (20:04 +0000)]
mmccam: Hold the periph during init

We need to sleep during this routine so acquire the cam hold too.

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

3 years agommcam: Use a static length sbuf buffer
Emmanuel Vadot [Tue, 4 Aug 2020 20:02:23 +0000 (20:02 +0000)]
mmcam: Use a static length sbuf buffer

We cannot sleep during cam proto_announce and sbuf sleeps so use
a static length buffer like nvme(4)

Reviewed by: kibab
Differential Revision: https://reviews.freebsd.org/D25949

3 years agommccam: mmc_xpt: We're only interested about losing the device
Emmanuel Vadot [Tue, 4 Aug 2020 20:00:21 +0000 (20:00 +0000)]
mmccam: mmc_xpt: We're only interested about losing the device

Remove all the uneeded printfs

Reviewed by: imp, kibab
Differential Revision: https://reviews.freebsd.org/D25948

3 years agocache: factor away failed vexec handling
Mateusz Guzik [Tue, 4 Aug 2020 19:55:26 +0000 (19:55 +0000)]
cache: factor away failed vexec handling

3 years agocache: assorted tidy ups
Mateusz Guzik [Tue, 4 Aug 2020 19:55:00 +0000 (19:55 +0000)]
cache: assorted tidy ups

3 years agocache: factor away lockless dot lookup and add missing stat + sdt probe
Mateusz Guzik [Tue, 4 Aug 2020 19:54:37 +0000 (19:54 +0000)]
cache: factor away lockless dot lookup and add missing stat + sdt probe

3 years agovfs: add vfs_op_thread_enter/exit _crit variants
Mateusz Guzik [Tue, 4 Aug 2020 19:54:10 +0000 (19:54 +0000)]
vfs: add vfs_op_thread_enter/exit _crit variants

and employ them in the namecache. Eliminates all spurious checks for preemption.

3 years agocache: add missing numcache detrement on insertion failure
Mateusz Guzik [Tue, 4 Aug 2020 19:52:52 +0000 (19:52 +0000)]
cache: add missing numcache detrement on insertion failure

3 years agorms: add a comment explaining performance deficiencies of write locking
Mateusz Guzik [Tue, 4 Aug 2020 19:52:16 +0000 (19:52 +0000)]
rms: add a comment explaining performance deficiencies of write locking

3 years agoImport DTS files for arm, arm64, riscv from Linux 5.8
Emmanuel Vadot [Tue, 4 Aug 2020 19:44:43 +0000 (19:44 +0000)]
Import DTS files for arm, arm64, riscv from Linux 5.8

MFC after: 2 months

3 years agoRemove extra memset() left after r342388.
Alexander Motin [Tue, 4 Aug 2020 19:27:03 +0000 (19:27 +0000)]
Remove extra memset() left after r342388.

This memset() wiped MPI2_FUNCTION_SCSI_TASK_MGMT set by mprsas_alloc_tm(),
that broke target reset on device removal, making later re-insertion into
the same slot impossible, since firmware was still waiting for the driver
to finish with the removed device.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agoImport DTS from Linux 5.8
Emmanuel Vadot [Tue, 4 Aug 2020 19:05:45 +0000 (19:05 +0000)]
Import DTS from Linux 5.8

3 years agoDisable errors for -Wsystem-headers for GCC on aarch64.
John Baldwin [Tue, 4 Aug 2020 18:24:46 +0000 (18:24 +0000)]
Disable errors for -Wsystem-headers for GCC on aarch64.

GCC's own arm_neon.h triggers multiple warnings on both GCC 6 and
GCC 9.

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

3 years agold.bfd requires an explicit emulation for MIPS for ld -r.
John Baldwin [Tue, 4 Aug 2020 18:23:32 +0000 (18:23 +0000)]
ld.bfd requires an explicit emulation for MIPS for ld -r.

Unlike lld, ld.bfd doesn't infer the emulation from the first object
file, but assumes its compiled in default for ld -r.

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

3 years agoDisable errors for -Wredundant-decls for GCC 6+.
John Baldwin [Tue, 4 Aug 2020 18:20:39 +0000 (18:20 +0000)]
Disable errors for -Wredundant-decls for GCC 6+.

GCC triggers warnings for this that clang does not for duplicate
declarations of yylex().

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

3 years agoTurn off errors for -Wmaybe-uninitialized in GCC 6+.
John Baldwin [Tue, 4 Aug 2020 18:19:29 +0000 (18:19 +0000)]
Turn off errors for -Wmaybe-uninitialized in GCC 6+.

Recent changes to <sys/tree.h> trigger this warning and seem like a
false positive.

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

3 years agolinuxkpi: Add time_after32 and time_before32
Emmanuel Vadot [Tue, 4 Aug 2020 15:27:32 +0000 (15:27 +0000)]
linuxkpi: Add time_after32 and time_before32

This compare two 32 bits times

Sponsored by: The FreeBSD Foundation
Reviewed by: kib, hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25700

3 years agolinuxkpi: Add clear_bit_unlock
Emmanuel Vadot [Tue, 4 Aug 2020 15:25:22 +0000 (15:25 +0000)]
linuxkpi: Add clear_bit_unlock

This calls clear_bit and adds a memory barrier.

Sponsored by: The FreeBSD Foundation

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25943

3 years agoRemove an incorrect assertion from in6p_lookup_mcast_ifp().
Mark Johnston [Tue, 4 Aug 2020 15:00:02 +0000 (15:00 +0000)]
Remove an incorrect assertion from in6p_lookup_mcast_ifp().

The socket may be bound to an IPv4-mapped IPv6 address.  However, the
inp address is not relevant to the JOIN_GROUP or LEAVE_GROUP operations.

While here remove an unnecessary check for inp == NULL.

Reported by: syzbot+d01ab3d5e6c1516a393c@syzkaller.appspotmail.com
Reviewed by: hselasky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25888

3 years agoRemove most lingering references to the page lock in comments.
Mark Johnston [Tue, 4 Aug 2020 14:59:43 +0000 (14:59 +0000)]
Remove most lingering references to the page lock in comments.

Finish updating comments to reflect new locking protocols introduced
over the past year.  In particular, vm_page_lock is now effectively
unused.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25868

3 years agoRe-apply r363564.
Emmanuel Vadot [Tue, 4 Aug 2020 14:53:41 +0000 (14:53 +0000)]
Re-apply r363564.

We now have linux/sizes.h in the tree.

3 years agopkgbase: Remove the last users of the FreeBSD-example package
Emmanuel Vadot [Tue, 4 Aug 2020 14:48:45 +0000 (14:48 +0000)]
pkgbase: Remove the last users of the FreeBSD-example package

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D24176

3 years agolinuxkpi: Add nested variant of mutex_lock_interruptible
Emmanuel Vadot [Tue, 4 Aug 2020 14:45:22 +0000 (14:45 +0000)]
linuxkpi: Add nested variant of mutex_lock_interruptible

We don't do anything with the _nesteds variant so just call mutex_lock_interruptible

Sponsoredby: The FreeBSD Foundation
Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25944

3 years agolinuxkpi: Add kref_put_lock
Emmanuel Vadot [Tue, 4 Aug 2020 14:44:16 +0000 (14:44 +0000)]
linuxkpi: Add kref_put_lock

Same as kref_put but in addition to calling the rel function it will
acquire the lock first.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
Differential Revision: https://reviews.freebsd.org/D25942

3 years agolinuxkpi: Add linux/sizes.h
Emmanuel Vadot [Tue, 4 Aug 2020 14:42:38 +0000 (14:42 +0000)]
linuxkpi: Add linux/sizes.h

This file contain some defines for common sizes.

Sponsored-by: The FreeBSD Foundation
Reviewed by: hselasky, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25941

3 years agoRemove free_domain() and uma_zfree_domain().
Mark Johnston [Tue, 4 Aug 2020 13:58:36 +0000 (13:58 +0000)]
Remove free_domain() and uma_zfree_domain().

These functions were introduced before UMA started ensuring that freed
memory gets placed in domain-local caches.  They no longer serve any
purpose since UMA now provides their functionality by default.  Remove
them to simplyify the kernel memory allocator interfaces a bit.

Reviewed by: cem, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25937

3 years agoiovctl.conf(5): Use Lk macro for the URL of the UCL website
Gordon Bergling [Tue, 4 Aug 2020 11:13:13 +0000 (11:13 +0000)]
iovctl.conf(5): Use Lk macro for the URL of the UCL website

PR: 248334
Reported by: chuck at tuffli dot net
Reviewed by: bcr, 0mp
Approved by: bcr, 0mp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25891

3 years agodirectory(3): Add an ERRORS section
Gordon Bergling [Tue, 4 Aug 2020 08:46:28 +0000 (08:46 +0000)]
directory(3): Add an ERRORS section

- Add an ERRORS section for opendir(3) and closedir(3)
- Document also the errors of readdir(3), readdir_r(3) and telldir(3)
- Convert the code sample into an EXAMPLES section

PR: 75711

Submitted by: abc <abc at ai1 dot anchorage dot mtaonline dot net>
Reviewed by: 0mp, bcr, jilles
Approved by: 0mp, bcr, jilles
Obtained from: partial from OpenBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25892

3 years agoEnsure libregex is built in time for googletest
Kyle Evans [Tue, 4 Aug 2020 03:43:28 +0000 (03:43 +0000)]
Ensure libregex is built in time for googletest

In lib/Makefile, we document the dependency with SUBDIR_DEPEND

For buildworld orchestration, just prebuild libregex if GOOGLETEST is
enabled. googletest will get built in a later pass.

3 years agobsdgrep: switch to libregex for GNU_GREP_COMPAT
Kyle Evans [Tue, 4 Aug 2020 02:47:24 +0000 (02:47 +0000)]
bsdgrep: switch to libregex for GNU_GREP_COMPAT

libregex is incomplete, but it's a bit less buggy than the in-base
libgnuregex and mostly OK.

While here, rename -DIWTH_GNU -> -DWITH_GNU_COMPAT; the option implies
that we're compatible with the GNU counterpart, not that we're including GNU
anything.

3 years agoRe-enable disabled googletest-port-test tests after r363820
Kyle Evans [Tue, 4 Aug 2020 02:20:15 +0000 (02:20 +0000)]
Re-enable disabled googletest-port-test tests after r363820

gtest now links against libregex here, and the tests pass locally.

PR: 248452

3 years agogtest: link against libregex for GNU extensions
Kyle Evans [Tue, 4 Aug 2020 02:18:24 +0000 (02:18 +0000)]
gtest: link against libregex for GNU extensions

gtest tests want to use \w ([[:alnum:]]) at the very least, which was
causing them to fail after r363679.

Start linking against libregex so that this shorthand is implemented.

PR: 248452

3 years agolibregex: disable some of the unimplemented test cases for now
Kyle Evans [Tue, 4 Aug 2020 02:16:43 +0000 (02:16 +0000)]
libregex: disable some of the unimplemented test cases for now

This should allow the tests to actually pass. Future work will uncomment the
unimplemented tests as they're implemented.

3 years agolibregex: Implement a subset of the GNU extensions
Kyle Evans [Tue, 4 Aug 2020 02:14:51 +0000 (02:14 +0000)]
libregex: Implement a subset of the GNU extensions

The entire patch-set is not yet mature enough for commit, but this usable
subset is generally enough for googletest to be happy with and mostly map to
some existing concepts, so they're not as invasive.

The specific changes included here are:

- Branching in BREs with \|
- \w and \W for [[:alnum:]] and [^[:alnum:]] respectively
- \s and \S for [[:space:]] and [^[:space:]] respectively
- Additional quantifiers in BREs, \? and \+ (self-explanatory)

There's some #ifdef'd out work for allowing empty branches as a match-all.
This is a feature that's under assessment... future work will determine
how standard this behavior is and act accordingly.

3 years agoregex(3): belatedly document REG_POSIX from r363734
Kyle Evans [Tue, 4 Aug 2020 02:06:49 +0000 (02:06 +0000)]
regex(3): belatedly document REG_POSIX from r363734

My original patch included this documented, but it appears that I failed to
include the manpage update. Do so now.

3 years agoAdd SOL_LOCAL symbolic constant for unix socket option level.
Konstantin Belousov [Mon, 3 Aug 2020 22:13:02 +0000 (22:13 +0000)]
Add SOL_LOCAL symbolic constant for unix socket option level.

The constant seems to exists on MacOS X >= 10.8.

Requested by: swills
Reviewed by: allanjude, kevans
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25933

3 years agoSome function had the blank lines, others didn't. Most of the ones that didn't
Warner Losh [Mon, 3 Aug 2020 22:12:18 +0000 (22:12 +0000)]
Some function had the blank lines, others didn't. Most of the ones that didn't
were newer, so remove this now-optional blank line everywhere.

3 years agoConnect the tests provided with the new bc and dc
Stefan Eßer [Mon, 3 Aug 2020 20:26:04 +0000 (20:26 +0000)]
Connect the tests provided with the new bc and dc

The tests compare the command output (including of error cases) with the
expected output and exit code.

Not all tests are executed, since some expect to have a known good bc and
dc binary installed and compare results of large amounts of generated data
being processed by both versions to test for regressions.

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