]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

3 years agopowerpc: Fix copyin/copyout race condition
Justin Hibbits [Tue, 8 Dec 2020 22:49:25 +0000 (16:49 -0600)]
powerpc: Fix copyin/copyout race condition

It's possible for a context switch, and CPU migration, to occur between
fetching the PCPU context and extracting the pc_curpcb.  This can cause
the fault handler to be installed for the wrong thread, leading to a
panic in copyin()/copyout().  Since curthread is already in %r13, just
use that directly, as GPRs are migrated, so there is no migration race
risk.

3 years agopowerpc: Optimize copyinstr() to avoid repeatedly mapping user strings
Justin Hibbits [Thu, 4 Jun 2020 18:15:15 +0000 (13:15 -0500)]
powerpc: Optimize copyinstr() to avoid repeatedly mapping user strings

Currently copyinstr() uses fubyte() to read each byte from userspace.
However, this means that for each byte, it calls pmap_map_user_ptr() to
map the string into memory.  This is needlessly wasteful, since the
string will rarely ever cross a segment boundary.  Instead, map a
segment at a time, and copy as much from that segment as possible at a
time.

Measured with the HPT pmap on powerpc64, this saves roughly 8% time on
buildkernel, and 5% on buildworld, in wallclock time.

3 years agoRadix dump updates
Justin Hibbits [Wed, 27 May 2020 03:31:17 +0000 (22:31 -0500)]
Radix dump updates

3 years agopowerpc/radix_mmu: Apply errata fixes for POWER9 TLB invalidation bug
Justin Hibbits [Thu, 14 May 2020 15:50:27 +0000 (10:50 -0500)]
powerpc/radix_mmu: Apply errata fixes for POWER9 TLB invalidation bug

Found in Linux, the only apparent source of errata documentation.

3 years agopowerpc/aim: Add machine check handler for TLB multihit
Justin Hibbits [Fri, 29 May 2020 02:02:41 +0000 (21:02 -0500)]
powerpc/aim: Add machine check handler for TLB multihit

Handle TLB multi-hit the same as ERAT multi-hit, by flushing the full
TLB.

3 years ago[POWERPC64LE] fix sysctl dev.opal_sensor.* on little-endian kernel
Alfredo Dal'Ava Junior [Thu, 31 Dec 2020 01:00:28 +0000 (22:00 -0300)]
[POWERPC64LE] fix sysctl dev.opal_sensor.* on little-endian kernel

- fix values returned by 'sysctls dev.opal_sensor.*.sensor'
- fix missing 'dev.opal_sensor.*.sensor_[max|min]' on sysctl

Reviewed-by: jhibbits
Sponsored-by: Eldorado Research Institute (eldorado.org.br)
Differential-Revision:  https://reviews.freebsd.org/D27365

3 years agoAdd "-n" flag to sockstat.
Alexander Motin [Wed, 30 Dec 2020 18:40:37 +0000 (13:40 -0500)]
Add "-n" flag to sockstat.

sockstat can "hang" on getpwuid() calls in situations when FreeBSD
is joined to a directory service (AD/LDAP etc) and the directory
service fail to answer in a timely manner when trying to resolve
numeric UIDs to user names.

Submitted by: Caleb St. John <caleb@ixsystems.com>
MFC after: 1 week

3 years ago[vale] Fix valectl to compile on a 32-bit platform
Adrian Chadd [Tue, 29 Dec 2020 18:20:43 +0000 (10:20 -0800)]
[vale] Fix valectl to compile on a 32-bit platform

This shows up when compiling valectl on a 32 bit platform like i386 and mips32.
gcc-6.4 complains about this (-Wint-to-pointer-cast).

Reviewed by: vmaffione
Differential Revision: https://reviews.freebsd.org/D27814

3 years agoFix typo in an_initator_name.
Alexander Motin [Tue, 29 Dec 2020 18:41:56 +0000 (13:41 -0500)]
Fix typo in an_initator_name.

MFC after: 1 week

3 years agoDon't try to adjust a TLS TOE socket that has been closed.
John Baldwin [Wed, 9 Dec 2020 22:36:01 +0000 (14:36 -0800)]
Don't try to adjust a TLS TOE socket that has been closed.

The handshake timer can race with another thread sending a FIN or RST
to close a TOE TLS socket.  Just bail from the timer without
rescheduling if the connection is closed when the timer fires.

Reported by: Sony Arpita Das @ Chelsio QA
Reviewed by: np
Differential Revision: https://reviews.freebsd.org/D27583

3 years agoAdd comment explaining Git commit message hook
Ed Maste [Wed, 30 Dec 2020 17:31:29 +0000 (12:31 -0500)]
Add comment explaining Git commit message hook

Suggested by: jhb

3 years agoSplit out the FDT arm pmu attachment
Andrew Turner [Wed, 30 Dec 2020 14:20:28 +0000 (14:20 +0000)]
Split out the FDT arm pmu attachment

This will allow us to add an ACPI attachment.

Submitted by: Greg V <greg@unrelenting.technology> (earlier version)
Sponsored by: Innovate UK

3 years agoHandle ports FLAVOR better. (+minor polish)
Poul-Henning Kamp [Wed, 30 Dec 2020 16:04:32 +0000 (16:04 +0000)]
Handle ports FLAVOR better. (+minor polish)

3 years agoshare/zoneinfo: fix minor documentation nit
Philip Paeps [Wed, 30 Dec 2020 13:23:17 +0000 (21:23 +0800)]
share/zoneinfo: fix minor documentation nit

The `git tag` command wants a tag name.

3 years agoarm64: Use new arm_kernel_boothdr script for generating booti images.
Michal Meloun [Fri, 25 Dec 2020 18:48:33 +0000 (19:48 +0100)]
arm64: Use new arm_kernel_boothdr script for generating booti images.

3 years agoMake calendarhome buffer static
Stefan Eßer [Wed, 30 Dec 2020 12:42:48 +0000 (13:42 +0100)]
Make calendarhome buffer static

the value may be used in error messages after leaving this function.

3 years agosys/tools: Add a tool for generating arm and arm64 kernel images.
Michal Meloun [Tue, 29 Dec 2020 13:49:41 +0000 (14:49 +0100)]
sys/tools: Add a tool for generating arm and arm64 kernel images.

This tool can generate kernel images without changing the offsets in
the final executable. It replaces the ELF header by properly sized zeroed
block then emits a relative jump to _start(for  'v7jump' or 'v8jump' option)
or the booti header (for 'v8booti' option) to the beginning of the converted file.
Submited by: ian

3 years agoxen: allow limiting the amount of duplicated pending xenstore watches
Roger Pau Monné [Wed, 25 Nov 2020 11:34:38 +0000 (12:34 +0100)]
xen: allow limiting the amount of duplicated pending xenstore watches

Xenstore watches received are queued in a list and processed in a
deferred thread. Such queuing was done without any checking, so a
guest could potentially trigger a resource starvation against the
FreeBSD kernel if such kernel is watching any user-controlled xenstore
path.

Allowing limiting the amount of pending events a watch can accumulate
to prevent a remote guest from triggering this resource starvation
issue.

For the PV device backends and frontends this limitation is only
applied to the other end /state node, which is limited to 1 pending
event, the rest of the watched paths can still have unlimited pending
watches because they are either local or controlled by a privileged
domain.

The xenstore user-space device gets special treatment as it's not
possible for the kernel to know whether the paths being watched by
user-space processes are controlled by a guest domain. For this reason
watches set by the xenstore user-space device are limited to 1000
pending events. Note this can be modified using the
max_pending_watch_events sysctl of the device.

This is XSA-349.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

3 years agoxen/xenstore: remove unused functions
Roger Pau Monné [Thu, 26 Nov 2020 08:57:47 +0000 (09:57 +0100)]
xen/xenstore: remove unused functions

Those helpers are not used, so remove them. No functional change.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

3 years agoTegra210: Connect to GENERIC kernel.
Michal Meloun [Tue, 29 Dec 2020 09:46:49 +0000 (10:46 +0100)]
Tegra210: Connect to GENERIC kernel.

3 years agoTegra210: Add lost-in-merge fixes:
Michal Meloun [Tue, 29 Dec 2020 09:58:29 +0000 (10:58 +0100)]
Tegra210: Add lost-in-merge fixes:
 - misplaced '#ifdef notyet' in max77620.c
 - misnamed 'xusb_gate' clock in tegra210_clk_per.c

3 years agoUpdate leap-seconds to leap-seconds.3676924800.
Xin LI [Wed, 30 Dec 2020 06:01:46 +0000 (22:01 -0800)]
Update leap-seconds to leap-seconds.3676924800.

Obtained from: ftp://ftp.nist.gov/pub/time/leap-seconds.3676924800
MFC after: 3 days

3 years agocontrib/tzdata: import tzdata 2020f
Philip Paeps [Wed, 30 Dec 2020 04:50:26 +0000 (12:50 +0800)]
contrib/tzdata: import tzdata 2020f

Merge commit '96b88ac701b35ce68425046d4be8f51cb75b5d5b' into main

Changes: https://github.com/eggert/tz/blob/2020f/NEWS

MFC after:    1 day

3 years agoImport tzdata 2020f
Philip Paeps [Wed, 30 Dec 2020 04:45:24 +0000 (12:45 +0800)]
Import tzdata 2020f

3 years agobsdcat,cpio,tar: derive version string from archive.h
Xin LI [Tue, 29 Dec 2020 21:38:47 +0000 (13:38 -0800)]
bsdcat,cpio,tar: derive version string from archive.h

Reviewed by: mm
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27823

3 years agocxgbe: replace zero sized array by flexible array
Toomas Soome [Tue, 29 Dec 2020 20:59:01 +0000 (22:59 +0200)]
cxgbe: replace zero sized array by flexible array

The issue was found while building cxgbe with gcc 10 (in illumos),
the array subscription check is warning us about outside the bounds
access.

See also: https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

3 years agoSet stdout & stderr unbuffered, so that the "telnet>" prompt
Poul-Henning Kamp [Tue, 29 Dec 2020 21:05:48 +0000 (21:05 +0000)]
Set stdout & stderr unbuffered, so that the "telnet>" prompt
also shows up when output is redirected:

telnet |& tee _log

3 years agoRevert "bsnmpclient(3): make it thread-safe"
Edward Tomasz Napierala [Tue, 29 Dec 2020 19:55:05 +0000 (19:55 +0000)]
Revert "bsnmpclient(3): make it thread-safe"

This reverts commit 89e3d5671ba13dceca272d5b159c9bd805f3f504.

As pointed out, there are several problems with that commit:

1. The new semantics, while useful for clients where multiple
   threads use separate contexts, breaks clients which correctly
   share a single one
2. Change in semantics would require a library version bump
3. It doesn't build with GCC

3 years agoFix generation of colldef source files for non-UTF-8 locales
Hiroki Sato [Tue, 29 Dec 2020 19:21:19 +0000 (04:21 +0900)]
Fix generation of colldef source files for non-UTF-8 locales

- Files for colldef were generated by duplicating UTF-8 collation files
  for each language and included invalid characters in the non-UTF-8
  encodings.  localedef(1) does not allow those characters.
  cldr2def.pl now checks if the characters are valid based on charmap files.

  TODO: ja_JP.UTF-8 locale should not be generated solely from CLDR because
  it was standardized in a document "UI-OSF Application Platform Profile for
  Japanese Environment" which was incompatible with information in CLDR.
  Most of commercial Unix vendors adopt this pre-Unicode-era document
  as the reference even for UTF-8 locale.  Newer versions of Solaris have
  added a CLDR version as ja_JP.UTF-8@cldr, and IBM AIX has used
  JA_JP.UTF-8 for the UI-OSF specification and ja_JP.UTF-8 for CLDR.

  Note that this commit does not change generation of ja_JP.UTF-8.
  Changes related to this issue will be committed separately later.

- Generate POSIX charamap UTF-32 as a reference.  It was confusing that
  charmap.xml used Unicode names defined in UnicodeData.txt though POSIX
  charmap used slightly different names for the same code points.
  cldr2def.pl now uses UTF-32.cm as single information source for Unicode
  symbol names and code points.  Charset.xml is also updated to use them.

- Fix a bug in get_encodings() in cldr2def.pl which did not understand
  0x00+0x00 notation correctly in charmaps/ISCII-DEV.TXT.

- Do not regenerate posix/xx_Comm_C.UTF-8.src every time when doing
  "make build".

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D27809

3 years agolook(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 29 Dec 2020 20:48:12 +0000 (21:48 +0100)]
look(1): Add EXAMPLES section

Add two simple examples. In this case I opted to show a small portion of
the output since it helps to understand what the tool does. It shows the use
of the -t flag too.

PR:
Submitted by:
Reported by:
Reviewed by: gbe@
Approved by: manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision: https://reviews.freebsd.org/D27543

3 years agolsvfs(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 29 Dec 2020 20:35:24 +0000 (21:35 +0100)]
lsvfs(1): Add EXAMPLES section

Add one simple exapmle and contrast some of the information using mount(8)

PR:
Submitted by:
Reported by:
Reviewed by: gbe@, yuripv@
Approved by: manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision: https://reviews.freebsd.org/D27544

3 years agoFix typo in ap_initator_portal.
Alexander Motin [Tue, 29 Dec 2020 18:32:05 +0000 (13:32 -0500)]
Fix typo in ap_initator_portal.

MFC after: 1 week

3 years ago[wlanwatch] fix compiler warnings-as-errors on gcc-6.4 mips
Adrian Chadd [Tue, 29 Dec 2020 17:50:49 +0000 (09:50 -0800)]
[wlanwatch] fix compiler warnings-as-errors on gcc-6.4 mips

* argc/argv are currently unused
* msglen is currently unused
* "default" is a const buffer, but char *cp isn't, so
  change default string to be a non-const global string variable
* Make 'cp' private to each context that's using it, which fixes
  a "variable shadows previous declaration" warning and makes it
  easier to track where it was being leaked between address family
  sections

3 years ago[wlanwds] Fix compiler warnings-as-errors on freebsd gcc-6.4 mips
Adrian Chadd [Tue, 29 Dec 2020 01:04:43 +0000 (17:04 -0800)]
[wlanwds] Fix compiler warnings-as-errors on freebsd gcc-6.4 mips

* Remove unused verbose global; things are now done through syslog
* Mark a variable as unused in handle_rtmsg()

Tested:

* FreeBSD/mips32 using gcc-6.4

3 years ago[wlanstats] Fix warnings-as-errors on gcc-6.4 on mips
Adrian Chadd [Tue, 29 Dec 2020 01:03:11 +0000 (17:03 -0800)]
[wlanstats] Fix warnings-as-errors on gcc-6.4 on mips

* use CLLADDR() to not try deconsting a const
* Unsigned where they should be
* static where it should be

Tested:

* freebsd/mips32, using gcc-6.4

3 years agokern: efirt: correct configuration table entry size
Kyle Evans [Sun, 27 Dec 2020 17:26:45 +0000 (11:26 -0600)]
kern: efirt: correct configuration table entry size

Each entry actually stores a native pointer, not a uint64_t quantity. While
we're here, go ahead and export the pointer as-is rather than converting it
to KVA. This may be more useful as consumers can map /dev/mem and observe
the entry.

For reference, see: sys/contrib/edk2/Include/Uefi/UefiSpec.h

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27669

3 years agokern: efirt: enter runtime environment to deref efi_cfgtbl
Kyle Evans [Sun, 27 Dec 2020 17:28:32 +0000 (11:28 -0600)]
kern: efirt: enter runtime environment to deref efi_cfgtbl

This fixes an insta-panic when EFIIOC_GET_TABLE is used.

Reviewed by: imp (earlier version), kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27669

3 years agoStreamline the infiniband code according to the ethernet code.
Hans Petter Selasky [Tue, 29 Dec 2020 17:01:57 +0000 (18:01 +0100)]
Streamline the infiniband code according to the ethernet code.

Specifically implement the if_requestencap callback function for infiniband.
Most of the changes are simply a cut and paste of the equivalent ethernet part.

Reviewed by: melifaro @
Differential Revision: https://reviews.freebsd.org/D27631
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix for IPoIB over lagg(4).
Hans Petter Selasky [Tue, 29 Dec 2020 16:34:01 +0000 (17:34 +0100)]
Fix for IPoIB over lagg(4).

Need to update both link layer address and broadcast address when active link changes for IP over infiniband.
This is because the broadcast address contains the so-called P-key, which is interface dependent.

Reviewed by: kib @
Differential Revision: https://reviews.freebsd.org/D27658
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agobsnmpclient(3): make it thread-safe
Edward Tomasz Napierala [Tue, 29 Dec 2020 14:59:31 +0000 (14:59 +0000)]
bsnmpclient(3): make it thread-safe

Reviewed By: harti
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27336

3 years agoiscsid(8): fix memory leak by freeing the 'addr'
Edward Tomasz Napierala [Tue, 29 Dec 2020 14:53:03 +0000 (14:53 +0000)]
iscsid(8): fix memory leak by freeing the 'addr'

Reviewed By: mav
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27328

3 years agoiscsid(8): free data allocated by getaddrinfo(3)
Edward Tomasz Napierala [Tue, 29 Dec 2020 14:47:35 +0000 (14:47 +0000)]
iscsid(8): free data allocated by getaddrinfo(3)

Reviewed By: mav
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27329

3 years agorelease.sh: Update GITROOT URL
Glen Barber [Tue, 29 Dec 2020 14:34:05 +0000 (09:34 -0500)]
release.sh: Update GITROOT URL

Hard-code the GITROOT for the ports tree to use cgit-beta
until the ports repository is converted.

While here, remove $FreeBSD$ RCS IDs.

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

3 years agogeom(4): make g_newprovider_event() return if G_P_WITHER is set
Edward Tomasz Napierala [Tue, 29 Dec 2020 14:29:54 +0000 (14:29 +0000)]
geom(4): make g_newprovider_event() return if G_P_WITHER is set

This fixes a failed assertion in scenario where the provider
disappears, disk_gone() gets called, and at the exact same
time something else closes the device node triggering a retaste.

Reviewed By: mav
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27330

3 years agolibcam(3): make cam_getccb(3) zero the whole ccb, not just the header
Edward Tomasz Napierala [Tue, 29 Dec 2020 14:25:46 +0000 (14:25 +0000)]
libcam(3): make cam_getccb(3) zero the whole ccb, not just the header

Leaving zeroing to the clients leads to error-prone pointer
tricks (zeroing needs to preserve the CCB header), and this
code is not performance-critical, so there's really no reason
to not do it.

Reviewed By: imp, rpokala (manpages)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27333

3 years agodevfs(4): defer freeing until we drop devmtx ("cdev")
Edward Tomasz Napierala [Tue, 29 Dec 2020 13:45:53 +0000 (13:45 +0000)]
devfs(4): defer freeing until we drop devmtx ("cdev")

Before r332974 the old code would sometimes cause a rare lock order
reversal against pagequeue, which looked roughly like this:

witness_checkorder()
__mtx_lock-flags()
vm_page_alloc()
uma_small_alloc()
keg_alloc_slab()
keg_fetch-slab()
zone_fetch-slab()
zone_import()
zone_alloc_bucket()
uma_zalloc_arg()
bucket_alloc()
uma_zfree_arg()
free()
devfs_metoo()
devfs_populate_loop()
devfs_populate()
devfs_rioctl()
VOP_IOCTL_APV()
VOP_IOCTL()
vn_ioctl()
fo_ioctl()
kern_ioctl()
sys_ioctl()

Since r332974 the original problem no longer exists, but it still
makes sense to move things out of the - often congested - lock.

Reviewed By: kib, markj
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27334

3 years agoRevert "uefi.8: mention boot1.efi"
Kevin Lo [Tue, 29 Dec 2020 04:08:19 +0000 (12:08 +0800)]
Revert "uefi.8: mention boot1.efi"

This reverts commit a8ec81e79871de98e30ce572a313f3f8d059ce7b

Revert D27782.  imp@ pointed out that bsdinstall has been updated, and gpart
bootcode isn't used with EFI.

3 years agoMove cp(4) module enable to SOURCELESS_HOST
Ed Maste [Tue, 29 Dec 2020 00:36:13 +0000 (19:36 -0500)]
Move cp(4) module enable to SOURCELESS_HOST

cp contains obfuscated code that runs on the host's processor

3 years agokern.mk: drop flag only patched in-tree gcc understood
Ryan Libby [Mon, 28 Dec 2020 22:03:36 +0000 (14:03 -0800)]
kern.mk: drop flag only patched in-tree gcc understood

-mno-align-long-strings was a flag maintained by FreeBSD for the
now-deleted in-tree gcc.  Upstream gcc has no such flag, so just drop
it.

The flag was originally submitted by bde and committed in 2002 (svn
r97911 & r104455).  However, upstream gcc did address this same issue in
2004 (gcc svn r76694 / git 4137ba7ab7a), reducing long string alignment
in general, and to 1 with -Os.

Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27768

3 years agodump(8): clarify the recommended use of cache and snapshots
Guangyuan Yang [Mon, 28 Dec 2020 21:54:36 +0000 (21:54 +0000)]
dump(8): clarify the recommended use of cache and snapshots

PR: 131626
MFC after: 1 week
Submitted by: Andrew Hamilton-Wright <andrew@qemg.org>
Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D27775

3 years agocache: work around corner case of dvp == tvp in cache_fplookup_final_modifying
Mateusz Guzik [Mon, 28 Dec 2020 21:24:53 +0000 (21:24 +0000)]
cache: work around corner case of dvp == tvp in cache_fplookup_final_modifying

Fixes a panic where the kernel would unlock an unheld lock coming from
rename looking up "foo/." as the source.

Reported by: markj (syzkaller)

3 years agofusefs: delete some dead code
Alan Somers [Thu, 24 Dec 2020 19:21:00 +0000 (19:21 +0000)]
fusefs: delete some dead code

The original fusefs GSoC project seems to have envisioned exchanging two
types of messages with FUSE servers.  Perhaps vectored and non-vectored?
But in practice only one type has ever been used.  Delete the other type.

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

3 years agoeventfd.2: Add the mail address of the submitter into copyright.
Konstantin Belousov [Mon, 28 Dec 2020 19:01:26 +0000 (21:01 +0200)]
eventfd.2: Add the mail address of the submitter into copyright.

Requested by: rgrimes
MFC after: 13 days

3 years agofusefs: fix the tests for a wider range of maxphys
Alan Somers [Thu, 24 Dec 2020 06:03:06 +0000 (06:03 +0000)]
fusefs: fix the tests for a wider range of maxphys

maxphys is now a tunable, ever since r368124.  The default value is also
larger than it used to be.  That broke several fusefs tests that made
assumptions about maxphys.

* WriteCluster.clustering used the MAXPHYS compile-time constant.

* WriteBackAsync.direct_io_partially_overlaps_cached_block implicitly
  depended on the default value of maxphys.  Fix it by making the
  dependency explicit.

* Write.write_large implicitly assumed that maxphys would be no more
  than twice maxbcachebuf.  Fix it by explicitly setting m_max_write.

* WriteCluster.clustering and several others failed because the MockFS
  module did not work for max_write > 128KB (which most tests would set
  when maxphys > 256KB).  Limit max_write accordingly.  This is the same
  as fusefs-libs's behavior.

* Bmap's tests were originally written for MAXPHYS=128KB.  With larger
  values, the simulated file size was too small.

PR: 252096
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D27769

3 years agoCorrect font.h comment describing vfnt font maps
Ed Maste [Mon, 28 Dec 2020 16:56:00 +0000 (11:56 -0500)]
Correct font.h comment describing vfnt font maps

Commit 41fb06651122 doubled the number of glyph maps in the vfnt format
from 2 to 4 to support double-width characters, but a comment describing
the maps was not updated to match.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agodumpon(8): Add missing section arguments
Gordon Bergling [Mon, 28 Dec 2020 15:48:58 +0000 (16:48 +0100)]
dumpon(8): Add missing section arguments

MFC after: 3 days

3 years agonewfs(8): Fix unusual Xr order
Gordon Bergling [Mon, 28 Dec 2020 15:46:28 +0000 (16:46 +0100)]
newfs(8): Fix unusual Xr order

- unusual Xr order: gjournal after gpart

MFC after: 3 days

3 years agoRemove misleading macros from -width arguments
Mateusz Piotrowski [Mon, 28 Dec 2020 15:29:35 +0000 (16:29 +0100)]
Remove misleading macros from -width arguments

Also, remove $FreeBSD$ tag from manual page examples.

MFC after: 1 week

3 years agoCollect statistics from all rate-limit queues in mlx5en(4).
Hans Petter Selasky [Mon, 12 Oct 2020 08:18:48 +0000 (10:18 +0200)]
Collect statistics from all rate-limit queues in mlx5en(4).

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImprove error message printing in krping.
Hans Petter Selasky [Wed, 9 Dec 2020 12:59:01 +0000 (13:59 +0100)]
Improve error message printing in krping.
Don't print completion queue flush as an error.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoARM64: Port FreeBSD to Nvidia Jetson TX1 and Nano.
Michal Meloun [Thu, 4 Jan 2018 12:18:24 +0000 (13:18 +0100)]
ARM64: Port FreeBSD to Nvidia Jetson TX1 and Nano.

Add support for the Tergra210 SoC and its companion PMIC MAX77620.

3 years agortld-elf: link libcompiler_rt on all architectures
Ryan Libby [Mon, 28 Dec 2020 08:44:25 +0000 (00:44 -0800)]
rtld-elf: link libcompiler_rt on all architectures

Statically link rtld-elf with libcompiler_rt on all architectures so
that we don't need to try to pick and choose the bits we need from it
for each architecture (we now leave that to the linker).  Compilers may
emit calls to support functions in this library, but because of the use
of the linker flag -nostdlib for rtld's special needs, the library is
not linked as normal.

Previously we had two different solutions.  On some architectures, we
were able to extract reimplementations of the necessary builtin
functions from our special build of libc.  On ARM, we just linked
libcompiler_rt.

This is motivated by the same issue as D26199 and D27665, but should be
a simpler solution that will apply to all architectures.

Reviewed by: arichardson, kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27736

3 years agoRevert "rtld-elf: link udivmoddi4 from compiler_rt"
Ryan Libby [Mon, 28 Dec 2020 08:44:25 +0000 (00:44 -0800)]
Revert "rtld-elf: link udivmoddi4 from compiler_rt"

This reverts commit bce2cff0bc0ee3ab5b7a66c19920e7cfe3400f6f.

Revert D27665 in favor of a more general fix coming in D27736.

3 years agolibcompiler_rt: stop building with stack smashing protection
Ryan Libby [Mon, 28 Dec 2020 08:44:25 +0000 (00:44 -0800)]
libcompiler_rt: stop building with stack smashing protection

libcompiler_rt implements certain functions that clang and gcc emit
calls to as part of their codegen (e.g. for extended width math).  Build
it without stack smashing protection (SSP, -fstack-protector) in order
to support building binaries without SSP, especially the dynamic linker.
Besides, SSP is probably not very valuable in this library.

Reviewed by: arichardson, dim, kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D27786

3 years agocaroot: drop $FreeBSD$ expansion from root bundle
Kyle Evans [Mon, 28 Dec 2020 03:47:41 +0000 (21:47 -0600)]
caroot: drop $FreeBSD$ expansion from root bundle

This debatably could have waited until the next update would have taken
place, but it's easier to see what changes if we get it out of the way
now.

MFC after: 3 days