]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 hours agoarm64_pmap: narrow scope of bti_same test main
Doug Moore [Tue, 14 May 2024 04:22:52 +0000 (23:22 -0500)]
arm64_pmap: narrow scope of bti_same test

The pmap_bti_same test in pmap_enter_l3c only happens in the
!ADDR_IS_KERNEL case; in the other case, a KASSERT fails. So move the
test into that case to save a bit of time when ADDR_IS_KERNEL.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D45160

2 hours agoboottrace: Use NULL for SYSINIT's last arg, which is a pointer type
Zhenlei Huang [Tue, 14 May 2024 04:03:50 +0000 (12:03 +0800)]
boottrace: Use NULL for SYSINIT's last arg, which is a pointer type

MFC after: 3 days

6 hours agox86: Add Intel TD/HFI related MSR/CPUID defines to specialregs.h
Koine Yuusuke [Mon, 6 May 2024 02:17:29 +0000 (11:17 +0900)]
x86: Add Intel TD/HFI related MSR/CPUID defines to specialregs.h

for the coredirector driver.

MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44453

7 hours agofreebsd-tips: Add fortune to find font providing Unicode character
Joseph Mingrone [Mon, 13 May 2024 18:38:13 +0000 (15:38 -0300)]
freebsd-tips: Add fortune to find font providing Unicode character

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

7 hours agoStop removing ssp headers
Kyle Evans [Mon, 13 May 2024 22:43:44 +0000 (17:43 -0500)]
Stop removing ssp headers

These were previously installed by the GCC implementation of libssp, but
now they're installed once again with our implementation of
FORTIFY_SOURCE.

Reported by: jkim
Fixes: be04fec42638 ("Import _FORTIFY_SOURCE implementation [...]")

7 hours agoinclude: ssp: kill off leftover $FreeBSD$ tag
Kyle Evans [Mon, 13 May 2024 22:38:11 +0000 (17:38 -0500)]
include: ssp: kill off leftover $FreeBSD$ tag

Most of these were fixed when rebasing the patch forward, but this one
seems to have been missed.

Reported by: marck
Fixes: be04fec426 ("Import _FORTIFY_SOURCE implementation [...]")

8 hours agonvme: Add comment about where tr->deadline is set
Warner Losh [Mon, 13 May 2024 21:58:59 +0000 (15:58 -0600)]
nvme: Add comment about where tr->deadline is set

It's easy to overlook the chain of events that lead to tr->deadline
being updated. Add a comment here to explain what otherwise looks like
an oversight w/o careful study.

Sponsored by: Netflix

8 hours agonvme: Slight simplification
Warner Losh [Mon, 13 May 2024 21:03:52 +0000 (15:03 -0600)]
nvme: Slight simplification

We don't need to dereference qpair to get the ctrlr pointer each time,
so use the cached value. It's not going to change. No change intended.

Sponsored by: Netflix

8 hours agonvme: Slight reworking this loop to match FreeBSD style
Warner Losh [Mon, 13 May 2024 20:55:42 +0000 (14:55 -0600)]
nvme: Slight reworking this loop to match FreeBSD style

Update the comment for the code, and slightly rework the code in the
'fast exit' paradigm that FreeBSD generally tries to do.

Sponsored by: Netflix

8 hours agonvme: Add locking asserts
Warner Losh [Mon, 13 May 2024 20:53:48 +0000 (14:53 -0600)]
nvme: Add locking asserts

nvme_qpair_complete_tracker and nvme_qpair_manual_complete_tracker have
to be called without the qpair lock, so assert its unowned.

Sponsored by: Netflix

11 hours agonvme/f: Use strlcpy instead of strncpy + manual string termination
John Baldwin [Mon, 13 May 2024 19:04:03 +0000 (12:04 -0700)]
nvme/f: Use strlcpy instead of strncpy + manual string termination

Reviewed by: dab, imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D45153

11 hours agonvme: Use strlcpy instead of strncpy to ensure termination
John Baldwin [Mon, 13 May 2024 19:03:49 +0000 (12:03 -0700)]
nvme: Use strlcpy instead of strncpy to ensure termination

Reviewed by: dab, imp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D45152

11 hours agoregen
Mariusz Zaborski [Mon, 13 May 2024 18:36:15 +0000 (20:36 +0200)]
regen

Pointed out by: brooks

11 hours agotmpfs_destroy_vobject(): clear v_object under the object lock
Konstantin Belousov [Sun, 12 May 2024 01:26:32 +0000 (04:26 +0300)]
tmpfs_destroy_vobject(): clear v_object under the object lock

Which allows tmpfs_pager_writecount_recalc() to reliably detect
reclaimed vnode and make its accesses to object->un_pager.swp.private
(== vp) safe against reclaim.  Note that vnode instantiation already
assigns v_object under the object lock.

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

11 hours agoswap-like pagers: assert that writemapping decrease does not pass zero
Konstantin Belousov [Wed, 8 May 2024 13:58:52 +0000 (16:58 +0300)]
swap-like pagers: assert that writemapping decrease does not pass zero

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

11 hours agotmpfs: recalculate OBJ_TMPFS_VREF on reinstantiating node' vnode
Konstantin Belousov [Mon, 6 May 2024 18:31:31 +0000 (21:31 +0300)]
tmpfs: recalculate OBJ_TMPFS_VREF on reinstantiating node' vnode

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

13 hours agosyscalls: regen
Mariusz Zaborski [Mon, 13 May 2024 17:28:54 +0000 (19:28 +0200)]
syscalls: regen

Pointed out by: trasz

14 hours agoFix the GCC build after _FORTIFY_SOURCE import
Kyle Evans [Mon, 13 May 2024 16:13:51 +0000 (11:13 -0500)]
Fix the GCC build after _FORTIFY_SOURCE import

We haven't exposed gets(3) in a long time, rip out __gets_chk before
it's too late and something builds a gets(3) user with it enabled.

15 hours agosrc.conf.5: regen after addition of _FORTIFY_SOURCE build knob
Ed Maste [Mon, 13 May 2024 15:27:05 +0000 (11:27 -0400)]
src.conf.5: regen after addition of _FORTIFY_SOURCE build knob

Regen to pick up WITHOUT_SSP addition from commit 9bfd3b4076a7.

Sponsored by: The FreeBSD Foundation

16 hours agosyscalls.master: allow vfork(2) in capsicum(4) capability mode
Edward Tomasz Napierala [Mon, 13 May 2024 14:10:01 +0000 (16:10 +0200)]
syscalls.master: allow vfork(2) in capsicum(4) capability mode

There is no reason not do do this, we already allow fork(2),
and I need vfork(2) for CHERI process colocation.

Reviewed by: brooks, emaste, oshogbo
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39829

19 hours agoexpand: Fix markup for the `-t` option.
Dag-Erling Smørgrav [Mon, 13 May 2024 10:41:27 +0000 (12:41 +0200)]
expand: Fix markup for the `-t` option.

PR: 274897
Fixes: 8993d785a261
MFC after: 3 days
Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D45167

20 hours agoif_ovpn: cope with loops
Kristof Provost [Mon, 13 May 2024 10:06:47 +0000 (12:06 +0200)]
if_ovpn: cope with loops

User misconfiguration may lead to routing loops where we try to send the tunnel
packet into the tunnel. This eventually leads to stack overflows and panics.

Avoid this using if_tunnel_check_nesting(), which will drop the packet if we're
looping or we hit three layers of nested tunnels.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

21 hours agoaccess.2: Mention that lstat(2) should be used for symbolic links
Gordon Bergling [Mon, 13 May 2024 08:40:12 +0000 (10:40 +0200)]
access.2: Mention that lstat(2) should be used for symbolic links

access(), eaccess() and faccessat() will always dereference
symbolic links.

So add a note in the manual page, that lstat(2) should be
used in the case of symbolic links.

PR: 262895
Reviewed by: gbe, pauamma_gundo.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D44890

25 hours agoAdd a build knob for _FORTIFY_SOURCE
Kyle Evans [Mon, 13 May 2024 05:23:50 +0000 (00:23 -0500)]
Add a build knob for _FORTIFY_SOURCE

In the future, we will Default to _FORTIFY_SOURCE=2 if SSP is enabled,
otherwise default to _FORTIFY_SOURCE=0.  For now we default it to 0
unconditionally to ease bisect across older versions without the new
symbols, and we'll put out a call for testing.

include/*.h include their ssp/*.h equivalents as needed based on the
knob. Programs and users are allowed to override FORTIFY_SOURCE in their
Makefiles or src.conf/make.conf to force it off.

Reviewed by: des, markj
Relnotes: yes
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32308

25 hours agoPrepare the system for _FORTIFY_SOURCE
Kyle Evans [Mon, 13 May 2024 05:23:50 +0000 (00:23 -0500)]
Prepare the system for _FORTIFY_SOURCE

Notably:
- libc needs to #undef some of the macros from ssp/* for underlying
  implementations
- ssp/* wants a __RENAME() macro (snatched more or less from NetBSD)

There's some extra hinkiness included for read(), since libc spells it
as "_read" while the rest of the world spells it "read."

Reviewed by: imp, ngie
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32307

25 hours agoImport _FORTIFY_SOURCE implementation from NetBSD
Kyle Evans [Mon, 13 May 2024 05:23:49 +0000 (00:23 -0500)]
Import _FORTIFY_SOURCE implementation from NetBSD

This is a mostly-unmodified copy of the various *_chk implementations
and headers from NetBSD, without yet modifying system headers to start
actually including them.  A future commit will also apply the needed
bits to fix ssp/unistd.h.

Reviewed by: imp, pauamma_gundo.com (both previous versions), kib
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32306

31 hours agoarm64: map kernel using large pages when page size is 16K
Alan Cox [Sat, 11 May 2024 06:09:39 +0000 (01:09 -0500)]
arm64: map kernel using large pages when page size is 16K

When the page size is 16K, use ATTR_CONTIGUOUS to map the kernel code
and data sections using 2M pages.  Previously, they were mapped using
16K pages.

Reviewed by: markj
Tested by: markj
Differential Revision: https://reviews.freebsd.org/D45162

37 hours agobsdinstall: Remove unused variables in fetchmissingdists
Fernando Apesteguía [Thu, 26 Oct 2023 12:16:54 +0000 (14:16 +0200)]
bsdinstall: Remove unused variables in fetchmissingdists

ALL_DISTRIBUTIONS and VERIFY_MANIFEST_SIG

They are neither used in the script nor exported.
Not referenced anywhere in bsdinstall/*

Approved by: imp@
Differential Revision: https://reviews.freebsd.org/D42369

39 hours agoRevert linprocfs commits
Warner Losh [Sun, 12 May 2024 15:08:39 +0000 (09:08 -0600)]
Revert linprocfs commits

There's a race in these that I missed in my review that needs
to be resolved.

This reverts commit ee2e36686e846d412deac23344185f4b8a8c0285.
This reverts commit 02f481a30b8269c7cad24ec2920ca09751708a1e.
This reverts commit 099a81a4173bc5b121e50d4e27ea5fafdda8475b.

45 hours agoipfw: Fix a typo in a source code comment
Gordon Bergling [Sun, 12 May 2024 08:53:40 +0000 (10:53 +0200)]
ipfw: Fix a typo in a source code comment

- s/defaul/default/

MFC after: 3 days

2 days agolinprocfs: Really fix time_t type issue
Warner Losh [Sun, 12 May 2024 04:53:15 +0000 (22:53 -0600)]
linprocfs: Really fix time_t type issue

The cast to (long) is wrong on all the other 32-bit platforms. (long
long) is the correct type on all platforms. Also, use a z modifier for
size_t which also fails on 32-bit platforms.

Fixes: 02f481a30b82
Sponsored by: Netflix

2 days agodevfs_allocv(): style
Konstantin Belousov [Tue, 7 May 2024 12:33:01 +0000 (15:33 +0300)]
devfs_allocv(): style

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 days agocdev_pager_allocate(): ensure that the cdev_pager_ops ctr is called only once
Konstantin Belousov [Tue, 7 May 2024 13:23:28 +0000 (16:23 +0300)]
cdev_pager_allocate(): ensure that the cdev_pager_ops ctr is called only once

per allocated vm_object.  Otherwise, since constructors are not
idempotent, we e.g. leak device reference in case of non-managed pager.

PR: 278826
Reported by: Austin Zhang <austin.zhang@dell.com>
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D45113

2 days agolinprocfs: Fix i386 time type
Warner Losh [Sat, 11 May 2024 22:36:23 +0000 (16:36 -0600)]
linprocfs: Fix i386 time type

Cast the time type to (long). This is correct on all architectures. On
i386, this promotes the int time_t to a long (which is also 32-bit). On
64-bit architectures, this promotes the 64-bit signed time_t to a 64-bit
signed int type.

Sponsored by: Netflix

2 days agolinux: Make module standalone-buildable
Warner Losh [Sat, 11 May 2024 22:35:54 +0000 (16:35 -0600)]
linux: Make module standalone-buildable

Add opt_inet.h and opt_usb.h to make linux module buildable standalone.

Sponsored by: Netflix

2 days agolinprocfs: Add support for proc/sysvipc/{msg,sem,shm}
Ricardo Branco [Sat, 4 May 2024 13:38:20 +0000 (15:38 +0200)]
linprocfs: Add support for proc/sysvipc/{msg,sem,shm}

Signed-off-by: Ricardo Branco <rbranco@suse.de>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1218

2 days agousb: Remove uneeded revision verbosity from quirks list
Ahmad Khalifa [Sat, 20 Apr 2024 00:52:57 +0000 (02:52 +0200)]
usb: Remove uneeded revision verbosity from quirks list

Seperate usb quirks that target specific revisions from those that
dont. Alot of the quirks dont use lo_rev and hi_rev, so we can abstract
the 0x0000, 0xffff into a macro.

[[ This commit is a bit more churn than we like. I carefully reviewed
   each one and they are all good. The end product is better -- imp ]]

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1153

2 days agousb: Fix quirks list
Ahmad Khalifa [Sat, 20 Apr 2024 00:51:25 +0000 (02:51 +0200)]
usb: Fix quirks list

In some cases, the USB_QUIRK_VP macro was being misused. Instead of
setting quirks to the intended value, the first two supplied quirks
would go into lo_rev and hi_rev. Replace it with USB_QUIRK_VO which only
takes the needed args. This also makes the Dummy products, which where
being used to correctly set vendor only quirks, not necessary.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1153

2 days ago/bin/rmdir: Exit with status 2 for invalid arguments
Henrich Hartzer [Fri, 10 May 2024 17:53:49 +0000 (17:53 +0000)]
/bin/rmdir: Exit with status 2 for invalid arguments

PR: 277677

Signed-off-by: Henrich Hartzer <henrichhartzer@tuta.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1161

2 days agonvmecontrol: Appease a meaningless signed error warning thing
Warner Losh [Sat, 11 May 2024 19:01:10 +0000 (13:01 -0600)]
nvmecontrol: Appease a meaningless signed error warning thing

Consistently use the weird ssize_t type for things I know are unsigned,
but which none-the-less need to be compared to signed things to prevent
a bogus warning. Sigh, these aren't bugs, can't possibly be bugs and
a waste of time to fix.

Sponsored by: Netflix

2 days agostand: Spell LUA_COMPILE_SET correctly.
Warner Losh [Sat, 11 May 2024 18:05:53 +0000 (12:05 -0600)]
stand: Spell LUA_COMPILE_SET correctly.

MFC After: 2 days
Sponsored by: Netflix

2 days agonvmecontrol: Implement telemetry-log command.
Warner Losh [Mon, 8 Apr 2024 16:54:12 +0000 (10:54 -0600)]
nvmecontrol: Implement telemetry-log command.

This produces the same data as the Linux nvme-cli 'nvme telemetry-log'
command. It extracts the telemetry log from drive. This is a variable
length log, so we read the first page and find out how much of the log
to grab. There's 3 levels of details available, and we grab the level of
detail specified on the command line.

Sponsored by: Netflix

2 days agonvme: Add telemetry page definitions
Warner Losh [Sun, 7 Apr 2024 23:48:42 +0000 (17:48 -0600)]
nvme: Add telemetry page definitions

Add definition for page types 7 and 8 for host initiated telemetry and
controller initiated telemetry (they differ by one byte, but that byte
that's defined in the host version is reserved in the controller
version).

Sponsored by: Netflix

2 days agotcp rack: improve handling of front states
Michael Tuexen [Sat, 11 May 2024 14:28:45 +0000 (16:28 +0200)]
tcp rack: improve handling of front states

When the RACK stack wants to send a FIN, but still has outstanding
or unsent data, it sends a challenge ack. Don't do this when the
TCP endpoint is still in the front states, since it does not
make sense.
Reviewed by: rrs
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D45122

3 days agoarm64: add page-to-pte convenience macros
Doug Moore [Sat, 11 May 2024 06:04:48 +0000 (01:04 -0500)]
arm64: add page-to-pte convenience macros

Define macros to perform pte to vm_page and vm_page to pte conversions
without composing two macros, and use the convenience macros wherever
possible.

Reviewed by: alc
Differential Revision: https://reviews.freebsd.org/D44699

3 days agointr: Document how to get the interrupt frame
Warner Losh [Fri, 10 May 2024 21:41:36 +0000 (15:41 -0600)]
intr: Document how to get the interrupt frame

Document that the only way to get the interrupt thread is to use
curthread->td_intr_frame, rather than the old-style of having a NULL
pointer for the interrupt thread. As of 38c35248fe3b, support for that
has been removed. I neglected to update that commit message with these
details.

Suggested by: mhorne

3 days agokern/intr: remove support for passing trap frame as argument
Elliott Mitchell [Fri, 8 Oct 2021 21:43:26 +0000 (14:43 -0700)]
kern/intr: remove support for passing trap frame as argument

While otherwise a handy potential approach, getting the trap frame via
the argument isn't documented and isn't supposed to be used.  With all
uses removed, now remove support to end the mixed calling conventions.

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

Reviewed by: imp, mhorne
Pull Request: https://github.com/freebsd/freebsd-src/pull/1225

3 days agounbound: Vendor import 1.20.0
Cy Schubert [Fri, 10 May 2024 20:56:34 +0000 (13:56 -0700)]
unbound: Vendor import 1.20.0

Release notes at
https://www.nlnetlabs.nl/news/2024/May/08/unbound-1.20.0-released/

Security: The DNSBomb vulnerability CVE-2024-33655

Merge commit 'c2a80056864d6eda0398fd127dc0ae515b39752b' into main

3 days agotftpd: silence gcc overflow warnings
Dag-Erling Smørgrav [Fri, 10 May 2024 21:15:54 +0000 (23:15 +0200)]
tftpd: silence gcc overflow warnings

GCC 13 complains that we might be writing too much to an on-stack buffer
when createing a filename.

In practice there is a check that filename isn't too long given the
time format and other static characters so GCC is incorrect, but GCC
isn't wrong that we're potentially trying to put a MAXPATHLEN length
string + some other characters into a MAXPATHLEN buffer (if you ignore
the check GCC can't realistically evaluate at compile time).

Switch to snprintf to populate filename to ensure that future logic
errors don't result in a stack overflow.

Shorten the questionably named yyyymmdd buffer enough to slience the
warning (checking the snprintf return value isn't sufficent) while
preserving maximum flexibility for admins who use the -F option.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D45086

3 days agotftpd: Satisfy clang-analyzer.
Dag-Erling Smørgrav [Fri, 10 May 2024 21:15:49 +0000 (23:15 +0200)]
tftpd: Satisfy clang-analyzer.

* Replace `random()` with `arc4random()`.
* Change some variable types.
* Drop some unused assignments.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D45132

3 days agotftpd: Add missing include.
Dag-Erling Smørgrav [Fri, 10 May 2024 21:15:45 +0000 (23:15 +0200)]
tftpd: Add missing include.

This went unnoticed due to namespace pollution in our headers.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D45131

3 days agotftpd: Drop unneeded includes.
Dag-Erling Smørgrav [Fri, 10 May 2024 21:15:42 +0000 (23:15 +0200)]
tftpd: Drop unneeded includes.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D45130

3 days agotftpd: Add missing `-S` option to synopsis.
Dag-Erling Smørgrav [Fri, 10 May 2024 21:15:37 +0000 (23:15 +0200)]
tftpd: Add missing `-S` option to synopsis.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: imp, markj
Differential Revision: https://reviews.freebsd.org/D45129

3 days agoCONTRIBUTING.md/style: spring cleaning
Alexander Ziaee [Fri, 10 May 2024 06:07:59 +0000 (02:07 -0400)]
CONTRIBUTING.md/style: spring cleaning

+ move Lua to alphabetize subsections
+ word manpages like other subsections
+ man PR's shouldn't bump document date

MFC after: (maybe MFC to BETA3 along w/ e7ff917057ea ?)

3 days agolinux: Adjust rlimit SIGPENDING & MSGQUEUE behaviour to match linprocfs
Ricardo Branco [Fri, 10 May 2024 14:20:16 +0000 (16:20 +0200)]
linux: Adjust rlimit SIGPENDING & MSGQUEUE behaviour to match linprocfs

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1227

3 days agounbound: Vendor import 1.20.0
Cy Schubert [Fri, 10 May 2024 20:48:53 +0000 (13:48 -0700)]
unbound: Vendor import 1.20.0

Release notes at
https://www.nlnetlabs.nl/news/2024/May/08/unbound-1.20.0-released/

Security: The DNSBomb vulnerability CVE-2024-33655

3 days agovm: Change the return types of kernacc and useracc to bool
John Baldwin [Fri, 10 May 2024 20:43:56 +0000 (13:43 -0700)]
vm: Change the return types of kernacc and useracc to bool

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

3 days agouio: Use switch statements when handling UIO_READ vs UIO_WRITE
John Baldwin [Fri, 10 May 2024 20:43:36 +0000 (13:43 -0700)]
uio: Use switch statements when handling UIO_READ vs UIO_WRITE

This is mostly to reduce the diff with CheriBSD which adds additional
constants to enum uio_rw, but also matches the normal style used for
uio_segflg.

Reviewed by: kib, emaste
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D45142

3 days agomd: Merge two switch statements in mdstart_vnode
John Baldwin [Fri, 10 May 2024 20:43:23 +0000 (13:43 -0700)]
md: Merge two switch statements in mdstart_vnode

While here, use bp->bio_cmd instead of auio.uio_rw to drive read vs
write behavior.

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

3 days agosctp: improve heartbeat timer computation
Michael Tuexen [Fri, 10 May 2024 18:58:01 +0000 (20:58 +0200)]
sctp: improve heartbeat timer computation
PR: 278666
Reviewed by: Albin Hellqvist
MFC after: 3 days
Pull Request: https://reviews.freebsd.org/D45107

3 days agoRevert "grdc: Add copyright"
Warner Losh [Fri, 10 May 2024 16:50:46 +0000 (10:50 -0600)]
Revert "grdc: Add copyright"

It turns out this wasn't in 4.4BSD. I had a false positive for gdc.c
(which is in 4.4BSD, but part of gated, not this). gdc.c comes from the
ncurses tests, so it shouldn't have this copyright. This version is
mostly Amos Shapir and John Lupien's code. It comes from ncurses test
directory. ncurses has made dozens of improvements to this file since
we imported it in 1997 (which pre-dates their online history), so it's
not clear if their new copyright applies (which doesn't mention Amos
or John) or if some other copyright applies. In any case, it wasn't
4.4BSD, so revert this.

This reverts commit 6ed7d0e3ac9c34fa9deeb73f2322b9f25b708788.

Sponsored by: Netflix

3 days agosctp: store heartbeat creation time as time_t
Michael Tuexen [Fri, 10 May 2024 18:40:15 +0000 (20:40 +0200)]
sctp: store heartbeat creation time as time_t
Reported by: Coverity Scan
CID: 1493087
MFC after: 3 days

3 days agosctp: store vtag expire time as time_t
Michael Tuexen [Fri, 10 May 2024 18:25:04 +0000 (20:25 +0200)]
sctp: store vtag expire time as time_t
Reported by: Coverity Scan
CID: 1492525
CID: 1493239
MFC after: 3 days

3 days agoIncrease IOAPIC_MAX_ID to 255 (from 254)
Ed Maste [Fri, 10 May 2024 17:40:59 +0000 (13:40 -0400)]
Increase IOAPIC_MAX_ID to 255 (from 254)

A test system provided by AMD panicked with "madt_parse_apics:
I/O APIC ID 255 too high".  I/O APIC ID 255 is acceptable, so increase
the limit.

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

3 days agosctp: store cookie secret change time as time_t
Michael Tuexen [Fri, 10 May 2024 18:09:06 +0000 (20:09 +0200)]
sctp: store cookie secret change time as time_t
Reported by: Coverity Scan
CID: 1492349
CID: 1493281
MFC after: 3 days

3 days agomadt: print CPU APIC ID as signed int
Ed Maste [Fri, 10 May 2024 18:57:22 +0000 (14:57 -0400)]
madt: print CPU APIC ID as signed int

Instead of printing something like "MADT: Found CPU APIC ID 4294967295
ACPI ID 512: disabled" print the APIC ID as a singed int for a more
user-friendly -1.

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

3 days agokmod.mk use ${XARGS}
Simon J. Gerraty [Fri, 10 May 2024 19:05:05 +0000 (12:05 -0700)]
kmod.mk use ${XARGS}

Also ${XARGS_J} this allows use of non-BSD xargs when building
kernel modules.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D45146

3 days agonvmf_transport: Remove invalid assertion
John Baldwin [Fri, 10 May 2024 16:12:03 +0000 (09:12 -0700)]
nvmf_transport: Remove invalid assertion

This is leftover from an earlier iteration of the code where 'nt' was
not dynamically allocated but was the passed in 'ops' pointer so was
always alive.

Reported by: Coverity Scan
CID:   1545042
Sponsored by: Chelsio Communications

3 days agoctl_backend_block: Correct value of NVME nsdata nuse field
John Baldwin [Fri, 10 May 2024 16:09:53 +0000 (09:09 -0700)]
ctl_backend_block: Correct value of NVME nsdata nuse field

Reported by: Coverity Scan
CID:   1545043
Sponsored by: Chelsio Communications

3 days agonvmecontrol: Free the addrinfo list when failing to open a TCP socket
John Baldwin [Fri, 10 May 2024 16:06:54 +0000 (09:06 -0700)]
nvmecontrol: Free the addrinfo list when failing to open a TCP socket

Reported by: Coverity Scan
CID:   1545048
Sponsored by: Chelsio Communications

3 days agonvmecontrol: Free array of I/O queue pairs on failure to handoff
John Baldwin [Fri, 10 May 2024 16:04:51 +0000 (09:04 -0700)]
nvmecontrol: Free array of I/O queue pairs on failure to handoff

This is harmless but cleaner.

Reported by: Coverity Scan
CID:   1545041,1545049
Sponsored by: Chelsio Communications

3 days agonvmf: Use strlcpy instead of strncpy to ensure termination
John Baldwin [Fri, 10 May 2024 15:56:51 +0000 (08:56 -0700)]
nvmf: Use strlcpy instead of strncpy to ensure termination

Reported by: Coverity Scan
CID:   1545054
Sponsored by: Chelsio Communications

3 days agonvmecontrol: Fix a sizeof mismatch
John Baldwin [Fri, 10 May 2024 15:54:02 +0000 (08:54 -0700)]
nvmecontrol: Fix a sizeof mismatch

In this case it is harmless since it is an array of pointers so the
resulting length is identical.

Reported by: Coverity Scan
CID: 1545055
Sponsored by: Chelsio Communications

3 days agogrdc: Add copyright
Warner Losh [Fri, 10 May 2024 15:22:44 +0000 (09:22 -0600)]
grdc: Add copyright

Add the stock BSD copyright and license from the 4.4-Lite distribution
(indirected by SPDX).

Sponsored by: Netflix

3 days agogrdc: add countdown timer mode
Gavin Atkinson [Fri, 10 May 2024 15:22:38 +0000 (09:22 -0600)]
grdc: add countdown timer mode

PR: 35113
Differential Revision: https://reviews.freebsd.org/D43463

3 days agoposix: POSIX-1.2008 moved SA_* from XSI to base standard
Warner Losh [Fri, 10 May 2024 15:18:43 +0000 (09:18 -0600)]
posix: POSIX-1.2008 moved SA_* from XSI to base standard

Starting with POSIX-1.2008, "The SA_RESETHAND, SA_RESTART, SA_SIGINFO,
SA_NOCLDWAIT, and SA_NODEFER constants are moved from the XSI option to
the Base." Make them so visible.

PR: 275328
Sponsored by: Netflix

3 days agoconf: Generate fdt_static_dtb.h in OBJDIR
Justin Hibbits [Thu, 9 May 2024 19:46:09 +0000 (15:46 -0400)]
conf: Generate fdt_static_dtb.h in OBJDIR

Though the kernel build expects ${.OBJDIR} to be equal to ${.CURDIR}
that may not always be the case.  Correctly generate fdt_static_dtb.h in
${.OBJDIR}, which is conceptually more correct anyway.

Obtained from: Juniper Networks, Inc.

3 days agotpm20: Support partial reads
Justin Hibbits [Thu, 9 May 2024 19:27:35 +0000 (15:27 -0400)]
tpm20: Support partial reads

Summary:
In some cases the TPM utilities may read only a partial block, instead
of a full block.  If a new command starts while in the middle of a read
it may cause the TPM to go catatonic and no longer respond to SPI.

Reviewed by: kd
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D45140

3 days agoukswitch: fix non-debug build
Ed Maste [Fri, 10 May 2024 12:52:06 +0000 (08:52 -0400)]
ukswitch: fix non-debug build

PR: 278847
Sponsored by: The FreeBSD Foundation

3 days agocat: Missed a couple.
Dag-Erling Smørgrav [Fri, 10 May 2024 11:04:56 +0000 (13:04 +0200)]
cat: Missed a couple.

MFC after: 3 days
Sponsored by: Klara, Inc.

3 days agocat: Check for lack of success rather than a specific failure.
Dag-Erling Smørgrav [Fri, 10 May 2024 10:59:18 +0000 (12:59 +0200)]
cat: Check for lack of success rather than a specific failure.

MFC after: 3 days
Sponsored by: Klara, Inc.
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D45149

3 days agoarm64: Update the page table list in locore
Andrew Turner [Wed, 24 Apr 2024 10:23:42 +0000 (11:23 +0100)]
arm64: Update the page table list in locore

The comment describing the page tables was out of date. Update it with
the current list.

Sponsored by: Arm Ltd

3 days agoarm64: Merge common page table creation code
Andrew Turner [Thu, 25 Apr 2024 13:06:23 +0000 (14:06 +0100)]
arm64: Merge common page table creation code

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45061

3 days agoarm64/gicv3: Check if the hardware supports LPIs
Andrew Turner [Tue, 23 Apr 2024 11:28:23 +0000 (12:28 +0100)]
arm64/gicv3: Check if the hardware supports LPIs

Some simulators have the ITS in the DTB passed to the kernel, however
it is a runtime configuration option to enable it.

Check the GICD_TYPER register to see if LPIs are enabled before
attaching the ITS driver.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44914

3 days agodev/psci: Check all compat strings
Andrew Turner [Tue, 23 Apr 2024 11:27:09 +0000 (12:27 +0100)]
dev/psci: Check all compat strings

When searching for the PSCI FDT node we only check a few compat strings.
Use the existing compat_data array to check all strings the driver may
attach to.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D44913

3 days agoarm64: Flush the spintable release address
Andrew Turner [Fri, 3 May 2024 16:17:25 +0000 (17:17 +0100)]
arm64: Flush the spintable release address

Ensure the spintable release address is written back from the cache
to memory. The other CPUs reading this may not be reading it with the
cache enabled so ensure it is written to the point of coherency
before issuing the wakeup sev.

As cpu_dcache_wbinv_range includes the needed barrier remove it from
the inline asm before the sev instruction.

Reviewed by: jhibbits, kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45083

3 days agoarm64: Support a shared release for spin-table
Andrew Turner [Mon, 29 Apr 2024 14:23:42 +0000 (15:23 +0100)]
arm64: Support a shared release for spin-table

When releasing multiple CPUs that share a release address we need them
to wait for their turn to boot. Add a mechanism to do this by booting
them until they enable the TLB before waiting their turn to enter
init_secondary.

Reviewed by: jhibbits, kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45082

3 days agoam64: Allow cpu.h to be included from assembly
Andrew Turner [Fri, 3 May 2024 16:07:29 +0000 (17:07 +0100)]
am64: Allow cpu.h to be included from assembly

Reviewed by: jhibbits, kevans
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45081

3 days agoAdd man page for nfslockd.
Dag-Erling Smørgrav [Fri, 10 May 2024 09:23:13 +0000 (11:23 +0200)]
Add man page for nfslockd.

PR: 130238
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D45139

4 days agomdconfig: Print options when listing devices
Ricardo Branco [Fri, 10 May 2024 04:42:22 +0000 (22:42 -0600)]
mdconfig: Print options when listing devices

PR: 278624
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1210

4 days agoExplain cron.d
Paweł Krawczyk [Fri, 10 May 2024 04:21:18 +0000 (22:21 -0600)]
Explain cron.d

Add details on the format of system cron files, which are mentioned in
cron(8) which refers here but barely explained here.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1106

4 days agoat cron file is now in /etc/cron.d
Paweł Krawczyk [Fri, 10 May 2024 04:21:18 +0000 (22:21 -0600)]
at cron file is now in /etc/cron.d

PR: 243380
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1106

4 days agosysexits: Tidy deprecated header and manual
Alexander Ziaee [Fri, 10 May 2024 02:43:39 +0000 (20:43 -0600)]
sysexits: Tidy deprecated header and manual

<sysexits.h> was deprecated in the base system in a1432b4 for FreeBSD
8.0 and is retained only for backwards compatibility.  Make that clear,
since sysexits(3) suggested using it since it was in style(9) prior
to this.

MFC after: 1 week
Co-authored-by: imp
Fixes: a1432b4
Reviewed by: imp, pauamma (previous version)
Pull Request https://github.com/freebsd/freebsd-src/pull/1195

4 days agoUpdate README.md to add pointer to release page.
Lukas R. Jackson [Fri, 10 May 2024 02:36:19 +0000 (20:36 -0600)]
Update README.md to add pointer to release page.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1151

4 days agoahc(4): Default to memory mapped IO
HP van Braam [Fri, 10 May 2024 02:13:03 +0000 (20:13 -0600)]
ahc(4): Default to memory mapped IO

When this driver was written it made sense to make this default to off,
but these days almost all BIOSses will do the right thing. Furthermore
non-mmio communication only works on Intel architectures.

So lets default to allowing mmio, but not change the semantics of the
AHC_ALLOW_MEMIO flag to not break existing installs. Also document the
already existing hint.ahc.<unit>.allow_memio.

Signed-off-by: HP van Braam <hp@tmm.cx>
Reviewed by: imp (small style tweak)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1219

4 days agoipfw: correctly report table manipulation errors
Ben Wilber [Fri, 10 May 2024 02:08:15 +0000 (20:08 -0600)]
ipfw: correctly report table manipulation errors

Let ipfw(8) report the actual error instead of the error that
may have come from calling printf().

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1221

4 days agoFix memory corruption in C++ demangler
Justine Tunney [Fri, 10 May 2024 01:55:45 +0000 (19:55 -0600)]
Fix memory corruption in C++ demangler

The __cxa_demangle_gnu3() and cpp_demangle_gnu3() functions segfault on
various libcxxabi test cases due to a copy and paste error. This change
fixes that.

This is a subset of https://github.com/libcxxrt/libcxxrt/pull/34 which
fixes the immediate problem.

Reviewed by: imp, emaste (I think)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1222

4 days agonfscl: Do not do readahead for directories
Rick Macklem [Fri, 10 May 2024 01:33:13 +0000 (18:33 -0700)]
nfscl: Do not do readahead for directories

For a very long time, the NFS client has done readahead for
directory blocks.  Unlike data blocks, the readahead cannot
begin until the Readdir RPC reply has been received, since
the directory offset cookie in that Readdir RPC reply is needed.
As such, the readahead is serialized and does not seem to
provide any real benefit.

Recent testing/benchmarking shows that removing this
readahead code for Readdir does not have a negative impact
on performance.

Therefore, this patch deletes the readahead code for Readdir,
which simplifies the code and may make future changes simpler.

MFC after: 1 month

4 days agoAllow -DNO_STRICT_REGEX to restore historic regex behavior
Simon J. Gerraty [Fri, 10 May 2024 01:29:43 +0000 (18:29 -0700)]
Allow -DNO_STRICT_REGEX to restore historic regex behavior

Allow restoring the behavior of '{' as described in regex(3).
Ie. only treat it as start of bounds if followed by a digit.

If NO_STRICT_REGEX is not defined, the behavior introduced by
commit a4a801688c909ef39cbcbc3488bc4fdbabd69d66 is retained,
otherwise the previous behavior is restored.

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

4 days agoNew sysctl to disable NOMATCH until devmatch runs
Isaac Cilia Attard [Mon, 29 Apr 2024 20:44:27 +0000 (22:44 +0200)]
New sysctl to disable NOMATCH until devmatch runs

Introduce hw.bus.devctl_nomatch_enabled and use it to suppress NOMATCH
until devmatch runs

There's a lot of NOMATCH events generated at boot. We also run devmatch
once during early boot to load unmatched devices. To avoid redundant
work, don't start generating NOMATCH events until after devmatch runs.
Set hw.bus.devctl_nomatch_enabled=1 just before we run devmatch. The
kernel will suppress NOMATCH events until this is set to true.

This saves about 170ms from the boot on aarch64 running atop Apple
M-series processors and the VMWare Fusion hypervisor.

Reviewed by:    imp, cperciva
MFC after:      3 days
Sponsored by:   Google Summer of Code
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1213