]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
11 months agoarm64 pmap: Retire PMAP_INLINE
Alan Cox [Sat, 22 Jul 2023 17:55:43 +0000 (12:55 -0500)]
arm64 pmap: Retire PMAP_INLINE

Neither of the remaining callers to pmap_kremove() warrant inlining.
Those calls rarely occur.  In other words, we were optimizing for the
uncommon case.

MFC after: 1 week

11 months agoarm64 pmap: Eliminate some duplication of code
Alan Cox [Sat, 22 Jul 2023 17:41:49 +0000 (12:41 -0500)]
arm64 pmap: Eliminate some duplication of code

pmap_unmapbios() can simply call pmap_kremove_device() rather than
duplicating its code.

While I'm here, add a comment to pmap_kremove_device() explaining its
proper use, and fix a whitespace issue.

MFC after: 1 week

11 months agoe1000: add missing parens in csum setup
Kevin Bowling [Sun, 23 Jul 2023 00:03:26 +0000 (17:03 -0700)]
e1000: add missing parens in csum setup

Reported by: rscheff
Fixes: 4f9a44a215f8 e1000: Fix/enable IPv6 transmit checksum offload
MFC after: 2 weeks

11 months agoe1000: Fix/enable IPv6 transmit checksum offload
Kevin Bowling [Sat, 22 Jul 2023 22:58:34 +0000 (15:58 -0700)]
e1000: Fix/enable IPv6 transmit checksum offload

Fixes and enables txcsum6 offload for lem(4) and em(4).

MFC after: 2 weeks

11 months agoe1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
Kevin Bowling [Sat, 22 Jul 2023 18:33:27 +0000 (11:33 -0700)]
e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes

* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30072

11 months agolinux(4): Implement xattr syscalls
Dmitry Chagin [Sat, 22 Jul 2023 11:03:33 +0000 (14:03 +0300)]
linux(4): Implement xattr syscalls

Reviewed by:
Differential revision: https://reviews.freebsd.org/D35544
MFC after: 1 month

11 months agovfs: Export exattr methods to reuse by Linuxulator
Dmitry Chagin [Sat, 22 Jul 2023 11:03:33 +0000 (14:03 +0300)]
vfs: Export exattr methods to reuse by Linuxulator

Reviewed by:
Differential revision: https://reviews.freebsd.org/D35543
MFC after: 1 month

11 months agolinux(4): Regen for xattr syscalls
Dmitry Chagin [Sat, 22 Jul 2023 11:03:32 +0000 (14:03 +0300)]
linux(4): Regen for xattr syscalls

MFC after: 1 month

11 months agolinux(4): Modify xattr syscalls to match Linux
Dmitry Chagin [Sat, 22 Jul 2023 11:03:31 +0000 (14:03 +0300)]
linux(4): Modify xattr syscalls to match Linux

MFC after: 1 month

11 months agolibc/csu: Do not compile the finalizer() for PIC build
Dmitry Chagin [Sat, 22 Jul 2023 08:56:06 +0000 (11:56 +0300)]
libc/csu: Do not compile the finalizer() for PIC build

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D41148

11 months agoarm64/riscv pmap: Initialize the pmap's pm_pvchunk field
Alan Cox [Sun, 16 Jul 2023 20:58:04 +0000 (15:58 -0500)]
arm64/riscv pmap: Initialize the pmap's pm_pvchunk field

I believe that there are two reasons that the missing TAILQ
initialization operations haven't caused a problem.  First, the TAILQ
head's first field is being initialized to zeroes elsewhere.  Second,
the first access to the TAILQ head's last field is by
TAILQ_INSERT_HEAD(), which assigns to the last field without reading
it when the first field is NULL.

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

11 months agoRevert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"
Kevin Bowling [Sat, 22 Jul 2023 04:42:23 +0000 (21:42 -0700)]
Revert "e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes"

Seems to cause a panic when booting under VitrualBox.

Reported by: yasu

This reverts commit 95f7b36e8fac45092b9a4eea5e32732e979989f0.

11 months agoip output: ensure that mbufs are mapped if ipsec is enabled
Konstantin Belousov [Thu, 20 Jul 2023 12:08:24 +0000 (15:08 +0300)]
ip output: ensure that mbufs are mapped if ipsec is enabled

Ipsec needs access to packet headers to determine if a policy is
applicable. It seems that typically IP headers are mapped, but the code
is arguably needs to check this before blindly accessing them. Then,
operations like m_unshare() and m_makespace() are not yet ready for
unmapped mbufs.

Ensure that the packet is mapped before calling into IPSEC_OUTPUT().

PR: 272616
Reviewed by: jhb, markj
Sponsored by: NVidia networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41112

11 months agocam_periph: Comment about why we need to reset cbfcnp
Warner Losh [Fri, 21 Jul 2023 16:11:37 +0000 (10:11 -0600)]
cam_periph: Comment about why we need to reset cbfcnp

Just spent a few minutes puzzling out why we do this. Add a comment to
remind my future self (and other intersted folk) why we do the reset
here when we'd set it a few lines above.

Sponsored by: Netflix

11 months agocam_periph: Fix a comment
Warner Losh [Fri, 21 Jul 2023 16:06:03 +0000 (10:06 -0600)]
cam_periph: Fix a comment

Add a couple of words so that this sentence makes sense.

Sponsored by: Netflix

11 months agoseq: style(9) cleanup
Ed Maste [Sun, 25 Jun 2023 23:33:49 +0000 (19:33 -0400)]
seq: style(9) cleanup

This is in part for diff reduction with OpenBSD.

Sponsored by: The FreeBSD Foundation

11 months agopf.conf.5: document SCTP support
Kristof Provost [Wed, 21 Jun 2023 08:04:07 +0000 (10:04 +0200)]
pf.conf.5: document SCTP support

Mention SCTP in the pf.conf.5

Reviewed by: tuexen
MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40870

11 months agopf tests: test SCTP pfsync
Kristof Provost [Wed, 7 Jun 2023 09:55:06 +0000 (11:55 +0200)]
pf tests: test SCTP pfsync

Ensure that SCTP connections survive a failover to the backup pf
instance.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40869

11 months agopf tests: test 'rdr' for SCTP
Kristof Provost [Thu, 1 Jun 2023 16:03:07 +0000 (18:03 +0200)]
pf tests: test 'rdr' for SCTP

Explicitly test that we cannot change the port number with rdr.
That's not a desireable feature on SCTP, because it could break
multihomed connections.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40868

11 months agopf tests: test SCTP NAT
Kristof Provost [Thu, 1 Jun 2023 13:28:58 +0000 (15:28 +0200)]
pf tests: test SCTP NAT

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40867

11 months agopf: add SCTP NAT support
Kristof Provost [Thu, 1 Jun 2023 13:04:48 +0000 (15:04 +0200)]
pf: add SCTP NAT support

Support NAT-ing SCTP connections.

This is mostly similar to UDP and TCP, but we refuse to change ports for
SCTP, to avoid interfering with multihomed connections.

As a result we also never copy the SCTP header back or recalculate
checksums as we'd do for TCP or UDP (because we don't modify the header
for SCTP).

We do use the existing pf_change_ap() function to modify the packet,
because we may still need to update the IPv4 header checksum.

Reviewed by: tuexen
MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40866

11 months agopf tests: test SCTP 'return'
Kristof Provost [Wed, 31 May 2023 19:45:29 +0000 (21:45 +0200)]
pf tests: test SCTP 'return'

Ensure that we send a correct abort message for 'block return' rules.

Test this by validating that nc doesn't sit around waiting for a
connection. It should give up immediately when it receives the abort.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40865

11 months agopf: support 'return' for SCTP
Kristof Provost [Wed, 31 May 2023 14:03:39 +0000 (16:03 +0200)]
pf: support 'return' for SCTP

Send an SCTP Abort message if we're refusing a connection, just like we
send a RST for TCP.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40864

11 months agopf tests: basic SCTP connection test
Kristof Provost [Thu, 27 Apr 2023 09:13:40 +0000 (11:13 +0200)]
pf tests: basic SCTP connection test

pf can now inspect SCTP. Check that we can set up a connection.
IPv4 and IPv6 tests.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40863

11 months agopf: initial SCTP support
Kristof Provost [Thu, 27 Apr 2023 08:58:02 +0000 (10:58 +0200)]
pf: initial SCTP support

Basic state tracking for SCTP. This means we scan through the packet to
identify the different chunks (so we can identify state changes).

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40862

11 months agopfctl: SCTP can have port numbers
Kristof Provost [Wed, 26 Apr 2023 14:59:40 +0000 (16:59 +0200)]
pfctl: SCTP can have port numbers

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40861

11 months agopf: use sctp_calculate_cksum()
Kristof Provost [Fri, 7 Jul 2023 08:04:51 +0000 (10:04 +0200)]
pf: use sctp_calculate_cksum()

This function is always available, even if the SCTP or SCTP_SUPPORT options
are not set.
That lets us remove an ifdef, and also means we improve pf's SCTP handling
when the options are not set.

MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D40911

11 months agoatf_pytest_wrapper: fix use with pytest-7.4
Kristof Provost [Tue, 18 Jul 2023 14:20:47 +0000 (16:20 +0200)]
atf_pytest_wrapper: fix use with pytest-7.4

As of pytest 7.4 it no longer walks all the way to the root directory
of the file system to find conftest files. As a result we don't find /
usr/tests/conftest.py, and don't load atf_python. That in turn causes
atf_python tests to fail.

Explicitly set the confcutdir, as advised by the pytest changelog.

See also: https://github.com/pytest-dev/pytest/pull/11043
MFC after: 3 weeks
Sponsored by: Orange Business Services
Differential Revision: https://reviews.freebsd.org/D41064

11 months agoxen: move vcpu_info to common, leave hook for setup
Elliott Mitchell [Thu, 8 Jun 2023 21:13:17 +0000 (14:13 -0700)]
xen: move vcpu_info to common, leave hook for setup

vcpu_info is crucial for the Xen event channel core.  Since both the
data and setup steps are identical between architectures, move them to
the common file.  Since there is no cross-architecture method to call
a function on every processor during bring-up, simply leave the setup
function.

The number of vcpu_info structures available on the shared information
page varies by architecture.  Instead of hard-coding the count use
nitems().  Add a warning message for this being used.

Switch to XEN_VCPUID() and use Xen's typedefs.

panic() on failure since >32 processors is no longer unusual.

royger: Specify 64-byte alignment for vcpu_info to try to defend
against vcpu_info crossing a page boundary.  Add detection for this
limit.

Reviewed by: royger

11 months agocam: Add CAM_NVME_STATUS_ERROR error code
Warner Losh [Fri, 21 Jul 2023 04:22:37 +0000 (22:22 -0600)]
cam: Add CAM_NVME_STATUS_ERROR error code

Add CAM_NVME_STATUS_ERROR error code. Flag all NVME commands that
completed with an error status as CAM_NVME_STATUS_ERROR (a new value)
instaead of CAM_REQ_CMP_ERR. This indicates to the upper layers of CAM
that the 'cpl' field for nvmeio CCBs is valid and can be examined for
error recovery, if desired.

No functional change. nda will still see these as errors, call
ndaerror() to get the error recovery action, etc. cam_periph_error will
select the same case as before (even w/o the change, though the change
makes it explicit).

Sponsored by: Netflix
Reviewed by: chuck, mav, jhb
Differential Revision: https://reviews.freebsd.org/D41085

11 months agocam/nda: Remove impossible CAM codes
Warner Losh [Fri, 21 Jul 2023 04:22:27 +0000 (22:22 -0600)]
cam/nda: Remove impossible CAM codes

The NVME SIM does not generate these status values, so remove them.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D41084

11 months agocam: Be explict about CAM_SMP_STATUS_ERROR
Warner Losh [Fri, 21 Jul 2023 04:22:18 +0000 (22:22 -0600)]
cam: Be explict about CAM_SMP_STATUS_ERROR

This is normally caught by default:, but no harm in making it explicit
that we'll retry valid periphs.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D41083

11 months agocam/scsi: Better action for ASC/ASCQ 0x18/0x08
Warner Losh [Fri, 21 Jul 2023 04:22:07 +0000 (22:22 -0600)]
cam/scsi: Better action for ASC/ASCQ 0x18/0x08

0x18/0x8 is another code to indicate that the data was recovered
successfully, so complete the command w/o an error rather than retry the
operation.

Sponsored by: Netflix
Reviewed by: mav, jhb
Differential Revision: https://reviews.freebsd.org/D41082

11 months agocam: Add comment about recovery ccbs
Warner Losh [Fri, 21 Jul 2023 04:21:57 +0000 (22:21 -0600)]
cam: Add comment about recovery ccbs

SS_START and higher actions (currently only SS_TUR) allocate a recovery
CCB to send a command to the periph. Add a quick comment about that here.

Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D41081

11 months agolibc: locale: flesh out an incomplete comment
Kyle Evans [Fri, 21 Jul 2023 04:27:24 +0000 (23:27 -0500)]
libc: locale: flesh out an incomplete comment

Extrapolate from the context what the intention for the rest of the
comment probably was -- that the C/POSIX (and now C.UTF-8) locales may
avoid an allocation and reuse a global table.

Reviewed by: bapt
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D41087

11 months agoe1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes
Kevin Bowling [Fri, 21 Jul 2023 03:30:00 +0000 (20:30 -0700)]
e1000: lem(4)/em(4) ifcaps, TSO and hwcsum fixes

* em(4) obey administrative ifcaps for using hwcsum offload
* em(4) obey administrative ifcaps for hw vlan receive tagging
* em(4) add additional TSO6 ifcap, but disabled by default as is TSO4
* lem(4) obey administrative ifcaps for using hwcsum offload
* lem(4) add support for hw vlan receive tagging
* lem(4) Add ifcaps for TSO offload experimentation, but disabled by
  default due to errata and possibly missing txrx code.
* lem(4) disable HWCSUM ifcaps by default on 82547 due to errata around
  full duplex links.  It may still be administratively enabled.

Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30072

11 months agoe1000: Some fixes for em(4) TSO setup
Kevin Bowling [Fri, 21 Jul 2023 01:51:02 +0000 (18:51 -0700)]
e1000: Some fixes for em(4) TSO setup

Always set TXD_CMD_IP for 82544
Otherwise set TXD_CMD_IP for IPv4, not IPv6

Reviewed by: markj (previous version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30072

11 months agoshare/mk: Pass -znoexecstack to ld.bfd when linking libraries and programs.
John Baldwin [Thu, 20 Jul 2023 23:36:35 +0000 (16:36 -0700)]
share/mk: Pass -znoexecstack to ld.bfd when linking libraries and programs.

lld assumes -znoexecstack by default whereas ld.bfd still defaults to
-zexecstack in the absence of .note.GNU-stack annotations.  Adding the
flags centrally avoids having to patch various libraries in the tree
as one-offs (e.g. OpenSSL 3 is the current thing generating new
warnings with ld.bfd).

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D41120

11 months agompr: Fix minor 'typos' comment
Warner Losh [Thu, 20 Jul 2023 23:16:04 +0000 (17:16 -0600)]
mpr: Fix minor 'typos' comment

moving -> removing (we're removing the device)
CAM_REQ_CMO_ERROR -> CAM_REQ_ERR (the former isn't a thing)

Sponsored by: Netflix

11 months agoixl(4): Add link state polling
Krzysztof Galazka [Thu, 20 Jul 2023 22:33:52 +0000 (15:33 -0700)]
ixl(4): Add link state polling

In some cases driver may ask FW about link state before FW finishes
configuration of a (Q)SFP+ transceiver. If first attempt of using Get Link
Status AQC after loading driver or handling a reset fails, then re-try
periodically for 5 seconds.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
Approved by: erj@
MFC after: 2 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D40899

11 months agotcp_wrappers: recognize IPv6 addresses/prefixes
Gleb Smirnoff [Thu, 20 Jul 2023 21:56:20 +0000 (14:56 -0700)]
tcp_wrappers: recognize IPv6 addresses/prefixes

Intentionally or not, but the libwrap was written in such manner that
if your /etc/hosts.allow doesn't have any domain names, neither smart
keywords like LOCAL or KNOWN, then it will not try to resolve the
client address during the hosts check.  This was achieved with the
NOT_INADDR() check that matched IPv4 addresses/prefixes.  Extend this
to also skip resolve if client list token looks like IPv6.

Reviewed by: philip, emaste
PR: 269456
Differential revision: https://reviews.freebsd.org/D40070

11 months agosshd: do not resolve refused client hostname
Gleb Smirnoff [Thu, 20 Jul 2023 21:56:20 +0000 (14:56 -0700)]
sshd: do not resolve refused client hostname

This is a compromise between POLA and practical reasoning.  We don't
want to block the main server loop in an attempt to resolve.  But we
need to keep the format of the logged message as is, for sake of
sshguard and other scripts.  So let's print just the IP address twice,
this is what libwrap's refuse() would do if it failed to resolve.

Reviewed by: philip
PR: 269456
Differential revision: https://reviews.freebsd.org/D40069

11 months agosshd: remove unneeded initialization of libwrap logging severities
Gleb Smirnoff [Thu, 20 Jul 2023 21:56:20 +0000 (14:56 -0700)]
sshd: remove unneeded initialization of libwrap logging severities

This part of ca573c9a177 proved to be unnecessary.  As the removed
comment says, we set them merely for logging syntax errors, as we log
refusals ourselves.  However, inside the libwrap the parser logs any
syntax errors with tcpd_warn() which has hardcoded LOG_WARNING inside.

Reviewed by: philip, emaste
Differential revision: https://reviews.freebsd.org/D40068

11 months agoRevert "tftpd: fix double-colon typo in option string"
Dmitry Morozovsky [Thu, 20 Jul 2023 21:38:30 +0000 (00:38 +0300)]
Revert "tftpd: fix double-colon typo in option string"

It was not a typo: -d takes an optional argument, which is indicated with
a double colon.

This reverts commit 3cbc8e752b92442c784306731e94fd904de3373c.

Spotted by: kevans

11 months agotftpd: fix double-colon typo in option string
Dmitry Morozovsky [Thu, 20 Jul 2023 21:24:28 +0000 (00:24 +0300)]
tftpd: fix double-colon typo in option string

MFC after: 1 month
X-MFC-With: 273a307d0b80743fb08e23237b3f74dc94a8fa2a
X-MFC-With: 03c2616dc530e5b23f06f9aa421012154590e578

11 months agotftpd: unbreak getopt()
Eugene Grosbein [Thu, 20 Jul 2023 20:26:32 +0000 (03:26 +0700)]
tftpd: unbreak getopt()

Unbreak getopt() broken by recent commit.

Fixes: 273a307d0b80743fb08e23237b3f74dc94a8fa2a
MFC after: 1 month

11 months agotftpd: introduce new option -S
Eugene Grosbein [Thu, 20 Jul 2023 20:11:33 +0000 (03:11 +0700)]
tftpd: introduce new option -S

Historically, tftpd disallowed write requests to existing files
that are not publicly writable. Such requirement is questionable at least.
Let us make it possible to run tftpd in chrooted environment
keeping files non-world writable.

New option -S enables write requests to existing files
for chrooted run according to generic file permissions.
It is ignored unless tftpd runs chrooted.

MFC after: 1 month
Requested by: marck
Differential: https://reviews.freebsd.org/D41090 (based on)

11 months agolibcrypto: add missing symbols to the FIPS provider
Pierre Pronchery [Thu, 20 Jul 2023 18:16:14 +0000 (14:16 -0400)]
libcrypto: add missing symbols to the FIPS provider

The fips.so provider module exposing FIPS-validated algorithms was still
missing a number of symbols.

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

11 months agovmspace_fork(): do not override offset for the guard entries
Konstantin Belousov [Thu, 20 Jul 2023 17:45:01 +0000 (20:45 +0300)]
vmspace_fork(): do not override offset for the guard entries

The offset field contains protection for the stack guards.

Reported by: cy
Fixes: 21e45c30c35c9aa732073f725924caf581c93460
MFC after: 1 week

11 months agoifconfig_netlink.c: whitespace cleanup.
Navdeep Parhar [Thu, 20 Jul 2023 17:47:34 +0000 (10:47 -0700)]
ifconfig_netlink.c: whitespace cleanup.

No functional change.

11 months agoifconfig: Shift unsigned value to avoid UB.
Navdeep Parhar [Thu, 20 Jul 2023 17:42:15 +0000 (10:42 -0700)]
ifconfig: Shift unsigned value to avoid UB.

Reported by: kib@

11 months agopciconf: add PCIe 5.0 and PCIe 6.0 link speeds
Ed Maste [Wed, 21 Jun 2023 20:23:18 +0000 (16:23 -0400)]
pciconf: add PCIe 5.0 and PCIe 6.0 link speeds

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40710

11 months agoRemove perforce tools and references
Minsoo Choo [Thu, 20 Jul 2023 17:28:18 +0000 (13:28 -0400)]
Remove perforce tools and references

Perforce has been retired since 2019 (commit feea78990c2f), so there is
no need anymore to keep perforce tools.  Plus, there is no need to
mention perforce admin.

Reviewed by: emaste, Olivier Certner
Differential Revision: https://reviews.freebsd.org/D41106

11 months agoifconfig: Fix the display of capabilities in the netlink based code.
Navdeep Parhar [Thu, 20 Jul 2023 01:05:12 +0000 (18:05 -0700)]
ifconfig: Fix the display of capabilities in the netlink based code.

The capabilities in if_capabilities2/if_capenable2 are reported in the
second 32b and were not being displayed correctly.  v does not need to
be advanced because v[i / 32] is the correct 32b value already.

Sponsored by: Chelsio Communications

Reviewed by: kib@
Differential Revision: https://reviews.freebsd.org/D41107

11 months agommap(MAP_STACK): on stack grow, use original protection
Konstantin Belousov [Wed, 19 Jul 2023 11:05:32 +0000 (14:05 +0300)]
mmap(MAP_STACK): on stack grow, use original protection

If mprotect(2) changed protection in the bottom of the currently grown
stack region, currently the changed protection would be used for the
stack grow on next fault.  This is arguably unexpected.

Store the original protection for the entry at mmap(2) time in the
offset member of the gap vm_map_entry, and use it for protection of the
grown stack region.

PR: 272585
Reported by: John F. Carr <jfc@mit.edu>
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41089

11 months agoiflib: Unlock ctx lock around call to ether_ifattach()
Eric Joyner [Wed, 19 Jul 2023 22:40:46 +0000 (15:40 -0700)]
iflib: Unlock ctx lock around call to ether_ifattach()

Panic occurs during loading driver using kldload. It exists since netlink is
enabled.  There is problem with double locking ctx. This fix allows to call
ether_ifattach() without locked ctx.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
PR: 271768
Reviewed by: erj@, jhb@
MFC after: 1 day
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D40557

11 months agoamd64 crt1: Explicitly use a PLT entry for main in the PIC case.
John Baldwin [Wed, 19 Jul 2023 18:53:33 +0000 (11:53 -0700)]
amd64 crt1: Explicitly use a PLT entry for main in the PIC case.

This ensures GNU as generates a R_X86_64_PLT32 relocation instead of
R_X86_64_32.

Reviewed by: kib
Fixes: c969310c992a csu: Implement _start using as to satisfy unwinders on x86_64
Differential Revision: https://reviews.freebsd.org/D41101

11 months agoi386: Switch to PIC kernel modules
Dmitry Chagin [Wed, 19 Jul 2023 18:21:04 +0000 (21:21 +0300)]
i386: Switch to PIC kernel modules

It seems since the last llvm project update, the lld linker has started
creating a PLT dependent kernel module object files.

Reviewed by: kib, jhb, emaste
Differential Revision: https://reviews.freebsd.org/D41088

11 months agoktls_alloc_rcv_tag: Fix capability checks for RXTLS4/6.
Navdeep Parhar [Wed, 19 Jul 2023 17:56:03 +0000 (10:56 -0700)]
ktls_alloc_rcv_tag: Fix capability checks for RXTLS4/6.

IFCAP2_* has the bit position and not the shifted value.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D41100

11 months agoMerge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):
Dimitry Andric [Wed, 19 Jul 2023 09:18:50 +0000 (11:18 +0200)]
Merge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):

  [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.

  Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
  code), we propagate the contains-errors bit for C-code path.

  Fixes https://github.com/llvm/llvm-project/issues/50236
  Fixes https://github.com/llvm/llvm-project/issues/50243
  Fixes https://github.com/llvm/llvm-project/issues/48636
  Fixes https://github.com/llvm/llvm-project/issues/50320

  Differential Revision: https://reviews.llvm.org/D154861

This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
|| RHSExpr->containsErrors()) && "Should only occur in error-recovery
path."), function BuildBinOp') when building parts of dtrace in certain
scenarios.

Reported by: dstolfa
PR: 271047
MFC after: 1 month

11 months agossh: Update to OpenSSH 9.3p2
Ed Maste [Wed, 19 Jul 2023 17:02:33 +0000 (13:02 -0400)]
ssh: Update to OpenSSH 9.3p2

From the release notes:

Changes since OpenSSH 9.3
=========================

This release fixes a security bug.

Security
========

Fix CVE-2023-38408 - a condition where specific libaries loaded via
ssh-agent(1)'s PKCS#11 support could be abused to achieve remote
code execution via a forwarded agent socket if the following
conditions are met:

* Exploitation requires the presence of specific libraries on
  the victim system.
* Remote exploitation requires that the agent was forwarded
  to an attacker-controlled system.

Exploitation can also be prevented by starting ssh-agent(1) with an
empty PKCS#11/FIDO allowlist (ssh-agent -P '') or by configuring
an allowlist that contains only specific provider libraries.

This vulnerability was discovered and demonstrated to be exploitable
by the Qualys Security Advisory team.

In addition to removing the main precondition for exploitation,
this release removes the ability for remote ssh-agent(1) clients
to load PKCS#11 modules by default (see below).

Potentially-incompatible changes
--------------------------------

 * ssh-agent(8): the agent will now refuse requests to load PKCS#11
   modules issued by remote clients by default. A flag has been added
   to restore the previous behaviour "-Oallow-remote-pkcs11".

   Note that ssh-agent(8) depends on the SSH client to identify
   requests that are remote. The OpenSSH >=8.9 ssh(1) client does
   this, but forwarding access to an agent socket using other tools
   may circumvent this restriction.

CVE: CVE-2023-38408
Sponsored by: The FreeBSD Foundation

11 months agoObsoleteFiles.inc: Remove leading slash from 20230714 entry
Marius Strobl [Wed, 19 Jul 2023 16:56:35 +0000 (18:56 +0200)]
ObsoleteFiles.inc: Remove leading slash from 20230714 entry

Fixes: c3f58005d92e signal: Remove gsignal references from manuals

11 months agoenic(4): Remove unused dupe prototype
Marius Strobl [Sun, 16 Jul 2023 07:43:13 +0000 (09:43 +0200)]
enic(4): Remove unused dupe prototype

11 months agokinst.h: make pointer to probe in kinst_cpu_state const
Christos Margiolis [Wed, 19 Jul 2023 16:56:10 +0000 (19:56 +0300)]
kinst.h: make pointer to probe in kinst_cpu_state const

Fixes: 5b701ed19c2e ("kinst: start moving towards per-probe
trampolines")

Sponsored by: The FreeBSD Foundation

11 months agoVendor import of OpenSSH 9.3p2
Ed Maste [Wed, 19 Jul 2023 15:49:33 +0000 (11:49 -0400)]
Vendor import of OpenSSH 9.3p2

11 months agoRevert "dtrace: cache current probe in kdtrace_thread_t"
Christos Margiolis [Wed, 19 Jul 2023 14:58:49 +0000 (17:58 +0300)]
Revert "dtrace: cache current probe in kdtrace_thread_t"

This reverts commit 22508c8b6c284ad9ad1385c703e224e1ed3fbd7c.

The t_kinst_curprobe field is no longer needed by kinst.

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41031

11 months agokinst: port to arm64
Christos Margiolis [Wed, 19 Jul 2023 14:58:18 +0000 (17:58 +0300)]
kinst: port to arm64

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40337

11 months agokinst: use per-probe trampolines in riscv
Christos Margiolis [Wed, 19 Jul 2023 14:57:59 +0000 (17:57 +0300)]
kinst: use per-probe trampolines in riscv

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40963

11 months agokinst: start moving towards per-probe trampolines
Christos Margiolis [Wed, 19 Jul 2023 14:57:21 +0000 (17:57 +0300)]
kinst: start moving towards per-probe trampolines

Using per-CPU and per-thread trampolines is expensive and error-prone,
since we're rewriting the same memory blocks constantly. Per-probe
trampolines solve this problem by giving each probe its own block of
executable memory, which more or less remains the same after the initial
write.

What this patch does, is get rid of the initialization code which
allocates a trampoline for each thread, and instead let each port of
kinst allocate a trampoline for each new probe created. It also sets up
the infrastructure needed to support the new trampoline scheme.

This change is not currently supported on amd64, as the amd64 port needs
further changes to work, so this is a temporary/gradual patch to fix the
riscv and arm64 ports.

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40962

11 months agokinst: exclude cpu_switch
Christos Margiolis [Wed, 19 Jul 2023 14:56:29 +0000 (17:56 +0300)]
kinst: exclude cpu_switch

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40985

11 months agokinst: check for 'push %rbp' anywhere in the function
Christos Margiolis [Wed, 19 Jul 2023 14:53:08 +0000 (17:53 +0300)]
kinst: check for 'push %rbp' anywhere in the function

Currently kinst checks if only the first instruction is 'push %rbp',
essentially excluding functions that do push RBP, but not in the first
instruction. This patch modifies kinst to check for 'push %rbp', as
well, as a following 'pop %rbp', anywhere in the function. This behavior
also matches that of FBT.

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40283

11 months agokinst.h: reorder function declarations based on implementation file
Christos Margiolis [Wed, 19 Jul 2023 14:50:24 +0000 (17:50 +0300)]
kinst.h: reorder function declarations based on implementation file

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41032

11 months agounifdef: Fix case where a multiline comment follows a directive.
Dag-Erling Smørgrav [Wed, 19 Jul 2023 14:25:56 +0000 (14:25 +0000)]
unifdef: Fix case where a multiline comment follows a directive.

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D41026

11 months agoradix_trie: simplify ge, le lookups
Doug Moore [Wed, 19 Jul 2023 14:43:31 +0000 (09:43 -0500)]
radix_trie: simplify ge, le lookups

Replace the implementations of lookup_le and lookup_ge with ones
that do not use a stack or climb back up the tree, and instead
exploit the popmap field to quickly identify the place to resume
searching if the straightforward indexed search fails.

The code size of the original functions shrinks by a combined 160
bytes on amd64, and the cumulative cycle count per invocation of
the two functions together is reduced 20% in a buildworld test.

Reviewed by: alc, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D40936

11 months agovfs: Add a parenthese to vn_lock_pair() asserts to silence gcc
Dmitry Chagin [Wed, 19 Jul 2023 13:51:07 +0000 (16:51 +0300)]
vfs: Add a parenthese to vn_lock_pair() asserts to silence gcc

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D41070

11 months agopw: Add regression tests for useradd bug fixes
Naman Sood [Wed, 19 Jul 2023 13:27:14 +0000 (10:27 -0300)]
pw: Add regression tests for useradd bug fixes

PR: 238995
Reviewed by: jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41080

11 months agopw: Use existing group entry, even if it already has members
Naman Sood [Wed, 19 Jul 2023 13:06:06 +0000 (10:06 -0300)]
pw: Use existing group entry, even if it already has members

Fix the following problem:

1. A nonexistent user, someuser, is added to /etc/group as
   someuser:*:12345:someuser.
2. someuser is then created with the default login group.

A second group entry for someuser will be created.

   someuser:*:12345:someuser
   someuser:*:12346:

With this fix, the existing group entry will be used.

PR: 238995
Reviewed by: bapt, jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41057

11 months agopw: Ensure group membership is not duplicated
Naman Sood [Wed, 19 Jul 2023 12:44:21 +0000 (09:44 -0300)]
pw: Ensure group membership is not duplicated

Fix the following problem:

1. A nonexistent user, someuser, is added to somegroup in /etc/group.
2. someuser is then created with membership in somegroup.

The entry for somegroup in /etc/group will then contain

    somegroup:*:12345:someuser,someuser

With this fix, the entry will be

    somegroup:*:12345:someuser

PR: 238995
Reviewed by: bapt, jrm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41076

11 months agotcp: improve layout of struct tcpcb
Michael Tuexen [Wed, 19 Jul 2023 12:47:36 +0000 (14:47 +0200)]
tcp: improve layout of struct tcpcb

Put optional fields at the end to minimize run time problems in
case CC modules are build from within its directory.

Reviewed by: cc, gallatin, glebius, imp
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D41059

11 months agocam: Move bus_dmamap_load_ccb into cam.c.
John Baldwin [Wed, 19 Jul 2023 01:19:27 +0000 (18:19 -0700)]
cam: Move bus_dmamap_load_ccb into cam.c.

This routine is specific to CAM and no longer assumes any internal
bus_dma knowledge as it is simple wrapper around bus_dmamap_load_mem.

Fixes: 60381fd1ee86 memdesc: Retire MEMDESC_CCB.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D41058

11 months agolinux(4): Use M_LINUX for malloc type of proc emuldata
Dmitry Chagin [Tue, 18 Jul 2023 21:44:17 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type of proc emuldata

MFC after: 2 weeks

11 months agolinux(4): Use M_LINUX for malloc type in getdents
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in getdents

MFC after: 2 weeks

11 months agolinux(4): Use M_LINUX for malloc type in getdents64
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in getdents64

MFC after: 2 weeks

11 months agolinux(4): Delete a useless variable in getdents64
Dmitry Chagin [Tue, 18 Jul 2023 21:44:16 +0000 (00:44 +0300)]
linux(4): Delete a useless variable in getdents64

MFC after: 2 weeks

11 months agolinux(4): Use M_LINUX for malloc type in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Use M_LINUX for malloc type in readdir

MFC after: 2 weeks

11 months agolinux(4): Delete a useless variable in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Delete a useless variable in readdir

MFC after: 2 weeks

11 months agolinux(4): Properly allocate buffer for kern_getdirentries in readdir
Dmitry Chagin [Tue, 18 Jul 2023 21:44:15 +0000 (00:44 +0300)]
linux(4): Properly allocate buffer for kern_getdirentries in readdir

Looks like prior to ino64 project the size of the struct linux_dirent
was greater (or equal) to the size of the native struct dirent so the
native dirent fit into the buffer. After ino64 project the size of the
native struct dirent has increased.

Spotted by gcc12.
MFC after: 2 weeks

11 months agoadd defaults for adduser.sh (OK? [yes] & additional user [no])
Sven Ruediger [Tue, 18 Jul 2023 17:37:48 +0000 (10:37 -0700)]
add defaults for adduser.sh (OK? [yes] & additional user [no])

Event: Kitchener-Waterloo Hackathon 202305
Differential Revision: https://reviews.freebsd.org/D40157

11 months agols: Improve POSIX compatibility for -g and -n.
Minsoo Choo [Tue, 18 Jul 2023 16:49:59 +0000 (09:49 -0700)]
ls: Improve POSIX compatibility for -g and -n.

- Change -g (ignored for BSD 4.3 compatibility since BSD 4.4)
  to use POSIX semantics of implying -l but omitting the owner's
  name.

- Change -n to imply -l.

The -o option remains unchanged (POSIX defines -o as a complement to
-g that implies -l but omits group names whereas BSD defines -o to add
file flags to -l).  This compromise is the same used by both NetBSD
and OpenBSD.

PR: 70813
Reviewed by: jhb, Pau Amma <pauamma@gundo.com>
Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Differential Revision: https://reviews.freebsd.org/D34747

11 months agoopenssh: document a locally-applied workaround
Ed Maste [Tue, 18 Jul 2023 16:23:31 +0000 (12:23 -0400)]
openssh: document a locally-applied workaround

We have a local hacky workaround for an issue caused by a hacky
upstream autoconf test.  Reported upstream on the OpenSSH mailing list:
https://lists.mindrot.org/pipermail/openssh-unix-dev/2022-May/040242.html

PR: 209441
Sponsored by: The FreeBSD Foundation

11 months agozfs: set autotrim default to 'off'
Yuri Pankov [Mon, 17 Jul 2023 09:12:53 +0000 (11:12 +0200)]
zfs: set autotrim default to 'off'

As it turns out having autotrim default to 'on' on FreeBSD never really
worked due to mess with defines where userland and kernel module were
getting different default values (userland was defaulting to 'off',
module was thinking it's 'on').

PR: 264234
Reviewed by: mav (zfs)
Differential Revision: https://reviews.freebsd.org/D41056

11 months agoText format cleanups. No functional changes intended.
Kirk McKusick [Tue, 18 Jul 2023 00:28:07 +0000 (17:28 -0700)]
Text format cleanups. No functional changes intended.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
11 months agorelease: adjust lang/python* dependencies for GCE
Glen Barber [Mon, 17 Jul 2023 20:16:46 +0000 (16:16 -0400)]
release: adjust lang/python* dependencies for GCE

The lang/python3 port had failed to properly install because
it did in fact already exist and FORCE_PKG_REGISTER was not
set.  So, behaviorally everything here was correct.  However,
installing lang/python3 is in fact not correct and not needed,
so only install the lang/python port to provide symbolic links.

PR: 272354
MFC after: 3 days
MFC with: 510fd83138001b0a6e45b3fa6a7249377f806171
MFC with: cd8cad0ef5cd534dc7ae1dd9a470cac2057ed957
MFC with: 0ed426276fd52e917506ab87c05a61c6641ae298
Sponsored by: GoFundMe https://www.gofundme.com/f/gjbbsd

11 months agolibbe: recursively promote deep BE datasets
R. Christian McDonald [Mon, 17 Jul 2023 19:06:28 +0000 (14:06 -0500)]
libbe: recursively promote deep BE datasets

beadm will recursively promote deep BE datasets. In order to match the
beadm behavior, we need to recursively iterate over child filesystems
and promote them along the way.

This patch further refines the work from D40903, completing the fix for
promotion.

Reviewed by: kevans, rew
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40972

11 months agokern.post.mk allow NEWVERS_{ENV,ARGS}
Simon J. Gerraty [Mon, 17 Jul 2023 19:03:35 +0000 (12:03 -0700)]
kern.post.mk allow NEWVERS_{ENV,ARGS}

Allow makefiles better control of newvers.sh env and args.
Also allow variable overrides on command line.

Reviewed by: imp, stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41012

11 months agotcbpcb: Always define t_osd
Warner Losh [Mon, 17 Jul 2023 17:22:45 +0000 (11:22 -0600)]
tcbpcb: Always define t_osd

Always define t_osd. congestion control modules access it
unconditionally. This fixes the build.

However, this is, at best, a temporary band-aide until the
larger issues are sorted.

Sponsored by: Netflix

11 months agobhyve: Remove an unneeded vm_get_register() call in main()
Mark Johnston [Wed, 5 Jul 2023 20:59:20 +0000 (16:59 -0400)]
bhyve: Remove an unneeded vm_get_register() call in main()

At one point the RIP value was passed to fbsdrun_addcpu(), but this is
no longer the case.  No functional change intended.

Reviewed by: jhb, corvink
Sponsored by: Innovate UK
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D40988

11 months agobhyve: Fix whitespace in bhyverun.c
Mark Johnston [Mon, 17 Jul 2023 15:11:20 +0000 (11:11 -0400)]
bhyve: Fix whitespace in bhyverun.c

No functional change intended.

MFC after: 1 week

11 months agostyle.Makefile.5: Wordsmith .PATH description
Mateusz Piotrowski [Mon, 17 Jul 2023 13:06:02 +0000 (15:06 +0200)]
style.Makefile.5: Wordsmith .PATH description

MFC after: 3 days
Fixes: 1ac5586c6d86 style.Makefile.5: Do not require $FreeBSD$ SCM IDs

11 months agostyle.Makefile.5: Remove $FreeBSD$ from examples
Mateusz Piotrowski [Mon, 17 Jul 2023 13:01:52 +0000 (15:01 +0200)]
style.Makefile.5: Remove $FreeBSD$ from examples

MFC after: 3 days