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

2 years agoif_ovpn tests: test pf's route-to
Kristof Provost [Thu, 9 Jun 2022 15:07:12 +0000 (17:07 +0200)]
if_ovpn tests: test pf's route-to

Ensure that pf's route-to works with if_ovpn.

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

2 years agoif_ovpn tests: IPv6 in IPv4 and IPv4 in IPv6 tunnels
Kristof Provost [Fri, 20 May 2022 11:06:09 +0000 (13:06 +0200)]
if_ovpn tests: IPv6 in IPv4 and IPv4 in IPv6 tunnels

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

2 years agoif_ovpn tests: tunnel over IPv6
Kristof Provost [Wed, 18 May 2022 07:41:52 +0000 (09:41 +0200)]
if_ovpn tests: tunnel over IPv6

Set up a tunnel over IPv6 carrying IPv6 traffic.

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

2 years agoif_ovpn: static probe points
Kristof Provost [Thu, 12 May 2022 19:48:23 +0000 (21:48 +0200)]
if_ovpn: static probe points

Sprinkle a few SDTs around if_ovpn to ease debugging.

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

2 years agoif_ovpn tests: timeout on clients
Kristof Provost [Tue, 26 Apr 2022 13:09:59 +0000 (15:09 +0200)]
if_ovpn tests: timeout on clients

Test that openvpn (DCO) clients are notified and handle timeout events.

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

2 years agoif_ovpn tests: basic test case
Kristof Provost [Mon, 25 Apr 2022 15:58:31 +0000 (17:58 +0200)]
if_ovpn tests: basic test case

Set up an OpenVPN tunnel between two jails, send traffic through them to
confirm basic function.

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

2 years agoovpn: Introduce OpenVPN DCO support
Kristof Provost [Tue, 22 Feb 2022 09:21:38 +0000 (10:21 +0100)]
ovpn: Introduce OpenVPN DCO support

OpenVPN Data Channel Offload (DCO) moves OpenVPN data plane processing
(i.e. tunneling and cryptography) into the kernel, rather than using tap
devices.
This avoids significant copying and context switching overhead between
kernel and user space and improves OpenVPN throughput.

In my test setup throughput improved from around 660Mbit/s to around
2Gbit/s.

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

2 years agostress2: Added comment about problem found
Peter Holm [Tue, 28 Jun 2022 09:30:51 +0000 (11:30 +0200)]
stress2: Added comment about problem found

2 years agostress2: Update the exclude list
Peter Holm [Tue, 28 Jun 2022 09:30:11 +0000 (11:30 +0200)]
stress2: Update the exclude list

2 years agopf tests: test short packets
Kristof Provost [Thu, 23 Jun 2022 15:52:52 +0000 (17:52 +0200)]
pf tests: test short packets

Test sending very short packets (i.e. too short for an IP header)
packets in the Ethernet filtering code.

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

2 years agopf: ensure mbufs are long enough before we copy out IP(v6) headers
Kristof Provost [Fri, 24 Jun 2022 07:41:00 +0000 (09:41 +0200)]
pf: ensure mbufs are long enough before we copy out IP(v6) headers

This isn't likely to be an issue on real hardware (as Ethernet has a
minimal packet length of 64 bytes), but can cause panics with short
packets on if_epair.

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

2 years agopf: add missing maximum length check for DIOCADDETHRULE
Kristof Provost [Tue, 28 Jun 2022 07:43:23 +0000 (09:43 +0200)]
pf: add missing maximum length check for DIOCADDETHRULE

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

2 years agoelfnote: place note in a PT_NOTE program header
Roger Pau Monné [Mon, 27 Jun 2022 13:51:28 +0000 (15:51 +0200)]
elfnote: place note in a PT_NOTE program header

Some tools (firecraker loader) only check for notes in PT_NOTE program
headers, so make sure the notes added using the ELFNOTE macro end up
in such header.

Output from readelf -Wl for and amd64 kernel after the change:

Elf file type is EXEC (Executable file)
Entry point 0xffffffff8038a000
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0xffffffff80200040 0x0000000000200040 0x000268 0x000268 R   0x8
  INTERP         0x0002a8 0xffffffff802002a8 0x00000000002002a8 0x00000d 0x00000d R   0x1
      [Requesting program interpreter: /red/herring]
  LOAD           0x000000 0xffffffff80200000 0x0000000000200000 0x189e28 0x189e28 R   0x200000
  LOAD           0x18a000 0xffffffff8038a000 0x000000000038a000 0xe447e8 0xe447e8 R E 0x200000
  LOAD           0xfce7f0 0xffffffff811ce7f0 0x00000000011ce7f0 0x6b955c 0x6b955c R   0x200000
  LOAD           0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x200000
  LOAD           0x1801000 0xffffffff81a01000 0x0000000001a01000 0x1c8480 0x5ff000 RW  0x200000
  DYNAMIC        0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 RW  0x8
  GNU_RELRO      0x1800000 0xffffffff81a00000 0x0000000001a00000 0x000140 0x000140 R   0x1
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
  NOTE           0x1687ae0 0xffffffff81887ae0 0x0000000001887ae0 0x0001c0 0x0001c0 R   0x4

 Section to Segment mapping:
  Segment Sections...
[...]
   10     .note.gnu.build-id .note.Xen

Reported by: cperciva
Fixes: 1a9cdd373a6a ('xen: add PV/PVH kernel entry point')
Fixes: 93ee134a24fa ('Integrate support for xen in to i386 common code.')
Sponsored by: Citrix Systems R&D
Reviewed by: emaste
Differential revision: https://reviews.freebsd.org/D35611

2 years agoxen/blkback: do not use x86 CPUID in generic code
Roger Pau Monné [Fri, 17 Jun 2022 13:29:05 +0000 (15:29 +0200)]
xen/blkback: do not use x86 CPUID in generic code

Move checker for whether Xen creates IOMMU mappings for foreign pages
into a helper that's defined in arch-specific code.

Reported by: Elliott Mitchell <ehem+freebsd@m5p.com>
Fixes: 1d528f95e8ce ('xen/blkback: remove bounce buffering mode')
Sponsored by: Citrix Systems R&D

2 years agoCorrectly update fs_dsize in growfs(8)
Kirk McKusick [Tue, 28 Jun 2022 04:46:15 +0000 (21:46 -0700)]
Correctly update fs_dsize in growfs(8)

When growing a UFS/FFS filesystem, the size of the summary information
may expand into additional blocks. These blocks must be removed from
fs_dsize which records the number of blocks in the filesystem that can
be used to hold filesystem data.

While here also update the fs_old_dsize and fs_old_size fields for
compatibility with kernels that were compiled before the addition
of UFS2.

Reported by: Edward Tomasz Napiera
MFC after:   1 week

2 years agoEliminate set but not used variable.
Kirk McKusick [Tue, 28 Jun 2022 04:37:09 +0000 (21:37 -0700)]
Eliminate set but not used variable.

No functional change intended.

2 years agodate: attempt to more accurately describe year limitations with -v
Kyle Evans [Tue, 28 Jun 2022 03:54:13 +0000 (22:54 -0500)]
date: attempt to more accurately describe year limitations with -v

The previous description was both incorrect and incomplete in its
description -- the 2038 limit doesn't apply on !i386 platforms, and
it didn't note that values above 100 are accepted and interpreted
differently.  Further, it didn't note that absolute years are accepted.

Reviewed by: pauamma_gundo.com (manpages)
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35360

2 years agoblackhole(4): fix operator precedence
Gleb Smirnoff [Tue, 28 Jun 2022 00:52:19 +0000 (17:52 -0700)]
blackhole(4): fix operator precedence

Fixes: 3ea9a7cf7b09a355cde3a76824809402b99d0892

2 years agokboot: rename kexec_load to host_kexec_load
Warner Losh [Mon, 13 Jun 2022 17:46:48 +0000 (11:46 -0600)]
kboot: rename kexec_load to host_kexec_load

And make it match the system call more closely by passing in the proper
args.

Sponsored by: Netflix

2 years agokboot: sort system calls
Warner Losh [Mon, 13 Jun 2022 17:39:55 +0000 (11:39 -0600)]
kboot: sort system calls

Sort the system calls. No functional change intended.

Sponsored by: Netflix

2 years agokboot: use SYS_kexec_load insteaed of __NR_kexec_load
Warner Losh [Mon, 13 Jun 2022 17:33:24 +0000 (11:33 -0600)]
kboot: use SYS_kexec_load insteaed of __NR_kexec_load

Make this regular with the rest of the system calls.

Sponsored by: Netflix

2 years agokboot: Sort system calls alphabetically
Warner Losh [Mon, 13 Jun 2022 17:28:31 +0000 (11:28 -0600)]
kboot: Sort system calls alphabetically

No functional change: sort the system calls alphbetically to make it
easier to add new ones.

Sponsored by: Netflix

2 years agodevmatch: Properly ignore commented fields
Greg V [Mon, 27 Jun 2022 20:41:59 +0000 (14:41 -0600)]
devmatch: Properly ignore commented fields

Any field that starts with # is a commented out field (there as a place
holder only, the data in that place holder is completely ignored). The
previous code improperly detected this using strcmp. Instead, any field
whose names starts with '#' is ignored.

Differential Reivsion: https://reviews.freebsd.org/D34633

2 years agoObsoleteFiles: flowtable header deleted in 2017
Gleb Smirnoff [Mon, 27 Jun 2022 19:31:36 +0000 (12:31 -0700)]
ObsoleteFiles: flowtable header deleted in 2017

Miss from ae69ad884d43826bdf8a67c51596d37f729c09a9

2 years agotesting: workaround pytest parser bug in pytest-atf-wrapper.
Alexander V. Chernikov [Mon, 27 Jun 2022 15:52:25 +0000 (15:52 +0000)]
testing: workaround pytest parser bug in pytest-atf-wrapper.

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

2 years agorouting: simplify decompose_change_notification().
Alexander V. Chernikov [Mon, 27 Jun 2022 17:29:03 +0000 (17:29 +0000)]
routing: simplify decompose_change_notification().

The function's goal is to compare old/new nhop/nexthop group for the route
 and decompose it into the series of RTM_ADD/RTM_DELETE single-nhop
 events, calling specified callback for each event.
Simplify it by properly leveraging the fact that both old/new groups
 are sorted nhop-# ascending.

Tested by: Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35598
MFC after: 2 weeks

2 years agorouting: actually sort nexthops in nhgs by their index
Alexander V. Chernikov [Mon, 27 Jun 2022 17:19:50 +0000 (17:19 +0000)]
routing: actually sort nexthops in nhgs by their index

Nexthops in the nexthop groups needs to be deterministically sorted
 by some their property to simplify reporting cost when changing
 large nexthop groups.

Fix reporting by actually sorting next hops by their indices (`wn_cmp_idx()`).
As calc_min_mpath_slots_fast() has an assumption that next hops are sorted
using their relative weight in the nexthop groups, it needs to be
addressed as well. The latter sorting is required to quickly determine the
layout of the next hops in the actual forwarding group. For example,
what's the best way to split the traffic between nhops with weights
19,31 and 47 if the maximum nexthop group width is 64?
It is worth mentioning that such sorting is only required during nexthop
group creation and is not used elsewhere. Lastly, normally all nexthop
are of the same weight. With that in mind, (a) use spare 32 bytes inside
`struct weightened_nexthop` to avoid another memory allocation and
(b) use insertion sort to sort the nexthop weights.

Reported by: thj
Tested by: Claudio Jeker<claudio.jeker@klarasystems.com>
Differential Revision: https://reviews.freebsd.org/D35599
MFC after: 2 weeks

2 years agosmartpqi: Allocate DMA memory NOWAIT
Yuri [Mon, 27 Jun 2022 15:48:31 +0000 (09:48 -0600)]
smartpqi: Allocate DMA memory NOWAIT

We're not allowed to wait in this allocation path, so allocate the
memory NOWAIT instead of WAITOK. The code already copes with the
failures that may result, so no additional code is needed.

PR: 263008
Reviewed by: markj, Scott Benesh at Microsemi, imp
Differential Revision: https://reviews.freebsd.org/D35601