]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoEnsure that dirent's d_off field is initialized
Mark Johnston [Sun, 3 Jan 2021 16:32:30 +0000 (11:32 -0500)]
Ensure that dirent's d_off field is initialized

We have the d_off field in struct dirent for providing the seek offset
of the next directory entry.  Several filesystems were not initializing
the field, which ends up being copied out to userland.

Reported by: Syed Faraz Abrar <faraz@elttam.com>
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27792

3 years agouma: Avoid unmapping direct-mapped slabs
Mark Johnston [Sun, 3 Jan 2021 16:31:00 +0000 (11:31 -0500)]
uma: Avoid unmapping direct-mapped slabs

startup_alloc() uses pmap_map() to map slabs used for bootstrapping the
VM.  pmap_map() may ignore the hint address and simply return a range
from the direct map.  In this case we must not unmap the range in
startup_free().

UMA uses bootstart and bootmem to track the range of KVA into which
slabs are mapped if the direct map is not used.  Unmap a startup slab
only if it was mapped into that range.

Reported by: alc
Reviewed by: alc, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27885

3 years agoAdd old bsdgrep aliases to ObsoleteFiles.inc
Dimitry Andric [Sun, 3 Jan 2021 16:43:20 +0000 (17:43 +0100)]
Add old bsdgrep aliases to ObsoleteFiles.inc

After 8aff76fb37b58a74832831ac1c54a013a64b35e7 there is only one grep,
so the bsdgrep binary and man page aliases can be cleaned up.

3 years agobhyve: fix build without casper/capsicum support
Mariusz Zaborski [Sun, 3 Jan 2021 16:18:22 +0000 (17:18 +0100)]
bhyve: fix build without casper/capsicum support

PR: 252353

3 years agofusefs: only check vnode locks with DEBUG_VFS_LOCKS
Alan Somers [Fri, 1 Jan 2021 21:27:03 +0000 (14:27 -0700)]
fusefs: only check vnode locks with DEBUG_VFS_LOCKS

MFC-With: 37df9d3bba8577fcdd63382ff5a4a5cbb4aa55b4
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27939

3 years agoFix a vnode locking bug in fuse_vnop_advlock.
Alan Somers [Wed, 30 Dec 2020 23:50:35 +0000 (16:50 -0700)]
Fix a vnode locking bug in fuse_vnop_advlock.

Must lock the vnode before accessing the fufh table.  Also, check for
invalid parameters earlier.  Bug introduced by r346170.

MFC after: 2 weeks

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27936

3 years agocap_net: CAPNET_CONNECT and CAPNET_CONNECTDNS are not mutually exclusive
Mariusz Zaborski [Sun, 3 Jan 2021 16:10:35 +0000 (17:10 +0100)]
cap_net: CAPNET_CONNECT and CAPNET_CONNECTDNS are not mutually exclusive

Fix the for the CAPNET_CONNECT and CAPNET_CONNECTDNS.
Add test to ensure that this is possible.

3 years agocap_net: allow to use the service without setting the limits
Mariusz Zaborski [Sun, 3 Jan 2021 16:09:20 +0000 (17:09 +0100)]
cap_net: allow to use the service without setting the limits

Add test to ensure that this is possible.

3 years agocapser: add cap_net to the list of services
Mariusz Zaborski [Sun, 3 Jan 2021 15:55:35 +0000 (16:55 +0100)]
capser: add cap_net to the list of services

3 years agozstd: Fix non-FreeBSD CI libzstd build
Conrad Meyer [Sun, 3 Jan 2021 15:39:12 +0000 (07:39 -0800)]
zstd: Fix non-FreeBSD CI libzstd build

Fix non-FreeBSD CI build after v1.4.8.  This definition was only used in
zstd(1), which isn't part of non-FreeBSD CI (I guess).  The ifdef was
added in v1.4.5 import.

Upstream does not currently support shared-linked zstd(1), but I have
proposed https://github.com/facebook/zstd/pull/2450 .  If that is
adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and
drop some diffs.

Reported by: uqs

3 years agoUpdate contrib/llvm-project/FREEBSD-Xlist for llvmorg-11.0.1-rc2.
Dimitry Andric [Sun, 3 Jan 2021 13:21:54 +0000 (14:21 +0100)]
Update contrib/llvm-project/FREEBSD-Xlist for llvmorg-11.0.1-rc2.

MFC after: 4 weeks
X-MFC-With: r364284

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Sun, 3 Jan 2021 12:54:24 +0000 (13:54 +0100)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.1-rc2-0-g43ff75f2c3f (aka 11.0.1 rc2).

MFC after: 4 weeks
X-MFC-With: r364284

3 years agovfs: denote vnode being a mount point with VIRF_MOUNTPOINT
Mateusz Guzik [Fri, 1 Jan 2021 03:10:12 +0000 (04:10 +0100)]
vfs: denote vnode being a mount point with VIRF_MOUNTPOINT

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D27794

3 years agovfs: add v_irflag accessors
Mateusz Guzik [Mon, 28 Dec 2020 03:01:15 +0000 (03:01 +0000)]
vfs: add v_irflag accessors

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D27793

3 years agocache: stop checkpointing cn_namelen
Mateusz Guzik [Fri, 1 Jan 2021 13:45:06 +0000 (14:45 +0100)]
cache: stop checkpointing cn_namelen

The variable is recomputed by regular lookup from the get go.

3 years agocache: predict on no spurious slashes in cache_fpl_handle_root
Mateusz Guzik [Fri, 1 Jan 2021 02:25:19 +0000 (02:25 +0000)]
cache: predict on no spurious slashes in cache_fpl_handle_root

This is a step towards speculatively not handling them.

3 years agocache: postpone NAME_MAX check as it may be unnecessary
Mateusz Guzik [Thu, 31 Dec 2020 07:28:32 +0000 (08:28 +0100)]
cache: postpone NAME_MAX check as it may be unnecessary

3 years agocache: remove spurious null check in sdt probe
Mateusz Guzik [Thu, 31 Dec 2020 07:22:30 +0000 (08:22 +0100)]
cache: remove spurious null check in sdt probe

3 years agoThe fsck_ffs program had previously only been able to expand the size
Kirk McKusick [Sun, 3 Jan 2021 06:31:55 +0000 (22:31 -0800)]
The fsck_ffs program had previously only been able to expand the size
of its lost+found directory by allocating direct block pointers. The
effect was that it was limited to about 19,000 files. One of Peter Holm's
tests produced a filesystem with about 23,000 lost files which meant
that fsck_ffs was unable to recover it. This update allows lost+found
to be expanded into a single indirect block which allows it to store
up to about 6,573,000 lost files.

Reported by:  Peter Holm
Sponsored by: Netflix

3 years agoRegenerate syscall files after addition of aio_writev/aio_readv
Alan Somers [Sun, 3 Jan 2021 02:57:39 +0000 (19:57 -0700)]
Regenerate syscall files after addition of aio_writev/aio_readv

3 years agoAdd aio_writev and aio_readv
Alan Somers [Sat, 2 Jan 2021 23:34:20 +0000 (16:34 -0700)]
Add aio_writev and aio_readv

POSIX AIO is great, but it lacks vectored I/O functions. This commit
fixes that shortcoming by adding aio_writev and aio_readv. They aren't
part of the standard, but they're an obvious extension. They work just
like their synchronous equivalents pwritev and preadv.

It isn't yet possible to use vectored aiocbs with lio_listio, but that
could be added in the future.

Reviewed by:    jhb, kib, bcr
Relnotes:       yes
Differential Revision: https://reviews.freebsd.org/D27743

3 years agoarm: fix atomic_testand{set,clear}_64 for ops on high bits
Ryan Libby [Sun, 3 Jan 2021 02:09:37 +0000 (18:09 -0800)]
arm: fix atomic_testand{set,clear}_64 for ops on high bits

The fix in bd03acedb804add1e22178d50eb2bfb703974ddf worked for 32-bit
ops, and for 64-bit ops for bit arguments of 0 - 95, but then was broken
for operations on the high 32 bits after that.

Reviewed by: markj, mmel
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27897

3 years agocopy_file_range(2): add recommendation to use large "len"
Rick Macklem [Sun, 3 Jan 2021 01:21:21 +0000 (17:21 -0800)]
copy_file_range(2): add recommendation to use large "len"

PR#252358 reported a serious performance problem w.r.t.
cp(1) when copying large non-sparse files.
This problem appears to have been caused by cp(1)
calling copy_file_range(2) with a small "len" argument.

This patch adds a recommendation to use a large "len"
value where possible, for performance reasons.

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D27935

3 years agocp(1): fix performance issue for large non-sparse file copies
Rick Macklem [Sun, 3 Jan 2021 00:58:43 +0000 (16:58 -0800)]
cp(1): fix performance issue for large non-sparse file copies

PR252358 reported a serious performance problem when
copying a large non-sparse file on a UFS file system.
This problem seems to have been caused by a large
number of SEEK_HOLE operations, with one done
for each copy_file_range(2) call.

This patch modifies cp(1) to use a large (SSIZE_MAX)
len argument, reducing the number of system calls
and resolving the performance issue.

While here, convert the type of the "rcount" from "int"
to "ssize_t" so that it is consistent with that returned
by both read(2) and copy_file_range(2).

PR: 252358
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D27937

3 years agoGithub actions: s/master/main/ for the CI workflow
Ulrich Spörlein [Sat, 2 Jan 2021 23:08:01 +0000 (00:08 +0100)]
Github actions: s/master/main/ for the CI workflow

3 years agoHandle KDB_WHY_TRAP return on arm and mips
Mitchell Horne [Sat, 2 Jan 2021 23:07:04 +0000 (19:07 -0400)]
Handle KDB_WHY_TRAP return on arm and mips

Upon exit from the debugger, checking the return code of kdb_trap()
allows one to retry the fatal page fault. This matches what is done on
all other architectures.

Reviewed by: jhb (earlier version)
Differential Revision: https://reviews.freebsd.org/D27535

3 years agoloader: fix build on non-x86 platforms
Toomas Soome [Sat, 2 Jan 2021 21:48:52 +0000 (23:48 +0200)]
loader: fix build on non-x86 platforms

Need to build pnglite with all.

Reported by: Herbert J. Skuhra

3 years agoVendor import of llvm-project branch release/11.x
Dimitry Andric [Sat, 2 Jan 2021 21:13:33 +0000 (22:13 +0100)]
Vendor import of llvm-project branch release/11.x
llvmorg-11.0.1-rc2-0-g43ff75f2c3f (aka 11.0.1 rc2).

3 years agoarm64: fix mask in atomic_testand{set,clear}_64
Ryan Libby [Sat, 2 Jan 2021 20:11:18 +0000 (12:11 -0800)]
arm64: fix mask in atomic_testand{set,clear}_64

These macros generate both the 32- and 64-bit ops, but the mask was hard
coded for 32-bit ops, causing the 64-bit ops always to affect only the
low 32 bits.

PR: 252324
Reported by: gbe, mmel
Reviewed by: markj, mmel
Tested by: mmel, rwatson
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27886

3 years agoloader: implement framebuffer console
Toomas Soome [Mon, 21 Dec 2020 05:31:16 +0000 (07:31 +0200)]
loader: implement framebuffer console

Draw console on efi.
Add vbe framebuffer for BIOS loader (vbe off, vbe on, vbe list,
vbe set xxx).
autoload font (/boot/fonts) based on resolution and font size.
Add command loadfont (set font by file) and
variable screen.font (set font by size). Pass loaded font to kernel.

Export variables:
screen.height
screen.width
screen.depth

Add gfx primitives to draw the screen and put png image on the screen.
Rework menu draw to iterate list of consoles to enamble device specific
output.

Probably something else I forgot...

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27420

3 years agoarm: Fix atomic_testand{set,clear}_32(). According to atomic (9), the bit position...
Michal Meloun [Sat, 2 Jan 2021 19:30:00 +0000 (20:30 +0100)]
arm: Fix atomic_testand{set,clear}_32(). According to atomic (9), the bit position argument should be a modulo operand size. While I'm in, add missing implementation of atomic_testandclear_64(). For more details see https://reviews.freebsd.org/D27886

Discused with: rlibby
MFC after: 3 weeks

3 years agocontrib: setup pnglite
Toomas Soome [Sat, 2 Jan 2021 19:29:24 +0000 (21:29 +0200)]
contrib: setup pnglite

3 years agoAdd 'contrib/pnglite/' from commit 'a70c2a23d0d84dfc63a1d9413a7f4aaede7313aa'
Toomas Soome [Sat, 2 Jan 2021 19:27:29 +0000 (21:27 +0200)]
Add 'contrib/pnglite/' from commit 'a70c2a23d0d84dfc63a1d9413a7f4aaede7313aa'

git-subtree-dir: contrib/pnglite
git-subtree-mainline: 5bcd0b860c7d4935db5b290cf932357fc22adf3a
git-subtree-split: a70c2a23d0d84dfc63a1d9413a7f4aaede7313aa

3 years agoInitial import of vendor/pnglite
Toomas Soome [Sat, 2 Jan 2021 19:20:31 +0000 (21:20 +0200)]
Initial import of vendor/pnglite

3 years agocontrib: setup terminus
Toomas Soome [Sat, 2 Jan 2021 19:03:28 +0000 (21:03 +0200)]
contrib: setup terminus

3 years agoAdd 'contrib/terminus/' from commit 'cee3932f8c02a220d70e48949c7c5ca6e98dfef4'
Toomas Soome [Sat, 2 Jan 2021 18:57:12 +0000 (20:57 +0200)]
Add 'contrib/terminus/' from commit 'cee3932f8c02a220d70e48949c7c5ca6e98dfef4'

git-subtree-dir: contrib/terminus
git-subtree-mainline: 51a9b978e75021415fdced616b4e4bc373a20a8a
git-subtree-split: cee3932f8c02a220d70e48949c7c5ca6e98dfef4

3 years agoimport terminus-font-4.48
Toomas Soome [Sat, 2 Jan 2021 18:17:37 +0000 (20:17 +0200)]
import terminus-font-4.48

3 years agonfs server: improve use of the VFS KPI
Konstantin Belousov [Fri, 1 Jan 2021 15:35:44 +0000 (17:35 +0200)]
nfs server: improve use of the VFS KPI

In particular, do not assume that vn_start_write() returns the same mp
as it was passed in, or never returns error.

Also be more accurate to return NULL vp and mp when error occured, to
catch wrong control flow easier.

Stop checking for NULL mp before calling vn_finished_write(), NULL mp
is handled transparently by the function.

Reviewed by: rmacklem
Tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27881

3 years agobootparamd: Add missing __unused mark.
Yoshihiro Takahashi [Sat, 2 Jan 2021 15:40:34 +0000 (00:40 +0900)]
bootparamd: Add missing __unused mark.

e03764d931d820185a019334259b18df2e3f6b6c did not catch all unused
variables.

Submitted by: otis
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27894

3 years agocontrib: remove libgnuregex
Kyle Evans [Sat, 2 Jan 2021 05:59:21 +0000 (23:59 -0600)]
contrib: remove libgnuregex

This should have been a part of 47d1ad2413da, but it was overlooked. All of
the build bits have been previously removed, and nothing references this
anymore.

3 years agobootparamd: Fix several warnings and increase warn level to 6.
Yoshihiro Takahashi [Sat, 2 Jan 2021 03:36:09 +0000 (12:36 +0900)]
bootparamd: Fix several warnings and increase warn level to 6.

- Increase WARNS to 6.
- Except -Wcast-align and -Wincompatible-pointer-types-discards-qualifiers
  checks.
- Use ANSI C prototype.
- Statically variables and functions.
- Add extern declaration for global variables.
- Rename local variables to resolve shadow warnings.

PR: 71667
MFC after: 2 weeks

3 years agotcgetwinsize(3): provide man page
Konstantin Belousov [Fri, 1 Jan 2021 22:28:42 +0000 (00:28 +0200)]
tcgetwinsize(3): provide man page

The current POSIX.1-202x draft (1.1) was used as source material.

Submitted by: Soumendra Ganguly <soumendraganguly@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27787

3 years agortld: call close(2) after errno is saved
Konstantin Belousov [Fri, 1 Jan 2021 22:24:46 +0000 (00:24 +0200)]
rtld: call close(2) after errno is saved

to prevent obliteration of error value from the original syscall.
Also improve error message for short read.

Submitted by: Konrad Sewiłło-Jopek
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27864

3 years agounzip: Sync with NetBSD upstream.
Yoshihiro Takahashi [Sat, 2 Jan 2021 01:50:08 +0000 (10:50 +0900)]
unzip: Sync with NetBSD upstream.

- Ignore malformed directory entries as created by Dropbox ("/").
  (rev 1.24)
- Use libarchive 3.x interface: check result for archive_read_free()
  and don't call archive_read_close manually. (rev 1.23)
- Always overwrite symlinks on extraction, ever if they're newer than
  entries in archive.
- Use getline() rather than getdelim().

PR: 231827
Submitted by: ak
Reviewed by: mm
Obtained from: NetBSD
MFC after: 2 weeks

3 years agousr.sbin/rtadvctl: Remove support for FreeBSD 9.x.
Xin LI [Sat, 2 Jan 2021 00:04:55 +0000 (16:04 -0800)]
usr.sbin/rtadvctl: Remove support for FreeBSD 9.x.

3 years agonfsd: fix NFSv4.0 seqid handling for ERELOOKUP
Rick Macklem [Fri, 1 Jan 2021 22:21:51 +0000 (14:21 -0800)]
nfsd: fix NFSv4.0 seqid handling for ERELOOKUP

Commit 774a36851e0e fixed the NFS server so that it could handle
ERELOOKUP returns from VOP calls by redoing the operation/RPC.
However, for NFSv4.0, redoing an Open would increment
the open_owner's seqid multiple times, breaking the protocol.
This patch sets a new flag called ND_ERELOOKUP on the RPC when
a redo is in progress.  Then the code that increments the seqid
avoids the seqid increment/check when the flag is set, since
it indicates this has already been done for the Open.

3 years agonfsd: fix NFS server for ERELOOKUP
Rick Macklem [Fri, 1 Jan 2021 21:55:51 +0000 (13:55 -0800)]
nfsd: fix NFS server for ERELOOKUP

r367672 modified UFS such that certain VOPs, such as
VOP_CREATE() will intermittently return ERELOOKUP.
When this happens, the entire system call, or NFS
operation in the case of the NFS server, must be redone.

This patch adds that support to the NFS server by rolling
back the state of the NFS request arguments and NFS
reply arguments mbuf lists to the condition they were
in before the operation and then redoing the operation.

Tested by: pho
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D27875

3 years agosyscons: scrnmaps: appease -Wmissing-variable-declarations
Kyle Evans [Fri, 1 Jan 2021 17:53:47 +0000 (11:53 -0600)]
syscons: scrnmaps: appease -Wmissing-variable-declarations

scrmap is only used in the one compilation unit in all cases, make it static
rather than extern'ing it. There's little benefit, but it's easy to do.

It's unclear how this hasn't failed many builds before now, since it should
have cropped up sometime around deeper hierarchies getting a default WARNS.

MFC after: 3 days

3 years agoefi loader: fix typos in a comment
Eric van Gyzen [Fri, 1 Jan 2021 17:38:39 +0000 (11:38 -0600)]
efi loader: fix typos in a comment

...mostly because it's a harmless way to try the shiny new git repo.

Sponsored by: Dell EMC Isilon

3 years agoping: fix ping when the kernel was built without INET6
Alan Somers [Fri, 1 Jan 2021 17:25:49 +0000 (10:25 -0700)]
ping: fix ping when the kernel was built without INET6

If the kernel was built without INET6, default to ICMP.  Or, if it was
built without INET, default to ICMPv6.

PR: 251725
Reported by: jbeich
Reviewed by: jbeich
Tested by: jbeich
MFC with: 368045

3 years agofusefs: implement FUSE_COPY_FILE_RANGE.
Alan Somers [Tue, 29 Dec 2020 01:25:21 +0000 (18:25 -0700)]
fusefs: implement FUSE_COPY_FILE_RANGE.

This updates the FUSE protocol to 7.28, though most of the new features
are optional and are not yet implemented.

MFC after: 2 weeks
Relnotes: yes
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27818

3 years agofusefs: fix an expectation in one of the tests
Alan Somers [Tue, 29 Dec 2020 17:48:34 +0000 (10:48 -0700)]
fusefs: fix an expectation in one of the tests

An order-of-operations problem caused an expectation intended for
FUSE_READ to instead match FUSE_ACCESS.  Surprisingly, only one test
case was affected.

MFC after: 2 weeks
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27818

3 years agoFix i386 build following 37df9d3bba8577fcdd63382ff5a4a5cbb4aa55b4.
Cy Schubert [Fri, 1 Jan 2021 16:46:58 +0000 (08:46 -0800)]
Fix i386 build following 37df9d3bba8577fcdd63382ff5a4a5cbb4aa55b4.

MFC after: 2 weeks
X-MFC with: 37df9d3bba8577fcdd63382ff5a4a5cbb4aa55b4

3 years agosctp: improve handling of aborted associations
Michael Tuexen [Fri, 1 Jan 2021 14:59:10 +0000 (15:59 +0100)]
sctp: improve handling of aborted associations

Don't clear a flag, when the structure already has been freed.
Reported by: syzbot+07667d16c96779c737b4@syzkaller.appspotmail.com

3 years agoMerge commit 4f568fbd2 from llvm git (by Nemanja Ivanovic):
Dimitry Andric [Fri, 1 Jan 2021 14:35:13 +0000 (15:35 +0100)]
Merge commit 4f568fbd2 from llvm git (by Nemanja Ivanovic):

  [PowerPC] Do not emit HW loop when TLS var accessed in PHI of loop
  exit

  If any PHI nodes in loop exit blocks have incoming values from the
  loop that are accesses of TLS variables with local dynamic or general
  dynamic TLS model, the address will be computed inside the loop.
  Since this includes a call to __tls_get_addr, this will in turn cause
  the CTR loops verifier to complain. Disable CTR loops in such cases.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=48527
This should fix building ceph 12.2.12 on powerpc64, powerpc, powerpcspe
and powerpc64le.

Requested by: pkubaj
MFC after: 3 days

3 years agostand: fix WITHOUT_FORTH/WITHOUT_LOADER_LUA build
Kyle Evans [Fri, 1 Jan 2021 06:22:48 +0000 (00:22 -0600)]
stand: fix WITHOUT_FORTH/WITHOUT_LOADER_LUA build

Previously having ficl/liblua in LIB32LIST with their respective option
turned OFF would be relatively harmless, as we wouldn't act on it unless we
were building the non-32 variant. As of ac5f382a9d0a, however, these are
now used for dependencies in some cases and must reflect what's actually
going to be built.

3 years agojail: revert the attachment part of b4e87a632955
Jamie Gritton [Fri, 1 Jan 2021 03:55:49 +0000 (19:55 -0800)]
jail: revert the attachment part of b4e87a632955

The change to kern_jail_set that was supposed to "also properly clean
up when attachment fails" didn't fix a memory leak but actually caused
a double free.  Back that part out, and leave the part that manages
allprison_lock state.

3 years agotmpfs: use VNPASS when asserting on a vnode in tmpfs_read_pgcache
Mateusz Guzik [Fri, 1 Jan 2021 03:19:13 +0000 (03:19 +0000)]
tmpfs: use VNPASS when asserting on a vnode in tmpfs_read_pgcache

3 years agoSoften caveat about fractional seconds for sleep(1)
Benjamin Kaduk [Fri, 1 Jan 2021 03:17:40 +0000 (19:17 -0800)]
Soften caveat about fractional seconds for sleep(1)

Support for fractional seconds has become much more widespread since
this text was originally written.

Reported by:    Mark Eichin
Reviewed by:    gbe, jilles
Differential Revision:  https://reviews.freebsd.org/D26208

3 years agoufs: use VNPASS when asserting on a vnode in ufs_read_pgcache
Mateusz Guzik [Fri, 1 Jan 2021 03:14:11 +0000 (03:14 +0000)]
ufs: use VNPASS when asserting on a vnode in ufs_read_pgcache

3 years agoservices: reinstate CouchDB and bring amqps
Pedro F. Giffuni [Fri, 1 Jan 2021 01:49:03 +0000 (20:49 -0500)]
services: reinstate CouchDB and bring amqps

CouchDB was mistakenly removed in r368712
amqps is used by net/rabbitmp

Both are registered in IANA

Reported by: dch
Differential Revision: https://reviews.freebsd.org/D27691

3 years agoservices: fiz bug introduced in r361898
Pedro F. Giffuni [Fri, 1 Jan 2021 00:38:29 +0000 (19:38 -0500)]
services: fiz bug introduced in r361898

Reported by: deischen@

3 years agocache: fold NCF_WHITE check into the rest
Mateusz Guzik [Mon, 28 Dec 2020 11:24:48 +0000 (11:24 +0000)]
cache: fold NCF_WHITE check into the rest

Tested by: pho

3 years agocache: call cache_fplookup_modifying in neg
Mateusz Guzik [Mon, 28 Dec 2020 11:22:35 +0000 (11:22 +0000)]
cache: call cache_fplookup_modifying in neg

Tested by: pho

3 years agocache: refactor cache_fpl_handle_root to fit the rest of the code better
Mateusz Guzik [Mon, 28 Dec 2020 09:25:01 +0000 (09:25 +0000)]
cache: refactor cache_fpl_handle_root to fit the rest of the code better

Tested by: pho

3 years agocache: refactor dot handling
Mateusz Guzik [Mon, 28 Dec 2020 07:46:02 +0000 (08:46 +0100)]
cache: refactor dot handling

Tested by: pho

3 years agocache: remove a branch from mount point checking
Mateusz Guzik [Mon, 28 Dec 2020 07:34:29 +0000 (08:34 +0100)]
cache: remove a branch from mount point checking

Tested by: pho

3 years agocache: support lockless lookup of degenerate paths
Mateusz Guzik [Mon, 28 Dec 2020 06:53:17 +0000 (07:53 +0100)]
cache: support lockless lookup of degenerate paths

Tested by: pho

3 years agocache: save on branching when parsing the path by inserting a sentinel
Mateusz Guzik [Mon, 28 Dec 2020 06:33:12 +0000 (07:33 +0100)]
cache: save on branching when parsing the path by inserting a sentinel

Tested by: pho

3 years agocache: hoist trailing slash and degenerate path handling out of the loop
Mateusz Guzik [Mon, 28 Dec 2020 04:24:15 +0000 (05:24 +0100)]
cache: hoist trailing slash and degenerate path handling out of the loop

Tested by: pho

3 years agofd: inline pwd_get_smr
Mateusz Guzik [Mon, 28 Dec 2020 09:29:57 +0000 (09:29 +0000)]
fd: inline pwd_get_smr

Tested by: pho

3 years agoddb: Display process flags (p_flag and p_flag2) in 'show proc'.
John Baldwin [Fri, 1 Jan 2021 00:01:52 +0000 (16:01 -0800)]
ddb: Display process flags (p_flag and p_flag2) in 'show proc'.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27872

3 years agoUse kdb_thr_* to iterate over threads consistently in DDB.
John Baldwin [Fri, 1 Jan 2021 00:01:35 +0000 (16:01 -0800)]
Use kdb_thr_* to iterate over threads consistently in DDB.

The "findstack", "show all trace", and "show active trace" commands
were iterating over allproc to enumerate threads.  This missed threads
executing in exit1() after being removed from allproc.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27829

3 years agoUse kdb_thr_from_pid() in db_lookup_thread().
John Baldwin [Fri, 1 Jan 2021 00:01:27 +0000 (16:01 -0800)]
Use kdb_thr_from_pid() in db_lookup_thread().

The code is identical, so this should be a no-op.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27828

3 years agoDon't check P_INMEM in kdb_thr_*().
John Baldwin [Fri, 1 Jan 2021 00:01:12 +0000 (16:01 -0800)]
Don't check P_INMEM in kdb_thr_*().

Not all debugger operations that enumerate threads require thread
stacks to be resident in memory to be useful.  Instead, push P_INMEM
checks (if needed) into callers.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27827

3 years agoEnumerate processes via the pid hash table in kdb_thr_*().
John Baldwin [Fri, 1 Jan 2021 00:00:54 +0000 (16:00 -0800)]
Enumerate processes via the pid hash table in kdb_thr_*().

Processes part way through exit1() are not included in allproc.  Using
allproc to enumerate processes prevented getting the stack trace of a
thread in this part of exit1() via ddb.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27826

3 years agoAdd a proc_off_p_hash helper variable.
John Baldwin [Fri, 1 Jan 2021 00:00:33 +0000 (16:00 -0800)]
Add a proc_off_p_hash helper variable.

This is used by kernel debuggers to enumerate processes via the pid
hash table.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27825

3 years agoddb ps: Use the pidhash to enumerate processes not in allproc.
John Baldwin [Fri, 1 Jan 2021 00:00:05 +0000 (16:00 -0800)]
ddb ps: Use the pidhash to enumerate processes not in allproc.

Exiting processes that have been removed from allproc but are still
executing are not yet marked PRS_ZOMBIE, so they were not listed (for
example, if a thread panics during exit1()).  To detect these
processes, clear p_list.le_prev to NULL explicitly after removing a
process from the allproc list and check for this sentinel rather than
PRS_ZOMBIE when walking the pidhash.

While here, simplify the pidhash walk to use a single outer loop.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27824

3 years agoCorrect and add some comments.
Kirk McKusick [Thu, 31 Dec 2020 23:15:44 +0000 (15:15 -0800)]
Correct and add some comments.

Sponsored by: Netflix

3 years agojail: Clean up allprison_lock handing in kern_jail_set
Jamie Gritton [Thu, 31 Dec 2020 23:18:43 +0000 (15:18 -0800)]
jail: Clean up allprison_lock handing in kern_jail_set

Keep explicit track of the allprison_lock state during the final part
of kern_jail_set, instead of deducing it from the JAIL_ATTACH flag.

Also properly clean up when the attachment fails, fixing a long-
standing (though minor) memory leak.

3 years agouma dbg: catch more corruption with atomics
Ryan Libby [Thu, 31 Dec 2020 21:02:45 +0000 (13:02 -0800)]
uma dbg: catch more corruption with atomics

Use atomic testandset and testandclear to catch concurrent double free,
and to reduce the number of atomic operations.

Submitted by: jeff
Reviewed by: cem, kib, markj (all previous version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22703

3 years agobitset: implement BIT_TEST_CLR_ATOMIC & BIT_TEST_SET_ATOMIC
Ryan Libby [Thu, 31 Dec 2020 21:02:45 +0000 (13:02 -0800)]
bitset: implement BIT_TEST_CLR_ATOMIC & BIT_TEST_SET_ATOMIC

That is, provide wrappers around the atomic_testandclear and
atomic_testandset primitives.

Submitted by: jeff
Reviewed by: cem, kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22702

3 years agoStop defaulting to DWRAF2 in kernel compilation
Ed Maste [Thu, 31 Dec 2020 19:31:12 +0000 (14:31 -0500)]
Stop defaulting to DWRAF2 in kernel compilation

After the removal of obsolete GDB 6.1.1 from the base system in
1c0ea326aa6d we no longer need to downgrade to DWARF2 debug info.

We will need to ensure that our tools (e.g. ctfconvert) handle DWARF5
prior to it becoming the default in the Clang and GCC versions we use.

Reported by: jhb
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

3 years agoRemove unused contrib/gdb
Ed Maste [Thu, 31 Dec 2020 18:36:55 +0000 (13:36 -0500)]
Remove unused contrib/gdb

As of 1c0ea326aa6d in-tree gdb is not used.  Clean up the contrib
directory.

Reported by: kib
Sponsored by: The FreeBSD Foundation

3 years agolibc: tests: add some tests for cpuset(2)
Kyle Evans [Thu, 31 Dec 2020 18:30:43 +0000 (12:30 -0600)]
libc: tests: add some tests for cpuset(2)

The cpuset(2) tests should be run as root (require.user properly set) with
>= 3 cpus for maximum coverage. All tests that want to modify the cpuset
don't assume any particular cpu layout (i.e. the first cpu may not be 0, the
last may not be first + count) and the following scenarios are tested:

1.) newset: basic execute cpuset() to grab a new cpuset, make sure the
    assigned cpuset then has a different ID.
2.) transient: create a new cpuset then assign the process its original
    cpuset, ensuring that the one we created is now gone.
3.) deadlk: test assigning an anonymous mask, then resetting the process
    base affinity with 1-cpu overlap w.r.t. the anonymous mask and with
    0-cpu overlap w.r.t. the anonymous mask.
4.) jail_attach_newbase: process attaches to a jail with its own
    cpuset+mask (e.g. cpuset -c -l 1,2 jail -c path=/ command=/bin/sh)
5.) jail_attach_newbase_plain: process attaches to a jail with its own
    cpuset (e.g. cpuset -c jail -c path=/ command=/bin/sh)
6.) jail_attach_prevbase: process attaches to a jail with the containing
    jail's root cpuset (e.g. jail -c path=/ command=/bin/sh)
7.) jail_attach_plain: process attaches to a jail with the containing jail's
    root cpuset+mask.
8.) badparent: creates a new cpuset and modifies the anonymous thread mask,
    then setid's back to the original and checks that cpuset_getid() returns
    the expected set.

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

3 years agolibc: tests: hook CPUSET(9) test up to the build
Kyle Evans [Thu, 31 Dec 2020 18:26:01 +0000 (12:26 -0600)]
libc: tests: hook CPUSET(9) test up to the build

Add shims to map NetBSD's API to CPUSET(9). Obviously the invalid input
parts of these tests are relatively useless since we're just testing the
shims that aren't used elsewhere, there's still some amount of value in
the parts testing valid inputs.

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

3 years agostand: properly declare subdir deps or .WAIT, do parallel build
Kyle Evans [Thu, 31 Dec 2020 17:15:45 +0000 (11:15 -0600)]
stand: properly declare subdir deps or .WAIT, do parallel build

buildworld already runs the stand build in parallel[1], so make it easier to
identify ordering issues by properly establishing dependencies or adding
.WAIT where needed.

Everything in stand/ relies on libsa, either directly or indirectly, because
libsa build is where the stand headers get installed and it gets linked in
most places.

Interpreters depend on their libs, machine dirs usually depend on top-level
libs that are getting built and at least one of the interpreter flavors.

For i386, order btx/libi386/libfirewire before everything else using a
big-ol-.WAIT hammer. btx is the most common dependency, but the others are
used sporadically. This seems to be where the race reporting on the mailing
list is- AFAICT, the following sequence is happening:

1.) One of the loaders gets built based on stale btx/btxldr
2.) btx/btxldr gets rebuilt
3.) installworld triggers loader rebuild because btx was rebuilt after

This seems like the most plausible explanation, as they've verified system
time and timestamps.

While we're here, let's switch stand/ over to a completely parallel build so
we can work out these kinds of issues in isolation rather than in the middle
of a larger build.

Reviewed by: bdragon, sjg, tsoome
Tested by: bdragon (-j1024, no failures, significant speed improvement)
Differential Revision: https://reviews.freebsd.org/D23411

3 years agoarm: tune vmparam.h towards a little more modern
Kyle Evans [Thu, 31 Dec 2020 17:12:39 +0000 (11:12 -0600)]
arm: tune vmparam.h towards a little more modern

An 8MB max stack size is quite limiting in today's world, and in-fact is
the *default* stack size for almost every other arch (including mips).

Raise the default to 4MB (should be pretty reasonable) and the max to 64MB.
NetBSD made a similar move back in 2015 and raised MAXDSIZ to 1856 at the
same time, so let's just roll that in as well. They later lowered it, but
eventually raised it back to 1856 in order to build rust.

This was noticed while looking at qemu-bsd-user's default stack sizes and
growth behavior (or lack thereof).

Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D27218

3 years agovt: restore tty when console is ungrabbed
Kyle Evans [Thu, 31 Dec 2020 16:50:43 +0000 (10:50 -0600)]
vt: restore tty when console is ungrabbed

When a break-to-debugger is triggered, kdb will grab the console and vt(4)
will generally switch back to ttyv0. If one issues a continue from the
debugger, then kdb will ungrab the console and the system rolls on.

This change adds a perhaps minor feature: when we're down to grab == 0 and
if vt actually switched away to ttyv0, switch back to the tty it was
previously on before the console was grabbed.

The justification behind this is that a typical flow is to work in
!ttyv0 to avoid console spam while occasionally dropping to ddb to inspect
system state before returning. This could easily enough be tossed behind
a sysctl or something if it's not generally appreciated, but I anticipate
indifference.

Reviewed by: ray
Differential Revision: https://reviews.freebsd.org/D27110

3 years agovt: more carefully handle vt_allocate_keyboard grab work
Kyle Evans [Thu, 31 Dec 2020 16:45:41 +0000 (10:45 -0600)]
vt: more carefully handle vt_allocate_keyboard grab work

vt_allocate_keyboard only needs to unwind the effects of keyboard-grabbing,
rather than any associated vt window action that may have also happened.

Split out the bits that do the keyboard work into *_noswitch equivalents,
and use those in keyboard allocation. This will be less error-prone when a
later change will offer up different window state behavior when the console
is ungrabbed.

Reviewed by: ray
Differential Revision: https://reviews.freebsd.org/D27110

3 years agolualoader: add loader_conf_dirs support (loader.conf.d)
Kyle Evans [Fri, 10 Jul 2020 01:50:15 +0000 (20:50 -0500)]
lualoader: add loader_conf_dirs support (loader.conf.d)

loader_conf_dirs is the supporting mechanism for the included
/boot/loader.conf.d directory.  When lualoader finishes processing all of
the loader_conf_files it finds after walking /boot/defaults/loader.conf,
it will now check any and all loader_conf_dirs and process files ending
in ".conf" as if they were a loader.conf.

Note that loader_conf_files may be specified in a loader.conf.d config
file, but loader_conf_dirs may *not*. It will only be processed as specified
in /boot/defaults/loader.conf and any loader_conf_files that were loaded
from there.

Reviewed by: allanjude, freqlabs, rpokala, tsoome
Includes suggestion from: imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D25608

3 years agofusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEK
Alan Somers [Tue, 29 Dec 2020 00:26:31 +0000 (17:26 -0700)]
fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEK

FUSE_LSEEK reports holes on fuse file systems, and is used for example
by bsdtar.

MFC after: 2 weeks
Relnotes: yes
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D27804

3 years agoVOP_PATHCONF.9: add a LOCKS section
Alan Somers [Thu, 31 Dec 2020 15:35:13 +0000 (08:35 -0700)]
VOP_PATHCONF.9: add a LOCKS section

MFC after: 2 weeks
Reviewed By: jhb, bjk
Differential Revision: https://reviews.freebsd.org/D27842

3 years agocopyrights: Happy New Year 2021
Glen Barber [Thu, 31 Dec 2020 15:23:36 +0000 (10:23 -0500)]
copyrights: Happy New Year 2021

Good riddance 2020.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoldconfig: Retire a.out support
Ed Maste [Thu, 31 Dec 2020 15:29:08 +0000 (10:29 -0500)]
ldconfig: Retire a.out support

aout support in ldconfig hasn't been required since FreeBSD 2.x.
If someone needs to use FreeBSD 2 shared libraries they will be best
served by using a FreeBSD 2 ldconfig as well.

In aa5e1b42e6e3 we removed the ldconfig a.out invocation from rc.d but
left the support in ldconfig itself.  Remove it now.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27481

3 years agoReplace strcat, strcpy and snprintf with bounds checking versions
Stefan Eßer [Thu, 31 Dec 2020 11:37:37 +0000 (12:37 +0100)]
Replace strcat, strcpy and snprintf with bounds checking versions

3 years agoAdd pmu.h missed in 5e78bbb74a1f
Andrew Turner [Thu, 31 Dec 2020 10:09:50 +0000 (10:09 +0000)]
Add pmu.h missed in 5e78bbb74a1f

Reported by: rlibby
Sponsored by: Innovate UK

3 years agoStreamline the infiniband code according to the ethernet code.
Hans Petter Selasky [Thu, 31 Dec 2020 09:06:42 +0000 (10:06 +0100)]
Streamline the infiniband code according to the ethernet code.

Fix LINT-NOIP kernel build.

Submitted by: rlibby @
Differential Revision: https://reviews.freebsd.org/D27861
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agorsu: Don't modify read-only firmware block.
John Baldwin [Wed, 30 Dec 2020 23:18:02 +0000 (15:18 -0800)]
rsu: Don't modify read-only firmware block.

The firmware header loaded into an rsu(4) device has to be customized
to reflect device settings.  The driver was overwriting the header
from the shared firmware image before sending it to the device.  If
two devices attached at the same time with different settings, one
device could potentially get a corrupted header.  The recent changes
in a095390344fb1795c1b118a2f84da8f6a7f254ab exposed this bug in the
form of a panic as the firmware blobs are now marked read-only in
object files and mapped read-only by the kernel.

To avoid the bug, change the driver to allocate a copy of the firmware
header on the stack that is initialized before writing it to the
device.

PR: 252163
Reported by: vidwer+fbsdbugs@gmail.com
Tested by: vidwer+fbsdbugs@gmail.com
Reviewed by: hselasky, bz, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27850

3 years ago[POWERPC64LE] enable IPMI using OPAL bus
Alfredo Dal'Ava Junior [Thu, 31 Dec 2020 01:32:34 +0000 (22:32 -0300)]
[POWERPC64LE] enable IPMI using OPAL bus

Enable build of IPMI over OPAL on powerpc64le

Reviewed by: bdragon
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D27443