]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years ago__sflush(): on write error, if nothing was written, reset FILE state back
Konstantin Belousov [Sun, 23 Jan 2022 06:52:59 +0000 (08:52 +0200)]
__sflush(): on write error, if nothing was written, reset FILE state back

otherwise the data is just dropped.  Check for current position equal to
the buffer base at the entry of the function; if not equal, setvbuf()
was done from the write method and it is not our business to override
the decision.

PR: 76398
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34007

2 years agoBump __FreeBSD_version for LinuxKPI changes
Emmanuel Vadot [Tue, 25 Jan 2022 15:13:38 +0000 (16:13 +0100)]
Bump __FreeBSD_version for LinuxKPI changes

Sponsored by: Beckhoff Automation GmbH & Co. KG

2 years agolinuxkpi: Add i2c support
Emmanuel Vadot [Thu, 4 Nov 2021 09:42:37 +0000 (10:42 +0100)]
linuxkpi: Add i2c support

Add i2c support to linuxkpi. This is needed by drm-kmod.
For every i2c_adapter added by i2c_add_adapter we add a child to the
device named "lkpi_iic". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
For every i2c_adapter added by i2c_bit_add_bus we add a child to the
device named "lkpi_iicbb". This child handle the conversion between
Linux i2c_msgs to FreeBSD iic_msgs.
With the help of iic(4), this expose the i2c controller to userspace
allowing a user to query DDC information from a monitor.
e.g.: i2c -f /dev/iic0 -a 0x28 -c 128 -d r
will query the standard EDID from the monitor if plugged.

The bitbang part (lkpi_iicbb) isn't tested at all for now as I don't have
compatible hardware (all my hardware have native i2c controller).

Tested on: Intel (SandyBridge, Skylake, ApolloLake)
Tested on: AMD (Picasso, Polaris (amd64 and arm64))

MFC after: 1 month
Reviewed by: hselasky
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D33053

2 years agoRevert "linux: Provide dummy seccomp(2)"
Edward Tomasz Napierala [Thu, 20 Jan 2022 22:25:15 +0000 (22:25 +0000)]
Revert "linux: Provide dummy seccomp(2)"

This reverts commit 56981629f91fcdd358ccb41081ff6dcc2edac12f.

Wrong patch; fails to build on i386.

2 years agolinux: Provide dummy seccomp(2)
Edward Tomasz Napierala [Tue, 25 Jan 2022 11:53:56 +0000 (11:53 +0000)]
linux: Provide dummy seccomp(2)

Don't emit warnings; this isn't any different from a Linux kernel
built without OPTIONS_SECCOMP, so the userspace already needs to know
how to deal with it.  This is also similar with how we handle seccomp
in linux_prctl().

Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D33808

2 years agolocate: change from BSD-4-clause to BSD-3-clause
Baptiste Daroussin [Tue, 25 Jan 2022 08:17:36 +0000 (09:17 +0100)]
locate: change from BSD-4-clause to BSD-3-clause

We have the authorization from the University of California to remove
the advertising clause for a while, wosch@ who also hold a copyright
on this code also approved the relicensing

Approved by: wosch@
MFC after: 3 days

2 years agofetch(1): more fixes for soft failure handling
Eugene Grosbein [Tue, 25 Jan 2022 05:46:07 +0000 (12:46 +0700)]
fetch(1): more fixes for soft failure handling

Fix logic error introduced in my commit
bf599c03f09dea0f7e188e002b42d782af6841c3

Also, authorization errors should not be considered as soft failures.

2 years agotests/net*: destroy interface from inside a jail
Gleb Smirnoff [Tue, 25 Jan 2022 05:08:03 +0000 (21:08 -0800)]
tests/net*: destroy interface from inside a jail

There is no guarentee that upon return of 'jail -r' all jail resources
will be released.  The test suite used to rely on that.  Recent changes
to the PCB zones made jails delay releasing their resources, which ended
with interface leak in the test suite.

Fix that by executing 'ifconfig foo0 destroy' inside the jail, instead
of doing 'jail -r' and expecting interfaces to pop up back immediately
in the parent jail.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33942

2 years agoif_clone: correctly destroy a clone from a different vnet
Gleb Smirnoff [Tue, 25 Jan 2022 05:07:16 +0000 (21:07 -0800)]
if_clone: correctly destroy a clone from a different vnet

Try to live with cruel reality fact - if_vmove doesn't move an
interface from previous vnet cloning infrastructure to the new
one.  Let's admit this as design feature and make it work better.

* Delete two blocks of code that would fallback to vnet0, if a
  cloner isn't found.  They didn't do any good job and also whole
  idea of treating vnet0 as special one is wrong.
* When deleting a cloned interface, lookup its cloner using it's
  home vnet.

With this change simple sequence works correctly:

  ifconfig foo0 create
  jail -c name=jj persist vnet vnet.interface=foo0
  jexec jj ifconfig foo0 destroy

Differential revision: https://reviews.freebsd.org/D33942

2 years agoif_vmove: improve restoration in cloner's ifgroup membership
Gleb Smirnoff [Tue, 25 Jan 2022 05:06:59 +0000 (21:06 -0800)]
if_vmove: improve restoration in cloner's ifgroup membership

* Do a single call into if_clone.c instead of two.  The cloner
  can't disappear since the interface sits on its list.
* Make restoration smarter - check that cloner with same name
  exists in the new vnet.

Differential revision: https://reviews.freebsd.org/D33941

2 years agotests/netinet: add test for IPv6 NS and CARP
Thomas Steen Rasmussen [Tue, 25 Jan 2022 05:02:47 +0000 (21:02 -0800)]
tests/netinet: add test for IPv6 NS and CARP

PR: 193280
Reviewed by: melifaro
Differential revision: https://reviews.freebsd.org/D33859

2 years agond6: use CARP link level address in SLLAO for NS sent out
Thomas Steen Rasmussen [Tue, 25 Jan 2022 05:02:47 +0000 (21:02 -0800)]
nd6: use CARP link level address in SLLAO for NS sent out

When sending an NS, check if we are using a IPv6 CARP address
and if we do, then put proper CARP link level address into
ND_OPT_SOURCE_LINKADDR option and also put PACKET_TAG_CARP tag
on the packet.  The latter will enforce CARP link level address
at the data link layer too, which might be necessary for broken
implementations.
The code really follows what NA sending code has been doing since
introduction of carp(4).  While here, bring to style(9) the whole
block of code.

PR: 193280
Differential revision: https://reviews.freebsd.org/D33858

2 years agoice_ddp: Update to 1.3.27.0
Eric Joyner [Wed, 1 Dec 2021 20:48:36 +0000 (12:48 -0800)]
ice_ddp: Update to 1.3.27.0

This is intended to be used with forthcoming ice(4) driver version 1.34.2.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Sponsored by: Intel Corporation

2 years agoiflib: Allow drivers to determine which queue to TX on
Eric Joyner [Thu, 29 Jul 2021 23:24:14 +0000 (16:24 -0700)]
iflib: Allow drivers to determine which queue to TX on

Adds a new function pointer to struct if_txrx in order to allow
drivers to set their own function that will determine which queue
a packet should be sent on.

Since this includes a kernel ABI change, bump the __FreeBSD_version
as well.

(This motivation behind this is to allow the driver to examine the
UP in the VLAN tag and determine which queue to TX on based on
that, in support of HW TX traffic shaping.)

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: kbowling@, stallamr@netapp.com
Tested by: jeffrey.e.pieper@intel.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D31485

2 years agoatsectl: Remove.
John Baldwin [Tue, 25 Jan 2022 00:40:02 +0000 (16:40 -0800)]
atsectl: Remove.

This was used in the BERI Altera DE4 that ran CHERI MIPS.

Approved by: brooks

2 years agoBump __FreeBSD_version for the addition of <crypto/curve25519.h>.
John Baldwin [Mon, 24 Jan 2022 23:28:36 +0000 (15:28 -0800)]
Bump __FreeBSD_version for the addition of <crypto/curve25519.h>.

Sponsored by: The FreeBSD Foundation

2 years agocrypto: Remove xform.c and compile xform_*.c standalone.
John Baldwin [Mon, 24 Jan 2022 23:27:40 +0000 (15:27 -0800)]
crypto: Remove xform.c and compile xform_*.c standalone.

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

2 years agoxform_*.c: Add headers when needed to compile standalone.
John Baldwin [Mon, 24 Jan 2022 23:27:40 +0000 (15:27 -0800)]
xform_*.c: Add headers when needed to compile standalone.

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

2 years agoRetire now-unused M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
Retire now-unused M_XDATA.

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

2 years agoIPsec: Use protocol-specific malloc types instead of M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
IPsec: Use protocol-specific malloc types instead of M_XDATA.

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

2 years agocryptodev: Use a private malloc type (M_CRYPTODEV) instead of M_XDATA.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
cryptodev: Use a private malloc type (M_CRYPTODEV) instead of M_XDATA.

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

2 years agoDon't implicitly pull in most of 'device crypto' for 'options IPSEC'.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
Don't implicitly pull in most of 'device crypto' for 'options IPSEC'.

options IPSEC is already documented as requiring 'device crypto' and
duplicating the dependencies is harder to read and not always
consistent.

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

2 years agocrypto: Add an API supporting curve25519.
John Baldwin [Mon, 24 Jan 2022 23:27:39 +0000 (15:27 -0800)]
crypto: Add an API supporting curve25519.

This adds a wrapper around libsodium's curve25519 support matching
Linux's curve25519 API.  The intended use case for this is WireGuard.

Note that this is not integrated with OCF as it is not related to
symmetric operations on data.

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

2 years agocxgbei: Parse all PDUs received prior to enabling offload mode.
John Baldwin [Sat, 22 Jan 2022 01:02:16 +0000 (17:02 -0800)]
cxgbei: Parse all PDUs received prior to enabling offload mode.

Previously this would only handle a single PDU that did not contain
any data.  This should now handle an arbitrary number of PDUs.

While here check for these PDUs in the T6-specific CPL_RX_ISCSI_CMP
handler in addition to CPL_RX_ISCSI_DDP.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

2 years agompr/mps: Remove write-only flag and callout
Warner Losh [Mon, 24 Jan 2022 20:21:09 +0000 (13:21 -0700)]
mpr/mps: Remove write-only flag and callout

The discovery callout is initialized and cancelled only, making it
write-only. Remove a state flag associated with it being pending as well
as two defines that aren't used that are associated with it. Remove
MP?SAS_SHUTDOWN flag, which is unused.

Sponsored by: Netflix
Reviewed by: ken, scottl, mav
Differential Revision: https://reviews.freebsd.org/D33925

2 years agopmcstudy: Fix a typo in a usage message
Gordon Bergling [Mon, 24 Jan 2022 18:41:39 +0000 (19:41 +0100)]
pmcstudy: Fix a typo in a usage message

-s /measurments/measurements/

MFC after: 3 days

2 years agorefactor script
Wolfram Schneider [Mon, 24 Jan 2022 18:23:59 +0000 (18:23 +0000)]
refactor script

- simpler usage of mktemp(1)
- remove unnecessary checks
- documentation

2 years agoawk: print the last two characters for bigram - not the second word
Wolfram Schneider [Mon, 24 Jan 2022 18:06:07 +0000 (18:06 +0000)]
awk: print the last two characters for bigram -  not the second word

A bigram may contain a space character, and we always need two characters.

2 years agostop on first error
Wolfram Schneider [Sat, 22 Jan 2022 09:57:09 +0000 (09:57 +0000)]
stop on first error

2 years agoInclude the correct header for pdfork()'s prototype.
John Baldwin [Mon, 24 Jan 2022 17:52:12 +0000 (09:52 -0800)]
Include the correct header for pdfork()'s prototype.

Reviewed by: kib, markj
Obtained from: CheriBSD
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33988

2 years agouser_getpeername: Use 'bool' for the compat argument.
John Baldwin [Mon, 24 Jan 2022 17:51:35 +0000 (09:51 -0800)]
user_getpeername: Use 'bool' for the compat argument.

This matches user_getsockname.

Reviewed by: brooks, kib
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33987

2 years agofetch(1): fix error in previous commit
Eugene Grosbein [Mon, 24 Jan 2022 08:07:18 +0000 (15:07 +0700)]
fetch(1): fix error in previous commit

strncmp() compares terminating zero and sizeof() includes it.
Un-obsfuscate the code and show what it is indended to do.

2 years agofetch(1): do not consider HTTP 5XX errors as soft failures
Eugene Grosbein [Mon, 24 Jan 2022 07:35:49 +0000 (14:35 +0700)]
fetch(1): do not consider HTTP 5XX errors as soft failures

This change fixes "fetch -a" looping forever on "502 Bad gateway"
error and similar.

MFC after: 1 month

2 years agoUPDATING: Sort by date
Cy Schubert [Mon, 24 Jan 2022 06:39:10 +0000 (22:39 -0800)]
UPDATING: Sort by date

I still didn't sort it right.

Pointy hat to: cy

2 years agoUPDATING: Sort by date
Cy Schubert [Mon, 24 Jan 2022 06:34:21 +0000 (22:34 -0800)]
UPDATING: Sort by date

Sort unbound entry by date.

2 years agoUPDATING: Document unbound support of RFC8375
Cy Schubert [Mon, 24 Jan 2022 06:21:49 +0000 (22:21 -0800)]
UPDATING: Document unbound support of RFC8375

As of unbound 1.14.0rc1, as per RFC8375 unbound by default blocks
'home.arpa'. Document this new behaviour and how to unblock it.

Reported by: avg
Discussed with: glebius, avg
RFC: 8375, Section 6: Security Considerations

2 years agounbound: Vendor import 1.14.0
Cy Schubert [Mon, 24 Jan 2022 05:58:36 +0000 (21:58 -0800)]
unbound: Vendor import 1.14.0

Vendor import GA release of unbound 1.14.0.

MFC after:      2 weeks

Merge commit '9b87431a326169e72d5ca55670cb3c95205aa350' into unbound/main

2 years agomodules: mgb: need opt_platform.h
Kevin Lo [Mon, 24 Jan 2022 05:38:39 +0000 (13:38 +0800)]
modules: mgb: need opt_platform.h

This fixes the standalone build.

2 years agofetch(1): correct progress accounting after previous commit
Eugene Grosbein [Mon, 24 Jan 2022 04:17:24 +0000 (11:17 +0700)]
fetch(1): correct progress accounting after previous commit

MFC after: 1 month

2 years agofetch(1): process truncated transfer as soft failure
Eugene Grosbein [Mon, 24 Jan 2022 04:03:42 +0000 (11:03 +0700)]
fetch(1): process truncated transfer as soft failure

Let "fetch -a" resume truncated transfer automatically
perform another attempt if it obtained some new data in previous one
making progress.

This makes it more robust against frequent but transient network failures.
For example:

=> sqlite-src-3370200.zip doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://www.sqlite.org/2022/sqlite-src-3370200.zip
sqlite-src-3370200.zip                          3% of   12 MB   45 kBps 04m24s
fetch: sqlite-src-3370200.zip appears to be truncated: 524288/13145234 bytes
sqlite-src-3370200.zip                         10% of   12 MB   67 kBps 02m56s
fetch: sqlite-src-3370200.zip appears to be truncated: 1327104/13145234 bytes
sqlite-src-3370200.zip                         28% of   12 MB  123 kBps 01m14s
fetch: sqlite-src-3370200.zip appears to be truncated: 3735552/13145234 bytes
sqlite-src-3370200.zip                         54% of   12 MB  253 kBps    24s
fetch: sqlite-src-3370200.zip appears to be truncated: 7176192/13145234 bytes
sqlite-src-3370200.zip                         62% of   12 MB   90 kBps    55s
fetch: sqlite-src-3370200.zip appears to be truncated: 8241152/13145234 bytes
sqlite-src-3370200.zip                         82% of   12 MB  113 kBps    20s
fetch: sqlite-src-3370200.zip appears to be truncated: 10862592/13145234 bytes
sqlite-src-3370200.zip                                  12 MB  185 kBps    12s
===> Fetching all distfiles required by sqlite3-3.37.2,1 for building

MFC after: 1 month

2 years agomountd: Delay starting mountd until after mountlate
Rick Macklem [Sun, 23 Jan 2022 22:17:40 +0000 (14:17 -0800)]
mountd: Delay starting mountd until after mountlate

PR#254282 reports a problem where nullfs mounts cannot be
exported via mountd for FreeBSD 13.0.

The problem seems to be that, to do the nullfs mounts in
/etc/fstab, they require the "late" mount option, so that the
underlying filesystem is mounted (ZFS for the PR).

Adding "mountlate" to the REQUIRE list in /etc/rc.d/mountd
fixes the problem, but that results in a dependency cycle
because /etc/rc.d/lockd specifies:

REQUIRE: nfsd
BEFORE: DAEMON
--> which forces mountd to preceed DAEMON.

This patch removes "nfsd" from REQUIRE for lockd and statd,
then adds mountlate to REQUIRE for mountd, to fix this
problem.  Having lockd REQUIRE nfsd was done in the NetBSD
code when it was pulled into FreeBSD and there does not
seem to be a need for this.

In case this causes problems, a long MFC has been specified.

PR: 254282
Differential Revision: https://reviews.freebsd.org/D33256
MFC after: 3 months

2 years agosound: add patch for Lenovo Legion 5 AMD
Philippe Michaud-Boudreault [Wed, 19 May 2021 14:38:34 +0000 (10:38 -0400)]
sound: add patch for Lenovo Legion 5 AMD

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30333

2 years agoena: update ENA version to v2.5.0
Michal Krawczyk [Mon, 3 Jan 2022 13:51:59 +0000 (14:51 +0100)]
ena: update ENA version to v2.5.0

Some of the changes in this release:
- IPv6 L4 checksum offload fixes.
- Optimization of the Tx req_id validation.
- Timer service adjustments.
- NUMA awareness for the kernel RSS mode.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: fix man page typos and update contact section
Michal Krawczyk [Mon, 3 Jan 2022 13:51:52 +0000 (14:51 +0100)]
ena: fix man page typos and update contact section

Verified spelling in the README and fixed the typos.

Also updated the contact section by removing Artur and adding Dawid
Gorecki who is now the second ENA FreeBSD driver developer.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: do not call reset if device is unresponsive
Dawid Gorecki [Mon, 3 Jan 2022 13:50:29 +0000 (14:50 +0100)]
ena: do not call reset if device is unresponsive

If the device becomes unresponsive, the driver will not be able to
finish the reset process correctly. Timeout during version validation
indicates that the device is currently not responding. In that case
do not perform the reset and instead reschedule timer service. Because
of that the driver will continue trying to reset the device until it
succeeds or is detached.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: start timer service on attach
Dawid Gorecki [Mon, 3 Jan 2022 13:50:13 +0000 (14:50 +0100)]
ena: start timer service on attach

The timer service was started when the interface was brought up and it
was stopped when it was brought down. Since ena_up requires the device
to be responsive, triggering the reset would become impossible if the
device became unresponsive with the interface down.

Since most of the functions in timer service already perform the check
to see if the device is running, this only requires starting the callout
in attach and stopping it when bringing the interface up or down to
avoid race between different admin queue calls.

Since callout functions for timer service are always called with the
same arguments, replace callout_{init,reset,drain} calls with
ENA_TIMER_{INIT,RESET,DRAIN} macros.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: rework tx req_id validation logic
Artur Rojek [Mon, 3 Jan 2022 13:50:06 +0000 (14:50 +0100)]
ena: rework tx req_id validation logic

Since `ena_com_tx_comp_req_id_get` already checks for `req_id` validity,
the logic was exiting early, never giving `validate_tx_req_id` a chance
to trigger device reset.
Rewrite the logic so that device reset is called based on return value
of `ena_com_tx_comp_req_id_get` instead.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: properly handle IPv6 L4 checksum offload
Dawid Gorecki [Mon, 3 Jan 2022 13:49:58 +0000 (14:49 +0100)]
ena: properly handle IPv6 L4 checksum offload

ena_tx_csum function did not check if IPv6 checksum offload was
requested it only checked checksum offloading flags for IPv4 packets.
Because of that, when encountering CSUM_IP6_* flags, the function simply
returned without actually setting checksum offloading in ena_ctx.
Check CUSM_IP6_* flags to enable IPv6 checksum offload.

Additionally, only IPv4 header was being parsed regardless of EtherType
field, because of that, value of L4 protocol read when actually trying
to send IPv6 packets was wrong. Use ip6_lasthdr function to get length
of all IPv6 headers and payload protocol.

Set the DF flag to 1 in order to allow the device to offload the IPv6
checksum calculation and achieve optimal performance.

Add CSUM6_OFFLOAD and CSUM_OFFLOAD definitions into ena_datapath.h.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: merge ena-com v2.5.0 upgrade
Marcin Wojtas [Sun, 23 Jan 2022 19:21:17 +0000 (20:21 +0100)]
ena: merge ena-com v2.5.0 upgrade

Merge commit '2530eb1fa01bf28fbcfcdda58bd41e055dcb2e4a'

Adjust the driver to the upgraded ena-com part twofold:

First update is related to the driver's NUMA awareness.

Allocate I/O queue memory in NUMA domain local to the CPU bound to the
given queue, improving data access time. Since this can result in
performance hit for unaware users, this is done only when RSS
option is enabled, for other cases the driver relies on kernel to
allocate memory by itself.

Information about first CPU bound is saved in adapter structure, so
the binding persists after bringing the interface down and up again.

If there are more buckets than interface queues, the driver will try to
bind different interfaces to different CPUs using round-robin algorithm
(but it will not bind queues to CPUs which do not have any RSS buckets
associated with them). This is done to better utilize hardware
resources by spreading the load.

Add (read-only) per-queue sysctls in order to provide the following
information:
- queueN.domain: NUMA domain associated with the queue
- queueN.cpu:    CPU affinity of the queue

The second change is for the CSUM_OFFLOAD constant, as ENA platform
file has removed its definition. To align to that change, it has been
added to the ena_datapath.h file.

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agozfs: fix kernel build after e92ffd9b6 if ZFS is compiled in
Martin Matuska [Sun, 23 Jan 2022 08:24:00 +0000 (09:24 +0100)]
zfs: fix kernel build after e92ffd9b6 if ZFS is compiled in

Add missing source file lz4_zfs.c to sys/conf/files

2 years agozfs: merge openzfs/zfs@17b2ae0b2 (master) into main
Martin Matuska [Sat, 22 Jan 2022 22:05:15 +0000 (23:05 +0100)]
zfs: merge openzfs/zfs@17b2ae0b2 (master) into main

Notable upstream pull request merges:
  #12766 Fix error propagation from lzc_send_redacted
  #12805 Updated the lz4 decompressor
  #12851 FreeBSD: Provide correct file generation number
  #12857 Verify dRAID empty sectors
  #12874 FreeBSD: Update argument types for VOP_READDIR
  #12896 Reduce number of arc_prune threads
  #12934 FreeBSD: Fix zvol_*_open() locking
  #12947 lz4: Cherrypick fix for CVE-2021-3520
  #12961 FreeBSD: Fix leaked strings in libspl mnttab
  #12964 Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD
  #12981 Introduce a flag to skip comparing the local mac when raw sending
  #12985 Avoid memory allocations in the ARC eviction thread

Obtained from: OpenZFS
OpenZFS commit: 17b2ae0b24d487fdda2ef1098ec26fa7f79a61f6

2 years agoSort SRCS in libcxxrt's Makefile, and use += to list sources
Dimitry Andric [Sat, 22 Jan 2022 20:08:55 +0000 (21:08 +0100)]
Sort SRCS in libcxxrt's Makefile, and use += to list sources

No functional change intended.

MFC after: 3 days

2 years agoMake date headers in ObsoleteFiles.inc a little more consistent
Dimitry Andric [Sat, 22 Jan 2022 20:04:23 +0000 (21:04 +0100)]
Make date headers in ObsoleteFiles.inc a little more consistent

* Use "yyyymmdd: description" format
* Remove dots at EOL

MFC after: 3 days

2 years agogdb(4): Do not use run length encoding for 3-symbol repetitions
Michał Górny [Mon, 10 Jan 2022 03:03:46 +0000 (22:03 -0500)]
gdb(4): Do not use run length encoding for 3-symbol repetitions

Disable the gdb packet run length encoding for 3-symbol repetitions.
While it is technically possible to encode them, they have no advantage
over sending the characters verbatim (the resulting length is the same)
and they result in sending non-printable \x1f character.  The protocol
has been designed with the intent of avoiding non-printable characters
and therefore the run length encoding is biased to emit \x20 (a space)
with the minimal intended run length of 4.

While at it, simplify the logic by merging the different 'if' blocks
into a single while loop, and moving 'runlen == 0' check lower.

Reviewed by: cem, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33686

2 years agoRemove quotes around Makefile .error/.warn/.info strings
Ed Maste [Sat, 15 Jan 2022 21:20:24 +0000 (16:20 -0500)]
Remove quotes around Makefile .error/.warn/.info strings

The text after .error et al is emitted verbatim.

Reviewed by: sjg
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33904

2 years agohwpmc: drop 0x before %p printf format string
Ed Maste [Mon, 17 Jan 2022 01:27:15 +0000 (20:27 -0500)]
hwpmc: drop 0x before %p printf format string

%p already includes the 0x.

Sponsored by: The FreeBSD Foundation

2 years agoptrace(2): document policies affecting access to the facility
Konstantin Belousov [Fri, 21 Jan 2022 23:26:23 +0000 (01:26 +0200)]
ptrace(2): document policies affecting access to the facility

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33986

2 years agoAdd security.bsd.allow_ptrace sysctl
Konstantin Belousov [Fri, 21 Jan 2022 21:52:35 +0000 (23:52 +0200)]
Add security.bsd.allow_ptrace sysctl

that disables any access to ptrace(2) for all processes.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33986

2 years agop_candebug(), p_cansee(): always allow for curproc
Konstantin Belousov [Fri, 21 Jan 2022 15:29:17 +0000 (17:29 +0200)]
p_candebug(), p_cansee(): always allow for curproc

Privilege checks in both functions should allow the current process to
infer information about itself, as well as use the interfaces that are
proclaimed 'debugging', for instance, procctl(2).

Note that in p_cansee() case, explicit comparision of curproc and p
avoids a race where the process might change credentials and cause
thread to compare its cached stale credentials against updated process
creds, effectively disallowing the process to observe itself.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33986

2 years agovm_pageout_scans: correct detection of active object
Konstantin Belousov [Sun, 16 Jan 2022 20:18:21 +0000 (22:18 +0200)]
vm_pageout_scans: correct detection of active object

For non-anonymous swap objects, there is always a reference from the
owner to the object to keep it from recycling.  Account for it when
deciding should we query pmap for hardware active references for the
page.

As result, we avoid unneeded calls to pmap_ts_referenced(), which for
non-mapped page means avoiding unneccessary lock and unlock of the pv list.

Reviewed by: markj
Discussed with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33924

2 years agoip_mroute: add unlock in early-exit
Wojciech Macek [Sat, 22 Jan 2022 13:47:47 +0000 (14:47 +0100)]
ip_mroute: add unlock in early-exit

Add missing unlock if V_ip_mrotue is not set

Obtained from: Semihalf

2 years agoport_conflicts_check.lua: revert commit 82bfeeff10da
Stefan Eßer [Sat, 22 Jan 2022 12:08:15 +0000 (13:08 +0100)]
port_conflicts_check.lua: revert commit 82bfeeff10da

An enhanced version of this script has been committed to the ports
repository as /usr/ports/Tools/scripts/port_conflicts_check.lua.

2 years agoip_mroute: release epoch lock if mrouter is not configured
Wojciech Macek [Sat, 22 Jan 2022 10:47:39 +0000 (11:47 +0100)]
ip_mroute: release epoch lock if mrouter is not configured

Add mising "else" branch to release a lock if mrouter is not
configured.

Obtained from: Semihalf
Sponsored by: Stormshield

2 years agoFix test-runner on FreeBSD
наб [Fri, 21 Jan 2022 23:37:46 +0000 (00:37 +0100)]
Fix test-runner on FreeBSD

CLOCK_MONOTONIC_RAW is only a thing on Linux and macOS. I'm not
actually sure why the previous hardcoding of a constant didn't
error out, but when we removed it, it sure does now.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12995

2 years agoiscsi: Fix missing is_lock unlock after cam_simq_alloc() failed
Ka Ho Ng [Fri, 21 Jan 2022 21:34:15 +0000 (16:34 -0500)]
iscsi: Fix missing is_lock unlock after cam_simq_alloc() failed

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoFix handling of errors from dmu_write_uio_dbuf() on FreeBSD
Mark Johnston [Fri, 21 Jan 2022 19:54:05 +0000 (14:54 -0500)]
Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD

FreeBSD's implementation of zfs_uio_fault_move() returns EFAULT when a
page fault occurs while copying data in or out of user buffers.  The VFS
treats such errors specially and will retry the I/O operation (which may
have made some partial progress).

When the FreeBSD and Linux implementations of zfs_write() were merged,
the handling of errors from dmu_write_uio_dbuf() changed such that
EFAULT is not handled as a partial write.  For example, when appending
to a file, the z_size field of the znode is not updated after a partial
write resulting in EFAULT.

Restore the old handling of errors from dmu_write_uio_dbuf() to fix
this.  This should have no impact on Linux, which has special handling
for EFAULT already.

Reviewed-by: Andriy Gapon <avg@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #12964

2 years agoIntroduce a flag to skip comparing the local mac when raw sending
George Amanakis [Fri, 21 Jan 2022 19:41:17 +0000 (20:41 +0100)]
Introduce a flag to skip comparing the local mac when raw sending

Raw receiving a snapshot back to the originating dataset is currently
impossible because of user accounting being present in the originating
dataset.

One solution would be resetting user accounting when raw receiving on
the receiving dataset. However, to recalculate it we would have to dirty
all dnodes, which may not be preferable on big datasets.

Instead, we rely on the os_phys flag
OBJSET_FLAG_USERACCOUNTING_COMPLETE to indicate that user accounting is
incomplete when raw receiving. Thus, on the next mount of the receiving
dataset the local mac protecting user accounting is zeroed out.
The flag is then cleared when user accounting of the raw received
snapshot is calculated.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #12981
Closes #10523
Closes #11221
Closes #11294
Closes #12594
Issue #11300

2 years agoena-com: add NUMA allocations macros
Artur Rojek [Fri, 21 Jan 2022 18:55:36 +0000 (19:55 +0100)]
ena-com: add NUMA allocations macros

Add implementation for the ENA_MEM_ALLOC_NODE and
ENA_MEM_ALLOC_COHERENT_NODE_* macros. Also the signature of
ena_dma_alloc() function was updated, for which the implementation
will be updated in ENA driver's patch.

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

2 years agoena-com: remove CSUM_OFFLOAD from the plat file
Michal Krawczyk [Fri, 21 Jan 2022 18:53:40 +0000 (19:53 +0100)]
ena-com: remove CSUM_OFFLOAD from the plat file

CSUM_OFFLOAD is a constant which is used only by the core driver code.
Because of that it shouldn't be defined in the platform file, as it's
not the platform specific code which is used only by the ena_com layer.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
Sponsored by: Amazon, Inc.

2 years agoena-com: remove redundant declaration of ena_log_level.
John Baldwin [Fri, 21 Jan 2022 18:52:39 +0000 (19:52 +0100)]
ena-com: remove redundant declaration of ena_log_level.

GCC6 raises a -Wredundant-decl error due to duplicate declarations
in ena_fbsd_log.h and ena_plat.h.

Sponsored by:   Chelsio Communications

2 years agoAvoid memory allocations in the ARC eviction thread
Mark Johnston [Fri, 21 Jan 2022 18:28:13 +0000 (13:28 -0500)]
Avoid memory allocations in the ARC eviction thread

When the eviction thread goes to shrink an ARC state, it allocates a set
of marker buffers used to hold its place in the state's sublists.

This can be problematic in low memory conditions, since
1) the allocation can be substantial, as we allocate NCPU markers;
2) on at least FreeBSD, page reclamation can block in
   arc_wait_for_eviction()

In particular, in stress tests it's possible to hit a deadlock on
FreeBSD when the number of free pages is very low, wherein the system is
waiting for the page daemon to reclaim memory, the page daemon is
waiting for the ARC eviction thread to finish, and the ARC eviction
thread is blocked waiting for more memory.

Try to reduce the likelihood of such deadlocks by pre-allocating markers
for the eviction thread at ARC initialization time.  When evicting
buffers from an ARC state, check to see if the current thread is the ARC
eviction thread, and use the pre-allocated markers for that purpose
rather than dynamically allocating them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: George Amanakis <gamanakis@gmail.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Closes #12985

2 years agolibspl: ASSERT*: !! for sizeof
наб [Fri, 21 Jan 2022 18:20:11 +0000 (19:20 +0100)]
libspl: ASSERT*: !! for sizeof

sizeof(bitfield.member) is invalid, and this shows up in some FreeBSD
build configurations: work around this by !!ing ‒
this makes the sizeof target the ! result type (_Bool), instead

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Fixes: 42aaf0e ("libspl: ASSERT*: mark arguments as used")
Closes #12984
Closes #12986

2 years agobhyve: ahci: Fix regression with no ports
Ryan Moeller [Fri, 21 Jan 2022 12:59:25 +0000 (12:59 +0000)]
bhyve: ahci: Fix regression with no ports

An AHCI controller may be specified with no connected ports.  Avoid
dumping core in this case for compatibility with existing VM configs.

Reviewed by: khng, jhb
Fixes: 621b5090487de Refactor configuration management in bhyve.
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D33969

2 years agoatrtc: Install address space handler for \_SB and its descendant.
Takanori Watanabe [Fri, 21 Jan 2022 06:32:30 +0000 (15:32 +0900)]
atrtc: Install address space handler for \_SB and its descendant.

SystemCMOS address space is accessible for system wide.
 So install address handler in \_SB space.

Reviewed by: jhb

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

2 years agoacpi: Ignore _STA and never disable AT RTC devices
Takanori Watanabe [Fri, 21 Jan 2022 06:30:46 +0000 (15:30 +0900)]
acpi: Ignore _STA and never disable AT RTC devices

atrtc(4) should always install a SystemCMOS address space handler unless
the RTC Not Present bit is not set in IAPC_BOOT_ARCH in the FADT.
The atrtc(4) driver already checks this bit, but _STA can return not-present
even when this bit is clear.

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

2 years agoip_mroute: move ip_mrouter_done outside lock
Wojciech Macek [Fri, 21 Jan 2022 05:15:08 +0000 (06:15 +0100)]
ip_mroute: move ip_mrouter_done outside lock

X_ip_mrouter_done might sleep, which triggers INVARIANTS to
print additional errors on the screen.
Move it outside the lock, but provide some basic synchronization
to avoid race condition during module uninit/unload.

Obtained from: Semihalf
Sponsored by: Stormshield

2 years agoRevert "ip_mroute: do not call epoch_waitwhen lock is taken"
Wojciech Macek [Thu, 20 Jan 2022 12:12:23 +0000 (13:12 +0100)]
Revert "ip_mroute: do not call epoch_waitwhen lock is taken"

This reverts commit 2e72208b6c622505323ed48dc58830fc307392b1.

2 years agopowerpc: enable ice in GENERIC64LE
Piotr Kubaj [Thu, 20 Jan 2022 21:32:02 +0000 (22:32 +0100)]
powerpc: enable ice in GENERIC64LE

Approved by: erj
Differential Revision: https://reviews.freebsd.org/D33974

2 years agossh: pass 0 to procctl(2) to operate on self
Ed Maste [Thu, 20 Jan 2022 18:41:39 +0000 (13:41 -0500)]
ssh: pass 0 to procctl(2) to operate on self

As of f833ab9dd187 procctl(2) allows idtype P_PID with id = 0 as a
shortcut for the calling process ID.  The shortcut also bypasses the
p_cansee / p_candebug test (since the process is able to act on itself.)

At present if the security.bsd.unprivileged_proc_debug sysctl is 0 then
procctl(P_PID, getpid(), ... for a process to act on itself will fail,
but procctl(P_PID, 0, ... will succeed.  This should likely be addressed
with a kernel change.

In any case the id = 0 shortcut is a tiny optimization for a process to
act on itself and allows the self-procctl to succeed, so use it in ssh.

Reported by: Shawn Webb
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33970

2 years agoAppend Keyboard Layout specified option for using VNC.
Michael Reifenberger [Thu, 20 Jan 2022 22:44:04 +0000 (23:44 +0100)]
Append Keyboard Layout specified option for using VNC.
Part two: Append bhyve -K option for specified keyboard layout
with layout setting files every languages.
Since the cmd option '-k' was used in the meantime
it was changed to '-K'

PR: 246121
Submitted by: koinec@yahoo.co.jp
Reviewed by: grehan@
Differential Revision: https://reviews.freebsd.org/D29473

MFC after: 4 weeks

2 years agochacha20_poly1305: Use the correct license disclaimer.
John Baldwin [Thu, 20 Jan 2022 22:36:48 +0000 (14:36 -0800)]
chacha20_poly1305: Use the correct license disclaimer.

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

2 years agocheck/delete-old: Auto-generate lib32 entries for libraries.
John Baldwin [Thu, 20 Jan 2022 22:09:57 +0000 (14:09 -0800)]
check/delete-old: Auto-generate lib32 entries for libraries.

- Add usr/lib32/libfoo.so.N for lib/libfoo.so.N.

- Add usr/lib32/foo for usr/lib/foo.

- Treat casper libraries special since they are installed to
  /usr/lib32 instead of /usr/lib32/casper and thus map
  usr/lib/casper/foo to usr/lib32/foo.

Note that OLD_DIRS and MOVED_LIBS entries are not duplicated, only
OLD_FILES and OLD_LIBS.

Reviewed by: imp, emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33324

2 years agoUse MOVED_LIBS for the libalias modules being moved to /lib.
John Baldwin [Thu, 20 Jan 2022 20:48:24 +0000 (12:48 -0800)]
Use MOVED_LIBS for the libalias modules being moved to /lib.

This is a bit more unusual in that the modules dropped their major
version suffix at the same time, so the old files being removed by
MOVED_LIBS in this case are the symlinks to the old libraries.

Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33849

2 years agoUse MOVED_LIBS for libraries moved between /usr/lib and /lib.
John Baldwin [Thu, 20 Jan 2022 20:47:43 +0000 (12:47 -0800)]
Use MOVED_LIBS for libraries moved between /usr/lib and /lib.

Add a MOVED_LIBS variable similar to OLD_LIBS except that MOVED_LIBS
is used for the cases that a library's name doesn't change, but it
just moves between /usr/lib and /lib.  This will be used by a future
change to auto-generate lib32 old files entries for which these cases
need to be ignored (a moved library remains in /usr/lib32).

Suggested by: emaste
Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33848

2 years agoRework documentation of OLD_*.
John Baldwin [Thu, 20 Jan 2022 20:46:29 +0000 (12:46 -0800)]
Rework documentation of OLD_*.

- Be more explicit in the difference between OLD_DIRS and OLD_FILES
  (the former is only in delete-old-libs whereas the latter is in
  delete-old).

- Document that debug symbols in /usr/lib/debug/ for files in
  OLD_FILES and OLD_LIBS are removed as well.

Reviewed by: emaste
Sponsored by: The University of Cambridge, Google Inc.
Differential Revision: https://reviews.freebsd.org/D33847

2 years agoktls: Zero out TLS_GET_RECORD control messages
Mark Johnston [Thu, 20 Jan 2022 20:42:46 +0000 (15:42 -0500)]
ktls: Zero out TLS_GET_RECORD control messages

Otherwise we end up copying one uninitialized byte into the socket
buffer.

Reported by: KMSAN
Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33953

2 years agoFix problem with zdb -d
Paul Zuchowski [Thu, 20 Jan 2022 17:28:55 +0000 (12:28 -0500)]
Fix problem with zdb -d

zdb -d <pool>/<objset ID> does not work when
other command line arguments are included i.e.
zdb -U <cachefile> -d <pool>/<objset ID>
This change fixes the command line parsing
to handle this situation.  Also fix issue
where zdb -r <dataset> <file> does not handle
the root <dataset> of the pool. Introduce -N
option to force <objset ID> to be interpreted
as a numeric objsetID.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #12845
Closes #12944

2 years agogeom: Handle partial I/O in g_{read,write,delete}_data()
Mark Johnston [Thu, 20 Jan 2022 13:25:27 +0000 (08:25 -0500)]
geom: Handle partial I/O in g_{read,write,delete}_data()

These routines are used internally by GEOM to dispatch I/O requests to a
provider, typically for tasting or for updating GEOM class metadata
blocks.

These routines assumed that partial I/O did not occur without setting
BIO_ERROR, but this is possible in at least two cases:
- Some or all of the I/O range is beyond the provider's mediasize.
  In this scenario g_io_check() truncates the bounds of the request
  before it is handed to the target provider.
- A read from vnode-backed md(4) device returns EOF (the backing vnode
  is allowed to be smaller than the device itself) or partial vnode I/O
  occurs.
In these scenarios g_read_data() could return a partially uninitialized
buffer.  Many consumers are not affected by the first case, since the
offsets used for provider metadata or tasting are relative to the
provider's mediasize, but in some cases metadata is read at fixed
offsets, such as when searching for a UFS superblock using the offsets
defined by SBLOCKSEARCH.

Thus, modify the routines to explicitly check for a non-zero residual
and return EIO in that case.  Remove a related check from the
DIOCGDELETE ioctl handler, it is handled within g_delete_data() now.

Reviewed by: mav, imp, kib
Reported by: KMSAN
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31293

2 years agovtnet: Mark MRG_RXBUF headers as initialized before loading fields
Mark Johnston [Thu, 20 Jan 2022 13:25:14 +0000 (08:25 -0500)]
vtnet: Mark MRG_RXBUF headers as initialized before loading fields

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agofusefs: Address -Wunused-but-set-variable warnings
Mark Johnston [Thu, 20 Jan 2022 13:25:00 +0000 (08:25 -0500)]
fusefs: Address -Wunused-but-set-variable warnings

Reviewed by: asomers
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33957

2 years agoclockcalib: Fix an overflow bug
Mark Johnston [Thu, 20 Jan 2022 13:23:38 +0000 (08:23 -0500)]
clockcalib: Fix an overflow bug

tc_counter_mask is an unsigned int and in the TSC timecounter is equal
to UINT_MAX, so the addition tc->tc_counter_mask + 1 can overflow to 0,
resulting in a hang during boot.

Fixes: c2705ceaeb09 ("x86: Speed up clock calibration")
Reviewed by: cperciva
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33956

2 years agoremove debug code for cpu usage
Wolfram Schneider [Wed, 19 Jan 2022 20:10:28 +0000 (20:10 +0000)]
remove debug code for cpu usage

I guess nobody used this in the last decade, and you can get
similar results with the time(1) command.

2 years agoUse 64-bit integers for database statistics
Wolfram Schneider [Wed, 19 Jan 2022 20:34:33 +0000 (20:34 +0000)]
Use 64-bit integers for database statistics

This fix (harmless) integer overflows for larger partitions (>2TB)

PR: 223023

2 years agokqueue(2): Add note about format of the data for NOTE_EXIT
Konstantin Belousov [Wed, 19 Jan 2022 22:35:09 +0000 (00:35 +0200)]
kqueue(2): Add note about format of the data for NOTE_EXIT

Noted by: Dave Baukus <daveb@spectralogic.com>
PR: 261346
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

2 years agoriscv: fix unused var in page_fault_handler()
Mitchell Horne [Tue, 11 Jan 2022 15:24:30 +0000 (11:24 -0400)]
riscv: fix unused var in page_fault_handler()

clang warns that p is set-but-not-used, so let's use it.

2 years agoAdd tests for ses(4)
Alan Somers [Fri, 27 Aug 2021 20:38:39 +0000 (14:38 -0600)]
Add tests for ses(4)

The tests require SES hardware.  Without it, the test cases will be
skipped.

Reviewed by: ken
Differential Revision: https://reviews.freebsd.org/D31809
Sponsored by: Axcient
MFC after: 2 weeks

2 years agosesutil: fix a comment
Alan Somers [Mon, 30 Aug 2021 23:39:38 +0000 (17:39 -0600)]
sesutil: fix a comment

MFC after: 2 weeks
Sponsored by: Axcient

2 years agocorrect type of mmap len parameter
Wolfram Schneider [Wed, 19 Jan 2022 19:20:11 +0000 (19:20 +0000)]
correct type of mmap len parameter

Using locate -m on a database > 2GB should work now.

PR: 261277

2 years agoses: minor cleanup
Alan Somers [Wed, 25 Aug 2021 21:08:19 +0000 (15:08 -0600)]
ses: minor cleanup

* Prefer variables of small scope rather than large scope
* Remove a magic number
* style(9) for return statements
* Remove the get_enc_status method, which never did anything
* Fix a variable type in the handle_string method
* Proofread some comments

MFC after: 2 weeks
Sponsored by: Spectra Logic, Axcient
Reviewed by: ken, mav
Differential Revision: https://reviews.freebsd.org/D31686

2 years agosanitizers: Improve FreeBSD ASLR detection
Ed Maste [Tue, 18 Jan 2022 00:00:35 +0000 (19:00 -0500)]
sanitizers: Improve FreeBSD ASLR detection

The kern.elf64.aslr.pie_enable and kern.elf32.aslr.pie_enable sysctls
control the default setting for PIE binary address randomization, but
it is possible to enable or disable ASLR on a per-process basis.  Use
procctl(2) to query whether ASLR is enabled.

(Note that with ASLR enabled but sysctl kern.elf64.aslr.pie_enable=0
a PIE binary will in effect have randomization disabled, and be
functional with msan.  This is not intended as as a user-facing control
though.  The user can use proccontrol(1) to disable aslr for the
process.)

Approved by: dim
Obtained from: LLVM 64de0064f315f57044294879d9ff4eacb454d45b
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33933