]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agodtrace: Remove local mips support
Brooks Davis [Fri, 1 Jul 2022 07:33:17 +0000 (08:33 +0100)]
dtrace: Remove local mips support

Remove the stub pid probe and all the build glue.

Reviewed by: imp, jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D35541

2 years agolibcompat: Use WORLDTMP sysroot
Brooks Davis [Fri, 1 Jul 2022 07:33:16 +0000 (08:33 +0100)]
libcompat: Use WORLDTMP sysroot

Now that -m32 is fixed, just install libs in ${WORLDTMP}/lib/lib32
and use the installed headers.

Reviewed by: imp, jhb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34697

2 years agoinstallworld: improve portability of ldd use
Brooks Davis [Fri, 1 Jul 2022 07:33:16 +0000 (08:33 +0100)]
installworld: improve portability of ldd use

b3b462229f97 added a case statement to ignore lines containing strings
in square brackets such as "[vdso]" and "[preloaded]". On MacOS
Monterey where /bin/sh may be zsh, this fails with:

/bin/sh: -c: line 0: syntax error near unexpected token `;;'

Invoke grep in the pipeline to remove such lines instead.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D35618

2 years agoigc: Change default duplex setting
Kornel Dulęba [Thu, 30 Jun 2022 11:57:58 +0000 (13:57 +0200)]
igc: Change default duplex setting

During media selection through ifconfig one might not specify
the duplex setting through the mediaopt flag.
In that case the igc driver would default to full-duplex.
The problem with this approach is that e1000(em/igb) driver
defaults to half-duplex.
Because of that if one connects both NICs and sets media to
e.g. 100baseTX on both of them no link will be found.
Fix that by matching igc behaviour with what e1000 does.

Reviewed by: grehan
Approved by: mw(mentor)
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35673

2 years agoAdd myself(kd) as src commiter and mw/emaste as my co-mentors
Kornel Dulęba [Wed, 29 Jun 2022 14:44:20 +0000 (16:44 +0200)]
Add myself(kd) as src commiter and mw/emaste as my co-mentors

Approved by: mw(mentor)
Differential Revision: https://reviews.freebsd.org/D35658

2 years agolibicp_rescue: Fix build for powerpc64le
Jessica Clarke [Fri, 1 Jul 2022 03:28:15 +0000 (04:28 +0100)]
libicp_rescue: Fix build for powerpc64le

This is a repeat of 13cee53cef35 ("libicp: Fix build for powerpc64le")
but for the rescue version of the library.

Fixes: 1f1e2261e341 ("zfs: merge openzfs/zfs@deb121309")

2 years agolibicp: Fix build for powerpc64le
Jessica Clarke [Fri, 1 Jul 2022 00:30:26 +0000 (01:30 +0100)]
libicp: Fix build for powerpc64le

The C sources use the assembly routines for little-endian powerpc64, and
the assembly files have ppc64le in their names, but the guard here was
for big-endian powerpc64.

Fixes: 1f1e2261e341 ("zfs: merge openzfs/zfs@deb121309")

2 years agovmm: Fix snapshots for AMD CPUs
Mihai Burcea [Thu, 30 Jun 2022 23:11:17 +0000 (16:11 -0700)]
vmm: Fix snapshots for AMD CPUs

This patch fixes the AMD implementation for snapshotting.  It removes
unnecessary vmcb fields that should not be saved and duplicates.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D33431

2 years agobhyve: Document the "type" config variable for network device models.
John Baldwin [Thu, 30 Jun 2022 22:14:36 +0000 (15:14 -0700)]
bhyve: Document the "type" config variable for network device models.

2 years agolibvmmapi: Add vm_close()
Vitaliy Gusev [Thu, 30 Jun 2022 21:21:57 +0000 (14:21 -0700)]
libvmmapi: Add vm_close()

Currently there is no way to safely free a vm structure without
leaking the fd.  vm_destroy() closes the fd but also destroys the VM
whereas in some cases a VM needs to be opened (vm_open) and then
closed (vm_close).

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D35073

2 years agoLink pwd.db.5 and spwd.db.5 to passwd.5
Mateusz Piotrowski [Thu, 30 Jun 2022 21:02:08 +0000 (23:02 +0200)]
Link pwd.db.5 and spwd.db.5 to passwd.5

Let's make it easier to find documentation for those databases.

MFC after: 3 days

2 years agohier.7: Document /nonexistent
Mateusz Piotrowski [Thu, 30 Jun 2022 19:58:01 +0000 (21:58 +0200)]
hier.7: Document /nonexistent

MFC after: 1 week

2 years agodevfs.5: Replace Nm with Xr devfs 8 where appropriate
Mateusz Piotrowski [Thu, 30 Jun 2022 14:45:23 +0000 (16:45 +0200)]
devfs.5: Replace Nm with Xr devfs 8 where appropriate

MFC after: 3 days

2 years agoReally fix cross-builds from macOS
Jessica Clarke [Thu, 30 Jun 2022 21:08:31 +0000 (22:08 +0100)]
Really fix cross-builds from macOS

LINKER_TYPE is set to mac not macos on macOS.

Fixes: 7927452ac4e9 ("Add RELRO build knob, default to enabled")

2 years ago.github: Attempt to fix and increase robustness of macOS action
Jessica Clarke [Thu, 30 Jun 2022 20:03:26 +0000 (21:03 +0100)]
.github: Attempt to fix and increase robustness of macOS action

Homebrew has added LLVM 14 and made that the default version, but GitHub
continues to install LLVM 13 for now, so it ends up only accessible via
the versioned name and not the unversioned one. We also add an explicit
installation of llvm@13 so that, if GitHub updates the image to using
LLVM 14, the action continues to work, albeit slightly more slowly. This
also ensures the compiler label remains correct rather than outdated, as
has occurred in the past, and that we don't get new versions of LLVM
before we're ready for them, which is especially relevant for stable
branches. This all mirrors how the Ubuntu jobs are configured.

2 years agorb_tree: silence coverity
Doug Moore [Thu, 30 Jun 2022 17:27:33 +0000 (12:27 -0500)]
rb_tree: silence coverity

Add comments to RB_INSERT_COLOR to silence coverity warnings about the
use of an uninitialized variable.  Since other static analyzers will
complain too, add a comment to explain why the complaints are unwarranted.

Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35671

2 years agobhyve virtio-net: Allow backend type to be explicitly specified.
Yan Ka Chiu [Thu, 30 Jun 2022 17:29:45 +0000 (10:29 -0700)]
bhyve virtio-net: Allow backend type to be explicitly specified.

Surrently virtio-net uses the prefix of the backing interface to
choose the backend.  This patch adds an additional option "type" to
choose the backend type explicitly.  This allows greater flexibility
for end users to manage bhyve specific resources (such as by naming
the tap interfaces to more descriptive names).  The option "type" is
optional.  When it is not presented, the backend is derived from the
name of the backend interface.

For example, the line `-s 3,virtio-net,bsdvm0,type=tap` will create a
virtio-net device for the guest using the tap interface "bsdvm0".

Adding a new "type" option preserves the current legacy format in which
the first value after virtio-net names an instance of a backend.

Note that tap interfaces not following the pattern "tap*" will not be
created on demand via devfs cloning but must be created explicitly.

Reviewed by: vmaffione, jhb
Differential Revision: https://reviews.freebsd.org/D35143

2 years agovmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info'
Vitaliy Gusev [Thu, 30 Jun 2022 17:27:27 +0000 (10:27 -0700)]
vmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info'

Summary:
    commit  1a5f1879be09d3de900b2510692dd12003784d84
    Author: Patrick Mooney <pmooney@pfmooney.com>
    Date:   2020-12-16T20:02:23.000Z

        13361 bhyve should mask RDT cpuid info
        Reviewed by: Andy Fiddaman <andy@omnios.org>
        Reviewed by: Toomas Soome <tsoome@me.com>
        Approved by: Robert Mustacchi <rm@fingolfin.org>

    https://github.com/illumos/illumos-gate/commit/1a5f1879be09d3de900b2510692dd12003784d8

----

We saw similar warning of GP (on Intel Xeon CPU E5-2630 v4 and VM with Ubuntu 20.04 5.4.0-113-generic)  until this commit is applied:

```
[    1.658880] kernel: unchecked MSR access error: WRMSR to 0xc8f (tried to write 0x0000000000000000) at rIP: 0xffffffffacc735b4 (native_write_msr+0x4/0x30)
[    1.662734] kernel: Call Trace:
[    1.663885] kernel:  ? clear_closid_rmid.isra.0+0x36/0x40
[    1.665501] kernel:  resctrl_online_cpu+0xdc/0x3f0
[    1.666952] kernel:  ? __switch_to_asm+0x40/0x70
[    1.668358] kernel:  ? __switch_to+0x7f/0x480
[    1.669693] kernel:  ? cat_wrmsr+0x70/0x70
[    1.670970] kernel:  cpuhp_invoke_callback+0x9b/0x580
[    1.672541] kernel:  ? __schedule+0x2eb/0x740
[    1.673893] kernel:  cpuhp_thread_fun+0xb8/0x120
[    1.675304] kernel:  smpboot_thread_fn+0xd0/0x170
[    1.676685] kernel:  kthread+0x104/0x140
[    1.677948] kernel:  ? sort_range+0x30/0x30
[    1.679299] kernel:  ? kthread_park+0x90/0x90
[    1.680570] kernel:  ret_from_fork+0x35/0x40
[    1.682000] kernel: *** VALIDATE rdt ***
[    1.683454] kernel: resctrl: L3 monitoring detected
```

Reviewed by: markj, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35442

2 years agocrypto: Fix assertions for digest-only sessions with separate output.
John Baldwin [Thu, 30 Jun 2022 17:10:00 +0000 (10:10 -0700)]
crypto: Fix assertions for digest-only sessions with separate output.

Digest-only sessions do not generate modified payload as an output, so
don't bother asserting anything about the payload with respect to the
output buffer other than the payload output start being zero.

In addition, a verify request on a digest-only session doesn't
generate any output at all so should never have a separate output
buffer.

PR: 252316
Reviewed by: markj
Co-authored-by: Jeremy Faulkner <gldisater@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35578

2 years agobusdma_bounce: Use PRI_ITHD scheduling class for worker thread.
John Baldwin [Thu, 30 Jun 2022 17:06:04 +0000 (10:06 -0700)]
busdma_bounce: Use PRI_ITHD scheduling class for worker thread.

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

2 years agogcore: Use PT_GETREGSET for NT_THRMISC and NT_PTLWPINFO.
John Baldwin [Thu, 30 Jun 2022 17:04:19 +0000 (10:04 -0700)]
gcore: Use PT_GETREGSET for NT_THRMISC and NT_PTLWPINFO.

This avoids the need for dealing with converting lwpinfo for alternate
ABIs in gcore itself.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35667

2 years agoAdd register sets for NT_THRMISC and NT_PTLWPINFO.
John Baldwin [Thu, 30 Jun 2022 17:04:02 +0000 (10:04 -0700)]
Add register sets for NT_THRMISC and NT_PTLWPINFO.

For the kernel this is mostly a non-functional change.  However, this
will be useful for simplifying gcore(1).

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35666

2 years agogcore: Remove unused typedefs.
John Baldwin [Thu, 30 Jun 2022 17:03:32 +0000 (10:03 -0700)]
gcore: Remove unused typedefs.

These are no longer needed after commit 4965ac059da1 which used
PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.

Reviewed by: markj, emaste
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35665

2 years agolibclang_rt: Trim a few more MIPSisms.
John Baldwin [Thu, 30 Jun 2022 17:02:37 +0000 (10:02 -0700)]
libclang_rt: Trim a few more MIPSisms.

The only FreeBSD architectures ending in 'hf' were MIPS hard-float
architectures.

Reviewed by: emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35591

2 years agotcpsso: improve man page
Michael Tuexen [Thu, 30 Jun 2022 16:37:09 +0000 (18:37 +0200)]
tcpsso: improve man page

Describe explicitly the handling of TCP endpoints in the TIME-WAIT and
SYN-RCVD state.

Reported by: glebius@
Reviewed by: glebius@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D35651

2 years agoena: Update driver version to v2.6.0
Michal Krawczyk [Fri, 10 Jun 2022 09:18:14 +0000 (11:18 +0200)]
ena: Update driver version to v2.6.0

Some of the changes in this release:
* Style fixes
* Fix ENI stats probing
* Add trace for the last Tx cleanup call
* Prevent LLQ initialization if member isn't exposed
* Improve logging

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Fix invalid KASSERT test in netmap code
Michal Krawczyk [Fri, 10 Jun 2022 09:18:13 +0000 (11:18 +0200)]
ena: Fix invalid KASSERT test in netmap code

The KASSERT was originally added to ensure that the netmap Rx ring is
not NULL, however, it was checking for the opposite.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Align names of constants
Dawid Gorecki [Fri, 10 Jun 2022 09:18:13 +0000 (11:18 +0200)]
ena: Align names of constants

Most of the constants in ena.h file were prefixed with ENA_*, while
others did not have this prefix. Align the constants by prefixing the
remaining constants with ENA.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Remove write-only datapath variable
Michal Krawczyk [Fri, 10 Jun 2022 09:18:11 +0000 (11:18 +0200)]
ena: Remove write-only datapath variable

The ena_qid variable value is never used. It can be safely removed.
That also silences the compilation warning.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Fix styling issues
Dawid Gorecki [Fri, 10 Jun 2022 09:18:11 +0000 (11:18 +0200)]
ena: Fix styling issues

Align code style with FreeBSD style(9) guidelines.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Use device_set_desc in probe
Dawid Gorecki [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Use device_set_desc in probe

During probe the driver created a temporary buffer to which the value of
DEVICE_DESC constant was printed. This buffer was then copied to the
device structure using device_set_desc_copy. Since the value of this
string is exactly the same for every device using the ENA driver, using
sprintf is unnecessary, and device_set_desc can be used instead.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Remove TSO refs from the documentation
Michal Krawczyk [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Remove TSO refs from the documentation

The Hardware currently doesn't support TSO feature and it can be
misleading to mention that in the docs.

All references to the docs were removed from the man pages.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Move ena_copy_eni_metrics into separate task
Dawid Gorecki [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Move ena_copy_eni_metrics into separate task

Copying ENI metrics was done in callout context, this caused the driver
to panic when sample_interval was set to a value other than 0, as the
admin queue call which was executed could sleep while waiting on
a condition variable. Taskqueue, unlike callout, allows for sleeping, so
moving the function to a separate taskqueue fixes the problem.
ena_timer_service is still responsible for scheduling the taskqueue.

Stop draining the callout during ena_up/ena_down. This was done to
prevent a race between ena_up/down and ena_copy_eni_metrics admin queue
calls. Since ena_metrics_task is protected by ENA_LOCK there is no
possibility of a race between ena_up/down and ena_metrics_task.

Remove a comment about locking in ena_timer_service. With ENI metrics
in a separate task this comment became obsolete.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Use atomic_load/store functions for first_interrupt variable
Dawid Gorecki [Fri, 10 Jun 2022 09:18:09 +0000 (11:18 +0200)]
ena: Use atomic_load/store functions for first_interrupt variable

Surround cases of possible simultaneous access to the first_interrupt
variable with atomic_load/store functions.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Store ticks of last Tx cleanup
Dawid Gorecki [Fri, 10 Jun 2022 09:18:09 +0000 (11:18 +0200)]
ena: Store ticks of last Tx cleanup

Store timestamp of last cleanup in Tx ring structure. This does not
change anything during normal operation of the driver but could be
useful when the device fails for some reason.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Prevent LLQ initialization when membar isn't exposed
Dawid Gorecki [Fri, 10 Jun 2022 09:18:08 +0000 (11:18 +0200)]
ena: Prevent LLQ initialization when membar isn't exposed

The ena_com_config_dev_mode() function performs many LLQ related
calculations and sends an admin command to configure LLQ in the device.

All the LLQ related operations are unnecessary if the driver fails to
find LLQ memory bar.

Move LLQ memory bar allocation to separate helper function
ena_map_llq_mem_bar and execute this function before LLQ configuration.
If the LLQ memory bar cannot be allocated, then LLQ configuration is
skipped.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Extend debug prints for invalid req_id resets
Dawid Gorecki [Fri, 10 Jun 2022 09:18:07 +0000 (11:18 +0200)]
ena: Extend debug prints for invalid req_id resets

Print information about qid if req_id is invalid. Add information about
qid and req_id if mbuf is invalid.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Move reset completion logging to the reset function
Dawid Gorecki [Fri, 10 Jun 2022 09:17:53 +0000 (11:17 +0200)]
ena: Move reset completion logging to the reset function

While ena_restore_device is called from the reset task, it can also be
called from other locations in the driver, for example in netmap
specific code. Move the reset completion logging to reset task, so it
better represents when the reset actually happened.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add ena_ring_tx_doorbell() function
Dawid Gorecki [Fri, 10 Jun 2022 09:17:52 +0000 (11:17 +0200)]
ena: Add ena_ring_tx_doorbell() function

Add ena_ring_tx_doorbell function to remove code duplication.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoRemove "All Rights Reserved" from Foundation copyrights
Ed Maste [Thu, 30 Jun 2022 14:52:29 +0000 (10:52 -0400)]
Remove "All Rights Reserved" from Foundation copyrights

on man pages.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agosocket: fix listen(2) on an already listening socket
Gleb Smirnoff [Thu, 30 Jun 2022 14:50:29 +0000 (07:50 -0700)]
socket: fix listen(2) on an already listening socket

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35669
Fixes: 141fe2dceeaeefaaffc2242c8652345a081e825a

2 years agoRemove "All Rights Reserved" from Foundation copyrights
Ed Maste [Thu, 30 Jun 2022 14:47:59 +0000 (10:47 -0400)]
Remove "All Rights Reserved" from Foundation copyrights

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agowait.2: Remove sys/types.h from the list of required headers
Mark Johnston [Thu, 30 Jun 2022 14:23:07 +0000 (10:23 -0400)]
wait.2: Remove sys/types.h from the list of required headers

wait.h is self-contained.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agolibsysdecode: Grab some more ioctl definitions from CAM
Mark Johnston [Thu, 30 Jun 2022 14:22:38 +0000 (10:22 -0400)]
libsysdecode: Grab some more ioctl definitions from CAM

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agopf: Make sure that pfi_update_status() always zeros counters
Mark Johnston [Thu, 30 Jun 2022 14:19:23 +0000 (10:19 -0400)]
pf: Make sure that pfi_update_status() always zeros counters

pfi_update_status() can return early if the status interface doesn't
exist.  But in this case pf_getstatus() was copying uninitialized stack
memory into the output nvlist.

Reported by: Jenkins (KMSAN job)
Reviewed by: kp
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35659

2 years agopf: Ensure that pfiio_name is always nul terminated
Mark Johnston [Thu, 30 Jun 2022 14:18:50 +0000 (10:18 -0400)]
pf: Ensure that pfiio_name is always nul terminated

Reported by: syzkaller
Reviewed by: kp
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35660

2 years agohier.7: Remove a.out lib directories
Mateusz Piotrowski [Thu, 30 Jun 2022 13:53:53 +0000 (15:53 +0200)]
hier.7: Remove a.out lib directories

Fixes: 76b4234537b2 BSD.usr.dist: remove aout
MFC after: 1 week

2 years agopkg.7: Clean up mdoc
Mateusz Piotrowski [Thu, 30 Jun 2022 13:46:54 +0000 (15:46 +0200)]
pkg.7: Clean up mdoc

MFC after: 1 week

2 years agosysctl.8: Reference sysctl(9)
Mateusz Piotrowski [Thu, 30 Jun 2022 13:34:58 +0000 (15:34 +0200)]
sysctl.8: Reference sysctl(9)

MFC after: 1 week

2 years agosysctl.conf.5: Document rc.d/sysctl and rc.d/sysctl_lastload
Mateusz Piotrowski [Thu, 30 Jun 2022 13:27:21 +0000 (15:27 +0200)]
sysctl.conf.5: Document rc.d/sysctl and rc.d/sysctl_lastload

Also, update the BUGS section. The example describes an issue, which is
not true anymore thanks to sysctl_lastload. Point readers to rcorder(8)
instead.

MFC after: 2 weeks

2 years agodummynet: handle IPV6 layer 2 traffic
Kristof Provost [Thu, 30 Jun 2022 11:34:53 +0000 (13:34 +0200)]
dummynet: handle IPV6 layer 2 traffic

When pf sends layer 2 traffic into dummynet it still marks IPv6 with
IPFW_ARGS_IPV6 (which dummynet translates to PROTO_V6). That in turn
results in it not matching the 'DIR_IN | PROTO_LAYER2' case, and
triggering the 'bad switch' error message.

Add extra cases for LAYER2 | PROTO_IPV6.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agorescure.8: Do not recommend release artifact disc2
Mateusz Piotrowski [Thu, 30 Jun 2022 11:28:00 +0000 (13:28 +0200)]
rescure.8: Do not recommend release artifact disc2

The FreeBSD project does not publish disc2 image anymore.

MFC after: 2 weeks

2 years agostress2: Rework test to improve error reporting
Peter Holm [Thu, 30 Jun 2022 07:46:26 +0000 (09:46 +0200)]
stress2: Rework test to improve error reporting

2 years agox86/xen: stop assuming kernel memory loading order in PVH
Roger Pau Monné [Tue, 28 Jun 2022 15:37:00 +0000 (17:37 +0200)]
x86/xen: stop assuming kernel memory loading order in PVH

Do not assume that start_info will always be loaded at the highest
memory address, and instead check the position of all the loaded
elements in order to find the last loaded one, and thus a likely safe
place to use as early boot allocation memory space.

Reported by: markj, cperciva
Sponsored by: Citrix Systems R&D
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35628

2 years agoEnable CRC64 checksums in xz.
Dag-Erling Smørgrav [Wed, 29 Jun 2022 20:11:42 +0000 (20:11 +0000)]
Enable CRC64 checksums in xz.

Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35668

2 years agovfs_mount.c: convert explicit panics and KASSERTs to MPASSERT/MPPASS
Konstantin Belousov [Wed, 29 Jun 2022 11:37:58 +0000 (14:37 +0300)]
vfs_mount.c: convert explicit panics and KASSERTs to MPASSERT/MPPASS

Reviewed by: imp, mjg
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35652

2 years agoAdd MPASSERT() and MPPASS() macros
Konstantin Belousov [Wed, 29 Jun 2022 11:37:04 +0000 (14:37 +0300)]
Add MPASSERT() and MPPASS() macros

Suggested by: mjg
Reviewed by: imp, mjg
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35652

2 years agovfs_op_exit(): assert that mnt_vfs_ops stays non-zero for unmount or suspend
Konstantin Belousov [Mon, 20 Jun 2022 15:54:44 +0000 (18:54 +0300)]
vfs_op_exit(): assert that mnt_vfs_ops stays non-zero for unmount or suspend

Reviewed by: mjg
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35639

2 years agojail: Remove a prison's shared memory when it dies
Jamie Gritton [Wed, 29 Jun 2022 17:47:39 +0000 (10:47 -0700)]
jail: Remove a prison's shared memory when it dies

Add shm_remove_prison(), that removes all POSIX shared memory segments
belonging to a prison.  Call it from prison_cleanup() so a prison
won't be stuck in a dying state due to the resources still held.

PR: 257555
Reported by: grembo

2 years agojail: add prison_cleanup() to release resources held by a dying jail
Jamie Gritton [Wed, 29 Jun 2022 17:33:05 +0000 (10:33 -0700)]
jail: add prison_cleanup() to release resources held by a dying jail

Currently, when a jail starts dying, either by losing its last user
reference or by being explicitly killed,
osd_jail_call(...PR_METHOD_REMOVE...) is called.  Encapsulate this
into a function prison_cleanup() that can then do other cleanup.

2 years agoDecode the arm64 SVE ID register
Andrew Turner [Tue, 28 Jun 2022 11:44:49 +0000 (11:44 +0000)]
Decode the arm64 SVE ID register

The field values are only valid when the ID_AA64PFR0_EL1.SVE or
ID_AA64PFR1_EL1.SME vields are non-zero. When this is not the case
the register is reserved as zero so is safe to read, but the SVEver
field will be incorrect so only print the decoded register when
the SVE or SME fields indicate it is valid.

Sponsored by: The FreeBSD Foundation

2 years agoAllow use of the arm64 unnamed register form
Andrew Turner [Wed, 29 Jun 2022 16:34:41 +0000 (17:34 +0100)]
Allow use of the arm64 unnamed register form

On arm64 all registers have a name that encodes op0, op1, CRn, CRm, and
op2 that are used to encode the register in the instruction. As some
registers we need to access may not be supportedby older compilers, or
are only supported when specific extensions are enabled support this
alternative form.

Sponsored by: The FreeBSD Foundation

2 years agounix: change error code for recvmsg() failed due to RLIMIT_NOFILE
Gleb Smirnoff [Wed, 29 Jun 2022 16:42:58 +0000 (09:42 -0700)]
unix: change error code for recvmsg() failed due to RLIMIT_NOFILE

Instead of returning EMSGSIZE pass the error code from fdallocn() directly
to userland.  That would be EMFILE, which makes much more sense.  This
error code is not listed in the specification[1], but the specification
doesn't cover such edge case at all.  Meanwhile the specification lists
EMSGSIZE as the error code for invalid value of msg_iovlen, and FreeBSD
follows that, see sys_recmsg().  Differentiating these two cases will make
a developer/admin life much easier when debugging.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35640

2 years agoSplit out vfp_new_thread
Andrew Turner [Fri, 24 Jun 2022 11:53:15 +0000 (11:53 +0000)]
Split out vfp_new_thread

To keep the vfp thread creation code in one place move into vfp.c. This
will also help with adding SVE support as it depends on VFP.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35615

2 years agoRemove store-only variable and unnecessary bzero()
En-Wei Wu [Tue, 28 Jun 2022 17:22:00 +0000 (01:22 +0800)]
Remove store-only variable and unnecessary bzero()

- Remove the variable set but not used to fix build on -CURRENT
- Remove bzero() on the space malloc'd with M_ZERO flag.

Signed-off-by: En-Wei Wu <enweiwu@FreeBSD.org>
Sponsored by: Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D35624

2 years agostress2: Fix broken random number generation
Peter Holm [Wed, 29 Jun 2022 10:28:18 +0000 (12:28 +0200)]
stress2: Fix broken random number generation

2 years agoUFS quotaoff: start write before unbusying
Konstantin Belousov [Mon, 27 Jun 2022 17:16:29 +0000 (20:16 +0300)]
UFS quotaoff: start write before unbusying

Otherwise the mount point could be unmounted meantime.

Reported and tested by: pho
Reviewed by: jah
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35638

2 years agoImprove parameters handling in veriexec
Hubert Mazur [Wed, 29 Jun 2022 08:55:51 +0000 (10:55 +0200)]
Improve parameters handling in veriexec

Provide more robust parameter parsing in veriexec. Do a little cleanup as well.

Differential revision: https://reviews.freebsd.org/D33246
Obtained from: Semihalf
Reviewed by: sjg, sebastien.bini_stormshield.eu

2 years agolibsecureboot: Do not propagate empty string
Wojciech Macek [Wed, 29 Jun 2022 08:50:23 +0000 (10:50 +0200)]
libsecureboot: Do not propagate empty string

If Trust Anchors are provided by UEFI and not compiled into
libsecureboot the segmentation fault occurs due to empty
or NULL string usage.

Obtained from: Semihalf
Reviewed by: sjg
Differential revision: https://reviews.freebsd.org/D35120

2 years agomac_veriexec: Authorize reads of secured sysctls
Wojciech Macek [Wed, 29 Jun 2022 08:48:01 +0000 (10:48 +0200)]
mac_veriexec: Authorize reads of secured sysctls

Writes to sysctls flagged with CTLFLAG_SECURE are blocked if the appropriate secure level is set. mac_veriexec does not behave this way, it blocks such sysctls in read-only mode as well.

This change aims to make mac_veriexec behave like secure levels, as it was meant by the original commit ed377cf41.

Reviewed by: sjg
Differential revision: https://reviews.freebsd.org/D34327
Obtained from: Stormshield

2 years agoBump __FreeBSD_version after linuxkpi changes.
Emmanuel Vadot [Wed, 29 Jun 2022 07:57:03 +0000 (09:57 +0200)]
Bump __FreeBSD_version after linuxkpi changes.

2 years agolinuxkpi: Add pwm.h
Emmanuel Vadot [Thu, 23 Jun 2022 08:25:23 +0000 (10:25 +0200)]
linuxkpi: Add pwm.h

Provide dummy functions needed for drm-kmod.

Reviewed by: bz
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35572

2 years agolinuxkpi: Add asm/set_memory.h
Emmanuel Vadot [Thu, 23 Jun 2022 08:14:30 +0000 (10:14 +0200)]
linuxkpi: Add asm/set_memory.h

Provide functions needed for drm-kmod.

MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35571

2 years agolinuxkpi: Add asm/iosfmbi.h
Emmanuel Vadot [Thu, 23 Jun 2022 08:12:27 +0000 (10:12 +0200)]
linuxkpi: Add asm/iosfmbi.h

Provide dummy functions needed for drm-kmod.

Obtain from: OpenBSD (via drm-kmod)
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35570

2 years agolinuxkpi: Add typecheck.h
Emmanuel Vadot [Thu, 23 Jun 2022 08:10:07 +0000 (10:10 +0200)]
linuxkpi: Add typecheck.h

typecheck macro check if the type of a variable matches a type.

MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35569

2 years agolinuxkpi: Add pm_runtime.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:59:11 +0000 (09:59 +0200)]
linuxkpi: Add pm_runtime.h

Provide dummy functions needed for drm-kmod.

Obtain from: OpenBSD (via drm-kmod)
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35568

2 years agolinuxkpi: Add mmu_notifier.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:56:04 +0000 (09:56 +0200)]
linuxkpi: Add mmu_notifier.h

Provide dummy structure needed for drm-kmod.

MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35567

2 years agolinuxkpi: Add mmu_context.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:53:55 +0000 (09:53 +0200)]
linuxkpi: Add mmu_context.h

Provide dummy functions needed for drm-kmod.

Reviewed by: bz
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35566

2 years agolinuxkpi: Add media-bus-format.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:52:37 +0000 (09:52 +0200)]
linuxkpi: Add media-bus-format.h

Provide macros needed for drm-kmod.

Obtain from: OpenBSD (via drm-kmod)
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35565

2 years agolinuxkpi: Add kmemleak.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:51:34 +0000 (09:51 +0200)]
linuxkpi: Add kmemleak.h

Provide macros needed for drm-kmod.

Obtain from: OpenBSD (via drm-kmod)
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35564

2 years agolinuxkpi: Add kfifo.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:50:29 +0000 (09:50 +0200)]
linuxkpi: Add kfifo.h

Provide macros needed for drm-kmod.

Reviewed by: bz
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35563

2 years agolinuxkpi: Add console.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:48:11 +0000 (09:48 +0200)]
linuxkpi: Add console.h

Provide dummy functions needed for drm-kmod.

Reviewed By: bz
MFC after:      1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35562

2 years agolinuxkpi: Add circ_buf.h
Emmanuel Vadot [Thu, 23 Jun 2022 07:46:03 +0000 (09:46 +0200)]
linuxkpi: Add circ_buf.h

Provide macros needed for drm-kmod.

Reviewed by: bz
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D35561

2 years agolinprocfs: Decode SGX CPU feature in cpuinfo
Dmitry Chagin [Wed, 29 Jun 2022 07:37:52 +0000 (10:37 +0300)]
linprocfs: Decode SGX CPU feature in cpuinfo

MFC after: 2 weeks

2 years agolinprocfs: Decode more CPU flags in cpuinfo
Dmitry Chagin [Wed, 29 Jun 2022 07:37:30 +0000 (10:37 +0300)]
linprocfs: Decode more CPU flags in cpuinfo

Differential revision: https://reviews.freebsd.org/D35556
MFC after: 2 weeks

2 years agoamd64: Reload CPU ext features after resume or cr4 changes
Dmitry Chagin [Wed, 29 Jun 2022 07:34:43 +0000 (10:34 +0300)]
amd64: Reload CPU ext features after resume or cr4 changes

Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D35555
MFC after: 2 weeks

2 years agolinprocfs: Decode constant_tsc CPU feature
Dmitry Chagin [Wed, 29 Jun 2022 07:34:04 +0000 (10:34 +0300)]
linprocfs: Decode constant_tsc CPU feature

Differential revision: https://reviews.freebsd.org/D35554
MFC after: 2 weeks

2 years agoifconfig.8: Prefer consistent terminologies
Zhenlei Huang [Wed, 29 Jun 2022 06:55:36 +0000 (08:55 +0200)]
ifconfig.8: Prefer consistent terminologies

Reviewed by: pauamma_gundo.com, email_luiz.eng.br
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35384

2 years agorc.conf.5: Fix example of how rc.conf.d works
Mateusz Piotrowski [Tue, 28 Jun 2022 22:37:39 +0000 (00:37 +0200)]
rc.conf.5: Fix example of how rc.conf.d works

While here, fix a typo.

MFC after: 1 week

2 years agohier.7: Add some missing Xr's
Mateusz Piotrowski [Tue, 28 Jun 2022 13:15:53 +0000 (15:15 +0200)]
hier.7: Add some missing Xr's

MFC after: 3 days

2 years agoftp: Use /var/spool/ftp as ftp's home consistently
Mateusz Piotrowski [Tue, 28 Jun 2022 13:13:39 +0000 (15:13 +0200)]
ftp: Use /var/spool/ftp as ftp's home consistently

The home directory of the ftp user is /var/spool/ftp according to
hier(7). Update the manual page of ftpd(8) to reflect that.

MFC after: 2 weeks

2 years agohier.7: Refer to build(7) for details about /usr/obj
Mateusz Piotrowski [Tue, 28 Jun 2022 10:23:31 +0000 (12:23 +0200)]
hier.7: Refer to build(7) for details about /usr/obj

MFC after: 3 days

2 years agoUSB: dwc3: use device_{has,get}_property()
Bjoern A. Zeeb [Mon, 29 Nov 2021 19:26:52 +0000 (19:26 +0000)]
USB: dwc3: use device_{has,get}_property()

Switch the driver to use device based functions which will work not
only with FDT but also ACPI.

While here make dr_mode a local variable as it is only used during
probe and not needed later in the softc.

MFC after: 2 weeks
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D33170

2 years agoACPI: change arguments to internal acpi_find_dsd()
Bjoern A. Zeeb [Thu, 23 Jun 2022 00:17:14 +0000 (00:17 +0000)]
ACPI: change arguments to internal acpi_find_dsd()

acpi_find_dsd() is not a bus function and we only need the acpi_device (ad).
The only caller has already looked up the ad (from ivars) for us.
Directly pass the ad to acpi_find_dsd() instead of bus, dev and remove
the extra call to device_get_ivars(); the changed argument also means we
now call AcpiEvaluateObject directly on the handle.

This optimisation was done a while ago while debugging a driver which
ended up with a bad bus, dev combination making the old version fail.

MFC after: 2 weeks
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D35558

2 years agotesting: pass ATF vars to pytest via env instead of arguments.
Alexander V. Chernikov [Tue, 28 Jun 2022 10:49:41 +0000 (10:49 +0000)]
testing: pass ATF vars to pytest via env instead of arguments.

This change is a continuation of 9c42645a1e4d workaround.
Apparently pytest argument parser is not happy when parsing values
 with spaces or just more than one --atf-var argument.
Switch wrapper to send these kv pairs as env variables. Specifically,
 use _ATF_VAR_key=value format to distinguish from the other vars.

Add the `atf_vars` fixture returning all passed kv pairs as a dict.

Reviewed by: lwhsu
Differential Revision: https://reviews.freebsd.org/D35625
MFC after: 2 weeks

2 years agopf: reduce the risk of src/dst mis-use
Kristof Provost [Thu, 23 Jun 2022 09:11:55 +0000 (11:11 +0200)]
pf: reduce the risk of src/dst mis-use

NULL out src/dst and check them rather than relying of 'af' to indicate
these variables are valid.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35573

2 years agoif_ovpn tests: extend multi_client test with an iroute test
Kristof Provost [Wed, 15 Jun 2022 16:24:35 +0000 (18:24 +0200)]
if_ovpn tests: extend multi_client test with an iroute test

OpenVPN allows us to push routes for client networks with the 'iroute'
directive. Test that this works as expected.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoif_ovpn tests: test multiple simultaneous clients
Kristof Provost [Wed, 15 Jun 2022 08:56:49 +0000 (10:56 +0200)]
if_ovpn tests: test multiple simultaneous clients

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoif_ovpn tests: Test if_ovpn when there's no route
Kristof Provost [Tue, 14 Jun 2022 12:37:06 +0000 (14:37 +0200)]
if_ovpn tests: Test if_ovpn when there's no route

In client mode (i.e. if there's only one peer) we should be able to
route to the correct peer even if the routing table is incorrect.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoif_ovpn tests: tunnel with CHACHA20-POLY1305
Kristof Provost [Mon, 13 Jun 2022 09:02:28 +0000 (11:02 +0200)]
if_ovpn tests: tunnel with CHACHA20-POLY1305

Sponsored by:   Rubicon Communications, LLC ("Netgate")