freebsd.git
2 years agosqlite3: Vendor import of sqlite3 3.39.3
Cy Schubert [Tue, 20 Sep 2022 04:37:59 +0000 (21:37 -0700)]
sqlite3: Vendor import of sqlite3 3.39.3

Changes at https://www.sqlite.org/releaselog/3_39_3.html.

Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3390300.tar.gz

Merge commit 'c51041e1ade322127d8dd584b6e9e5c355f11daa'

2 years agosqlite3: Vendor import of sqlite3 3.39.3
Cy Schubert [Tue, 20 Sep 2022 03:07:59 +0000 (20:07 -0700)]
sqlite3: Vendor import of sqlite3 3.39.3

Changes at https://www.sqlite.org/releaselog/3_39_3.html.

Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3390300.tar.gz

2 years agosqlite3: Vendor import of sqlite3 3.39.3
Cy Schubert [Tue, 20 Sep 2022 03:07:59 +0000 (20:07 -0700)]
sqlite3: Vendor import of sqlite3 3.39.3

Changes at https://www.sqlite.org/releaselog/3_39_3.html.

Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3390300.tar.gz

2 years agopseudofs: use the vget_prep/vget_finish idiom
Mateusz Guzik [Mon, 19 Sep 2022 20:07:10 +0000 (20:07 +0000)]
pseudofs: use the vget_prep/vget_finish idiom

2 years agozfs: stop passing LK_INTERLOCK to VOP_LOCK
Mateusz Guzik [Mon, 19 Sep 2022 20:03:01 +0000 (20:03 +0000)]
zfs: stop passing LK_INTERLOCK to VOP_LOCK

There is an ongoing effort to eliminate this feature.

2 years agomsun: correct comment
Steve Kargl [Mon, 19 Sep 2022 18:38:48 +0000 (21:38 +0300)]
msun: correct comment

The comment in msun/src/e_jn.c lacks proper grammar, and is incorrect on
the choice of normalization entity.

PR: 266503
MFC after: 3 days

2 years agotcpcb: fix tabulation count in i4012ef7754c and abbreviate "packets"
Gleb Smirnoff [Mon, 19 Sep 2022 17:29:53 +0000 (10:29 -0700)]
tcpcb: fix tabulation count in i4012ef7754c and abbreviate "packets"

This lines up comments to the rest of the file.  Abbreviation
helps to fit in to 80 char terminal.  Not a functional change.

2 years agoCorrect IPv6 MLD group state string table
Sébastien BINI [Fri, 16 Sep 2022 13:58:52 +0000 (09:58 -0400)]
Correct IPv6 MLD group state string table

MLD_REPORTING_MEMBER was missing

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

2 years agotcp: fix computation of offset
Michael Tuexen [Mon, 19 Sep 2022 10:42:43 +0000 (12:42 +0200)]
tcp: fix computation of offset

Only update the offset if actually retransmitting from the
scoreboard. If not done correctly, this may result in
trying to (re)-transmit data not being being in the socket
buffe and therefore resulting in a panic.

PR: 264257
PR: 263445
PR: 260393
Reviewed by: rscheff@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D36626

2 years agoigc: Don't start in promiscious mode by default
Hubert Mazur [Fri, 16 Sep 2022 11:37:12 +0000 (13:37 +0200)]
igc: Don't start in promiscious mode by default

The igc driver always sets the promiscious mode during initialization,
ignoring what is set in ifp.
Fix this by checking the interface flags and setting mode appropriately.

Reviewed by: grehan
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36591

2 years agogpio: Merge TCA6416 & TCA6408 drivers into TCA64XX
Jakub Kołodziej [Fri, 16 Sep 2022 11:33:40 +0000 (13:33 +0200)]
gpio: Merge TCA6416 & TCA6408 drivers into TCA64XX

This merges TCA6416, TCA6408 drivers and adds PCA9555 support.
They handle 8 pin and 16 pin ICs with basic INPUT/OUTPUT functionality.
The register map is fairly similar so there is no point in having two
separate drivers.

Reviewed by: kd
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36559

2 years agovfs: silence a bogus LOR in freevnode
Mateusz Guzik [Mon, 12 Sep 2022 23:40:22 +0000 (23:40 +0000)]
vfs: silence a bogus LOR in freevnode

Reported by: imp

2 years agortld-elf/libmap.c: correct comment
Konstantin Belousov [Sun, 18 Sep 2022 22:16:52 +0000 (01:16 +0300)]
rtld-elf/libmap.c: correct comment

There is no intent to support TLS for rtld.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agortld-elf/libmap.h: style declarations
Konstantin Belousov [Sun, 18 Sep 2022 22:06:33 +0000 (01:06 +0300)]
rtld-elf/libmap.h: style declarations

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agortld-elf/libmap.h: add include guard
Konstantin Belousov [Sun, 18 Sep 2022 22:05:06 +0000 (01:05 +0300)]
rtld-elf/libmap.h: add include guard

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agovfs: indent V_VALID_FLAGS with a tab
Mateusz Guzik [Sun, 18 Sep 2022 21:32:25 +0000 (21:32 +0000)]
vfs: indent V_VALID_FLAGS with a tab

Requested by: kib

2 years agorb_tree: silence unused function warnings
Doug Moore [Sun, 18 Sep 2022 08:34:47 +0000 (03:34 -0500)]
rb_tree: silence unused function warnings

With DIAGNOSTIC set a kernel build generates warnings about the
defined-but-unused RB_RANK method. Don't set _RB_DIAGNOSTIC
automatically, to silence these warnings.

Reported by: mjguzik@gmail.com
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D36617

2 years agolinuxkpi: use SI_SUB_EVENTHANDLER + 1, like other consumers
Mateusz Guzik [Sat, 17 Sep 2022 23:41:46 +0000 (23:41 +0000)]
linuxkpi: use SI_SUB_EVENTHANDLER + 1, like other consumers

Otherwise it may try to initialize before eventhandler subsystem.

2 years agostand: Pass in the proper size for bootinfo
Warner Losh [Sat, 17 Sep 2022 21:15:51 +0000 (15:15 -0600)]
stand: Pass in the proper size for bootinfo

Missed one sizeof(bi) -> sizeof(*bi) in 9758dd3de1cdd conversion to
allocating bootinfo.

Noticed by: tijl@
Fixes: 9758dd3de1cdd
Sponsored by: Netflix

2 years agovfs: introduce V_PCATCH to stop abusing PCATCH
Mateusz Guzik [Sat, 17 Sep 2022 15:22:04 +0000 (17:22 +0200)]
vfs: introduce V_PCATCH to stop abusing PCATCH

2 years agovfs: deperl msleep flag calculation in vn_start_*write
Mateusz Guzik [Sat, 17 Sep 2022 15:17:20 +0000 (17:17 +0200)]
vfs: deperl msleep flag calculation in vn_start_*write

2 years agovfs: clean up parse_mount_dev_present
Mateusz Guzik [Sat, 17 Sep 2022 12:42:46 +0000 (12:42 +0000)]
vfs: clean up parse_mount_dev_present

2 years agozfs: don't access nameidata unless namei succeeded
Mateusz Guzik [Sat, 17 Sep 2022 12:25:59 +0000 (12:25 +0000)]
zfs: don't access nameidata unless namei succeeded

2 years agoThere's no PEM(3) anywhere around; delete reference.
Jens Schweikhardt [Sat, 17 Sep 2022 11:14:01 +0000 (13:14 +0200)]
There's no PEM(3) anywhere around; delete reference.

2 years agoReference correct section for free(3).
Jens Schweikhardt [Sat, 17 Sep 2022 11:11:42 +0000 (13:11 +0200)]
Reference correct section for free(3).

2 years agovfs: fix non-INVARIANTS build after 5b5b7e2ca2fa9a2418dd51749f4ef6f881ae7179
Mateusz Guzik [Sat, 17 Sep 2022 10:45:12 +0000 (10:45 +0000)]
vfs: fix non-INVARIANTS build after 5b5b7e2ca2fa9a2418dd51749f4ef6f881ae7179

Reported by: gj

2 years agovfs: fixup parse_mount_dev_present after 5b5b7e2ca2fa9a2418dd51749f4ef6f881ae7179
Mateusz Guzik [Sat, 17 Sep 2022 10:35:00 +0000 (10:35 +0000)]
vfs: fixup parse_mount_dev_present after 5b5b7e2ca2fa9a2418dd51749f4ef6f881ae7179

Reported by: kib

2 years agovfs: always retain path buffer after lookup
Mateusz Guzik [Sat, 17 Sep 2022 09:10:38 +0000 (09:10 +0000)]
vfs: always retain path buffer after lookup

This removes some of the complexity needed to maintain HASBUF and
allows for removing injecting SAVENAME by filesystems.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D36542

2 years agovfs: move cn_nameptr assignment out of namei_getpath
Mateusz Guzik [Sat, 17 Sep 2022 00:59:32 +0000 (00:59 +0000)]
vfs: move cn_nameptr assignment out of namei_getpath

2 years agovfs: slightly reorganize error handling in chroot
Mateusz Guzik [Sat, 17 Sep 2022 01:19:42 +0000 (01:19 +0000)]
vfs: slightly reorganize error handling in chroot

This avoids duplicated NDFREE_NOTHING which will be of importance
later.

2 years agovm/vm.h: cleanup
Konstantin Belousov [Fri, 16 Sep 2022 22:44:39 +0000 (01:44 +0300)]
vm/vm.h: cleanup

Move declarations for in-kernel function and variables to _KERNEL
section.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36612

2 years agoktrace: make ktr_tid a long not intptr_t (NFC)
Brooks Davis [Sat, 17 Sep 2022 08:21:32 +0000 (09:21 +0100)]
ktrace: make ktr_tid a long not intptr_t (NFC)

Long ago, ktr_tid was ktr_buffer which pointed to the buffer following
the header and was used internally in the kernel.  Use was removed in
efbbbf570d70b and it was repurposed as ktr_kid in c6854c347f4d8.  For
ABI reasons, it stayed an intptr_t rather than becoming an lwpid_t at
the time.  Since it doesn't hold a pointer any more (unless you have
a ktrace.out from 2005), change the type to long which is alwasy the
same size on all supported architectures.  Add a suggestion to change
the type to lwpid_t (__int32_t) on a future ABI break.

Remove most remaining references to ktr_buffer, retaing a comment in
kdump.c explaining why negative values are treated as 0.  While here,
accept that pid_t and lwpid_t are of type int and simplify casts in
printf.

This changed was motivated by CheriBSD where intptr_t is 16-bytes
in the pure-capability ABI.

Reviewed by: kib, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D36599

2 years agoChange sysctl section to 3 as suggested by Benjamin Kaduk.
Jens Schweikhardt [Sat, 17 Sep 2022 07:35:49 +0000 (09:35 +0200)]
Change sysctl section to 3 as suggested by Benjamin Kaduk.

2 years agoSPDX: Not BSD-4-Clause
Warner Losh [Sat, 17 Sep 2022 03:47:23 +0000 (21:47 -0600)]
SPDX: Not BSD-4-Clause

This is not BSD-4-Clause. It's closer to a modified BSD-2-Clause with 2
added clauses (and the first one has added clauses). Remove
SPDX-License-Idnetifier since this license doesn't match anything in
SPDX.

2 years agorelease/rc.local: Provide option to shutdown after installation complete
Ben Woods [Wed, 14 Sep 2022 13:03:22 +0000 (21:03 +0800)]
release/rc.local: Provide option to shutdown after installation complete

This can be useful instead of reboot if installing in a virtual machine,
and the user wants to modify the VM hardware or virtual media mounts
prior to booting into the newly installed system.

Reported by: Juan Manuel Palacios (@jmp_imaginarium on Twitter)
Approved by: philip
Differential Revision: https://reviews.freebsd.org/D36560

2 years agojemalloc: Define SWAP_RESERVE_* if not provided by the system headers
Konstantin Belousov [Fri, 16 Sep 2022 21:08:03 +0000 (00:08 +0300)]
jemalloc: Define SWAP_RESERVE_* if not provided by the system headers

instead ifdef-ing out the return statement.

Reported by: Mark Millard <marklmi@yahoo.com>
Fixes: 87384c51e047
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

2 years agoCorrect a typo in man page references: rpcset_gss -> rpcsec_gss.
Jens Schweikhardt [Fri, 16 Sep 2022 20:37:20 +0000 (22:37 +0200)]
Correct a typo in man page references: rpcset_gss -> rpcsec_gss.

2 years agoiommu_gas: don't remove and insert boundary entry
Doug Moore [Fri, 16 Sep 2022 20:32:11 +0000 (15:32 -0500)]
iommu_gas: don't remove and insert boundary entry

Avoid removing an item in iommu_gas_free_region only to reinsert it,
by avoiding removing an entry that is either first_place or
last_place.

Reviewed by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36597

2 years agortld: teach LD_SHOW_AUXV about AT_USRSTACK*
Konstantin Belousov [Thu, 15 Sep 2022 10:16:30 +0000 (13:16 +0300)]
rtld: teach LD_SHOW_AUXV about AT_USRSTACK*

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agolibthr: extract code to get main stack base and size into helpers
Konstantin Belousov [Tue, 13 Sep 2022 22:14:24 +0000 (01:14 +0300)]
libthr: extract code to get main stack base and size into helpers

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agolibc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") and get_rl...
Konstantin Belousov [Mon, 12 Sep 2022 19:45:21 +0000 (22:45 +0300)]
libc, libthr: use AT_USRSTACK{BASE,LIM} instead of sysctl("kern.usrstack") and get_rlimit(RLIMIT_STACK)

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agolibthr: use nitems() for mib length
Konstantin Belousov [Mon, 12 Sep 2022 20:24:55 +0000 (23:24 +0300)]
libthr: use nitems() for mib length

Suggested by: imp
Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agojemalloc: use auxv ELF_BSDF_VMNOOVERCOMMIT instead of sysctl("vm.overcommit")
Konstantin Belousov [Mon, 12 Sep 2022 19:44:37 +0000 (22:44 +0300)]
jemalloc: use auxv ELF_BSDF_VMNOOVERCOMMIT instead of sysctl("vm.overcommit")

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agoauxv.3: Document AT_USRSTACKBASE and AT_USRSTACKLIM
Konstantin Belousov [Thu, 15 Sep 2022 10:08:59 +0000 (13:08 +0300)]
auxv.3: Document AT_USRSTACKBASE and AT_USRSTACKLIM

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agoprocstat(1): print AT_USRSTACKBASE and AT_USRSTACKLIM
Konstantin Belousov [Thu, 15 Sep 2022 10:14:17 +0000 (13:14 +0300)]
procstat(1): print AT_USRSTACKBASE and AT_USRSTACKLIM

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years ago_elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM}
Konstantin Belousov [Mon, 12 Sep 2022 19:36:24 +0000 (22:36 +0300)]
_elf_aux_info(3): add support for AT_USRSTACK{BASE,LIM}

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agoAdd AT_USRSTACK{BASE, LIM} AT vectors, and ELF_BSDF_VMNOOVERCOMMIT flag
Konstantin Belousov [Mon, 12 Sep 2022 19:32:02 +0000 (22:32 +0300)]
Add AT_USRSTACK{BASE, LIM} AT vectors, and ELF_BSDF_VMNOOVERCOMMIT flag

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agojemalloc: use symbolic definitions for bits in vm_overcommit
Konstantin Belousov [Thu, 15 Sep 2022 09:59:42 +0000 (12:59 +0300)]
jemalloc: use symbolic definitions for bits in vm_overcommit

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agoswap_pager: style, wrap long lines
Konstantin Belousov [Tue, 13 Sep 2022 10:03:11 +0000 (13:03 +0300)]
swap_pager: style, wrap long lines

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agovm_overcommit: put into __read_mostly section
Konstantin Belousov [Tue, 13 Sep 2022 10:00:12 +0000 (13:00 +0300)]
vm_overcommit: put into __read_mostly section

Suggested by: mjg
Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agovm: make vm.overcommit available externally
Konstantin Belousov [Mon, 12 Sep 2022 19:31:30 +0000 (22:31 +0300)]
vm: make vm.overcommit available externally

Reviewed by: brooks, imp (previous version)
Discussed with: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D36540

2 years agoctime.3: Add a note about a possible return value of localtime(3)
Gordon Bergling [Fri, 16 Sep 2022 18:38:58 +0000 (20:38 +0200)]
ctime.3: Add a note about a possible return value of localtime(3)

The localtime(3) function returns a NULL pointer, if the passed in-time
translates to a year that will not fit in an integer type. It is stricly
recommended to check the return value to avoid garage output.

Reported by: mckusick
Reviewed by: mckusick, imp, rpokala
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36515

2 years agoFix dead references (wrong section) to sysctl(8).
Jens Schweikhardt [Fri, 16 Sep 2022 18:00:49 +0000 (20:00 +0200)]
Fix dead references (wrong section) to sysctl(8).

2 years agoMore precise language: what is called data pointer, C calls object pointer.
Jens Schweikhardt [Fri, 16 Sep 2022 17:40:11 +0000 (19:40 +0200)]
More precise language: what is called data pointer, C calls object pointer.

Also delete reference to non-existing lint(1).

2 years agoFix dead refs to pam(8) with pam(3) as well as some other PAM functions.
Jens Schweikhardt [Fri, 16 Sep 2022 17:32:11 +0000 (19:32 +0200)]
Fix dead refs to pam(8) with pam(3) as well as some other PAM functions.

2 years agolocks: whack a failed experiment in form of restrict_starvation
Mateusz Guzik [Fri, 16 Sep 2022 17:28:35 +0000 (17:28 +0000)]
locks: whack a failed experiment in form of restrict_starvation

This was never enabled and only pollutes the code. The issue will
be addressed later in a different manner.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoFix dead reference to boot0(8) to point to boot0cfg(8).
Jens Schweikhardt [Fri, 16 Sep 2022 17:08:22 +0000 (19:08 +0200)]
Fix dead reference to boot0(8) to point to boot0cfg(8).

2 years agoCorrect wrong sections for bpf and pcap.
Jens Schweikhardt [Fri, 16 Sep 2022 17:03:37 +0000 (19:03 +0200)]
Correct wrong sections for bpf and pcap.

2 years agostand: fix mismerge
Warner Losh [Fri, 16 Sep 2022 16:54:04 +0000 (10:54 -0600)]
stand: fix mismerge

Remove stray line from mismerge of 5d1531d9d4e7. This is no longer
needed.

Fixes: 5d1531d9d4e7
Sponsored by: Netflix

2 years agostand/elf: Only support swapping headers on powerpc.
Warner Losh [Fri, 16 Sep 2022 15:10:14 +0000 (09:10 -0600)]
stand/elf: Only support swapping headers on powerpc.

Powerpc is currently the only architecture that we support more than one
endian. It's the only one that benefits from this swapping, so restrict
the code to there. This saves about 1k in the i386 BIOS loader.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36577

2 years agostand: Allocate bootinfo rather than have it be static
Warner Losh [Fri, 16 Sep 2022 15:09:41 +0000 (09:09 -0600)]
stand: Allocate bootinfo rather than have it be static

This saves 80 bytes (the new bootinfo structure was 84 bytes, and a
pointer is 4 bytes). The bi_load32 code is the same size.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D36575

2 years agoi386: Make boot loader smaller by reducing size of bootinfo
Warner Losh [Fri, 16 Sep 2022 15:09:26 +0000 (09:09 -0600)]
i386: Make boot loader smaller by reducing size of bootinfo

We don't need the 56 bytes at the end of bootinfo, and never had.  Don't
copy them from old boot loaders, and don't provide them with new boot
loaders.

Add comments about what versions of FreeBSD 'old' means in various
contexts. Add note that old disk loader (from 1.x/2.x) is doomed to
failure because it doesn't provide metadata that we now require to boot,
and has been since approximately FreeBSD 7.x. Retain all this
information to explain why we have 4 arguments that are always 0, even
though it's ancient history.

This saves 56 bytes in the boot loader.

Sponsored by: Netflix
Reviewed by: phk, rgrimes, kib
Differential Revision: https://reviews.freebsd.org/D36550

2 years agoi386: Mark the obsolete fields in bootinfo with _was_
Warner Losh [Fri, 16 Sep 2022 15:09:16 +0000 (09:09 -0600)]
i386: Mark the obsolete fields in bootinfo with _was_

Mark the obsolete fields in bootinfo with _was_. Note that the fields
from bi_memdesc_version to the end of the structure never were used in a
release. They were added in April 2010 for i386 EFI booting. The boot
loader set these fields though 2019, but no kernel ever looked at them
and we never supported i386 EFI booting, and likely never will in this
form. They can likely be deleted entirely in the future, but locore.S
needs to change to do that (it also needs to change to drop support for
really old booting scenarios as well, which will eliminate bi_endcommon
too).

All the other fields haven't been used since the 4.x -> 5.x cutover of
the wdc driver to ata.

The bi_bios_dev field is used in the handoff between bootXX and the
loader. The loader uses it to determine what disk it was loaded off of
to detmerine the default root filesystem. It's not used by the i386
kernel anymore to determine anything.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D36544

2 years agostand: Stop support booting 4.x and earlier kernels
Warner Losh [Fri, 16 Sep 2022 15:09:07 +0000 (09:09 -0600)]
stand: Stop support booting 4.x and earlier kernels

FreeBSD 4.x and earlier used the bi_bios_geom to get the geometry of the
device. Starting in 5.x, with the wdc -> ata rewrite, it was used only
in pc98 kernels to report geometry of the drives. It can be safely
removed as booting kernels this old is no longer supported. This saves
176 bytes in the BIOS loader.

Sponsored by: Netflix
Reviewed by: adrian, emaste
Differential Revision: https://reviews.freebsd.org/D36543

2 years agostand: Remove dead store to bi_kernelname
Warner Losh [Fri, 16 Sep 2022 15:09:02 +0000 (09:09 -0600)]
stand: Remove dead store to bi_kernelname

We set this value twice: once to 0 and once to the VA that has the name
of the kernel. The first store is redundant. In addition, these two
stores of 0 are also redundant. Since we never set them, they will
always be zero, even if we're called multiple times. This saves 21
bytes on BIOS loader.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36541

2 years agostand: collapse all copies of *copyenv into md_copyenv
Warner Losh [Fri, 16 Sep 2022 15:08:57 +0000 (09:08 -0600)]
stand: collapse all copies of *copyenv into md_copyenv

Use the efi's bi_copyenv to md_copyenv and place it in modinfo.c. Remove
all other nearly identical and efi's has the best error handling.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36574

2 years agostand: Move MOD_xxx macros from modinfo.h to .c
Warner Losh [Fri, 16 Sep 2022 15:08:52 +0000 (09:08 -0600)]
stand: Move MOD_xxx macros from modinfo.h to .c

Now that MOD_xxx macros are modinfo.c, they don't need to be in
modinfo.h.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36573

2 years agostand: Move md_copymodules into modinfo.c and reduce copies
Warner Losh [Fri, 16 Sep 2022 15:08:47 +0000 (09:08 -0600)]
stand: Move md_copymodules into modinfo.c and reduce copies

md_copymodules, bi_copymdoules, bi_copymodules32 (x2) and
bi_copymodules64 (x2) are all the same routine... Replace them all with
md_copymodules. This saves about 800 bytes on i386 BIOS loader, which is
a nice bonus.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36572

2 years agostand: Create common/modinfo.h
Warner Losh [Fri, 16 Sep 2022 15:08:42 +0000 (09:08 -0600)]
stand: Create common/modinfo.h

Move all the MOD_xxx macros to this header. Each user of this interface
is currently required to define MOD_ALIGNMENT(l). modinfo was selected
because it sits inbetween modules and metadata and will make it easier
to migrate to new, shared intefaces.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36571

2 years agostand: Create MOD_ALIGN macro and use it everywhere
Warner Losh [Fri, 16 Sep 2022 15:08:37 +0000 (09:08 -0600)]
stand: Create MOD_ALIGN macro and use it everywhere

To further reduce the differences between the different MOD_xxx macros,
use MOD_ALIGN to do the proper alignment for the given use.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36570

2 years agostand: use archsw.arch_copyin instead of direct call
Warner Losh [Fri, 16 Sep 2022 15:08:32 +0000 (09:08 -0600)]
stand: use archsw.arch_copyin instead of direct call

This replaces the CALLBACK(copyin, ...) with a call to
archsw.arch_copyin which points to a function that does the
callback. More diff reduction for the multiple copies of these routines
in the tree.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36569

2 years agostand: use archsw.arch_copyin instead of i386_copyin
Warner Losh [Fri, 16 Sep 2022 15:08:23 +0000 (09:08 -0600)]
stand: use archsw.arch_copyin instead of i386_copyin

Since archsw.arch_copyin is always i386_copyin, this will be a nop in
terms of functionality. This is a diff reduction against other copies of
the code that differ only by what copyin routine they call.

Sponsored by: Netflix
Reviewed by: tsoome
Differential Revision: https://reviews.freebsd.org/D36568

2 years agosound: add patch for Lenovo Legion 5 Intel
Nuno Teixeira [Fri, 16 Sep 2022 13:29:30 +0000 (14:29 +0100)]
sound: add patch for Lenovo Legion 5 Intel

Laptop Legion Lenovo 5 15MH05 (Intel)

Patch to fix the sound on this machine.
It requires sending the speaker and the headphone jack to the same nid.

PR: 265632
Approved by: emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D36511

2 years agobridge.4: describe new MTU behaviour
Kristof Provost [Thu, 15 Sep 2022 06:26:49 +0000 (08:26 +0200)]
bridge.4: describe new MTU behaviour

1865ebfb12 changed if_bridge to have it change the MTU on newly added
interfaces to match the if_bridge MTU, rather than rejecting them for
having an incorrect MTU.

Update the man page to reflect this, as pointed out by woodsb02.

Reviewed by: woodsb02
Differential Revision: https://reviews.freebsd.org/D36481

2 years agouname.1: Clarify the -r option
Gordon Bergling [Fri, 16 Sep 2022 11:27:54 +0000 (13:27 +0200)]
uname.1: Clarify the -r option

It is some times hard to understand the difference between
kernel version and userland version. So clarify the -r option
of uname(1) in terms of a printed kernel version.

While here, add some cross references:

- cross reference freebsd-version(1) in uname(1)
- cross reference freebsd-version(1) and uname(1) in freebsd-update(8)

PR: 265594
Reported by: rwatson
Reviewed by: gbe, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36516

2 years agoarch: armv4 isn't supported either on aarch64 running in aarch32 mode
Warner Losh [Thu, 15 Sep 2022 17:17:12 +0000 (11:17 -0600)]
arch: armv4 isn't supported either on aarch64 running in aarch32 mode

FreeBSD used to support both armv4 and armv5 binaries. All of that
support has been removed from the tree. We have only ever supported
armv6 and armv7 binaries in that mode. Note armv4 here too for
completeness since it flowed better than 'armv5 and earlier' and means
the same thing (FreeBSD never ran on an armv3 or earlier CPU).

Sponsored by: Netflix

2 years agofreebsd32: Make sendmsg match native ABI for unpadded final control message
Jessica Clarke [Thu, 15 Sep 2022 16:16:22 +0000 (17:16 +0100)]
freebsd32: Make sendmsg match native ABI for unpadded final control message

The API says that CMSG_SPACE should be used for msg_controllen, but in
practice the native ABI allows you to only use CMSG_LEN for the final
(typically only) control message, and real-world software does this,
including Wayland. For freebsd32, this is in practice mostly harmless,
since control messages are generally used to carry file descriptors,
which are already 4 bytes in size and thus no padding is needed, but
they can carry other quantities that may not result in an aligned
length. This was discovered after CheriBSD's freebsd64 equivalent was
updated to match the freebsd32 implementation, as that uses 8 byte
alignment which does break the file descriptor use case, and thus
Wayland.

This used to be addressed by aligning buflen before the first iteration,
but that allowed unwanted invalid inputs and was lost in 1b1428dcc82b,
with no safer equivalent put in its place.

Reviewed by: brooks, kib, markj
Obtained from: CheriBSD
Fixes: 1b1428dcc82b ("Fix a TOCTOU vulnerability in freebsd32_copyin_control().")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36554

2 years agoObsoleteFiles: fix some dates in my comments
Gleb Smirnoff [Thu, 15 Sep 2022 16:04:50 +0000 (09:04 -0700)]
ObsoleteFiles: fix some dates in my comments

2 years agostand/efi: Clean the proper files
Guido van Rooij [Thu, 15 Sep 2022 15:10:20 +0000 (09:10 -0600)]
stand/efi: Clean the proper files

Need to clean the specific loader we build, not the generic loader.efi

Reviewed by: imp

2 years agoAdd deprecation notices for OPIE.
Dag-Erling Smørgrav [Thu, 15 Sep 2022 14:21:33 +0000 (16:21 +0200)]
Add deprecation notices for OPIE.

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

2 years agoRetire ISA sound card DMA support
Ed Maste [Fri, 18 Mar 2022 16:22:21 +0000 (12:22 -0400)]
Retire ISA sound card DMA support

As all ISA sound card drivers have been removed sndbuf_dma no longer
serves any purpose.

Reviewed by: mav
Relnotes:  Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34671

2 years agotests/sys/fs: remove mips workaround
Mitchell Horne [Thu, 15 Sep 2022 13:57:43 +0000 (10:57 -0300)]
tests/sys/fs: remove mips workaround

MIPS is gone, so we no longer require this check.

Reviewed by: imp, asomers
Differential Revision: https://reviews.freebsd.org/D36566

2 years agopf tests: require scapy for ether:short_pkt
Mitchell Horne [Thu, 15 Sep 2022 13:57:07 +0000 (10:57 -0300)]
pf tests: require scapy for ether:short_pkt

The pft_ether.py script requires both python and scapy to be installed.
Check for this so we properly skip the test when it is unavailable.

Reviewed by: kp
Fixes: 07ffa50ba075d ("pf tests: test short packets")
Differential Revision: https://reviews.freebsd.org/D36561

2 years agoUpdate SEE ALSO sections for resolver.{3,5} and hosts.5
Gordon Bergling [Thu, 15 Sep 2022 13:24:28 +0000 (15:24 +0200)]
Update SEE ALSO sections for resolver.{3,5} and hosts.5

The mentioned document "Name Server Operations Guide for BIND" is
outdated, so remove it from the SEE ALSO section of hosts.5
and resolver.{3,5}.

PR: 266360
Reported by: Graham Perrin <grahamperrin at FreeBSD dot org>
Reviewed by: karels
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36557

2 years agoqlnxe(4): Fix a typo in a source code comment
Gordon Bergling [Thu, 15 Sep 2022 08:31:05 +0000 (10:31 +0200)]
qlnxe(4): Fix a typo in a source code comment

- s/paramters/parameters/

MFC after: 3 days

2 years agocxgbetool(8): Fix a typo in a source code comment
Gordon Bergling [Thu, 15 Sep 2022 08:29:54 +0000 (10:29 +0200)]
cxgbetool(8): Fix a typo in a source code comment

- s/paramter/parameter/

MFC after: 3 days

2 years agobootptest: Fix a typo in a source code comment
Gordon Bergling [Thu, 15 Sep 2022 08:28:52 +0000 (10:28 +0200)]
bootptest: Fix a typo in a source code comment

- s/avaible/available/

MFC after: 3 days

2 years agosafexcel: Fix a typo in a source code comment
Gordon Bergling [Thu, 15 Sep 2022 08:26:48 +0000 (10:26 +0200)]
safexcel: Fix a typo in a source code comment

- s/paramters/parameters/

MFC after: 3 days

2 years agoflua: Fix a typo in a source code comment
Gordon Bergling [Thu, 15 Sep 2022 08:25:54 +0000 (10:25 +0200)]
flua: Fix a typo in a source code comment

- s/paramter/parameter/

MFC after: 3 days

2 years agokern_jail: Fix a typo in a source code comment
Gordon Bergling [Thu, 15 Sep 2022 08:25:19 +0000 (10:25 +0200)]
kern_jail: Fix a typo in a source code comment

- s/paramter/parameter/

MFC after: 3 days

2 years agonetpfil: Fix some typos in source code comments
Gordon Bergling [Thu, 15 Sep 2022 08:24:00 +0000 (10:24 +0200)]
netpfil: Fix some typos in source code comments

- s/paramter/parameter/
- s/paramters/parameters/

MFC after: 3 days

2 years agoSPDX: Not BSD-4-Clause
Warner Losh [Thu, 15 Sep 2022 03:17:44 +0000 (21:17 -0600)]
SPDX: Not BSD-4-Clause

This license has 4 clauses, and shares some text with the BSD-4-Clause
license. However, it omits the standard disclaimer and has 2 clauses all
its own. Remove this tag, since it was made in error and this doesn't
match the SPDX copy of the BSD-4-Clause license.

Sponsored by: Netflix

2 years agoip_output: always increase "cantfrag" stat if ip_fragment() fails
Gleb Smirnoff [Thu, 15 Sep 2022 02:22:40 +0000 (19:22 -0700)]
ip_output: always increase "cantfrag" stat if ip_fragment() fails

While here, join two unlikely cases into one if clause.

Submitted by: Ivan Rozhuk <rozhuk.im gmail.com>
PR: 265718
Reviewed by: mjg, melifaro
Differential revision: https://reviews.freebsd.org/D36584

2 years agoUnbreak the build after b3ee318b79d54a59190d35b8c76a63a8fb81b903
Mateusz Guzik [Wed, 14 Sep 2022 23:52:05 +0000 (23:52 +0000)]
Unbreak the build after b3ee318b79d54a59190d35b8c76a63a8fb81b903

2 years agovfs: make delmntque return with the interlock held
Mateusz Guzik [Wed, 14 Sep 2022 23:08:08 +0000 (23:08 +0000)]
vfs: make delmntque return with the interlock held

saves on relocking dance -- the lock is taken immediately
afterwards anyway.

2 years agolockf: elide vnode interlock in the common case in lf_purgelocks
Mateusz Guzik [Wed, 14 Sep 2022 23:04:22 +0000 (23:04 +0000)]
lockf: elide vnode interlock in the common case in lf_purgelocks

The interlock was already taken and released when dooming, thus by
API contract locking state cannot be legally installed.

At the same time the state is almost never there to begin with.

2 years agodevfs: stop taking the interlock in devfs_delete
Mateusz Guzik [Wed, 14 Sep 2022 22:51:42 +0000 (22:51 +0000)]
devfs: stop taking the interlock in devfs_delete

It buys nothing now that vhold does not require it.

2 years agodevfs: retire the unused DEVFS_DEL_VNLOCKED flag
Mateusz Guzik [Wed, 14 Sep 2022 22:47:53 +0000 (22:47 +0000)]
devfs: retire the unused DEVFS_DEL_VNLOCKED flag

2 years agodomains: rewrite documentation to describe present state
Gleb Smirnoff [Wed, 14 Sep 2022 21:11:40 +0000 (14:11 -0700)]
domains: rewrite documentation to describe present state

Reviewed by: debdrup, pauamma
Differential revision: https://reviews.freebsd.org/D36513

2 years agovfs: retire the V_MNTREF flag
Mateusz Guzik [Sat, 10 Sep 2022 20:13:19 +0000 (22:13 +0200)]
vfs: retire the V_MNTREF flag

Reviewed by: kib, mckusick
Differential Revision: https://reviews.freebsd.org/D36521