Commit Graph

285719 Commits

Author SHA1 Message Date
Warner Losh
edd23e4dc0 nvme: Eliminate redundant code
get_admin_opcode_string and get_io_opcode_string are identical, but
start with different tables. Use a helper routine that takes an argument
to implement these instead. A future commit will refine this further.

Sponsored by:		Netflix
Reviewed by:		chuck, mav, jhb
Differential Revision:	https://reviews.freebsd.org/D41310
2023-08-07 16:44:31 -06:00
Warner Losh
7be0b06885 nvme: Remove duplicate command printing routine
Both nvme_dump_command and nvme_qpair_print_command print nvme
commands. The former latter better. Recode the one call to
nvme_dump_command to use nvme_qpair_print_command and delete the
former. No sense having two nearly identical routines. A future commit
will convert to sbuf.

Sponsored by:		Netflix
Reviewed by:		chuck, mav, jhb
Differential Revision:	https://reviews.freebsd.org/D41309
2023-08-07 16:44:30 -06:00
Warner Losh
6f76d49386 nvme: Remove duplicate completion printing routine
Both nvme_dump_completion and nvme_qpair_print_completion print
completions. The latter is better. Recode the two instances of
nvme_dump_completion to use nvme_qpair_print_completion and delete the
former. No sense having two nearly identical routines. A future commit
will convert this to sbuf.

Sponsored by:		Netflix
Reviewed by:		chuck
Differential Revision:	https://reviews.freebsd.org/D41308
2023-08-07 16:44:30 -06:00
Kristof Provost
f8b4f9aab5 pfctl: optionally clarify which anchors are layer 3 and which are Ethernet
When listing anchors pfctl lists both 'regular' layer 3 anchors and
Ethernet anchors. It's possible to have the same anchor name in both,
which can be confusing.

Mitigate this a little by explicitly marking where the Ethernet anchors
start. Avoid breaking scripts by only doing this at the second level
of verbosity.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-08-07 19:59:50 +02:00
Colin Percival
ac4f03e03e Firecracker: Make root disk configurable
Add a FCROOTFSSZ variable which defaults to "1g" which controls the
size of the Firecracker root filesystem; it can be set as low as "300m"
at present.

Allow WITHOUTS to be overridden if users want to build a root disk with
more -- or fewer -- parts of the FreeBSD base system.

Reviewed by:	gjb
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D41041
2023-08-07 09:21:08 -07:00
Mark Johnston
454c425dbe ossl: Add missing labels to bsaes-armv7.S
There is a bug in the OpenSSL script which generates this file; the bug
is in the process of being fixed upstream.

Specifically, when generating the output, bsaes-armv7.pl strips some
labels that are used when the output asm is compiled with __KERNEL__
defined, resulting in a build error.  As a step towards adding armv7
support to ossl(4), manually patch the generated asm.  The upstream fix
will be imported later.

Reviewed by:	andrew, jhb, emaste
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D41303
2023-08-07 10:17:16 -04:00
Mariusz Zaborski
2ea65afbd1 md5: extend capabilites
In 4849767cb1, we did a large refactor of the md5(1) source code.
One of them is that instead of reading data using read(2) syscall, we
are using binary stream input (fread(3)).

fread(3) requires additional Capsicum capabilities:
sha256 CAP operation requires CAP_FSTAT, descriptor holds CAP_READ
sha256 RET fstat -1 errno 93 Capabilities insufficient

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D41348
2023-08-07 14:19:26 +02:00
Robert Clausecker
d7302cabc0 lib/libc/amd64/string/strchrnul.S: fix wrong indentation
Uses spaces instead of tabs for this line by accident.

Reported by:	jrtc27, kib
Approved by:	kib
2023-08-07 14:03:28 +02:00
Pedro F. Giffuni
9610cbc09e patch: don't run off the end of path if it ends in '/'.
Found by fuzzing (afl) in OpenBSD.

Obtained from:	OpenBSD (CVS 1.65)
2023-08-06 22:27:27 -05:00
Colin Percival
395b9c9977 OCI: Bump image size to 6 GB
5 GB is no longer enough.

Sponsored by:	https://www.patreon.com/cperciva
2023-08-06 18:51:35 -07:00
Bjoern A. Zeeb
d73de45743 net80211: Radiotap: add two more EHT defines
An updated iwlwifi needs further radiotap updates for EHT.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-08-07 01:22:53 +00:00
Bjoern A. Zeeb
dcb0c54968 LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page
Rather than using the FreeBSD internal calls vtophys() and
PHYS_TO_VM_PAGE() use the already existing LinuxKPI abstraction for
this called virt_to_page().  This reduces the amount of compat code
to maintain and will allow further work on struct [vm_]page.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41257
2023-08-07 00:58:21 +00:00
Bjoern A. Zeeb
d1ea07642c LinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYS
Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys()
allowing us to work on a struct page in the future using the one
single public Linux KPI interface to map to a native FreeBSD vm_page.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41256
2023-08-07 00:57:42 +00:00
Bjoern A. Zeeb
9e9c682ff3 LinuxKPI: reduce usage of struct vm_page and vm_page_t
We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.

This should be a NOP.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D41255
2023-08-07 00:55:30 +00:00
Bjoern A. Zeeb
f74c09f3ec LinuxKPI: pci.h add more constants
Add two more PCI_EXP_LNKSTA_CLS constants to the compat defines
needed by wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	manu, emaste
Differential Revision: https://reviews.freebsd.org/D41258
2023-08-07 00:54:03 +00:00
Bjoern A. Zeeb
1dcd1a5392 LinuxKPI: implement get_random_u32_inclusive()
Implementation of get_random_u32_inclusive().
This is needed by an update for wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Differential Revision: https://reviews.freebsd.org/D40121
2023-08-07 00:52:41 +00:00
Konstantin Belousov
676f02a482 acpi_spibus.c: fix i386 build
intmax_t requires %j format specifier, %z is for size_t.

Fixes:	7d380b986a
Sponsored by:	The FreeBSD Foundation
2023-08-07 00:09:52 +03:00
Sebastian Huber
15876d9fd8 sys/cdefs.h: fix for use __restrict in C++
Newlib shares large parts of <sys/cdefs.h> with FreeBSD and received
this bug report:

https://sourceware.org/pipermail/newlib/2023/020400.html

As an extension, GCC and clang offer C99-style restricted pointers in
C++ mode:
https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html

We notice that this extension is broken when including newlib headers:
restricted pointers are treated as ordinary pointers.

We traced this to the following section of
newlib/libc/include/sys/cdefs.h:

  /*
   * GCC 2.95 provides `__restrict' as an extension to C90 to support the
   * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
   * a way to define the `restrict' type qualifier without disturbing older
   * software that is unaware of C99 keywords.
   */
  #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
  #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
  #define	__restrict
  #else
  #define	__restrict	restrict
  #endif
  #endif

While the GCC __restrict extension was indeed introduced in GCC 2.95, it
is not limited to this version; the extension is also not limited to
C90:
https://gcc.gnu.org/gcc-2.95/c++features.html

Rewrite the logic in the header so that __restrict is kept alone when
available.

PR:	272723
MFC after:	1 week
2023-08-07 00:09:52 +03:00
Marius Strobl
9ec7a595ed mergemaster(8): Remove support for sparc64 2023-08-06 22:28:46 +02:00
Marius Strobl
76e3b8f54f nanobsd: Remove remainder of sparc64 support
Fixes:	25a66f1fb1 nanobsd: remove sparc64 embedded example
2023-08-06 22:28:13 +02:00
Marius Strobl
96c76d9306 exit1(): Revert sparc64 workaround
If this still is a problem on other architectures, it should be fixed
properly.

This reverts commit 5486ffc898.
2023-08-06 22:26:01 +02:00
Marius Strobl
ba3c1f5972 targets: Catch up with the removals of mips and sparc64 2023-08-06 22:25:37 +02:00
Robert Clausecker
66f5f4bffe share/man/man7/simd.7: document amd64/strchrnul SIMD implementaionts
While we are at it, remove mention of x86-64-v3 and v4 variants of
strlen(3) which were omitted when D40693 landed.

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
Differential Revision: https://reviews.freebsd.org/D41333
2023-08-06 16:05:09 +02:00
Robert Clausecker
61f4c4d3dd lib/libc/amd64/string: add strchrnul implementations (scalar, baseline)
A lot better than the generic (pre) implementaion.  We do not beat glibc
for long strings, likely due to glibc switching to AVX once the input is
sufficiently long.  X86-64-v3 and v4 implementations may be added at a
future time.

os: FreeBSD
arch: amd64
cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
        │ strchrnul_pre.out │         strchrnul_scalar.out         │       strchrnul_baseline.out        │
        │      sec/op       │    sec/op     vs base                │   sec/op     vs base                │
Short          129.68µ ± 3%    59.91µ ± 1%  -53.80% (p=0.000 n=20)   44.37µ ± 1%  -65.79% (p=0.000 n=20)
Mid             21.15µ ± 0%    19.30µ ± 0%   -8.76% (p=0.000 n=20)   12.30µ ± 0%  -41.85% (p=0.000 n=20)
Long           13.772µ ± 0%   11.028µ ± 0%  -19.92% (p=0.000 n=20)   3.285µ ± 0%  -76.15% (p=0.000 n=20)
geomean         33.55µ         23.36µ       -30.37%                  12.15µ       -63.80%

        │ strchrnul_pre.out │          strchrnul_scalar.out          │         strchrnul_baseline.out         │
        │        B/s        │      B/s       vs base                 │      B/s       vs base                 │
Short          919.3Mi ± 3%   1989.7Mi ± 1%  +116.45% (p=0.000 n=20)   2686.8Mi ± 1%  +192.28% (p=0.000 n=20)
Mid            5.505Gi ± 0%    6.033Gi ± 0%    +9.60% (p=0.000 n=20)    9.466Gi ± 0%   +71.97% (p=0.000 n=20)
Long           8.453Gi ± 0%   10.557Gi ± 0%   +24.88% (p=0.000 n=20)   35.441Gi ± 0%  +319.26% (p=0.000 n=20)
geomean        3.470Gi         4.983Gi        +43.62%                   9.584Gi       +176.22%

For comparison, glibc on the same machine:

        │ strchrnul_glibc.out │
        │       sec/op        │
Short             49.73µ ± 0%
Mid               14.60µ ± 0%
Long              1.237µ ± 0%
geomean           9.646µ

        │ strchrnul_glibc.out │
        │         B/s         │
Short            2.341Gi ± 0%
Mid              7.976Gi ± 0%
Long             94.14Gi ± 0%
geomean          12.07Gi

Sponsored by:	The FreeBSD Foundation
Approved by:	mjg
Differential Revision: https://reviews.freebsd.org/D41333
2023-08-06 15:58:27 +02:00
Vladimir Kondratyev
f1d955be2a hidraw(4): Implement HIDRAW_GET_DEVICEINFO ioctl
In commit c77bfaa750 uhid(4) gained support for ioctl from
USB_GET_DEVICEINFO. This is used in libraries like libfido2 to
retrieve information about a device.

This commit adds binary compatible version to hidraw(4).

PR:		264843
MFC after:	1 month
Requested by:	grembo
2023-08-06 14:51:08 +03:00
Vladimir Kondratyev
12f5f11477 hidraw(4): Fix ioctl names in man page. 2023-08-06 14:51:08 +03:00
Kirk McKusick
4ce2a2db41 Update newfs(8) and tunefs(8) manual pages.
Delete note that UFS/FFS filesystems running with journaled soft updates
cannot run background fsck as 344b5bf made it possible to do so.

MFC-with:     344b5bf
Sponsored-by: The FreeBSD Foundation
2023-08-05 23:40:26 -07:00
Kirk McKusick
02b7bf07c5 Improve dumpfs(8) error messages when a cylinder group read fails.
Previously dumpfs(8) exited when a cylinder group read failed (such
as a cylinder-group check-hash failure). Now an error message
indicating the cylinder group number and the type of failure is
printed and the output continues for the remaining cylinder groups.

MFC-after:    1 week
Sponsored-by: The FreeBSD Foundation
2023-08-05 23:10:15 -07:00
Ed Maste
1a6238d1ea sigexit: add a break in default case
Suggested by:	markj
Fixes:		6edbe5616c ("Provide some more information for...")
Sponsored by:	The FreeBSD Foundation
2023-08-05 19:21:11 -04:00
Ed Maste
6edbe5616c Provide some more information for userland core dumps
Previously the log message indicated only "(core dumped)" if a core was
successfully created, or nothing if it was not. This provides
insufficient information to faciliate debugging. Dtrace is no help as
coredump() is static and we cannot find the return value via fbt.
Expand the log message to include error return value information.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39942
2023-08-05 19:18:35 -04:00
Mike Karels
6f15b7e199 ldconfig script: enable 32-bit compat on aarch64
Add aarch64 to set of architectures that support 32-bit compat
libraries.
2023-08-05 07:37:39 -05:00
Michael Tuexen
10b2b30670 sctp: improve consistency
MFC after:	1 week
2023-08-05 11:29:23 +02:00
Michael Tuexen
e3771cc034 sctp: remove redundant check
This is already checked by the caller.

MFC after:	1 week
2023-08-05 11:26:45 +02:00
Doug Rabson
1d7ffb373c pkgbase: reorganise caroot and openssl packages
This splits out the certctl utility into a new certctl package and the
openssl libs into an openssl-lib package.

PR:		272816
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D41321
2023-08-05 09:30:35 +01:00
Jessica Clarke
995d2b3e3b ObsoleteFiles.inc: Don't try and delete /usr/lib32/libdtrace.so.2
OLD_FILES and OLD_LIBS implicitly include the libcompat variant, whereas
MOVED_LIBS exists specifically for files that have moved between /lib
and /usr/lib, and thus don't get a libcompat equivalent.

Reported by:	des
Fixes:		5fd1da4d85 ("ObsoleteFiles.inc: Add an entry for libdtrace.so.2 in /usr/lib")
2023-08-05 07:02:27 +01:00
Doug Moore
e77f4e7f59 vm_phys: tune vm_phys_enqueue_contig loop
Rewrite the final loop in vm_phys_enqueue_contig as a new function,
vm_phys_enq_beg, to reduce amd64 code size.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D41289
2023-08-04 21:09:39 -05:00
Ed Maste
dedc71fd38 libc: unsplit log message to to make it greppable in src
Also use __func__ rather than hardcoding the function name.  This code
now fits in 80 columns without splitting the log message.

Reviewed by:	zlei
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39619
2023-08-04 20:59:30 -04:00
Igor Ostapenko
452661c967 exit1(): fix a comment typo
Signed-off-by: Igor Ostapenko <pm@igoro.pro>
Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/809
2023-08-04 20:42:07 -04:00
Jessica Clarke
106c9ff5ac stand: Export _start on arm like other architectures
By not exporting _start, we get various warnings of the form:

  ld: warning: cannot find entry symbol _start

Note that in practice these don't matter because we manually construct
our PE header and use objcopy -O binary, so the entry point is set to
whatever we put explicitly in the PE header, but we should still do the
right thing and silence these warnings.

This was found in CheriBSD, where bsd.prog.mk has similar logic to
bsd.lib.mk and sets -Wl,--(no-)fatal-warnings based on LD_FATAL_WARNINGS
(unlike FreeBSD which only does so in the latter).
2023-08-05 01:14:16 +01:00
John Baldwin
aca3d65fed netsmb: Add bounds checking to smb_t2_placedata
Verify that the requested region of the mbuf chain is not beyond the
end of the chain before trimming it from the end.  If it is out of
bounds, fail with an error (EPROTO).

While here, properly handle the case that the amount of data at the
end of the chain might span more than one mbuf by using m_adj to drop
the extra bytes rather than assuming m_len of the last mbuf can be
adjusted directly.

PR:		258504
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Co-authored-by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41229
2023-08-04 16:42:41 -07:00
John Baldwin
4af849d71f cd9660: Reject volumes with small logical block sizes
ISO9660 permits specifying a logical block size that is any power of 2
greater than or equal to 512.  The geom disk layer requires requests
to be aligned on sector boundaries of the provider.  With a volume
that uses a logical block size smaller than the underlying disk sector
size (e.g. a logical block size of 512 or 1024 on a CD which uses 2048
byte sectors), the current cd9660 vfs can issue requests for partial
sectors, or on non-sector boundaries.

Fixing this properly would require wrapping all of the calls to
bread*/bwrite* in cd9660 vfs to roundup requests to be on sector
boundaries which can include both the length, but also the starting
sector number (and thus requiring use of an offset relative to b_data
in the resulting buf).

These images do not seem to be common however given that no one has
fixed this in cd9660's vfs in the past few decades, so just reject
them during mount with an error.  If such images are found to be used
in the wild in practice, then the larger fix can be applied.

PR:		258063
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41228
2023-08-04 16:41:50 -07:00
John Baldwin
4c89c0127d g_raid concat: Fail requests to read beyond the end of the volume
Previously a debug kernel would trigger an assertion failure if an I/O
request attempted to read off the end of a concat volume, but a
non-debug kernel would use an invalid sub-disk to try to complete the
request eventually resulting in some sort of fault in the kernel.

Instead, turn the assertions into explicit checks that fail requests
beyond the end of the volume with EIO.  For requests which run over
the end of the volume, return a short request.

PR:		257838
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41222
2023-08-04 16:41:05 -07:00
John Baldwin
c70e615051 udf: Reject read requests with an invalid length
- If the size is negative or if rounding it up to a multiple of
  the block size overflows, fail the read request with ERANGE.

- While here, add a sanity check that the ICB length for the root
  directory is at least as long as a minimum-sized file entry.

PR:		257768
Reported by:	Robert Morris <rtm@lcs.mit.edu>
MFC after:	1 week
Sponsored by:	FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D41220
2023-08-04 16:40:19 -07:00
Konstantin Belousov
9e6941a2c7 udf: reject invalid block sizes from lvd
PR:	272893
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-08-05 01:49:36 +03:00
Michael Tuexen
efb04fb404 sctp: improve consistency of acc and ccc handling in snd buffer
Don't clear the counters for the socket snd buffer when
shutdown(..., SHUT_WR) or shutdown(..., SHUT_RDWR) is called.
This was causing the system to panic() when SCTP pf tests were
running.

Reported by:	dchagin, kp
MFC after:	1 week
2023-08-04 08:32:25 +02:00
Doug Moore
ccdb28275d vm_phys_enq_range: no alignment assert for npages==0
Do not assume that when vm_phys_enq_range is passed npages==0 that the
vm_page argument is valid in any way, much less that it has a
page-aligned address. Just don't look at it. Assert nothing about it.

Reported by:	karels
Differential Revision:	https://reviews.freebsd.org/D41317
2023-08-04 13:41:59 -05:00
Andrew Turner
a0e20c0ded Limit the number of CPUs in the gicv1/2 driver
The GICv2 can only send IPIs to 8 CPUs. Because of this it should only
be in machines with no more than 8 cores.

Create a new macro to hold this limit to reduce the size of the softc.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D41322
2023-08-04 18:47:47 +01:00
Ed Maste
348bea10b6 openssh: retire HPN option handling
The HPN patch set was removed from base system SSH in January 2016, in
commit 60c59fad88.  We retained the option parsing (using OpenSSH's
support for deprecated options) to avoid breaking existing installations
upon upgrade, but sufficient time has now passed that we can remove this
special case.

Approved by:	des
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41291
2023-08-04 13:29:04 -04:00
Mark Johnston
78cc000cba amd64: Increase sanitizers' static shadow memory reservation
Because KASAN shadows the kernel image itself (KMSAN currently does
not), a shadow mapping of the boot stack must be created very early
during boot.  pmap_san_enter() reserves a fixed number of pages for the
purpose of creating and mapping this shadow region.

After commit 789df254cc ("amd64: Use a larger boot stack"), it could
happen that this reservation is insufficient; this happens when
bootstack crosses a PAGE_SHIFT + KASAN_SHADOW_SCALE_SHIFT boundary.
Update the calculation to take into account the new size of the boot
stack.

Fixes:		789df254cc ("amd64: Use a larger boot stack")
Sponsored by:	The FreeBSD Foundation
2023-08-04 12:38:24 -04:00
Dag-Erling Smørgrav
9c2823bae9 pam_krb5: Rename a variable.
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D41300
2023-08-04 16:08:38 +00:00