Commit graph

288125 commits

Author SHA1 Message Date
Dag-Erling Smørgrav 53fc8e1902 cp: Move the -N flag in the manual page.
This accidentally got left out of 0f4467ce44.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D43067
2023-12-14 21:02:06 +01:00
Jessica Clarke 3812c653b1 Revert "Don't try and run kldxref for arm kernels"
Now that kldxref supports arm this should not be needed.

This reverts commit 0840bdbf2a.
2023-12-14 18:27:09 +00:00
Jessica Clarke c88f7d8fb5 kldxref: Add arm support 2023-12-14 18:27:09 +00:00
Jessica Clarke ada9d12f95 kldxref: Put each ef_CPUARCH.c on its own line to prepare for ef_arm.c
Adding ef_arm.c would push this past 80 columns, so prepare for its
addition by splitting the line up.
2023-12-14 18:27:09 +00:00
Jessica Clarke 0840bdbf2a Don't try and run kldxref for arm kernels
Surprisingly, kldxref does not currently support arm, and unhelpfully
this means it silently does nothing rather than give an error, so the
linker.hints entry added to the METALOG for -DNO_ROOT builds (and
pkgbase ones) refers to a file that doesn't exist. Ideally it would be
supported (and ideally the METALOG handling would be less fragile, but
without integrating it into kldxref the only real option would be to
just run find(1) to get the list of linker.hints files, which feels a
little backwards), but for now just paper over this by skipping the
build step on arm.

Reported by:	bapt
Fixes:		ff7c12c1f1 ("Make kldxref a bootstrap tool and use unconditionally")
2023-12-14 16:40:08 +00:00
Jessica Clarke d1ce87ae0d kldxref: Fix for 32-bit powerpc
R_PPC_RELATIVE lost its 32-bit handling in the libelf conversion.

Reported by:	bapt
Fixes:		0299afdff1 ("kldxref: Make use of libelf to be a portable cross tool")
2023-12-14 16:37:34 +00:00
Dag-Erling Smørgrav 3850927066 cp: Further simplify the core logic.
If the destination file exists but we decide unlink it, set the dne
flag.  This means we don't need to re-check the conditions that would
have caused us to delete the file when we later need to decide whether
to create or replace it.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43064
2023-12-14 17:07:04 +01:00
Dag-Erling Smørgrav 0f4467ce44 cp: Move the flags around a bit.
- The HLPR flags are grouped together at the beginning because they are
  the standard flags for programs using FTS.  Move the N flag out from
  among them to its correct place in the sequence.
- The Pflag variable isn't used outside main(), but moving it out lets
  us skip initialization and keeps it with its friends H, L and R.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43063
2023-12-14 17:07:00 +01:00
Dag-Erling Smørgrav ac56b9d83c cp: Split the basic_symlink test case in two.
This test case tests two different things: first, that copying a symlink
results in a file with the same contents as the target of the symlink,
rather than a second symlink, and second, that cp will refuse to copy a
file to itself, or to a link to itself, or a link to its target.  Leave
the first part in basic_symlink, move the second part to a new test case
named samefile, and slightly expand both cases.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43062
2023-12-14 17:06:57 +01:00
Kristof Provost 8fab83d2c5 pf tests: fix typos in the abort_v6 test case head / cleanup function name
MFC after:	1 week
2023-12-14 10:23:41 +01:00
Frank Hilgendorf 59dba901f2 bwn: remove unused ic_headroom
Unlike bwi(4), bwn(4) does not rely on ic_headroom (despite having it
set) but splits the bwn_txhdr (first) segment into its own transaction.
Remove ic_headroom to avoid net80211 troubles with not enough space in
the mbuf around ieee80211_mbuf_adjust().

PR:		275616
MFC after:	3 days
2023-12-13 23:54:05 +00:00
Dag-Erling Smørgrav d002316fd7 cp: Refactor the core logic.
Rewrite `copy_file()` so the lflag and sflag are handled as early as
possible instead of constantly checking that they're not set and then
handling them at the end.  This also opens the door to changing the
failure logic at some future point (for instance, we might decide to
fall back to copying if `errno` indicates that the file system does not
support links).

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D43055
2023-12-14 00:40:55 +01:00
Dag-Erling Smørgrav d3a8e9b43b cp: Add tests for symbolic link case.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D43054
2023-12-14 00:33:37 +01:00
Jessica Clarke ff7c12c1f1 Make kldxref a bootstrap tool and use unconditionally
Now that kldxref is a generic cross tool and can be built on non-FreeBSD
we can bootstrap it during the build and thus remove the condition for
whether it exists. We also need to make sure to add it to the METALOG
for -DNO_ROOT builds.

Reviewed by:	brooks, imp
Differential Revision:	https://reviews.freebsd.org/D43051
2023-12-13 21:43:10 +00:00
Jessica Clarke e131d3f4f3 Makefile.inc1: Forward on METALOG and DISTBASE for kernel targets
Currently IMAKE_INSTALL, which includes -M METALOG, is enough for the
sub-makes to work, but using kldxref for -DNO_ROOT builds will require
manually adding linker.hints to the METALOG, and thus both METALOG
itself and DISTBASE need to be exposed directly to the sub-makes, so do
so.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D43050
2023-12-13 21:43:09 +00:00
Jessica Clarke 881ec81372 tools/build: Provide sys/linker_set.h when cross-building
This is needed for kldxref, which will shortly become a bootstrap tool.
Linux can use the same one as FreeBSD (provided the cross-building
sys/cdefs.h is augmented appropriately), whilst macOS needs its own
Mach-O-specific implementation.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D43049
2023-12-13 21:43:09 +00:00
Dag-Erling Smørgrav 1fead66b64 cp: Add tests for hard link case.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D43052
2023-12-13 22:31:16 +01:00
John Baldwin 894f3f48c3 kldxref: Cast rtype to int in ef_aarch64.c in warning
This is consistent with the other architecture-specific relocation
handlers.

Reported by:	mjg
Sponsored by:	DARPA
2023-12-13 12:17:44 -08:00
Dimitry Andric bc6051a060 libicp(_rescue)?: use asm versions for all 32-bit arm flavors
OpenZFS upstream refactored the asm versions of sha2 to be usable on all
32-bit arm flavors, so it is not necessary to limit this to armv6 and
armv7.

Suggested by:	jhb
2023-12-13 20:00:35 +01:00
Jean-Sébastien Pédron fe84281803
linuxkpi: Add struct kset support in <linux/kobject.h>
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43020
2023-12-13 19:57:52 +01:00
Jean-Sébastien Pédron d6d1e73e5f
linuxkpi: Include <linux/string_helpers.h> from <linux/seq_file.h>
[Why]
The i915 DRM driver in Linux 5.18 relies on this indirect include.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43030
2023-12-13 19:54:32 +01:00
Jean-Sébastien Pédron 38138beb42
linuxkpi: Add <linux/string_helpers.h> and str_yes_no()
[Why]
This header and str_yes_no() are now used by the i915 DRM driver in
Linux 5.18.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43014
2023-12-13 19:54:32 +01:00
Dimitry Andric ca217224f1 Proactively remove libc++ __tuple header file that became a directory
This was already handled in ObsoleteFiles.inc (see the 20230622 entry),
but some people never run "make delete-old", or want to upgrade directly
from a revision that still had libc++ 15 to the most recent revision.

They would then encounter a failure during installworld, similar to:

  install: target directory `/usr/include/c++/v1/__tuple/' does not exist

Therefore, clean it up in the distrib-cleanup phase, similar to the
earlier instance of the libc++ __string header file that became a
directory.

PR:		273753
MFC after:	1 month
2023-12-13 19:53:17 +01:00
Jean-Sébastien Pédron 59cbead6b1
linuxkpi: Add support for suspend_noirq callback in struct dev_pm_ops
[Why]
This callback is being used by the amdgpu DRM driver in Linux 5.18.

[How]
The callback is called after `suspend_late()`.

Reviewed by:	emaste, manu
Approved by:	emaste, manu
Differential Revision:	https://reviews.freebsd.org/D43029
2023-12-13 19:18:47 +01:00
Jean-Sébastien Pédron b30637c100
linuxkpi: Add <video/of_display_timing.h> to dummy headers
[Why]
This header is being used by DRM drivers in Linux 5.18.

Reviewed by:	emaste, manu
Approved by:	emaste, manu
Differential Revision:	https://reviews.freebsd.org/D43028
2023-12-13 19:18:47 +01:00
Jean-Sébastien Pédron d752a5e82a
linuxkpi: Fix __ATTR_RO() in <linux/sysfs.h>
[Why]
The passed structure may not have a `.store` field. This is the case in
the amdgpu DRM driver starting with Linux 5.18.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43023
2023-12-13 19:18:46 +01:00
Jean-Sébastien Pédron 509707e8b6
linuxkpi: Add sysfs_create_link() in <linux/sysfs.h>
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.

[How]
The function is a no-op as I'm not sure how to implement this with
sysctls yet.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43022
2023-12-13 19:18:46 +01:00
Jean-Sébastien Pédron b723bcd05a
linuxkpi: Add list_for_each_prev_safe() in <linux/list.h>
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43021
2023-12-13 19:18:46 +01:00
Jean-Sébastien Pédron 80446fc7b5
linuxkpi: Move struct kobject code to linux_kobject.c
[Why]
`linux_compat.c` is already too long. I will need to add `struct kset`
in a follow-up commit, so let's move the existing `struct kobject` code
to its own file.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43019
2023-12-13 19:18:46 +01:00
Jean-Sébastien Pédron 4e0d3f7b3c
linuxkpi: Move invalidate_mapping_pages() to <linux/pagemap.h>
[Why]
This is consistent with Linux.

[How]
The definition is moved from <linux/shmem_fs.h> to <linux/pagemap.h> and
the latter is included from the former. This is how it is done on Linux.

Prototypes are also expanded with argument names. I got a build failure
in the DRM 5.18 drivers because the compiler considered that the
`pgoff_t` argument was there twice.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43018
2023-12-13 19:18:46 +01:00
Jean-Sébastien Pédron 50a56453da
linuxkpi: Include <linux/types.h> from <linux/cc_platform.h>
[Why]
We need this for the `bool` type.

Reviewed by:	manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D43016
2023-12-13 19:18:42 +01:00
Jessica Clarke 641eba2de4 Makefile.inc1: Reinstate building sbin/md5 for BOOTSTRAP_ALL_TOOLS
The sha256 and sha512 binaries are used when building release images.
Bootstrapping them used to be gated on MK_BOOT, which wasn't quite right
but in practice worked, at least in our use cases downstream. Add back
bootstrapping sbin/md5 and its aliases for this purpose to fix building
release images on Linux and macOS.

Fixes:	f213da893c ("Makefile.inc1: Remove beri straggler")
2023-12-13 18:02:45 +00:00
Kyle Evans d04415c520 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
2023-12-13 10:52:14 -06:00
Kyle Evans a206524709 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
2023-12-13 10:49:03 -06:00
Michal Gulbicki 5437c3b6ad qat: Update firmware for 4xxx devices to version 1.1.20
Key features:
- added zeropadding feature for compression
- added partial decompression support
- added DC rate limiting support
- added Admin ME capabilities reporting
- added Hash+Compress chaining support

MFC after:	2 weeks
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D42864
2023-12-13 09:47:37 -05:00
Baptiste Daroussin 97530894fc kldxref: fix build on 32 bits arches 2023-12-13 12:04:43 +01:00
Ed Maste 92aa071dc7 Cirrus-CI: stop forcibly installing pkg
Updated pkg is now in quarterly and there is no need to forcibly
install a specific version.

This reverts commit 1c376684c7.
This reverts commit 3c097b06a7.

Reported by:	bapt
Sponsored by:	The FreeBSD Foundation
2023-12-12 19:50:19 -05:00
John Baldwin 0299afdff1 kldxref: Make use of libelf to be a portable cross tool
This allows kldxref to operate on kernel objects from any
architecture, not just the native architecture.  In particular, this
will permit generating linker.hints files as part of a cross-arch
release build.

- elf.c is a new file that includes various wrappers around libelf
  including routines to read ELF data structures such as program and
  section headers and ELF relocations into the "generic" forms
  described in <gelf.h>.  This file also provides routines for
  converting a linker set into an array of addresses (GElf_Addr)
  as well as reading architecture-specific mod_* structures and
  converting them into "generic" Gmod_* forms where pointers are
  replaced with addresses.

- The various architecture-specific reloc handlers now use GElf_*
  types for most values (including GElf_Rel and GElf_Rela for
  relocation structures) and use routines from <sys/endian.h> to read
  and write target values.  A new linker set matches reloc handlers
  to specific ELF (class, encoding, machine) tuples.

- The bits of kldxref.c that write out linker.hints now use the
  encoding (ELFDATA2[LM]SB) of the first file encountered in a
  directory to set the endianness of the output file.  Input files
  with a different architecture in the same directory are skipped with
  a warning.  In addition, the initial version record for the file
  must be deferred until the first record is finished since the
  architecture of the output file is not known until then.

- Various places that used 'sizeof(void *)' throughout now use
  'elf_pointer_size()' to determine the size of a pointer in the
  target architecture.

Tested by:	amd64 binary on both amd64 and i386 /boot/kernel
Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42966
2023-12-12 15:43:00 -08:00
John Baldwin c40fa3dc98 kldxref: Refactor PNP entry parsing, no functional change
- Add a free_pnp_list to complement parse_pnp_list.  Add freeing
  of 'new_desc' which was previously leaked.

- Move body of loop that checked a single pnp list element against a
  table entry into a parse_pnp_entry function to reduce indentation
  and split parse_entry into a smaller function.

- Similarly, split out a record_pnp_info function from parse_entry
  which builds the pnp_list and walks a table.

Reviewed by:	imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42965
2023-12-12 15:30:16 -08:00
John Baldwin 4a3cf5f329 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 66422f5b7a back in
2002, but various files still #define it.

Reviewed by:	kevans, imp, emaste
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42964
2023-12-12 15:30:00 -08:00
John Baldwin 087c4c90d1 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 9c6f92408c.

Reviewed by:	kevans
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42963
2023-12-12 15:29:43 -08:00
Bojan Novković ca96a942ca bhyve: refactor gdbstub to enable single-stepping on AMD CPUs
This patch refactors the existing Intel-specific single-stepping
mechanism in bhyve's GDB stub to work with both AMD and Intel CPUs.

Reviewed by:	jhb
Sponsored by:	Google, Inc. (GSoC 2022)
Differential Revision: https://reviews.freebsd.org/D42298
2023-12-12 15:28:59 -08:00
Brooks Davis 5c7a909271 libc/i386/SYS.h: Remove unused LCALL macro
It appears that the only user of this macro was removed
with support for building a.out binaries in 2002 by commit
66422f5b7a.

Reviewed by:	imp, kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42997
2023-12-12 22:53:09 +00:00
Brooks Davis 9aaf4e3be6 libc/*/SYS.h: remove SYCALL macro
This has not been a univerally available interface since it was removed
from amd64 by commit efbef97de9 in 2004.
I removed the last consumers in 2016 when I replaced pipe(2) with
pipe2(2) in commit b60998c633.

Reviewed by:	imp, jhibbits
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D42996
2023-12-12 22:52:41 +00:00
Igor Ostapenko 0c511bafdd netlink: fix snl_writer and linear_buffer re-allocation logic
- Use the correct base pointer after re-allocation to avoid buffer
  overflows.

- Maintain correct snl_writer.size, which avoids redundant memory
  allocation, e.g. a need for ~1k bytes may end up with ~32k
  linear_buffer actually allocated.

This fixes a pfctl regression at least for armv7 after the addrule logic
migration to netlink:
  ffbf25951e ("pf: convert rule addition to netlink")

The add rule command creates a bigger than default size netlink requests
which triggers the re-allocation logic.

Reviewed by:	kp
MFC after:	2 weeks
Differnetial Revision:	https://reviews.freebsd.org/D43003
2023-12-12 21:49:14 +01:00
Mark Johnston 6fa843f6e6 nfsclient: Propagate copyin() errors from nfsm_uiombuf()
Approved by:	so
Security:	SA-23:18.nfsclient
Reviewed by:	rmacklem
Sponsored by:	The FreeBSD Foundation
2023-12-12 14:05:24 -05:00
Ram Kishore Vegesna 70547544ce ocs_fc: IO timeout handling and error reporting fix.
Hardware timeout uses a 8-bit timeout value and expects the timeout to
be less than 255 seconds. Added software timer implemetation to timeout
and abort the IOs with timeout more than 255 seconds.

Fix the timeout problem by dividing CAM timeouts by 1000 as hardware
expects timeout value in seconds.  Before this change, CAM timeouts in
milliseconds were getting truncated to 8 bits and converted to seconds.
So the actual timeout used when going down to the card would depend on
the bottom 8 bits of the timeout used.

Add the mapping of ocs_fc error status to CAM status.

Reported by:	ken
Reviewed by:	ken
Tested by:	ken, ram
Approved by:	ken
MFC after:	1 week
2023-12-12 10:22:58 -05:00
Michael Tuexen 793e4aca9e tcp stacks: in kernel BBR and RACK require in kernel HPTS
Compiling the BBR or RACK stack into the kernel requires HPTS to be
compiled into the kernel.

Reviewed by:		glebius, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D42998
2023-12-12 12:01:37 +01:00
Alex Richardson 60e845ceef 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
2023-12-11 21:14:56 -08:00
Alex Richardson 0156465c6d 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
2023-12-11 21:14:56 -08:00