Commit graph

291588 commits

Author SHA1 Message Date
Kyle Evans 0ed58ac88a 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 [...]")
2024-05-13 17:45:55 -05:00
Warner Losh 0dd84c3b11 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
2024-05-13 16:14:04 -06:00
Warner Losh c931cf6af0 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
2024-05-13 16:14:04 -06:00
Warner Losh 9db8ca92b9 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
2024-05-13 16:14:04 -06:00
Warner Losh 5a178b831a 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
2024-05-13 16:14:03 -06:00
John Baldwin da4230af3f 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
2024-05-13 12:04:03 -07:00
John Baldwin 01fc488381 nvme: Use strlcpy instead of strncpy to ensure termination
Reviewed by:	dab, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D45152
2024-05-13 12:03:49 -07:00
Mariusz Zaborski e90259af59 regen
Pointed out by:	brooks
2024-05-13 20:37:20 +02:00
Konstantin Belousov 4681194979 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
2024-05-13 21:33:59 +03:00
Konstantin Belousov 6ada4e8a0a 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
2024-05-13 21:33:29 +03:00
Konstantin Belousov 58d7ac11e7 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
2024-05-13 21:33:29 +03:00
Mariusz Zaborski 663838451e syscalls: regen
Pointed out by: trasz
2024-05-13 19:29:57 +02:00
Kyle Evans 8b0682644e 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.
2024-05-13 11:21:38 -05:00
Ed Maste b667c40f9f src.conf.5: regen after addition of _FORTIFY_SOURCE build knob
Regen to pick up WITHOUT_SSP addition from commit 9bfd3b4076.

Sponsored by:	The FreeBSD Foundation
2024-05-13 11:28:52 -04:00
Edward Tomasz Napierala 050555e129 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
2024-05-13 16:12:29 +02:00
Dag-Erling Smørgrav f3eeeb959c expand: Fix markup for the -t option.
PR:		274897
Fixes:		8993d785a2
MFC after:	3 days
Reviewed by:	gbe
Differential Revision:	https://reviews.freebsd.org/D45167
2024-05-13 12:41:38 +02:00
Kristof Provost 59a6666ec9 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")
2024-05-13 12:11:06 +02:00
Gordon Bergling 421025a274 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
2024-05-13 10:40:12 +02:00
Kyle Evans 9bfd3b4076 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
2024-05-13 00:23:50 -05:00
Kyle Evans e55512504d 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
2024-05-13 00:23:50 -05:00
Kyle Evans be04fec426 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
2024-05-13 00:23:49 -05:00
Alan Cox 94b09d388b 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
2024-05-12 18:22:38 -05:00
Fernando Apesteguía 47535ba3d3 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
2024-05-12 19:25:06 +02:00
Warner Losh 71ffda4130 Revert linprocfs commits
There's a race in these that I missed in my review that needs
to be resolved.

This reverts commit ee2e36686e.
This reverts commit 02f481a30b.
This reverts commit 099a81a417.
2024-05-12 09:09:03 -06:00
Gordon Bergling 78e4dbc345 ipfw: Fix a typo in a source code comment
- s/defaul/default/

MFC after:	3 days
2024-05-12 10:53:40 +02:00
Warner Losh ee2e36686e 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: 02f481a30b
Sponsored by: Netflix
2024-05-11 22:53:15 -06:00
Konstantin Belousov 6d79564fe3 devfs_allocv(): style
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-12 04:13:00 +03:00
Konstantin Belousov e934040651 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
2024-05-12 04:13:00 +03:00
Warner Losh 02f481a30b 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
2024-05-11 18:38:17 -06:00
Warner Losh c5f906d32d linux: Make module standalone-buildable
Add opt_inet.h and opt_usb.h to make linux module buildable standalone.

Sponsored by:		Netflix
2024-05-11 16:35:54 -06:00
Ricardo Branco 099a81a417 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
2024-05-11 13:37:47 -06:00
Ahmad Khalifa 881ae768f2 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
2024-05-11 13:32:57 -06:00
Ahmad Khalifa 64e05e9065 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
2024-05-11 13:32:37 -06:00
Henrich Hartzer 9bcc1b18c1 /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
2024-05-11 13:13:28 -06:00
Warner Losh 3d966ae789 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
2024-05-11 13:03:29 -06:00
Warner Losh e63d20b70e stand: Spell LUA_COMPILE_SET correctly.
MFC After: 2 days
Sponsored by:		Netflix
2024-05-11 12:09:51 -06:00
Warner Losh c1fccf0f60 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
2024-05-11 12:09:51 -06:00
Warner Losh e84a75f936 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
2024-05-11 12:09:50 -06:00
Michael Tuexen 2f923a0ced 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
2024-05-11 16:28:45 +02:00
Doug Moore c1ebd76c3f 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
2024-05-11 01:04:48 -05:00
Warner Losh a2409f1737 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 38c35248fe, support for that
has been removed. I neglected to update that commit message with these
details.

Suggested by: mhorne
2024-05-10 15:41:36 -06:00
Elliott Mitchell 38c35248fe 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
2024-05-10 15:33:24 -06:00
Cy Schubert 335c7cda12 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
2024-05-10 14:23:43 -07:00
Dag-Erling Smørgrav 25945af47e 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
2024-05-10 23:16:26 +02:00
Dag-Erling Smørgrav 4d09eb87c5 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
2024-05-10 23:16:26 +02:00
Dag-Erling Smørgrav ae285a8cbf 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
2024-05-10 23:16:26 +02:00
Dag-Erling Smørgrav 1111da6b7c tftpd: Drop unneeded includes.
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	imp, markj
Differential Revision:	https://reviews.freebsd.org/D45130
2024-05-10 23:16:26 +02:00
Dag-Erling Smørgrav 816c4d3dcf 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
2024-05-10 23:16:26 +02:00
Alexander Ziaee 467e3e2f20 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/ e7ff917057 ?)
2024-05-10 15:07:03 -06:00
Ricardo Branco a7cc56b28f linux: Adjust rlimit SIGPENDING & MSGQUEUE behaviour to match linprocfs
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1227
2024-05-10 14:50:04 -06:00