Commit graph

277427 commits

Author SHA1 Message Date
Konstantin Belousov 9877b9bea5 mlx5en: add diagnostic in one more case of failed eeprom read preparation
(cherry picked from commit c097967b9a)
2024-05-12 04:18:13 +03:00
Dimitry Andric e2de08bf70 Merge commit 73bb8d9d92f6 from llvm-project (by Jonathan Peyton):
[OpenMP] Fix child processes to use affinity_none (#91391)

  When a child process is forked with OpenMP already initialized, the
  child process resets its affinity mask and sets proc-bind-var to false
  so that the entire original affinity mask is used. This patch corrects
  an issue with the affinity initialization code setting affinity to
  compact instead of none for this special case of forked children.

  The test trying to catch this only testing explicit setting of
  KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

  Fixes: #91098

This should fix OpenMP processes sometimes getting stuck on a single CPU
core.

PR:		278845
Reported by:	Cassidy B. Larson <cbl@cbl.us>
MFC after:	3 days

(cherry picked from commit 22b3e7898e)
2024-05-11 10:56:35 +02:00
Dimitry Andric 7b966dcc3a Merge commit 5300a6731e98 from llvm-project (by Jonathan Peyton):
[OpenMP] Fix re-locking hang found in issue 86684 (#88539)

  This was initially reported here (including stacktraces):
  https://stackoverflow.com/questions/78183545/does-compiling-imagick-with-openmp-enabled-in-freebsd-13-2-cause-sched-yield

  If `__kmp_register_library_startup()` detects that another instance of
  the library is present, `__kmp_is_address_mapped()` is eventually
  called. which uses `kmpc_alloc()` to allocate memory. This function
  calls `__kmp_entry_thread()` to access the thread-local memory pool,
  which is a bad idea during initialization. This macro internally calls
  `__kmp_get_global_thread_id_reg()` which sets the bootstrap lock at the
  beginning (before calling `__kmp_register_library_startup()`).

  The fix is to use `KMP_INTERNAL_MALLOC()`/`KMP_INTERNAL_FREE()` instead
  of `kmpc_malloc()`/`kmpc_free()`. `KMP_INTERNAL_MALLOC` and
  `KMP_INTERNAL_FREE` do not use any bootstrap locks. They just translate
  to `malloc()`/`free()` and are meant to be used during library
  initialization before other library-specific allocators have been
  initialized.

  Fixes: #86684

This should fix OpenMP processes sometimes getting locked with 100% CPU
usage, endlessly calling sched_yield(2).

PR:		278845
Reported by:	Cassidy B. Larson <cbl@cbl.us>
MFC after:	3 days

(cherry picked from commit da15ed2e98)
2024-05-11 10:56:33 +02:00
Rick Macklem 85e63d952d nfsd: Fix Link conformance with RFC8881 for delegations
RFC8881 specifies that, when a Link operation occurs on an
NFSv4, that file delegations issued to other clients must
be recalled.  Discovered during a recent discussion on nfsv4@ietf.org.

Although I have not observed a problem caused by not doing
the required delegation recall, it is definitely required
by the RFC, so this patch makes the server do the recall.

Tested during a recent NFSv4 IETF Bakeathon event.

(cherry picked from commit 3f65000b6b)
2024-05-10 18:09:21 -07:00
Mateusz Guzik ff99bfe3ef inet6: protect address manipulation with a lock
This is a total hack/bare minimum which follows inet4.

Otherwise 2 threads removing the same address can easily crash.

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

(cherry picked from commit f5a365e51f)
2024-05-11 00:27:07 +08:00
Lexi Winter e57876309d sys/net/if_bridge: support non-INET kernels
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1159

(cherry picked from commit 65767e6126)

if_bridge: Minor style fixes

And more comments on the #ifdef INET blocks to improve readability.

While here, revert the order of two prototypes to produce minimal diff
compared to stable branches.

(cherry picked from commit 73585176ff)
(cherry picked from commit d45f1f5193)
2024-05-10 22:10:29 +08:00
Lexi Winter 07e4121aa1 if_bridge: clean up INET/INET6 handling
The if_bridge contains several instances of:

	if (AF_INET code ...
	#ifdef INET6
	    AF_INET6 code ...
	#endif
	) {
		...

Clean this up by adding a couple of macros at the top of the file that
are conditionally defined based on whether INET and/or INET6 are enabled,
which makes the code more readable and easier to maintain.

No functional change intended.

Reviewed by:	zlei, markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1191

(cherry picked from commit ef84dd8f49)
(cherry picked from commit 2f95e4a01e)
2024-05-10 22:09:20 +08:00
Yuri Pankov e1ae31fc11 calendar: cleanup obsolete directories
Follow 5282ada06b and don't reinstall obsolete directories.

(cherry picked from commit 7adea6dbed)
2024-05-10 08:55:46 +00:00
Konstantin Belousov 5cf78a5500 __cxa_thread_call_dtors(3): fix dtor pointer validity check
PR:	278701

(cherry picked from commit b27eb9ce96)
2024-05-10 10:49:36 +03:00
Olivier Certner 8c308a22e7
sched: Simplify sched_lend_user_prio_cond()
If 'td_lend_user_pri' has the expected value, there is no need to check
the fields that sched_lend_user_prio() modifies, they either are already
good or soon will be ('td->td_lend_user_pri' has just been changed by
a concurrent update).

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44050

(cherry picked from commit aeff15b392)

Approved by:            emaste (mentor)
2024-05-09 22:29:32 +09:00
Olivier Certner ba2c48a7f2
PP mutexes: lock: Reduce 'umtx_lock' holding before taking the user lock
There is no need to have it for the priority check (that the thread
doesn't have a higher priority than the mutex's ceiling), and there's
also no need to take it if the thread doesn't have privileges to set its
priority to the mutex's ceiling.

While here, turn 'su' into a 'bool' and compute the internal priority
corresponding to the mutex's ceiling once and for all, putting it in new
'new_pri'.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44045

(cherry picked from commit 39e4665c96)

Approved by:            emaste (mentor)
2024-05-09 22:29:25 +09:00
Olivier Certner f5a145cb0a
PP mutexes: lock: Check if priority is too high against base one
Doing this instead of using the current (user) priority, which includes
current lendings, prevents gratuitous failures for threads involved in
multiple locking groups, where each group is defined as the threads that
can lock a particular PP or PI mutex.  No deadlock can occur in this
case.  Indeed, if a thread holds such a lock A giving it a higher
priority than the ceiling of some other lock B that is PP, and B is
acquired by another thread, effectively the latter may not be able to
run but this situation can only last until the first thread releases A,
which it will do eventually.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44044

(cherry picked from commit 9ac3ac9ece)

Approved by:            emaste (mentor)
2024-05-09 22:29:18 +09:00
Olivier Certner b94acafdbc
PP mutexes: unlock: Reset inherited prio regardless of privileges
'uq_inherited_pri' contains the current priority inherited from Priority
Protection mutexes.  If -1 is passed through 'm_ceilings[1]', meaning
that there are no such mutexes held anymore, this must be reflected into
it by setting it to PRI_MAX, regardless of whether the thread has
privilege to set realtime priorities (PRI_MAX is also obviously not
a realtime priority level).  By contrast, it shall not be updated and
the computed 'new_inherited_pri' shall stay unused if the thread doesn't
have the ability to set a realtime priority, possibly keeping an older
such priority acquired previously.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43984

(cherry picked from commit 1df8700aa6)

Approved by:            emaste (mentor)
2024-05-09 22:29:11 +09:00
Dag-Erling Smørgrav 9f21d0ef91 adduser: Fix confusion between uclass and _class.
This caused adduser to produce an invalid `pw(8)` command line.  Due to
bugs in `pw(8)`, the command line was silently accepted and led to the
user being created, but locked out and with no home directory.

Also fix the default value for the “Another user?” prompt.

Fixes:		170d088290
MFC after:	3 days
Reviewed by:	karels, allanjude
Differential Revision:	https://reviews.freebsd.org/D45098

(cherry picked from commit 46c4e86ebf)
2024-05-09 11:05:36 +00:00
Dag-Erling Smørgrav e3bd4b9288 pw: Rename some enums.
Rename `M_PRINT` and `M_UPDATE` to `M_SHOW` and `M_MODIFY` to match the
names of the commands they represent.  No functional change intended.

MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45096

(cherry picked from commit a9ea647c29)

pw: Don't silently ignore unparsed command line arguments.

MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45097

(cherry picked from commit c86119328e)

pw: Test home directory ownership and mode.

MFC after:	3 days
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45099

(cherry picked from commit e12b7446bd)
2024-05-09 11:05:35 +00:00
Naman Sood 3532d9c66e 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

(cherry picked from commit 17839f45d8)
2024-05-09 11:04:30 +00:00
Dimitry Andric e5e6242f62 lib/clang: clean out old llvm/clang Sparc target remnants
The WITH_LLVM_TARGET_ENABLE_SPARC option was removed a long time ago,
but some ifdefs were still laying around, so clean them up.

PR:		276104
MFC after:	3 days

(cherry picked from commit 6f44401900)
2024-05-07 19:04:30 +02:00
Dimitry Andric 3c6fe83671 Fixup: Merge llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9
Update version numbers, config headers, etc. Git tricked me into losing
these before pushing.

PR:		276104
Fixes:		d67fc74b9249
MFC after:	3 days

(cherry picked from commit 894cb08f0d)
2024-05-07 19:04:27 +02:00
Dimitry Andric 67df63f10e Merge llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9.

PR:		276104
MFC after:	3 days

(cherry picked from commit 5678d1d98a)
2024-05-07 19:04:21 +02:00
Konstantin Belousov f73055ab1e rtld.1: clarify interaction between -u and -o
(cherry picked from commit 6a7819e43f)
2024-05-07 11:59:07 +03:00
Konstantin Belousov e45b440633 rtld direct exec: make -u behavior match the description
(cherry picked from commit ef2694f368)
2024-05-07 11:59:07 +03:00
Konstantin Belousov 10484ee13a rtld: add direct-exec option -o
(cherry picked from commit d1cd0cc32b)
2024-05-07 11:59:07 +03:00
Ed Maste 8d0ca01740 Update capsicum-test to eab7a83b05becf64439b4b256b3d756b353fbbbb
(cherry picked from commit 4ee9db7a1d)

PR:		266112
2024-05-06 20:03:52 -04:00
Shawn Bayern 6290fc5eef Tighten boundary check in split(1) to prevent a potential buffer overflow.
(cherry picked from commit 95032b58a1)
2024-05-05 23:04:43 -07:00
Michael Galassi 76f866f0f6 vmm.4: Add verbiage about need to load module from loader.conf
PR:		277530
MFC after:	1 week
Co-authored-by:	Mateusz Piotrowski <0mp@FreeBSD.org>

(cherry picked from commit d0168b32bc)
2024-05-04 15:18:15 +02:00
Mateusz Piotrowski cecda19fd6 style.9: Document the existence of tools/build/checkstyle9.pl
MFC after:	3 days
Sponsored by:	Klara, Inc.

(cherry picked from commit 5626f9e790)
2024-05-04 15:09:01 +02:00
Mateusz Piotrowski 64f6c5fd9b gettimeofday.2: Do mention improbable future removal
As kib@ noted:

> Obviously gettimeofday(2) is not going to be removed
> even in the far future.

Reported by:	kib
Fixes:		4395d3ced5 Document that gettimeofday() is obsolescent
MFC after:	3 days

(cherry picked from commit 6662c2312e)
2024-05-04 15:06:55 +02:00
Mateusz Piotrowski f7659ab235 Document that gettimeofday() is obsolescent
Reported by:	kaktus
Reviewed by:	kaktus, pstef
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23942

(cherry picked from commit 4395d3ced5)
2024-05-04 15:06:40 +02:00
Martin Matuska c923dda75a libarchive: merge bugfixes from vendor branch
#2147 archive_string: clean up strncat_from_utf8_to_utf8 (36047967a)
 #2153 archive_match: check archive_read_support_format_raw()
       return value (0ce1b4c38)
 #2154 archive_match: turn counter into flag (287e05d53)
 #2155 lha: Do not allow negative file sizes (93b11caed)
 #2156 tests: setenv LANG to en_US.UTF-8 in bsdunzip test_I.c (83e8b0ea8)

(cherry picked from commit c0b58e65de)
2024-05-04 13:55:21 +02:00
Martin Matuska 3a77c21a25 libarchive: merge from vendor branch
Libarchive 3.7.4 + three fixes from master

Security fixes:
 #2135 rar: Fix OOB in rar e8 filter (CVE-2024-26256)
 #2145 zip: Fix out of boundary access
 #2148 rar: Fix OOB in rar delta filter
 #2149 rar: Fix OOB in rar audio filter

Important bugfixes:
 #2131 7zip: Limit amount of properties
 #2110 bsdtar: Fix error handling around strtol() usages
 #2116 passphrase: Never allow empty passwords
 #2124 rar: Fix "File CRC Error" when extracting specific rar4 archives
 #2123 xar: Avoid infinite link loop
 #2150 xar: Fix another infinite loop and expat error handling
 #2108 zip: Update AppleDouble support for directories
 #2071 zstd: Implement core detectiongit

PR:	278662 (exp-run)

(cherry picked from commit 13d826ff94)
2024-05-04 13:54:42 +02:00
Martin Matuska 43a6a8b077 libarchive: add two missing package files to libarchive tests
(cherry picked from commit 7d03ec3306)
2024-05-04 13:53:07 +02:00
Martin Matuska 4217cc09bd libarchive: fix null format string error in tests (unbreaks gcc13 build)
Obtained from:	libarchive (d43c39247)

(cherry picked from commit 701d0666c0)
2024-05-04 13:53:07 +02:00
Martin Matuska aa2aad0492 libarchive: merge from vendor branch
Libarchive 3.7.3

New features:
  #1941 uudecode filter: support file name and file mode in raw mode
  #1943 7-zip reader: translate Windows permissions into UNIX
        permissions
  #1962 zstd filter now supports the "long" write option
  #2012 add trailing letter b to bsdtar(1) substitute pattern
  #2031 PCRE2 support
  #2054 add support for long options "--group" and "--owner" to tar(1)

Security fixes:
  #2101 Fix possible vulnerability in tar error reporting introduced
        in f27c173

Important bugfixes:
  #1974 ISO9660: preserve the natural order of links
  #2105 rar5: fix infinite loop if during rar5 decompression the last
        block produced no data
  #2027 xz filter: fix incorrect eof at the end of an lzip member
  #2043 zip: fix end-of-data marker processing when decompressing zip
        archives

(cherry picked from commit b9128a37fa)
2024-05-04 13:53:07 +02:00
Martin Matuska 2772835855 unzip: swtich to bsdunzip from libarchive
Unzip from FreeBSD has been ported to libarchive.
Change usr.bin/unzip to use bsdunzip from libarchive.

Differential Revision:	https://reviews.freebsd.org/D41239
PR:			272845 (exp-run)

(cherry picked from commit b5a3a89c50)
2024-05-04 13:53:07 +02:00
Martin Matuska db2cc817fa libarchive: merge from vendor branch
Changes to not yet connected unzip only.

(cherry picked from commit 058ab969fd)
2024-05-04 13:53:07 +02:00
Martin Matuska 0db84579ce libarchive: merge from vendor branch
Changes to not yet connected unzip only.

(cherry picked from commit d91bfe0fb7)
2024-05-04 13:53:07 +02:00
Martin Matuska 2cb0ab6bc1 libarchive: merge from vendor branch
Libarchive 3.7.1

Important changes (relevant to FreeBSD):
  ISSUE #1934: stack buffer overflow in cpio verbose mode
  ISSUE #1935: SEGV in cpio verbose mode
  PR #1731 tar: respect --strip-components and -s patterns in cru modes

(cherry picked from commit 64884e0d4c)
2024-05-04 13:53:07 +02:00
Martin Matuska cd09ca5e71 libarchive: merge from vendor branch
Libarchive 3.7.0

Important changes (relevant to FreeBSD):
  #1814 Do not account for NULL terminator when comparing with "TRAILER!!!"
  #1818 Add ability to produce multi-frame zstd archives
  #1840 year 2038 fix for pax archives on platforms with 64-bit time_t
  #1860 Make single bit bitfields unsigned to avoid clang 16 warning
  #1869 Fix FreeBSD builds with WARNS=6
  #1873 bsdunzip ported to libarchive from FreeBSD
  #1894 read support for zstd compression in 7zip archives
  #1918 ARM64 filter support in 7zip archives

(cherry picked from commit e64fe029e9)
2024-05-04 13:53:07 +02:00
Pierre Pronchery d2291dbb3c libarchive: Avoid a build failure with OpenSSL 3.0
This is a minimal workaround; a proper fix will come via a future update
from upstream.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e23d45187b)
2024-05-04 13:53:07 +02:00
Pierre Pronchery 9377240725 libarchive: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future update should migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 5a7500dab9)
2024-05-04 13:53:07 +02:00
John Baldwin ffd190f223 libarchive: Remove MIPS build glue.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39329

(cherry picked from commit f40b617e15)
2024-05-04 13:53:07 +02:00
Konstantin Belousov d9ec850bde rtld snprintf: do not erronously skip a char at the buffer boundary
(cherry picked from commit 56ee5fc43c)
2024-05-03 03:26:26 +03:00
Konstantin Belousov cf2750be9e kcmp_pget(): do not accept TIDs
(cherry picked from commit 5b3e5c6ce3)
2024-05-03 03:26:26 +03:00
Konstantin Belousov 6b667b46ab kcmp_pget(): add an assert that we did not hold the current process
(cherry picked from commit 1e01650a78)
2024-05-03 03:26:25 +03:00
Jessica Clarke 91e0b44c15 kldxref: Fix bootstrapping on macOS with Clang 16 / Apple Clang 15
macOS, like Linux, does not include an outer const qualifier for its
fts_open callback arguments, so -Wincompatible-function-pointer-types
also picks this up and breaks the build now Clang 16 makes it an error
by default. Extend the existing Linux support to fix this.

MFC after:	1 week

(cherry picked from commit 75464941dc)
2024-05-02 21:11:52 +01:00
Jessica Clarke 89342dba7d jevents: Fix bootstrapping on macOS with Clang 16 / Apple Clang 15
macOS, like Linux, does not include an outer const qualifier for its
fts_open callback arguments, so -Wincompatible-function-pointer-types
also picks this up and breaks the build now Clang 16 makes it an error
by default. Extend the existing Linux support to fix this.

MFC after:	1 week

(cherry picked from commit d8c84215d7)
2024-05-02 21:11:52 +01:00
Jessica Clarke 2714c4d328 mandoc: Fix bootstrapping on macOS with Clang 16 / Apple Clang 15
macOS, like Linux, does not include an outer const qualifier for its
fts_open callback arguments, so -Wincompatible-function-pointer-types
also picks this up and breaks the build now Clang 16 makes it an error
by default. Extend the existing Linux support to fix this.

MFC after:	1 week

(cherry picked from commit ce312ef72d)
2024-05-02 21:11:52 +01:00
Alex Richardson f16e205c6f jevents: fix bootstrapping on Linux with Clang 16
The glibc fts_open() callback type does not have the second const
qualifier and it appears that Clang 16 errors by default for mismatched
function pointer types. Add an ifdef to handle this case.

Reviewed By:	imp, emaste
Differential Revision: https://reviews.freebsd.org/D43000

(cherry picked from commit 60e845ceef)
2024-05-02 21:11:52 +01:00
Alex Richardson dbbbe6f393 mandoc: fix bootstrapping on Linux with Clang 16
It appears that Clang 16 errors by default for the mismatched function
pointer types that are triggered by the fts callback (since glibc has a
callback type without the second const qualifier).
Fortunately, there is already code to handle glibc inside mandoc, we
just have to edit the checked-in config.h.

Reviewed By:	imp, emaste
Differential Revision: https://reviews.freebsd.org/D42999

(cherry picked from commit 0156465c6d)
2024-05-02 21:11:52 +01:00
Dag-Erling Smørgrav 3f59eb3141 libulog: Make sure ut_line, ut_user, ut_host are terminated.
MFC after:	3 days
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D45004

(cherry picked from commit c28253ecde)
2024-05-02 11:08:36 +02:00