]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 months agoMerge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51
Dimitry Andric [Sat, 2 Sep 2023 21:17:18 +0000 (23:17 +0200)]
Merge llvm-project main llvmorg-17-init-19304-gd0b54bb50e51

This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the
last commit before the upstream release/17.x branch was created.

PR: 273753
MFC after: 1 month

(cherry picked from commit 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)

5 months agoMerge commit 3537338d1ab9 from llvm git (by Nikolas Klauser):
John Baldwin [Wed, 15 Nov 2023 02:34:45 +0000 (18:34 -0800)]
Merge commit 3537338d1ab9 from llvm git (by Nikolas Klauser):

    [libc++][libunwind] Fixes to allow GCC 13 to compile libunwind/libc++abi/libc++

    These are changes to allow GCC 13 to successfully compile the runtimes stack.

    Reviewed By: ldionne, #libc, #libunwind, MaskRay

    Spies: MaskRay, zibi, SeanP, power-llvm-team, mstorsjo, arichardson, libcxx-commits

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

Reviewed by: imp, dim, emaste
Differential Revision: https://reviews.freebsd.org/D42578

(cherry picked from commit ab43851b0c7bd5f21ade72c3cae3d3ee09eb8891)

5 months agollvm: Reduce overlinking with the minimal llvm
Andrew Turner [Thu, 9 Nov 2023 13:00:51 +0000 (13:00 +0000)]
llvm: Reduce overlinking with the minimal llvm

We only need to link against libz and libzstd when linking against the
fill libllvm, libllvmminimal doesn't use either library. Move adding
libz and libzstd to the list of libraries to link against to where
we decide to use the full libllvm.

Reported by: Cristian Marussi <Cristian.Marussi@arm.com>
Reported by: Colin S. Gordon <csgordon@fastmail.com>
Reviewed by: dim
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42528

(cherry picked from commit 83771b1914e182c6324839e05ff82ee6f4a87c98)

5 months agoarm64 lib32: change clang to allow -m32 on arm64
Mike Karels [Tue, 25 Jul 2023 23:58:51 +0000 (18:58 -0500)]
arm64 lib32: change clang to allow -m32 on arm64

The FreeBSD driver support for clang tested explicitly for 32-bit
Intel, MIPS, or PowerPC targets where /usr/lib32/libcrt1.o was
present to decide whether -m32 should use /usr/lib32.  At jrtc27's
suggestion, simply test for a 32-bit platform rather than adding
arm to the list.  Upstreamed as
https://github.com/llvm/llvm-project/commit/3450272fc281979388bb845a9fffb59b42cc2e7e
Bump the freebsd version to force a bootstrap build.  This is one
step in adding support for -m32 on arm64.

Reviewed by: jrtc27, brooks, dim
Differential Revision: https://reviews.freebsd.org/D40943

(cherry picked from commit f1d5183124d3e18d410ded61e45adb9a23b23c83)

5 months agolldb: dereference stoppcbs based on target kernel version
Ed Maste [Tue, 2 May 2023 20:24:46 +0000 (16:24 -0400)]
lldb: dereference stoppcbs based on target kernel version

As of 9fb6718d1b18 / __FreeBSD_version 1400089 stoppcbs is a pointer to
the pcbs array.  Dereference stoppcbs on sufficiently new kernels.

Reviewed by: markj (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39939

(cherry picked from commit 0f2bb40bc7ddee7ba329d9b344623e2a186b4046)

5 months agomake cross build from arm64 work..
John-Mark Gurney [Fri, 24 Feb 2023 05:47:03 +0000 (05:47 +0000)]
make cross build from arm64 work..

Reviewed by: dim, imp, emaste
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38762

(cherry picked from commit eb81dd8404e55c8e048acfb1cd4f4c3c021afaf4)

5 months agobuild target triple variable from sys/conf/newvers.sh
Alfredo Dal'Ava Junior [Tue, 3 May 2022 11:09:38 +0000 (08:09 -0300)]
build target triple variable from sys/conf/newvers.sh

Retrieve FreeBSD revision number directly from sys/conf/newvers.sh
when building the compiler target triple value, avoiding manual
intervention on other files every new release.

Reviewed by: imp
MFC after: 2 months
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D34429

(cherry picked from commit f9ee4156741a205c93ae947595b5c48717107d9e)

5 months agosyscalls.master: Fix SAL annotation for getdirentires basep argument
Haoyu Gu [Sun, 24 Sep 2023 22:34:43 +0000 (18:34 -0400)]
syscalls.master: Fix SAL annotation for getdirentires basep argument

getdirentires last argument "off_t *basep" is an optional output
argument.  It returns the value only when the passed-in value(pointer)
is non-NULL.

This is a part of the research work at RCSLab, University of Waterloo.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41969

(cherry picked from commit 5e29272bf57e24a16f3a17f037f9a5e7cf25ed90)
(cherry picked from commit dd588b3c9a5a2f2b2b62836ce70fd85813434748)

5 months agofreebsd-update: for rollback, first create directories
Ed Maste [Fri, 29 Sep 2023 15:28:35 +0000 (11:28 -0400)]
freebsd-update: for rollback, first create directories

rollback_files() tried to install files before creating the directories
for those files.  In some cases this is due to special handling to
install certain classes of files earlier than others.

Just create all directories up front when performing rollback.

PR: 273950
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42020

(cherry picked from commit 6b27e1f2eaab9360a796c943da9d206515e1742b)
(cherry picked from commit 2b79df0ad999df4bc22ed0e1eff446efa4055359)

5 months agofreebsd-update: handle directories changing to files
Ed Maste [Tue, 12 Sep 2023 02:59:30 +0000 (22:59 -0400)]
freebsd-update: handle directories changing to files

Further to f6d37c9ca13f ("freebsd-update: handle file -> directory on
upgrade"), handle the reverse case of a directory changing to a file.
We may not encounter this case on upgradess (before freebsd-update is
retired) but it is needed to support rollback.

PR: 273950
Reviewed by: dim
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41945

(cherry picked from commit c0f52443166ae7ecd512ab0350469d9c3648788c)
(cherry picked from commit 1cf8528fec85a965baa5df2d8852166437af88a6)

5 months agofreebsd-update: allow user to break out of conflict resolution loop
Ed Maste [Fri, 3 Mar 2023 17:32:51 +0000 (12:32 -0500)]
freebsd-update: allow user to break out of conflict resolution loop

When a conflict marker is found during update allow the user to confirm
they want it to remain in the file.

Suggested by: Tim Hogard
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Fixes: ceb5f28ba5fc ("freebsd-update: re-edit files if merge confli...")
Differential Revision: https://reviews.freebsd.org/D38896

(cherry picked from commit 3d44241546173de00852ab5e22263ba538cd8759)
(cherry picked from commit 6561fec386a6cbe65b3f9661db797317ab6a99b4)

5 months agocapsicum(4): add cross-ref to capsicum_helpers(3)
Ed Maste [Wed, 3 Jan 2024 18:31:55 +0000 (13:31 -0500)]
capsicum(4): add cross-ref to capsicum_helpers(3)

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c3786ca8bc5ba471edae059393bb7bac6400ac2a)
(cherry picked from commit f326e5af071f3d7108f66e57d35fe8e99f1285e0)

5 months agoendian.h: Remove duplicate words
Jose Luis Duran [Sun, 10 Dec 2023 16:35:56 +0000 (16:35 +0000)]
endian.h: Remove duplicate words

Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/920

(cherry picked from commit dff3a80f6dfe88c52326ceb2c154668f132fdb52)
(cherry picked from commit 4e1deb61eab2037ab53cebf7d5dd688626d6f094)

5 months agolibdtrace: Fix line number reporting in error messages
Mark Johnston [Sun, 31 Dec 2023 17:37:06 +0000 (12:37 -0500)]
libdtrace: Fix line number reporting in error messages

MFC after: 1 week

(cherry picked from commit ad3174ecea3374442b3504149fe2b5a9d9ec6f1e)

5 months agogtaskqueue: Fix a typo
Mark Johnston [Sun, 31 Dec 2023 16:36:12 +0000 (11:36 -0500)]
gtaskqueue: Fix a typo

This is a no-op in practice since gtaskqueue_thread_enqueue() and
taskqueue_thread_enqueue() are identical, and while _gtaskqueue_create()
compares the enqueue callback pointer with gtaskqueue_thread_enqueue(),
the result has no effect since TQ_FLAGS_UNLOCKED_ENQUEUE was copied
directly from subr_taskqueue.c and is unused in the gtaskqueue code.

Fix it anyway since it's a bug.  More generally we really need to
consolidate subr_taskqueue.c and subr_gtaskqueue.c.

PR: 270661
MFC after: 1 week

(cherry picked from commit e1f336704d308679d4178fd5063dba854b22a07b)

5 months agohvsock: Fix a typo in a source code comment
Gordon Bergling [Wed, 27 Dec 2023 08:37:29 +0000 (09:37 +0100)]
hvsock: Fix a typo in a source code comment

- s/recieved/received/

(cherry picked from commit 6dc7bf0c5ce9ce0b77b0f7b9293467babc685abe)

5 months agogpioevents: Fix a typo in a diagnostic output message
Gordon Bergling [Wed, 27 Dec 2023 08:41:48 +0000 (09:41 +0100)]
gpioevents: Fix a typo in a diagnostic output message

- s/recieved/received/

(cherry picked from commit 63c928f17e08f58fd3bd44b45c36ea5df7d15e77)

5 months agotcp_stacks: Fix two typos in a source code comments
Gordon Bergling [Wed, 27 Dec 2023 08:36:30 +0000 (09:36 +0100)]
tcp_stacks: Fix two typos in a source code comments

- s/recieved/received/

(cherry picked from commit 7b0b448ba9fd53fb4db81a2309dedfdc47533cfb)

5 months agoipfw(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 27 Dec 2023 08:38:43 +0000 (09:38 +0100)]
ipfw(4): Fix a typo in a source code comment

- s/preserv/preserve/

(cherry picked from commit f795d5458b2a9ce114b4e177d34705a53824edd2)

5 months agotail(1): Fix a typo in a source code comment
Gordon Bergling [Wed, 27 Dec 2023 08:35:38 +0000 (09:35 +0100)]
tail(1): Fix a typo in a source code comment

- s/recieved/received/

(cherry picked from commit c58205be7a7d4eb1c68b169bb7fdb57f1e057cc5)

5 months agotcp_info: Add and export more FreeBSD-specific fields
Marius Strobl [Tue, 22 Aug 2023 18:12:59 +0000 (20:12 +0200)]
tcp_info: Add and export more FreeBSD-specific fields

This change adds struct tcp_info fields corresponding to the following
struct tcpcb ones:
- snd_una
- snd_max
- rcv_numsacks
- rcv_adv
- dupacks

Note that while both tcp_fill_info() and fill_tcp_info_from_tcb() are
extended accordingly, no counterpart of rcv_numsacks is available in
the cxgbe(4) TOE PCB, though.

Sponsored by: NetApp, Inc. (originally)

(cherry picked from commit dc485b968ddeb070d23354f55164a8c336acf081)

Conflicts (due tue missing 945f9a7c):
sys/netinet/tcp.h

5 months agotcp: reserve tcp_info counters for AccECN
Richard Scheffenegger [Fri, 4 Nov 2022 09:18:41 +0000 (10:18 +0100)]
tcp: reserve tcp_info counters for AccECN

Marking all new fields unused (__xxx).

No functional change.

Reviewed By: tuexen, rrs, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37016

(cherry picked from commit 3708c3d370f26af0841cd3e97bf569d39c42953b)

5 months agotcp_fill_info(): Change lock assertion on INPCB to locked only
Marius Strobl [Tue, 22 Aug 2023 17:03:42 +0000 (19:03 +0200)]
tcp_fill_info(): Change lock assertion on INPCB to locked only

This function actually only ever reads from the TCP PCB. Consequently,
also make the pointer to its TCP PCB parameter const.

Sponsored by: NetApp, Inc. (originally)

(cherry picked from commit 8c6104c48ea3f0ffaabeb9784b0f2327db04e7af)

Conflicts (due tue missing 9eb0e832):
sys/dev/cxgbe/tom/t4_tom.c
sys/netinet/tcp_offload.c
sys/netinet/tcp_usrreq.c

5 months agosym(4): Add __diagused to nseg of getbaddrcb()
Marius Strobl [Fri, 18 Aug 2023 14:29:10 +0000 (16:29 +0200)]
sym(4): Add __diagused to nseg of getbaddrcb()

The parameter is only used when compiling with INVARIANTS.

(cherry picked from commit ae6d4963589418f2116ddc8cabcf93dd2f4bbf3b)

5 months agoiflib drivers: Constify PCI ID LUTs
Marius Strobl [Wed, 16 Aug 2023 16:49:34 +0000 (18:49 +0200)]
iflib drivers: Constify PCI ID LUTs

Since d49e83eac3baf16a22b1c5d42e8438b68b17e6f9, iflib(9) is ready
for this change.
While at it, make isc_driver_version strings (static) const where
not apparently un-const on purpose, too.
This reduces the size of the amd64 GENERIC by about 10 KiB.

(cherry picked from commit 51e235148a4becba94e824a44bd69687644a7f56)

Conflicts (drivers missing in stable/13):
sys/dev/enetc/if_enetc.c
sys/dev/enic/if_enic.c

5 months agomergemaster(8): Remove support for sparc64
Marius Strobl [Sun, 6 Aug 2023 20:07:29 +0000 (22:07 +0200)]
mergemaster(8): Remove support for sparc64

(cherry picked from commit 9ec7a595ed2c7631ef916d9f5818ccd5c5d327c8)

5 months agonanobsd: Remove remainder of sparc64 support
Marius Strobl [Sun, 6 Aug 2023 20:01:17 +0000 (22:01 +0200)]
nanobsd: Remove remainder of sparc64 support

Fixes: 25a66f1fb177 nanobsd: remove sparc64 embedded example
(cherry picked from commit 76e3b8f54f59e6bfc318dd99c8abcc5adabc10e0)

5 months agoexit1(): Reword comment regarding init workaround
Marius Strobl [Sun, 6 Aug 2023 19:54:57 +0000 (21:54 +0200)]
exit1(): Reword comment regarding init workaround

There are other relatively common reasons why init might get killed
during reboot, the workaround was really not sparc64-specific.

(cherry picked from commit 96c76d930656f13d3c041dc8d8f2fc3dd1e5e05a)
(cherry picked from commit 28b36ecf990fc28a935ab2ce75f7504721c3a7ea)

5 months agotargets: Catch up with the removal of sparc64
Marius Strobl [Sun, 6 Aug 2023 19:51:01 +0000 (21:51 +0200)]
targets: Catch up with the removal of sparc64

(cherry picked from commit ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)

5 months agoiflib(9): Revert ancillary changes
Marius Strobl [Fri, 5 Jan 2024 21:31:02 +0000 (22:31 +0100)]
iflib(9): Revert ancillary changes

In main, 7ff9ae90f reverted 09f6ff4f, i. e. support for cloning pseudo
interfaces along with "ancillary changes" part of the original commit.
As these latter were never actually used, this change turns the macros
into spares in stable/13, too. Thus, when the bits gets reused in main
such commits can be merged without conflicts.

5 months agolibifconfig: Fix bridge status member list
Michael Gmelin [Wed, 20 Dec 2023 20:21:55 +0000 (21:21 +0100)]
libifconfig: Fix bridge status member list

When this functionality was moved to libifconfig in 3dfbda3401abea84da9,
the end of list calculation was modified for unknown reasons, practically
limiting the number of bridge member returned to (about) 102.

This patch changes the calculation back to what it was originally and
adds a unit test to verify it works as expected.

Reported by: Patrick M. Hausen (via ML)
Reviewed by: kp
Approved by: kp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43135

(cherry picked from commit 3d36053ca6d6a17d408c8f92c504e6135dc9d8df)

5 months agosupport spaces in filenames
Wolfram Schneider [Thu, 28 Dec 2023 10:50:29 +0000 (10:50 +0000)]
support spaces in filenames

PR: 275978
MFC after: 1 week

(cherry picked from commit 789480702e490818244af11279868ba4f3dabe6b)

5 months agoimprove handling of shell metacharacters in filenames
Wolfram Schneider [Wed, 27 Dec 2023 17:35:08 +0000 (17:35 +0000)]
improve handling of shell metacharacters in filenames

PR: 275967
MFC after: 1 week

(cherry picked from commit c4368d03e52c7c97d583ee6b81a59510d371ffbb)

5 months agoOptionalObsoleteFiles.inc: Add libnss_tacplus_p.a as an old profiled library
John Baldwin [Thu, 28 Dec 2023 22:20:54 +0000 (14:20 -0800)]
OptionalObsoleteFiles.inc: Add libnss_tacplus_p.a as an old profiled library

Noticed this was still present after upgrading a 12.x stable host to
14.0 stable.

(cherry picked from commit e7300a8f638e6eb801953c0fb9e53d99308dc3f0)

5 months agoStop #defining FREEBSD_ELF
John Baldwin [Tue, 12 Dec 2023 23:30:00 +0000 (15:30 -0800)]
Stop #defining FREEBSD_ELF

This was originally used (along with FREEBSD_AOUT) to prefer the use
of ELF in various tools instead of a.out as part of the a.out to ELF
transition in the 3.x days.  The last use of it was removed from
<link.h> in commit 66422f5b7a1a6055f0b2358268eb902aab6e2e3e back in
2002, but various files still #define it.

Reviewed by: kevans, imp, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42964

(cherry picked from commit 4a3cf5f329d69076aa9d093d596eb0ee82d917f5)

5 months agokldxref: Add a copyright and license statement to ef.h
John Baldwin [Tue, 12 Dec 2023 23:29:43 +0000 (15:29 -0800)]
kldxref: Add a copyright and license statement to ef.h

This uses the statement from other files in kldxref when the tool was
first imported in commit 9c6f92408c29a8980e7aec26a2590087c3b3d8ed.

Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D42963

(cherry picked from commit 087c4c90d193c1401613e1e13fa99db8de52c8f0)

5 months agobsdinstall.8: Clarify the description of ZFSBOOT_FORCE_4K_SECTORS
John Baldwin [Sat, 18 Nov 2023 19:31:07 +0000 (11:31 -0800)]
bsdinstall.8: Clarify the description of ZFSBOOT_FORCE_4K_SECTORS

This variable does not set the exact sector size of the pool, but
controls the minimum sector size.  The sector size of the underlying
disks can always be larger than the minium controlled by this knob.

PR: 274513
Reported by: Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>

(cherry picked from commit 84f773037ee4fc78585501a2ce2f5398f0bae9f4)

5 months agobsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.
John Baldwin [Sat, 18 Nov 2023 19:18:29 +0000 (11:18 -0800)]
bsdinstall zfsboot: Don't override ZFSBOOT_FORCE_4K_SECTORS if it is null.

Only set a default value of 1 if the shell variable is unset.  This allows
installer scripts to disable the variable.

PR: 274513
Reported by: Albin "a12l" Otterhäll <bugs.freebsd.org@a12l.xyz>
Differential Revision: https://reviews.freebsd.org/D42319

(cherry picked from commit de82aed1192470574a08d3e479d81c4c1280487a)

5 months agobsdinstall: add missing init of fd variable
Brad Davis [Fri, 13 May 2022 15:06:02 +0000 (09:06 -0600)]
bsdinstall: add missing init of fd variable

Missed breaking this commit into smaller pieces

Approved by: kp

(cherry picked from commit 2c4499dcd72a335a72341492e37f859eed422a6f)

5 months agobsdinstall: Filter out devices that cannot be opened
Brad Davis [Fri, 13 May 2022 14:33:21 +0000 (08:33 -0600)]
bsdinstall: Filter out devices that cannot be opened

Devices that cannot be opened are most likely the install media and
should not be listed as destinations.

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

(cherry picked from commit 964ad27f1e48ec28247142cfe6afdfa1f8bd3182)

5 months agobsdinstall partedit: Use snprintf instead of sprintf for error messages
John Baldwin [Mon, 16 Oct 2023 23:25:38 +0000 (16:25 -0700)]
bsdinstall partedit: Use snprintf instead of sprintf for error messages

When generating a message for a dialog box into a static buffer, use
snprintf instead of sprintf to avoid buffer overflows.

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

(cherry picked from commit 6e8bf24073a1867c4b21bd84438a8b01ce91d82d)

5 months agobsdinstall partedit: Use asprintf to build wrapper command for newfs
John Baldwin [Mon, 16 Oct 2023 23:25:25 +0000 (16:25 -0700)]
bsdinstall partedit: Use asprintf to build wrapper command for newfs

Don't abuse the message[] static buffer used elsewhere for error
messages to generate the command that actually newfs's each
filesystem.  Use asprintf to a more aptly-named 'char *command'
variable to construct the string instead.  This avoids potential bugs
from truncation of the command string.

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

(cherry picked from commit a8676bf367b099dcc97ff61031cbf4ceb5e37899)

5 months agobsdinstall partedit: Replace malloc + sprintf with asprintf
John Baldwin [Mon, 16 Oct 2023 23:25:15 +0000 (16:25 -0700)]
bsdinstall partedit: Replace malloc + sprintf with asprintf

This avoids potential bugs with the length passed to malloc not
matching the string written via sprintf.

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

(cherry picked from commit 51749e05e96eb07134a38984a8c06608b20f07ea)

5 months agobsdinstall partedit: Avoid potential buffer overflow in newfs_command
John Baldwin [Mon, 16 Oct 2023 23:25:03 +0000 (16:25 -0700)]
bsdinstall partedit: Avoid potential buffer overflow in newfs_command

Allocate the buffer holding the newfs command string dynamically
(building the string via open_memstream) rather than storing the
command into a caller-supplied buffer of unknown length.

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

(cherry picked from commit ae2fc74fe76ca8b89c5ef0081ef3f4008f83de41)

5 months agobsdinstall partedit: Apply changes from scripted installs
John Baldwin [Mon, 16 Oct 2023 22:13:31 +0000 (15:13 -0700)]
bsdinstall partedit: Apply changes from scripted installs

I got a check inverted in a previous cleanup commit and as a result
partedit was only applying GEOM changes (and generating an /etc/fstab)
if it got an error reading the current GEOM mesh.  Instead, it needed
to do those actions if it succeeded in reading the mesh.

The lack of /etc/fstab meant that bsdinstall mount didn't mount
anything in a scripted install.

PR: 273723
Reported by: Andrey Fesenko <andrey@bsdnir.info>
Reported by: Michal Nowak <mnowak@startmail.com>
Reviewed by: cognet, brooks
Fixes: 230990991965 bsdinstall: Handle errors from geom_gettree.
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42236

(cherry picked from commit 5307bbcc038f878b4b3714f03a2c824a0caeba4f)

5 months agobsdinstall: Handle errors from geom_gettree.
John Baldwin [Wed, 28 Jun 2023 18:11:00 +0000 (11:11 -0700)]
bsdinstall: Handle errors from geom_gettree.

geom_gettree probably never fails, and if it does there isn't much of
a fallback other than aborting partitioning.  However, a few places
were checking the return value and not doing anything with it
triggering a unused-but-set-variable warning.  Checking the errors
resolves the warning.

While here, check for errors in other places that weren't checking for
them at all, remove a spurious double call (the second call overwrote
the mesh structure leaking all the pointers from the first), and close
a few resource leaks on error paths.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D40779

(cherry picked from commit 23099099196548550461ba427dcf09dcfb01878d)

5 months agobsdinstall: Replace correct, but fragile, string builder with open_memstream.
John Baldwin [Tue, 27 Jun 2023 17:19:32 +0000 (10:19 -0700)]
bsdinstall: Replace correct, but fragile, string builder with open_memstream.

The old one triggered a false positive -Warray-bounds from GCC (the
compiler assumed len was always 0), but it was also fragile with
manually computed lengths paired with strcat vs using a string
builder.

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

(cherry picked from commit f66a8328c3effcb4fbd7807b798d0288b865421d)

5 months agoagp_amd64: Use <machine/pci_cfgreg.h> rather than bare prototypes
John Baldwin [Wed, 29 Nov 2023 18:31:16 +0000 (10:31 -0800)]
agp_amd64: Use <machine/pci_cfgreg.h> rather than bare prototypes

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

(cherry picked from commit 71ac18a84df2771fb9bd91e2349eae91602c4e46)

5 months agoatrtc: Add a required include
Mark Johnston [Thu, 28 Dec 2023 20:16:39 +0000 (15:16 -0500)]
atrtc: Add a required include

PR: 275867
MFC after: 1 week

(cherry picked from commit c63dda466a5ba6a9ec0a5de18f9180683f9af982)

5 months agoiommu: fix build on stable/13 with the DDB option
Konstantin Belousov [Thu, 4 Jan 2024 03:54:17 +0000 (05:54 +0200)]
iommu: fix build on stable/13 with the DDB option

Sponsored by: The FreeBSD Foundation

5 months agovfs_vnops.c: Fix cherry-pick of e7044084cf81
Rick Macklem [Wed, 3 Jan 2024 15:40:15 +0000 (07:40 -0800)]
vfs_vnops.c: Fix cherry-pick of e7044084cf81

Oops, my bad.  When I did the cherry-pick of e7044084cf81
I missed changing outsize to va.va_size.

This direct commit fixes it.

PR: 276045

5 months agocamcontrol: add support for Toshiba drive firmware update
Kenneth D. Merry [Fri, 29 Dec 2023 19:23:51 +0000 (14:23 -0500)]
camcontrol: add support for Toshiba drive firmware update

Thanks to Toshiba for providing the SCSI spec for their latest
generation drives so I could confirm how they operate.

The firmware download works in a pretty standard way, so this
is a straightforward table addition.

sbin/camcontrol/camcontrol.8:
Document that Toshiba drives are supported for fwdownload,
and that it was tested on TOSHIBA MG10SFA22TE 22TB drives.

sbin/camcontrol/fwdownload.c:
Add TOSHIBA to the known SCSI vendors list for fwdownload.

Sponsored by: Spectra Logic

(cherry picked from commit cd95f18c477ca30c3ba6f98577d321f56b1e8439)

5 months agocamcontrol: Add a sense subcommand
Kenneth D. Merry [Thu, 28 Dec 2023 21:23:16 +0000 (16:23 -0500)]
camcontrol: Add a sense subcommand

As the name suggests, this sends a SCSI REQUEST SENSE to a device,
and prints out decoded sense information.  It can also print out a
hexdump of the sense data.

sbin/camcontrol/camcontrol.c:
Add the new sense subcommand.

sbin/camcontrol/camcontrol.8:
Document camcontrol sense.

Sponsored by: Spectra Logic
Reviewed by: mav
Differential Revision:  https://reviews.freebsd.org/D43225

(cherry picked from commit 40a492d38ee10ecf9d9a099c5cdecc072e24d2d1)

5 months agoloader: lua: remove the default kernel if it doesn't exist
Kyle Evans [Wed, 13 Dec 2023 16:52:14 +0000 (10:52 -0600)]
loader: lua: remove the default kernel if it doesn't exist

The `kernel` env var provides the default kernel, usually "kernel".  It
may be the case that the user doesn't have a "kernel" kernel, just
"kernel.*" kernels, but have left `kernel` to the default because we
autodetect entries by default anyways.

If we're doing autodetection, take note of whether the default kernel
exists or not and remove it from the list if it doesn't and we had found
any other kernels.  We avoid it in the #kernels == 1 case because
something fishy has likely happened and we should just trust the
configuration.

Reviewed by: imp, manu
Differential Revision: https://reviews.freebsd.org/D42967

(cherry picked from commit d04415c520b031fb8eb93cb252e4acee66149c87)

5 months agokdump: use print_mask_arg0 appropriately
Kyle Evans [Wed, 13 Dec 2023 16:49:03 +0000 (10:49 -0600)]
kdump: use print_mask_arg0 appropriately

Some callers are using print_mask_arg() when they should be using
print_mask_arg0(); the latter should be used when all flags are optional
and there's not a flag to be decoded with a 0-mask.  This turns:

nmount(0x6991e009000,0x8,0<><invalid>0)

into:

nmount(0x6991e009000,0x8,0)

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D43007

(cherry picked from commit a206524709bdfbd577bcfe76676da80b8250f84c)

5 months agoloader: provide a features table for binary compatibility advertisement
Kyle Evans [Fri, 8 Dec 2023 21:36:06 +0000 (15:36 -0600)]
loader: provide a features table for binary compatibility advertisement

liblua now provides a loader.has_feature() function to probe the loader
binary for features advertised.  name => desc mappings are provided in
loader.features to get a list of all of the features loader *can*
support.  core.hasFeature is provided as a shim to loader.has_feature
so that individual consumers don't need to think about the logic of the
loader module not providing has_feature; we know that means the feature
isn't enabled.

The first consumer of this will be EARLY_ACPI to advertise that the
loader binary probes for ACPI presence before the interpreter has
started, so that we know whether we can trust the presence of acpi.rsdp
as relatively authoritative.  In general, it's intended to be used to
avoid breaking new scripts on older loaders within reason.

This will be used in lua as `core.hasFeature("EARLY_ACPI")`, while the
C bits of loader will `feature_enable(FEATURE_EARLY_ACPI)`.

Reviewed by: imp

(cherry picked from commit 1631382cf2820245cc72965498ff174bb548dd63)

5 months agovfs_vnops.c: Fix vn_generic_copy_file_range() for truncation
Rick Macklem [Sun, 31 Dec 2023 23:55:24 +0000 (15:55 -0800)]
vfs_vnops.c: Fix vn_generic_copy_file_range() for truncation

When copy_file_range(2) was first being developed,
*inoffp + len had to be <= infile_size or an error was
returned. This semantic (as defined by Linux) changed
to allow *inoffp + len to be greater than infile_size and
the copy would end at *inoffp + infile_size.

Unfortunately, the code that decided if the outfd should
be truncated in length did not get updated for this
semantics change.
As such, if a copy_file_range(2) is done, where infile_size - *inoffp
is less that outfile_size but len is large, the outfd file is truncated
when it should not be. (The semantics for this for Linux is to not
truncate outfd in this case.)

This patch fixes the problem. I believe the calculation is safe
for all non-negative values of outsize, *outoffp, *inoffp and insize,
which should be ok, since they are all guaranteed to be non-negative.

Note that this bug is not observed over NFSv4.2, since it truncates
len to infile_size - *inoffp.

PR: 276045

(cherry picked from commit 2319ca6a01816f7fc85d623097c639f239e18c6a)

5 months agotcp: always set tcp_tun_port to a correct value
Gleb Smirnoff [Tue, 19 Dec 2023 19:24:17 +0000 (11:24 -0800)]
tcp: always set tcp_tun_port to a correct value

The tcp_tun_port field that is used to pass port value between UDP
and TCP in case of tunneling is a generic field that used to pass
data between network layers.  It can be contaminated on entry, e.g.
by a VLAN tag set by a NIC driver.  Explicily set it, so that it
is zeroed out in a normal not-tunneled TCP.  If it contains garbage,
tcp_twcheck() later can enter wrong block of code and treat the packet
as incorrectly tunneled one.  On main and stable/14 that will end up
with sending incorrect responses, but on stable/13 with ipfw(8) and
pcb-matching rules it may end up in a panic.

This is a minimal conservative patch to be merged to stable branches.
Later we may redesign this.

PR: 275169
Reviewed by: tuexen
Differential Revision: https://reviews.freebsd.org/D43065

(cherry picked from commit 513f2e2e7180202167ca2963d815d2a4c3ac0af9)

5 months agonfscl: Fix handling of expired Kerberos credentials (NFSv4.1/4.2)
Rick Macklem [Tue, 26 Dec 2023 22:33:39 +0000 (14:33 -0800)]
nfscl: Fix handling of expired Kerberos credentials (NFSv4.1/4.2)

If the NFS server detects that the Kerberos credentials provided
by a NFSv4.1/4.2 mount using sec=krb5[ip] have expired, the NFS
server replies with a krpc layer error of RPC_AUTHERROR.
When this happened, the client erroneously left the NFSv4.1/4.2
session slot busy, so that it could not be used by other RPCs.
If this happened for all session slots, the mount point would
hang.

This patch fixes the problem by releasing the session slot
and resetting its sequence# upon receiving a RPC_AUTHERROR
reply.

This bug only affects NFSv4.1/4.2 mounts using sec=krb5[ip],
but has existed since NFSv4.1 client support was added to
FreeBSD.

So, why has the bug remained undetected for so long?
I cannot be sure, but I suspect that, often, the client detected
the Kerberos credential expiration before attempting the RPC.
For this case, the client would not do the RPC and, as such,
there would be no busy session slot.  Also, no hang would
occur until all session slots are busied (64 for a FreeBSD
client/server), so many cases of the bug probably went undetected?
Also, use of sec=krb5[ip] mounts are not that common.

PR: 275905

(cherry picked from commit a558130881e9d574dc5f37827fe2284667d5aba8)

5 months agomips: Add a return value to cpu_set_upcall()
Mark Johnston [Tue, 2 Jan 2024 00:55:27 +0000 (19:55 -0500)]
mips: Add a return value to cpu_set_upcall()

This is a direct commit to stable/13.

5 months agocompat_freebsd4: Fix handling of errors from subyte()
Mark Johnston [Tue, 26 Dec 2023 01:43:38 +0000 (20:43 -0500)]
compat_freebsd4: Fix handling of errors from subyte()

Upon failure, subyte() returns -1, not an errno value.

MFC after: 1 week

(cherry picked from commit c38df501ce2ed7da128448f815ec627c39fd3bad)

5 months agoiscsi: Check for copyout errors in iscsi_ioctl_daemon_receive()
Mark Johnston [Tue, 26 Dec 2023 01:43:31 +0000 (20:43 -0500)]
iscsi: Check for copyout errors in iscsi_ioctl_daemon_receive()

Reviewed by: jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43148

(cherry picked from commit 74e713804fa4767991c5f20e6b85da4235107122)

5 months agonmount: Ignore errors when copying out an error string
Mark Johnston [Tue, 26 Dec 2023 01:43:21 +0000 (20:43 -0500)]
nmount: Ignore errors when copying out an error string

In general we copy error strings as part of reporting an error from
lower layers, so if the copyout() fails there's nothing to do since we'd
prefer to preserve the original error.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

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

(cherry picked from commit 099d25c354d93d9cd9c9cd261428f5ab0547a194)

5 months agogeom: Report copyout() errors in g_ctl_ioctl_ctl()
Mark Johnston [Tue, 26 Dec 2023 01:43:06 +0000 (20:43 -0500)]
geom: Report copyout() errors in g_ctl_ioctl_ctl()

Despite the name, req->serror is used in some cases to copy non-error
messages to userspace.  So, report errors when copying out so long as
they don't clobber an earlier error.

Reviewed by: mav, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43146

(cherry picked from commit bbf221e3e822d15dafb37bd8e200a9864f2636b4)

5 months agogntdev: Handle errors from suword32() in gntdev_alloc_gref()
Mark Johnston [Tue, 26 Dec 2023 01:42:58 +0000 (20:42 -0500)]
gntdev: Handle errors from suword32() in gntdev_alloc_gref()

Try to copy out output values before handling errors, and check that we
did so successfully.  In particular, it doesn't seem sensible to ignore
errors here, otherwise userspace won't have any way to refer to the
allocations.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by: royger
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43145

(cherry picked from commit 6cdff09c0d70f780a738dbd3d87deb3b13ec8446)

5 months agompr: Handle errors from copyout() in ioctl handlers
Mark Johnston [Tue, 26 Dec 2023 01:42:49 +0000 (20:42 -0500)]
mpr: Handle errors from copyout() in ioctl handlers

In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mpr(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by: imp, asomers
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D43177

(cherry picked from commit 68cc77a3b73ffda1e8ac891b9852faca833e11b7)

5 months agomps: Handle errors from copyout() in ioctl handlers
Mark Johnston [Tue, 26 Dec 2023 01:42:33 +0000 (20:42 -0500)]
mps: Handle errors from copyout() in ioctl handlers

In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mps(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by: imp, asomers
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D43176

(cherry picked from commit bcf4a7c7ace21a01d10003de9c7692f0887526c1)

5 months agoumtx: Check for errors from suword32()
Mark Johnston [Tue, 26 Dec 2023 01:42:17 +0000 (20:42 -0500)]
umtx: Check for errors from suword32()

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43144

(cherry picked from commit 3379d9b5de4c4876a317d25ca008e66b1111b701)

5 months agothread: Ignore errors when copying out during thr_exit()
Mark Johnston [Tue, 26 Dec 2023 01:42:04 +0000 (20:42 -0500)]
thread: Ignore errors when copying out during thr_exit()

It does not seem reasonable to return to userspace after calling
umtx_thread_exit().

This is in preparation for annotating copyin() and related functions
with __result_use_check.

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

(cherry picked from commit f450277f7a608f26624384e046c1987490c51296)

5 months agojail: Ignore errors from copyout() while copying the error string
Mark Johnston [Tue, 26 Dec 2023 01:41:54 +0000 (20:41 -0500)]
jail: Ignore errors from copyout() while copying the error string

Reviewed by: zlei, jamie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43142

(cherry picked from commit abbc260f74b203646dd108ad4038627fcfb0ded7)

5 months agosendfile: Explicitly ignore errors from copyout()
Mark Johnston [Tue, 26 Dec 2023 01:41:32 +0000 (20:41 -0500)]
sendfile: Explicitly ignore errors from copyout()

There is a documented bug in sendfile.2 which notes that sendfile(2)
does not raise an error if it fails to copy out the number of bytes
written.  Explicitly ignore the error from copyout() calls in
preparation for annotating copyout() with __result_use_check.

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

(cherry picked from commit d0adc2f283ad5db6b568ca533a056c9f635551cd)

5 months agoses: Add error checking for copyout() calls
Mark Johnston [Tue, 26 Dec 2023 01:40:33 +0000 (20:40 -0500)]
ses: Add error checking for copyout() calls

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by: mav, imp, asomers
Tested by: asomers
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43130

(cherry picked from commit 771501e96ffd7e314c338300a351ad76d28a2f69)

5 months agopowerpc: Avoid ignoring copyin()'s return value
Mark Johnston [Tue, 26 Dec 2023 01:40:16 +0000 (20:40 -0500)]
powerpc: Avoid ignoring copyin()'s return value

A recent change made it possible for cpu_set_upcall() to return an
error.  Do that here instead of ignoring an error from copyin().

Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43105

(cherry picked from commit bdf03b4bcc4a9aa0be503dbc64415e6b0b845fbc)

5 months agolinux: Check for copyout errors in linux_fixup()
Mark Johnston [Tue, 26 Dec 2023 01:40:05 +0000 (20:40 -0500)]
linux: Check for copyout errors in linux_fixup()

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by: olce, dchagin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43104

(cherry picked from commit 3fde275167ce1f1455a03586d29840546d06d97a)

5 months agothread: Add a return value to cpu_set_upcall()
Mark Johnston [Tue, 26 Dec 2023 01:39:39 +0000 (20:39 -0500)]
thread: Add a return value to cpu_set_upcall()

Some implementations copy data to userspace, an operation which can in
principle fail.  In preparation for adding a __result_use_check
annotation to copyin() and related functions, let implementations of
cpu_set_upcall() return an error, and check for errors when copying data
to user memory.

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

(cherry picked from commit 7b68fb5ab2a276ccd081cc1a43cebf0fb315e952)

5 months agocompat_freebsd4: Check for errors from subyte() in freebsd4_uname()
Mark Johnston [Tue, 26 Dec 2023 01:39:21 +0000 (20:39 -0500)]
compat_freebsd4: Check for errors from subyte() in freebsd4_uname()

This is in preparation for adding a __result_use_check annotation to
copyin() and related functions.

Reviewed by: imp, kib, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43099

(cherry picked from commit 4f35450ce52a7b141e7ae8d37fa257b5f8971dda)

5 months agoocs: Check for copyin errors in the ioctl handler
Mark Johnston [Tue, 26 Dec 2023 01:38:57 +0000 (20:38 -0500)]
ocs: Check for copyin errors in the ioctl handler

If copyin() fails, the driver will blindly proceed with whatever had
been in the uninitialized DMA buffer.  This is not what we want.  Check
for copyin failures.

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by: ram
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43097

(cherry picked from commit a01ff11cb73d7a1988f6241f63d141371ff23717)

5 months agouhid: Check for errors from copyin() in ioctl handlers
Mark Johnston [Tue, 26 Dec 2023 01:38:04 +0000 (20:38 -0500)]
uhid: Check for errors from copyin() in ioctl handlers

This is in preparation for annotating copyin() and related functions
with __result_use_check.

Reviewed by: wulf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43103

(cherry picked from commit b2caed2f8d699d6dc59ecf8810d945cdea148c44)

5 months agohid: Handle errors from copyin() in ioctl handlers
Mark Johnston [Tue, 26 Dec 2023 01:37:49 +0000 (20:37 -0500)]
hid: Handle errors from copyin() in ioctl handlers

If copyin() fails, the driver will proceed blindly with a zeroed buffer,
which is not what we want.  In preparation for annotating copyin() with
__result_use_check, start checking for errors.

Reviewed by: wulf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43102

(cherry picked from commit e452fa70d50761b5fe5f19c3c93c107be116728c)

5 months agofreebsd32: Report errors when copying out oldlenp in __sysctl
Mark Johnston [Tue, 26 Dec 2023 01:37:32 +0000 (20:37 -0500)]
freebsd32: Report errors when copying out oldlenp in __sysctl

This matches the native implementation's behaviour.

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

(cherry picked from commit 81eb7baa69e983fe159d254a4ed47d9c00396801)

5 months agoath: Handle errors from copyout() in ath_rate_fetch_node_stats()
Mark Johnston [Tue, 26 Dec 2023 01:35:43 +0000 (20:35 -0500)]
ath: Handle errors from copyout() in ath_rate_fetch_node_stats()

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43096

(cherry picked from commit 711880597c6c4ac971eb2aba6a2dadb5933d38dd)

5 months agoConvert fsidcmp(9) from macro to inline function
Konstantin Belousov [Tue, 26 Dec 2023 19:39:33 +0000 (21:39 +0200)]
Convert fsidcmp(9) from macro to inline function

(cherry picked from commit 3334a537ed385e487a47208dab8f36b25643bcdb)

5 months agoofed: use ANSI C functions definitions in opensm/sm.c
Konstantin Belousov [Tue, 26 Dec 2023 19:16:49 +0000 (21:16 +0200)]
ofed: use ANSI C functions definitions in opensm/sm.c

(cherry picked from commit bf7830d79dd02a84225c93130c2dce68e0a541d6)

5 months agoiommu_gas_remove(): consolidate places where decision is made to keep the entry
Konstantin Belousov [Fri, 22 Dec 2023 22:41:19 +0000 (00:41 +0200)]
iommu_gas_remove(): consolidate places where decision is made to keep the entry

(cherry picked from commit c0047e7c356953d138194ff71cc510ffe85425f0)

5 months agoiommu_gas: make placeholder entry at the start of the GAS zero size
Konstantin Belousov [Fri, 22 Dec 2023 22:19:05 +0000 (00:19 +0200)]
iommu_gas: make placeholder entry at the start of the GAS zero size

(cherry picked from commit f59128775636846574e092c68e849a56f74577e6)

5 months agoiommu: add iommu_gas_remove_locked()
Konstantin Belousov [Thu, 14 Dec 2023 02:41:31 +0000 (04:41 +0200)]
iommu: add iommu_gas_remove_locked()

(cherry picked from commit 273b4de3462d7825ebe4ace7a1930f098311287f)

5 months agoIOMMU: add GAS map entry flag IOMMU_MAP_ENTRY_FAKE
Konstantin Belousov [Fri, 22 Dec 2023 22:39:27 +0000 (00:39 +0200)]
IOMMU: add GAS map entry flag IOMMU_MAP_ENTRY_FAKE

(cherry picked from commit a59c252903e81f46c74903ce5b1cf0960927dbcc)

5 months agoiommu_gas: zero fake on-stack map entry used in iommu_gas_remove_clip_left()
Konstantin Belousov [Sun, 24 Dec 2023 00:59:19 +0000 (02:59 +0200)]
iommu_gas: zero fake on-stack map entry used in iommu_gas_remove_clip_left()

(cherry picked from commit cb1d664b0073232173072231cb386f0216ee596b)

5 months agoiommu_gas: print entries flags and domains if an overlap detected
Konstantin Belousov [Sat, 23 Dec 2023 23:34:16 +0000 (01:34 +0200)]
iommu_gas: print entries flags and domains if an overlap detected

(cherry picked from commit 733da1eb947688210bc152656357ecafbd172bb7)

5 months agoDMAR: add knob to disable RMRR entries installation into domains
Konstantin Belousov [Sat, 23 Dec 2023 16:57:19 +0000 (18:57 +0200)]
DMAR: add knob to disable RMRR entries installation into domains

(cherry picked from commit 24e38af60a637073b5164837959098acaa3d8daa)

5 months agoiommu_gas: add ddb 'show iommu_domain' command
Konstantin Belousov [Sun, 24 Dec 2023 14:52:00 +0000 (16:52 +0200)]
iommu_gas: add ddb 'show iommu_domain' command

(cherry picked from commit 30ce85ca11433ba05cdbab8aedceaa15a93bd97a)

5 months agoiommu_gas_match_one(): check for underflow
Konstantin Belousov [Tue, 26 Dec 2023 00:57:00 +0000 (02:57 +0200)]
iommu_gas_match_one(): check for underflow

(cherry picked from commit a869643e184a73382ef7939b465fd42785e096d1)

5 months agodmar(9): style, fix indent
Konstantin Belousov [Fri, 15 Dec 2023 11:24:44 +0000 (13:24 +0200)]
dmar(9): style, fix indent

(cherry picked from commit 7153d5e4bc67732f8258d50ffffa42a09a19b427)

5 months agoiommu: remove leftover sys/cdefs.h includes
Konstantin Belousov [Sun, 24 Dec 2023 14:24:05 +0000 (16:24 +0200)]
iommu: remove leftover sys/cdefs.h includes

(cherry picked from commit 6afa2333d2e42e1df67a0fab20f0ede76dff516d)

5 months agoMerge commit c97a7675eea4 from llvm git (by Qiu Chaofan):
Dimitry Andric [Fri, 29 Dec 2023 19:30:45 +0000 (20:30 +0100)]
Merge commit c97a7675eea4 from llvm git (by Qiu Chaofan):

  [PowerPC] Expand FSINCOS of fp128 (#76494)

This fixes "fatal error: error in backend: Cannot select: 0x6d420285c0:
f128,f128 = fsincos 0x6d4202b6f0" when compiling s_cpowl.c for
powerpc64le.

Upstream ticket: https://github.com/llvm/llvm-project/issues/76442

Reported by: pkubaj
MFC after: 3 days

(cherry picked from commit 79639686401bedbcbbf04eb71e0acb1cc7dcbbcb)

5 months agoMinimize libc++ errno-related header diffs with upstream
Dimitry Andric [Mon, 25 Dec 2023 17:18:31 +0000 (18:18 +0100)]
Minimize libc++ errno-related header diffs with upstream

In commit 88640c0e8b6f5 the new EINTEGRITY errno value was added, and
this caused us to carry a patch for upstream libc++ since that time.
Because it can cause merge conflicts when importing libc++ code from
upstream, I have submitted an upstream pull request to get most of that
patch integrated.

It turns out that we do not need the errno.h part of it at all, since
all supported FreeBSD versions define EOWNERDEAD and ENOTRECOVERABLE,
and therefore the block that juggles with ELAST values is never used in
FreeBSD. At the moment it only applies to older versions of Linux, or
possibly other platforms.

Therefore the only part that needs to stay is the definition of a enum
errc value for EINTEGRITY, and this is made optional upon EINTEGRITY
being defined, to make it suitable for upstreaming.

No functional change is intended.

MFC after: 1 week

(cherry picked from commit 1ff41cad716adeba0d408652c92c81e59e3ba316)

5 months agoReorganize libclang_rt Makefile and make more lib/arch combos available
Dimitry Andric [Thu, 28 Dec 2023 12:57:41 +0000 (13:57 +0100)]
Reorganize libclang_rt Makefile and make more lib/arch combos available

Upstream has made more clang runtime libraries available for more
architectures, so add them. To make this easier, split up subdir lists
into functional parts (asan, tsan, etc), and put each architecture into
its own .if block.

Effectively, this adds the following libraries for aarch64: asan, cfi,
fuzzer, msan, safestack, stats, tsan, ubsan, xray.

PR: 262706
MFC after: 3 days

(cherry picked from commit e77a1bb2757471ab3fed0750b76eeb15d0c7b10a)

5 months agoTeach if_smsc to get MAC from bootargs.
Ronald Klop [Sat, 4 Nov 2023 14:14:00 +0000 (15:14 +0100)]
Teach if_smsc to get MAC from bootargs.

Some Raspberry Pi pass smsc95xx.macaddr=XX:XX:XX:XX:XX:XX as bootargs.
Use this if no ethernet address is found in an EEPROM.
As last resort fall back to ether_gen_addr() instead of random MAC.

(cherry picked from commit 3878bbf1bb9e68f8579b57cde7d4e5c77de93320)

if_smsc: fix build on armv6 & armv7

compile error was:
/usr/src/sys/dev/usb/net/if_smsc.c:1597:40: error: format specifies type 'unsigned long' but the argument has type 'ssize_t' (aka 'int') [-Werror,-Wformat]
                                "failed alloc for bootargs (%lu)", len);
                                                            ~~~    ^~~
                                                            %zd

(cherry picked from commit 8a0ee306227a17a998bdc7af2275fd94b9164342)

PR: 274092
Reported by: Patrick M. Hausen (via ML)
Reviewed by: imp, karels, zlei
Tested by: Patrick M. Hausen
Approved by: karels
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D42463

5 months agofortune: update mailing list search url
Christos Margiolis [Wed, 27 Dec 2023 16:28:11 +0000 (18:28 +0200)]
fortune: update mailing list search url

Markmail no longer exists.

Reviewed by: markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D43209

(cherry picked from commit 2b1c477d88e579585c6b3ba5f6ded70b9a05e3c3)

6 months agovfs_domount_update(): correct fsidcmp() usage
Andrew Gierth [Sun, 24 Dec 2023 12:04:21 +0000 (14:04 +0200)]
vfs_domount_update(): correct fsidcmp() usage

(cherry picked from commit 2a1d50fc12f6e604da834fbaea961d412aae6e85)