Commit Graph
310754 Commits
Author SHA1 Message Date
Mark Johnston a8f5e24070 ee: Handle EINTR when waiting for a character
Otherwise one can't easily attach gdb to ee.

Reviewed by:	bapt
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57997
2026-07-06 13:18:18 +00:00
Mark Johnston 705a88a717 ee: Improve handling of malformed UTF-8 characters
In delete(), when copying the deleted character to the d_char buffer,
don't assume that it fits.  utf8_prev() may return a sequence of more
than 5 bytes.

In insert_utf8(), fix the copy-up of the line.  We extended the line by
"len" bytes, so "temp" has to be repositioned accordingly.  Compare with
plain insert().

Use sizeof when copying to buffers instead of hard-coding buffer sizes.

Don't dynamically allocate d_char, there is no need.

Fixes:		62fba0054d ("ee: add unicode support")
Reported by:	Sayono Hiragi (overflow in delete())
Reviewed by:	bapt
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57996
2026-07-06 13:18:13 +00:00
Mark Johnston 38dd686b93 jaildesc: Publish the new fd only after the jaildesc is initialized
jaildesc_alloc() finishes initializing the file structure only after it
is made visible from the file descriptor table via finit().  In that
window, other threads could try to perform operations on the descriptor
and thus access an incompletely initialized jaildesc.

Defer the finit() call until locks are initialized.  While here,
simplify the error path for falloc_caps().

Reported by:	Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
		and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai
Reviewed by:	jamie
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D58049
2026-07-06 12:51:11 +00:00
Mark Johnston 92dfe30ba2 inotify.2: Fix formatting and lint
MFC after:	1 week
2026-07-06 12:50:51 +00:00
Mark Johnston b70997c8c7 inotify: Unconditionally generate IN_IGNORED events for files/dirs
The implementation previously only generated an IN_IGNORED event for a
deleted watched file if the watch explicitly requested IN_DELETE_SELF.
This is not correct, IN_IGNORED should always be raised when the watched
subject is deleted.  Adjust the implementation of inotify_log_one()
accordingly.

This also fixes a problem where a deleted watched file's watch
would not be removed if IN_DELETE_SELF was not in the watch's event
mask, in which case the unlinked vnode would linger until the inotify
descriptor itself is closed.

Add a regression test.

Reported by:	jrtc27
Reviewed by:	jrtc27
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D58050
2026-07-06 12:50:37 +00:00
Dag-Erling Smørgrav 4805b88edb libc/resolv: Dead code and style cleanup
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57928
2026-07-06 14:23:55 +02:00
Dag-Erling Smørgrav 3f15998d25 resolv.h: Remove unused parts
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57927
2026-07-06 14:23:50 +02:00
Dag-Erling Smørgrav 60827d7885 libc/resolv: Add no-debug and no-rotate options
These are simply the reverse of the debug and rotate options.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57926
2026-07-06 14:23:43 +02:00
Dag-Erling Smørgrav fbe0257b56 libc/resolv: Reimplement the sortlist parser
When we switched from the BIND4 resolver to the BIND9 resolver, the
sortlist parser was inadvertently disabled due to a missing #define, and
nobody seemed to notice.  The sorting code remained enabled in the
resolver, but there was no way to set a sort order.

Reimplement the sortlist parser, but correctly, and update the manual
accordingly.  The new parser accepts IPv4 and IPv6 addresses with or
without a mask or prefix length, just like the old one, except IPv6
support was a bit wonky in the original code.

Fixes:		5342d17f09 ("Update the resolver in libc to BIND9's one.")
Relnotes:	yes
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57925
2026-07-06 14:23:37 +02:00
Dag-Erling Smørgrav ffeb56905e libc/resolv: Refactor the configuration parser
This was previously all a single loop in res_init(), apart from option
parsing which we cleaned up in a previous commit.  Break it out into
separate functions for reading the configuration line by line, setting
the default domain, setting the search list, and adding a nameserver
to the nameserver list.  Sprinkle bounds checks and code comments all
around.

The sortlist code, which has been disabled for the past 20 years, will
be dealt with in a separate commit.

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57924
2026-07-06 14:23:33 +02:00
Dag-Erling Smørgrav 9bfdfecd27 libc/resolv: Refactor the option parser
Start the loop by finding the end of the option name, the name-value
separator (if any), and the end of the option.  Use those pointers to
simplify matching the option name and parsing the option value, and
validate option names and values more strictly.  This means that:

* We no longer accept trailing garbage in an option name or value.  For
  instance, we would previously interpret “edns0123” as “edns0” and
  “timeout:3xyz” as “timeout:3”.  This was actually quite lucky because
  we also failed to recognize the newline at the end of the option line
  as a whitespace character.

* For options that take a numerical argument, we would previously accept
  negative values and treat non-numerical arguments as 0, while large
  numerical arguments would be capped to the option's maximum permitted
  value.  Now, any failure to parse the argument, including overflow,
  results in the option being left unchanged.

MFC after:	1 week
Relnotes:	yes
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57923
2026-07-06 14:23:29 +02:00
Dag-Erling Smørgrav aba9fffebf libc/resolv: Drop Solaris 2 compatibility
MFC after:	1 week
Reviewed by:	kevans, markj
Differential Revision:	https://reviews.freebsd.org/D57922
2026-07-06 14:23:24 +02:00
Dag-Erling Smørgrav 4319e4bf42 resolver(5): Overhaul
* Modernize the markup

* Describe the comment syntax

* Drop obsolete advice

* Capitalize sentences

* Improve the language

* Replace no_tld_query with no-tld-query; both are supported, but all the
  other multi-word options use hyphens rather than underscores.

* Add missing ENVIRONMENT section

* Redo the example

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D57921
2026-07-06 14:23:20 +02:00
Goran Mekić 24576c3978 sound: track kqueue low watermark per-knote for mmaped channels
Use kn->kn_sdata to track the last bs->total value for each knote
attached to an mmaped channel. An event is delivered only when the total
byte counter has advanced by at least c->lw since the last delivery.
After delivery kn_sdata is updated to the current total.

Each knote tracks its own watermark independently, so multiple knotes
attached to the same mmaped channel all receive events correctly.

Non-mmap channels keep the existing level-triggered behavior via
chn_polltrigger().

MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D57833
2026-07-06 15:07:41 +03:00
Slava Shwartsman b125b736ea ibcore: Fix GID sysctl fallback formatting
When a GID table entry is empty or not yet present in the cache,
show_port_gid() falls back to printing a zero GID.  Use the existing
GID_PRINT_FMT/GID_PRINT_ARGS helpers instead of Linux's %pI6 format,
which FreeBSD printf treats as a pointer followed by "I6".
This makes empty GID sysctl entries consistently report
0000:0000:0000:0000:0000:0000:0000:0000.

Tested by:	Wafa Hamzah <[email protected]> (mlx5_ib)
Reviewed by:	jhb, kib
Sponsored by:	NVIDIA Networking
Fixes:	6a75471dbc ("OFED: Various changes from Linux 4.19")
Differential Revision:	https://reviews.freebsd.org/D58042
2026-07-06 13:15:02 +03:00
Artem Bunichev 759ce9a2b3 ps.1: Fix broken comment line
While here, remove the long-unused dash in the first line.

Reviewed by:    ziaee, olce
Fixes:          ddf144a04b ("ps.1: Revamp: Explain general principles, update to match reality")
MFC after:      1 day
Differential Revision:  https://reviews.freebsd.org/D58038
2026-07-05 22:03:34 +02:00
Abdelkader Boudih 22ddc9eb1d fwip: Fix M_PKTHDR loss in fwip_async_output broadcast path
M_PREPEND in the broadcast branch may call m_prepend(9) which allocates
a new head mbuf and calls m_move_pkthdr(), stripping M_PKTHDR from the
old mbuf.

xfer->mbuf was set before M_PREPEND, so it pointed at the
deheadered old mbuf. bus_dmamap_load_mbuf(9) asserts M_PKTHDR and
panics.

Reviewed by:	zlei, adrian
Differential Revision:	https://reviews.freebsd.org/D57495
2026-07-05 11:34:02 -07:00
Simon J. Gerraty 5dfe1956df Merge bmake-20260704
Merge commit 'e988c5eab5231646c612d35ff5b16122cebfbf6a'
2026-07-05 11:31:49 -07:00
Simon J. Gerraty e988c5eab5 Import bmake-20260704
Intersting/relevant changes since bmake-20260508

ChangeLog since bmake-20260508

2026-07-04  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260704

2026-07-03  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260703
	Merge with NetBSD make, pick up
	o meta.c: do a better job of resolving relative paths
	o var.c: add alternation support to :M
	eg. :M*{Makefile*,.mk} matches any *Makefile* or *.mk

2026-07-02  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260702
	Merge with NetBSD make, pick up
	o meta.c: .MAKE.META.FILTER can be used to more generally filter
	relevant content of .meta file in meta_oodate.

2026-06-19  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260619
	Merge with NetBSD make, pick up
	o make.1: fix description of .MADE it is a source not a target.

	* update mk files

2026-06-10  Simon J Gerraty  <[email protected]>

	* VERSION (_MAKE_VERSION): 20260609
	Merge with NetBSD make, pick up
	o parse.c: allow semicolons and parentheses in dependency line
	expressions

mk/ChangeLog since bmake-20260508

2026-07-04  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260704

2026-07-03  Simon J Gerraty  <[email protected]>

	* dirdeps.mk: make use of alternation support in latest bmake
	when setting .MAKE.META.IGNORE_FILTER so we can get both
	Makefile.depend* and *.mk to make cache out-of-date.

2026-07-02  Simon J Gerraty  <[email protected]>

	* meta2deps.py: detect corrupted filemon data on Linux,
	caused by lost newlines.

2026-06-21  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260621

	* gendirdeps.mk: more debug output

	* meta.autodep.mk: remove extra } from GENDIRDEPS_ENV

2026-06-19  Simon J Gerraty  <[email protected]>

	* install-mk (MK_VERSION): 20260619

	* install-new.mk: for POSIX_SHELL we need .new*
	rather than just .new

2026-05-21  Simon J Gerraty  <[email protected]>

	* meta2deps.{py,sh}: skip pathnames with spaces - not worth the pain.
2026-07-05 11:22:31 -07:00
Ishan Agrawal fa50691ecf libsysdecode: decode PF Generic Netlink commands
Decode the Generic Netlink command header for messages
belonging to the PF Generic Netlink family. Display the
command name using the PF Generic Netlink command decoder.

Signed-off-by:	Ishan Agrawal <[email protected]>
Reviewed by:	kp
Sponsored-by:	Google LLC (GSoC 2026)
2026-07-05 16:04:06 +02:00
Ishan Agrawal c268c80fc3 libsysdecode: cache Generic Netlink family IDs
Record Generic Netlink family IDs learned from
CTRL_CMD_GETFAMILY responses and use them to decode subsequent
Generic Netlink messages using symbolic family names instead of
numeric IDs.

Signed-off-by:	Ishan Agrawal <[email protected]>
Reviewed by:	kp
Sponsored-by:	Google LLC (GSoC 2026)
2026-07-05 16:03:52 +02:00
Ishan Agrawal 80586e8536 libsysdecode: decode Generic Netlink controller messages
Decode Generic Netlink controller (GENL_ID_CTRL) messages in
Netlink payloads. Display the Generic Netlink header along with
the CTRL_CMD_GETFAMILY attributes, including the family ID and
family name.

Signed-off-by:	Ishan Agrawal <[email protected]>
Reviewed by:	kp
Sponsored-by:	Google LLC (GSoC 2026)
2026-07-05 16:03:34 +02:00
Ishan Agrawal 8a1576dc26 truss: track Netlink socket protocols
Record the Netlink protocol associated with AF_NETLINK sockets when
they are created and pass it to libsysdecode during message decoding.

Use the protocol to distinguish between Generic Netlink and Route
Netlink sockets, ensuring that Generic Netlink decoding is only
performed for NETLINK_GENERIC sockets.

Signed-off-by:	Ishan Agrawal <[email protected]>
Reviewed by:	kp
Sponsored-by :	Google LLC (GSoC 2026)
2026-07-05 16:03:20 +02:00
Konstantin Belousov 4efbcf36a0 libc locale/localeconv.c: use release semantic when clearing locale_changed
PR:	296410
Submitted by:	Tomas Vondra <[email protected]>
MFC after:	1 week
2026-07-05 06:18:50 +03:00
Rick Macklem fe6677e7f4 nfs_clstate.c: Fix handling of delegation upgrades
Commit 016570c446 modified the client to handle
the upgrade of a read delegation to a write delegation,
where the server provides the same delegation stateid
to the client.  However, it failed to check if the
delegation structure was currently in use.  Without this
patch, if the structure was in use, a use after free
could occur.

This patch handles the "in use" case by copying the
necessary fields into the current/old structure and
free's the new one instead of the old one that is
"in use".

PR:	296224
MFC after:	2 weeks
2026-07-04 15:00:02 -07:00
Alexander Motin b77f6ae689 Revert "zfs: Wire sha512 offload to the build"
This reverts commit cd61eb4f66.

Some people report module load failure due to undefined symbol.
I don't have those problems myself, so it might be a question of
full rebuild.  But I don't have time right now, so just revert.
2026-07-04 05:14:02 -04:00
Konstantin Belousov bcb471cfb4 sys/systm.h: include sys/limits.h for SSIZE_MAX
This makes the header more self-contained.
The symbol is needed only on 32bit arches, but the include file is
provided unconditionally to make the namespace population predictable.

PR:	296489
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-07-04 04:26:23 +03:00
Adrian Chadd 830f690eb6 iwn: assign sequence number to raw transmit frames
This fixes associating to various APs.

It worked fine to a FreeBSD AP (which is a wholly separate problem
I'm going to need to dive into) but not to my tplink AX1800 Wifi-6
router.

PR: kern/296503

Locally tested:

* STA: Intel Centrino Advanced-N 6205 (iwn), Lenovo T420
* AP: TP-Link AX1800 wifi-6 router
2026-07-03 16:06:22 -07:00
Mark Johnston 0dbd497fff tests/if_wg: Let wg_vnet_parent_routing run in a VNET jail
MFC after:	1 week
2026-07-03 19:31:15 +00:00
Mark Johnston 81cf9a0ca7 tests/aslr: Fix spurious test failures
/sbin/ping and /sbin/ping6 are hard-linked, and the vmmap sysctl handler
doesn't know which name was used to launch the process.

PR:		296116
MFC after:	3 days
Fixes:		080a408701 ("tests: Fix race condition in aslr_setuid")
2026-07-03 19:28:30 +00:00
Robert Wing 2de20c5c77 autofs: enable witness for autofs node lock
Previously, an_vnode_lock was initialized with SX_NOWITNESS to silence
lock order reversals. The reversals would occur when autofs_node_vn()
was called with the directory vnode lock held, then lock an_vnode_lock,
then lock the vnode attached to the autofs node. It looked like:

    directory vnode -> an_vnode_lock -> vnode attached to autofs node

The established lock order is now vnode -> an_vnode_lock

Currently, we don't have to worry about losing an autofs node during the
unlock/lock as autofs nodes are only removed during an unmount() after
vflush(). When autofs_node_vn() is called, the mountpoint has either
been busied (preventing unmount) or a directory vnode is locked which
prevents vflush() from finishing until the directory vnode is unlocked.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D57857
2026-07-03 10:55:37 -08:00
Martin Cracauer e89a398c10 Add myself as ports committer, update mentor/mentee
This completes step 5 from Committer's Guide.

Approved by:         	jbo (mentor)
Differential Revision:	https://reviews.freebsd.org/D57934
2026-07-03 14:32:13 -04:00
Alan Somers ee1c3d38a2 fusefs: fix vnode locking violations during execve
Fix two locking violations that could happen during execve, while
executing a file stored on fusefs.  Both would cause panics on an
INVARIANTS kernel after 15.0, or a DEBUG_VFS_LOCKS kernel prior to that.
Neither is likely to be noticeable on a release kernel.

* Don't assume that the vnode is exclusively locked during VOP_CLOSE.
  It usually is thanks to !MNTK_LOOKUP_SHARED, but isn't during execve,
  which locks the vnode outside of the lookup path.

* Totally rewrite fuse_io_invalbuf.  It's had a number of problems ever
  since its original introduction[^1]:

  - Don't assume that the vnode is exclusively locked.  That assumption
    failed during execve just like the assumption in fuse_vnop_close.

  - Don't livelock forever if vinvalbuf returns ENOSPC or EDQUOT.

  - Don't attempt to handle multiple threads calling this function at
    the same time.  That would be impossible if the vnode truly were
    exclusively locked.  So the code was dead.  Or it would've been, if
    the assumption hadn't been wrong.  Furthermore, both vinvalbuf and
    vnode_pager_clean_sync only require a shared vnode lock, and are
    already capable of dealing with multiple simultaneous callers.

  - Using fvdat->flag in this way would require some sort of mutex
    protection, if the vnode weren't exclusively locked.

 * Add new test cases that trigger both of the aforementioned panics.

[^1]: https://github.com/glk/fuse-freebsd/commit/efe6eb3005e7633b4e31d5e453eacbaa0cba42fa

PR:		295957
Reported by:	[email protected]
MFC after:	2 weeks
Sponsored by:	ConnectWise
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D57536
2026-07-03 10:18:17 -06:00
Olivier Certner 7e0df6af8d hwpstate_amd(4): Use new cpu_get_pcpuid(), constify related variables
Also, add a check in the attach method that a per-CPU structure is
provided by the bus.  This allows to remove such checks in multiple
functions.  The check cannot currently fail as all x86 CPU drivers
(ACPI, legacy) provide the CPU_IVAR_PCPU instance variable, but it is
safer to have it, especially as an example to other driver writers.

Event:          Halifax Hackathon 202606
Location:       Seat 25A in AF0349, before leaving Montréal-Trudeau
Sponsored by:   The FreeBSD Foundation
2026-07-03 17:32:32 +02:00
Olivier Certner 74e43f631b hwpstate_intel(4): Use new cpu_get_pcpuid(), constify related variables
Also, add a check in the attach method that a per-CPU structure is
provided by the bus.  This allows to remove such checks in multiple
functions.  The check cannot currently fail as all x86 CPU drivers
(ACPI, legacy) provide the CPU_IVAR_PCPU instance variable, but it is
safer to have it, especially as an example to other driver writers.

Event:          Halifax Hackathon 202606
Location:       Seat 36K in AC667, still waiting for a gate at Montréal-Trudeau
Sponsored by:   The FreeBSD Foundation
2026-07-03 17:32:31 +02:00
Olivier Certner c3c8f4d9e6 cpu: New cpu_get_pcpuid(), retrieves internal CPU ID
It is a handy shortcut that will be used extensively in
hwpstate_intel(4) and hwpstate_amd(4).

Warn users that it panics if the parent bus does not provide the
CPU_IVAR_PCPU instance variable.  That condition should be tested by
callers (doing so once is enough).  Suggest to do that in driver's
attach method.

Reviewed by:    jhb (code)
Event:          Halifax Hackathon 202606
Location:       Seat 36K in AC667, waiting for a gate at Montréal-Trudeau
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57897
2026-07-03 17:32:25 +02:00
Ed Maste 465a3b7adc newvers.sh: Avoid spurious -dirty in git revision
If git is installed and .git exists but git rev-parse failed to report a
hash we previously produced just "-dirty" as the git revision.  Gate the
git commit count and -dirty check on the rev-parse passing.

Reviewed by:	jlduran
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57995
2026-07-03 09:34:58 -04:00
Ishan Agrawal c9d98c0134 netlink: add const variants of NLA iteration macros
Add const-qualified versions of the NLA iteration helpers to allow
walking immutable netlink attribute buffers without discarding const
qualifiers.

This introduces NLA_NEXT_CONST(), _NLA_END_CONST(), and
NLA_FOREACH_CONST() in netlink_snl.h.

Signed-off-by: Ishan Agrawal <[email protected]>
Sponsored-by : Google LLC (GSoC 2026)
2026-07-03 10:20:12 +02:00
Konstantin Belousov c041b82c59 ffs: do not return ESTALE on attempt to ffs_unotovp() on unlinked inode
The consequences are:
- for nfs exports and fhopen(2), unlinked but still referenced inodes
  are accessible
- for ffs_vput_pair() with unlock_vp = false, spurious ESTALE is not
  returned when the inode is still alive but unlinked

Note that tmpfs does not return ESTALE for the unlinked nodes.
The same behavior is claimed for Linux in
https://github.com/openzfs/zfs/issues/18699

Reviewed by:	rmacklem
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57982
2026-07-03 03:28:23 +03:00
Devin Teske d1b62492f9 acpi: ignore wake button press replayed by firmware on resume
Some firmware delivers the power or sleep button press that woke the
system as an ordinary button press (Notify 0x80) shortly after resume,
rather than as the wakeup notification (Notify 0x02) the ACPI
specification requires for a button that is also a wake source.

On affected machines (e.g. the Framework Laptop 12, Intel Raptor Lake-P)
the power button is a control-method device behind the embedded
controller.  The EC latches the key press that woke the system across the
sleep transition and flushes it through its normal _Qxx query path as
soon as it is reinitialized on resume.  The replayed press is
indistinguishable from a genuine one, so the kernel honors it as a fresh
suspend request and the machine suspends again immediately after waking;
it cannot be kept awake with the button.

The event cannot be filtered at its source: it arrives over the same EC
query path that also carries legitimate events (lid, AC, thermal,
battery), so suppressing the drain would lose real notifications.
Instead, record the time of resume and ignore a button-initiated suspend
that arrives within a short grace window of it.  The timestamp is taken
before DEVICE_RESUME() re-initializes the EC, so it is set before the
replay can be processed on the ACPICA notify taskqueue; otherwise the
replay can be evaluated before the timestamp is written and slip through.
Measured from that point, the replay lands at ~600 ms across many cycles
on a Framework Laptop 12, whereas a deliberate press cannot occur that
quickly -- it happens well after the display is back -- so a one-second
window separates the two without ignoring real presses for any
perceptible time.

Spec-compliant firmware reports the wake as Notify 0x02, which is handled
on a different path and never reaches this check, so there is no change
in behavior on such systems.

The replay window is a fixed compile-time constant rather than a tunable
on purpose: it tracks a hardware characteristic -- the EC's post-resume
replay latency -- not a user policy, so there is no value a user would
meaningfully choose.

PR:		296243
Reviewed by:	adrian, imp (earlier revision), olce
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D57712
2026-07-02 16:39:13 -07:00
Jamie Gritton d4e0f4dab2 jail: prevent a race between jail_attach in different threads
Attaching to a jail changes its root directory and its process
credentials. These operations both require unlocking the jail, and also
need allprison_lock unlocked. That means that if two threads are trying
to attach to different jails at the same time, it's possible for the
process to end up with one jail's root directory but the other jail's
credentials.

Solve this by forcing the process into single-threaded mode during
system calls that attach to a jail (jail_attach, jail_attach_jd, and
sometimes jail_set).

Reviewed by:	kib, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D57858
2026-07-02 15:48:07 -07:00
Alexander Motin cd61eb4f66 zfs: Wire sha512 offload to the build
FreeBSD main just got the CPUID_STDEXT4_SHA512 define.

OpenZFS PR #18732
2026-07-02 13:58:12 -04:00
Dag-Erling Smørgrav a2545f68f6 src.conf(5): Suggest using ccache4
We have separate ports for Ccache 3 and 4.  Suggest both, rather than
only the Ccache 3 port.  Rearrange the text somewhat to avoid an
excessively ragged edge on a standard 80-column terminal.

MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D58005
2026-07-02 17:16:52 +02:00
Dag-Erling Smørgrav 43da0c93ff usb/quirks: Sort the USB mass storage quirks
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D57930
2026-07-02 14:59:42 +02:00
Damian Weber e1a0592ccd usb/quirks: Add entry for Verbatim Store'n'Go
PR:		199101
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D57929
2026-07-02 14:59:36 +02:00
YAO, Xin 8ad097de02 linuxulator: Fix operator precedence for LINUX_XATTR_FLAGS in setxattr()
The LINUX_XATTR_FLAGS macro expands to (LINUX_XATTR_CREATE|LINUX_XATTR_REPLACE).
Without parentheses around the macro expansion, the bitwise & operator has
higher precedence than |, causing incorrect flag evaluation and a compiler
warning.

Add the missing parentheses around LINUX_XATTR_FLAGS to ensure correct
operator grouping, matching the existing usage in getxattr().

Signed-off-by:	YAO, Xin <[email protected]>
Fixes:		2c90545631 ("linuxulator: Fix O_PATH file descriptors errno for f*xattr(2)")
Reviewed by:	kib
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2306
2026-07-02 14:47:01 +03:30
Michael Tuexen fbc039e512 tests: fix checksum computation
This fixes an endianness bug in sys/netinet/ip_reass_test.
Just use the code from RFC 1071.

Reported by:		glebius
Reviewed by:		glebius, Timo Völker
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D57988
2026-07-01 18:07:04 +02:00
Pierre Pronchery c146f5ae30 pkgconf: determine the default paths dynamically
This automatically computes the correct PKG_CONFIG_PATH with LOCALBASE
from the environment (when set) or from the "user.localbase" sysctl, in
this order.

Reviewed by:	des
Approved by:	des
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D57246
2026-07-02 02:57:45 +02:00
Konstantin Belousov cf851111b0 x86: add CPUID bits for SHA512/SM3/SM4
Reviewed by:	mav
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D58003
2026-07-02 02:37:40 +03:00
Jamie Gritton 6d9bc46cd7 jail: prevent a null derefence on array parameter assignment
The same variable was used as a counter for an inner and out loop.
Add a new one for the inner loop.

PR:		283934
Reported by:	crest at rlwinm.de
2026-07-01 11:36:08 -07:00