Commit Graph

277394 Commits

Author SHA1 Message Date
Jens Schweikhardt
825225e52f For man page references found in ports, indicate the respective port. 2022-08-14 15:02:06 +02:00
Dimitry Andric
6e62d9a5a5 gpio: mark more INVARIANTS variables as __diagused
Mark another set of variables that are only used in INVARIANTS builds,
which otherwise result in set-but-not-used warnings.

Fixes:		7dc4d5118c
MFC after:	3 days
2022-08-14 14:12:42 +02:00
Dimitry Andric
8534e6be81 Avoid using TARGET_ARCH in llvm.build.mk
Apparently the TARGET_ARCH macro is not supposed to be used outside of
the top-level Makefiles. Directly use MACHINE_ARCH instead.

Noticed by:	imp, jrtc27
MFC after:	1 week
2022-08-14 13:11:52 +02:00
Dimitry Andric
ab28cc352b Adjust function definition in if_ovpn_c.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    tests/sys/net/if_ovpn/if_ovpn_c.c:19:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    fake_sockaddr()
		 ^
		  void

This is because fake_sockaddr() is declared with a (void) argument list,
but defined with an empty argument list. Make the definition match the
declaration.

MFC after:      3 days
2022-08-14 13:11:52 +02:00
Jens Schweikhardt
9356efa8c8 Indicate that X(7) cross refs are satisfied by ports/x11/xorg-docs. 2022-08-14 12:01:30 +02:00
Jens Schweikhardt
7c20397b72 In man page cross refs to sudo, indicate it comes from ports/security/sudo. 2022-08-14 11:44:43 +02:00
Alexander V. Chernikov
a4b8c6d9d5 netlink: add AF_NETLINK / PF_NETLINK definitions
Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D36174
MFC after:	1 weeks
2022-08-14 09:22:33 +00:00
Alexander V. Chernikov
9b967bd65d domains: allow domains to be unloaded
Add domain_remove() SYSUNINT callback that removes the domain
 from the domain list if it has DOMF_UNLOADABLE flag set.
This change is required to support netlink ( D36002 ).

Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D36173
2022-08-14 09:22:33 +00:00
Xin LI
278d080bad Remove minigzip from the base system.
The minigzip(1) was initially introduced as a minimal replacement
of GNU gzip(1). We have replaced the GNU gzip(1) with the zlib
based, GPL-free implementation, and minigzip(1) is not being used
anywhere in the base system, so just remove it.

Relnotes:	yes
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D35979
2022-08-13 21:11:50 -07:00
Martin Matuska
271171e0d9 zfs: merge openzfs/zfs@b3d0568cf
Notable upstream pull request merges:
  #9372 Implement a new type of zfs receive: corrective receive (-c)
  #13635 Add snapshots_changed as property
  #13636 Add support for per dataset zil stats and use wmsum counters
  #13643 Fix scrub resume from newly created hole
  #13670 Fix memory allocation for the checksum benchmark
  #13695 Skip checksum benchmarks on systems with slow cpu
  #13711 zpool: fix redundancy check after vdev removal

Obtained from:	OpenZFS
OpenZFS commit:	b3d0568cfd
2022-08-14 01:14:21 +02:00
Colin Percival
cc495d3b67 rc.d/hostid: Skip warning on systems w/o smbios
The first time a FreeBSD system boots, it obtains a hostuuid and hostid
from the smbios.system.uuid kernel environment variable.  If this value
is found to be invalid, a warning is printed and the boot pauses for
two seconds to give the user a chance to read it.

If the FreeBSD kernel is launched directly in a virtual machine rather
than via the FreeBSD boot loader, the smbios.system.uuid environment
variable might not be set; in this case, there's no need to alert the
user and delay the boot process since the lack of a "hardware" uuid is
entirely expected.

Distinguish between the cases of "invalid UUID" and "no UUID", warning
and delaying the boot only in the former case.  In both cases we still
generate a random UUID in software.

Reviewed by:	delphij
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36185
2022-08-13 15:58:16 -07:00
Colin Percival
02ab915ae0 lapic_init: Reduce LOOPS
While I'm here, instrument lapic_init with TSLOG so it shows up (or
typically not, after this change) on flamecharts.

Reviewed by:	kib
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36186
2022-08-13 15:28:09 -07:00
Andrew Gallatin
2c6ff1d632 LRO: fix BPF filters for lagg in the hpts path
When in the hpts path, we need to handle BPF filters since aggregated
packets do not pass up the stack in the normal way. This is already
done for most interfaces, but lagg needs special handling. This is
because packets received via a lagg are passed up the stack with
the leaf interface's ifp stored in m_pkthdr.rcvif.

To handle lagg packets, we must identify that the passed rcvif is
currently a lagg port by checking for IFT_IEEE8023ADLAG or
IFT_INFINIBANDLAG (since lagg changes the lagg port's type to that
when an interface becomes a lagg member). Then we need to find the
lagg's ifp, and handle any BPF listeners on the lagg.

Note: It is possible to have multiple BPF filters, one on a member
port and one on the lagg itself. That is why we have to have 2
checks and 2 ETHER_BPF_MTAPs.

Reviewed by: jhb, rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36136
2022-08-13 17:33:36 -04:00
Jens Schweikhardt
0f6a767c02 Replace a dead cross reference with the proper (I think) macro. 2022-08-13 22:55:10 +02:00
Kirk McKusick
6b9d4fbb7f Explicitly initialize rather than reading newly allocated UFS inodes.
The function ffs_vgetf() is used to find or load UFS inodes into a
vnode. It first looks up the inode and if found in the cache its
vnode is returned. If it is not already in the cache, a new vnode
is allocated and its associated inode read in from the disk. The
read is done even for inodes that are being initially created.
The contents for the inode on the disk are assumed to be empty. If
the on-disk contents had been corrupted either due to a hardware
glitch or an agent deliberately trying to exploit the system, the
UFS code could panic from the unexpected partially-allocated inode.

Rather then having fsck_ffs(8) verify that all unallocated inodes
are properly empty, it is easier and quicker to add a flag to
ffs_vgetf() to indicate that the request is for a newly allocated
inode. When set, the disk read is skipped and the inode is set to
its expected empty (zero'ed out) initial state. As a side benefit,
an unneeded disk I/O is avoided.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-13 13:51:25 -07:00
Jens Schweikhardt
30f6269155 Fix wrong section number in man page cross references. 2022-08-13 22:42:23 +02:00
Jens Schweikhardt
d491167b38 Fix wrong section number in man page cross references. 2022-08-13 22:31:24 +02:00
Kirk McKusick
6e821c35d6 Correctness cleanups in fsck_ffs(8).
Allocation or I/O failures in fsck_ffs(8) could cause segment
faults because of missing checks or not-yet-initialized data
structures. Correct these issues.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation
2022-08-13 13:28:31 -07:00
Jessica Clarke
3179bb2737 stand: Fix a couple of comment typos in f8a199f28f
The commit message documented it as /etc/src.conf but the comment in the
source mentioned the non-existent /etc/loader.conf.

Fixes:	f8a199f28f ("stand: Raise limit to 550,000 bytes for loader")
2022-08-13 20:48:30 +01:00
Kirk McKusick
e688661642 Move the ability to search for alternate UFS superblocks from fsck_ffs(8)
into ffs_sbsearch() to allow use by other parts of the system.

Historically only fsck_ffs(8), the UFS filesystem checker, had code
to track down and use alternate UFS superblocks. Since fsdb(8) used
much of the fsck_ffs(8) implementation it had some ability to track
down alternate superblocks.

This change extracts the code to track down alternate superblocks
from fsck_ffs(8) and puts it into a new function ffs_sbsearch() in
sys/ufs/ffs/ffs_subr.c. Like ffs_sbget() and ffs_sbput() also found
in ffs_subr.c, these functions can be used directly by the kernel
subsystems. Additionally they are exported to the UFS library,
libufs(8) so that they can be used by user-level programs. The new
functions added to libufs(8) are sbfind(3) that is an alternative
to sbread(3) and sbsearch(3) that is an alternative to sbget(3).
See their manual pages for further details.

The utilities that have been changed to search for superblocks are
dumpfs(8), fsdb(8), ffsinfo(8), and fsck_ffs(8). Also, the prtblknos(8)
tool found in tools/diag/prtblknos searches for superblocks.

The UFS specific mount code uses the superblock search interface
when mounting the root filesystem and when the administrator doing
a mount(8) command specifies the force flag (-f). The standalone UFS
boot code (found in stand/libsa/ufs.c) uses the superblock search
code in the hope of being able to get the system up and running so
that fsck_ffs(8) can be used to get the filesystem cleaned up.

The following utilities have not been changed to search for
superblocks: clri(8), tunefs(8), snapinfo(8), fstyp(8), quot(8),
dump(8), fsirand(8), growfs(8), quotacheck(8), gjournal(8), and
glabel(8). When these utilities fail, they do report the cause of
the failure. The one exception is the tasting code used to try and
figure what a given disk contains. The tasting code will remain
silent so as not to put out a slew of messages as it trying to taste
every new mass storage device that shows up.

Reviewed by: kib
Reviewed by: Warner Losh
Tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D36053
Sponsored by: The FreeBSD Foundation
2022-08-13 12:43:40 -07:00
Chuck Tuffli
88951aaaee bhyve nvme: Fix out-of-bound IOV array access
Summary:
NVMe operations indicate the memory region(s) associated with a command
via physical region pages (PRPs). Since each PRP has a fixed size,
contiguous memory regions larger than the PRP size require multiple PRP
entries.

Instead of issuing a blockif call for each PRP, the NVMe emulation
concatenates multiple contiguous PRP entries into a single blockif
request. The test for contiguous regions has a bug such that it
mistakenly treats an initial PRP address of zero as a contiguous range
and concatenates it with the previous. But because there is no previous
IOV, the concatenation code corrupts the IO request structure and leads
to a segmentation fault when the blockif request completes.

Fix is to test for the existence of a previous range before trying to
concatenate the current range with the previous one.

While in the area, rename pci_nvme_append_iov_req()'s lba parameter to
offset to match its usage.

PR:             264177
Reported by:    Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	jhb
MFC after:      2 weeks
Differential Revision:	https://reviews.freebsd.org/D35328
2022-08-13 12:16:02 -07:00
Jens Schweikhardt
14e3d3248a Fix wrong capitalization in man page references. 2022-08-13 20:46:59 +02:00
Warner Losh
4e2a0135a0 mrsas module: Use MACHINE_ARCH exlcusively
TARGET_ARCH is always wrong when not used at the toplevel Makefile*, or
in something that has to be included from there. Switch to using
MACHINE_ARCH exclusively here since there's no benefit from assigning
TARGET_ARCH the value of MACHINE_ARCH and then using TARGET_ARCH (and
make TARGET_ARCH=xxx won't work).

Sponsored by:		Netflix
2022-08-13 11:56:53 -06:00
Jens Schweikhardt
b4cea17bf6 Fix a broken man page reference. 2022-08-13 17:40:29 +02:00
Warner Losh
4f0c9b76cf stand: Only compile decompression routines
We don't need the compress rotuines, nor zstd_opt.c. Remove them.
Expand the number of places we omit code for IN_LIBSA (which are FreeBSD
specific). Due to the agressive optimization, though, this doesn't
reduce the size of the loader. It does reduce the number of 'false
positives' for places to omit to reduce the size as well as reducing the
build time slightly.

Sponsored by:		Netflix
Reviewed by:		tsoome, delphij
Differential Revision:	https://reviews.freebsd.org/D36145
2022-08-12 21:48:18 -06:00
Warner Losh
1482113008 stand: Compile out the extensive superblock diagnostic messages for BIOS loader
The BIOS loader operates in a very constrained environment. The messages
for the super block integrity tests take up about 12k of space. Compile
them out for the BIOS loader, while leaving it intact for all other
loaders that aren't space constrained. These aren't used in the 'super
tiny' *boot* programs, so no adjustment is needed there.

We reply on the fact that (a) i386 doesn't support 32-bit UEFI booting
and (b) LIBSA_CPUARCH is "i386" when building on both i386 and when
we're building the 32-bit libsa32 library.

This saves about 12k of space for this constrained envrionment and will
take a bit of the pressure off some machines where the loader has grown
too big for their BIOS (see comments in i386/loader/Makefile for
details).

Sponsored by:		Netflix
Reviewed by:		mckusick
Differential Revision:	https://reviews.freebsd.org/D36175
2022-08-12 21:48:17 -06:00
Warner Losh
f8a199f28f stand: Raise limit to 550,000 bytes for loader
Raise the limit for /boot/loader to be 550k. The IBM PC imposes a limit
of 640k of RAM below 1MB, which is needed for real mode calls. BTX takes
40k of that. The BIOS takes some amount (25k seems a good "99% take less
than or equal to this" estimate for that, though some systems consume
more). Most typical setups need 25k of stack.  This leaves 550k for
code. We set the limit to 550,000 which gives about an extra 13,000
bytes of buffer for machines that whose setups use a little more stack
or whose BIOS reserves a bit more...

Add this derivation in the Makefile. Also recommend setting LOADERSIZE
lower in /etc/src.conf when the loader has to run on a system whose BIOS
takes up more space, or for a complex setup. Add a recipe for how to
find how much RAM your BIOS uses as well (thanks to jhb@ for the
trick). Network cards that boot via PXE and HBAs with their BIOS enabled
are known to be large consumers of lomem space.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D36152
2022-08-12 21:47:02 -06:00
Colin Percival
b9fd884a8d sys/vm: Add TSLOG to some functions
The functions pbuf_init, kva_alloc, and keg_alloc_slab are significant
contributors to the kernel boot time when FreeBSD boots inside the
Firecracker VMM.  Instrument them so they show up on flamecharts.
2022-08-12 16:53:04 -07:00
Gleb Smirnoff
b7bf3cb07f keysock: explicitly initialized LIST_HEAD
This is supposed to fix syzcaller report.

Reported by:	syzbot+1e08b5f9f7f00383ddea@syzkaller.appspotmail.com
Fixes:		ea7be1293b
2022-08-12 12:29:26 -07:00
Gleb Smirnoff
f277746e13 protosw: change prototype for pr_control
For some reason protosw.h is used during world complation and userland
is not aware of caddr_t, a relic from the first version of C.  Broken
buildworld is good reason to get rid of yet another caddr_t in kernel.

Fixes:	886fc1e804
2022-08-12 12:08:18 -07:00
John Baldwin
3a3af6b2a1 mac_ddb: Fix the show rman validator.
The validator always returned true due to an incorrect check.

Reviewed by:	mhorne, imp
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36125
2022-08-12 10:20:05 -07:00
Maxim Sobolev
6b3ad1d737 When -u option is used also set USER, HOME and SHELL variables.
This is consistent with what other uid-morphing utilities
do, i.e. jexec(1), su(1) etc.

MFC after:      2 weeks
Reviewed by:    gbe
Differential Revision:  https://reviews.freebsd.org/D36148
2022-08-12 10:07:56 -07:00
Gleb Smirnoff
948f31d7b0 netinet: do not broadcast PRC_REDIRECT_HOST on ICMP redirect
This is expensive and useless call.  It has been useless since Alexander
melifaro@ moved the forwarding table to nexthops with passive invalidation.
What happens now is that cached route in a inpcb would get invalidated
on next ip_output().

These were the last users of pfctlinput(), so garbage collect it.

Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36156
2022-08-12 08:31:29 -07:00
Gleb Smirnoff
886fc1e804 protosw: provide prototypes for all protocol switch methods
Reviewed by:		melifaro
Differential revision:	https://reviews.freebsd.org/D36153
2022-08-12 08:30:34 -07:00
Alexander V. Chernikov
9d16275c65 netinet6: simplify defrouter_select_fib()
* factor out underlying llentry check into a separate function and use it consistently
* enter epoch once instead of per-router enter/exit
* don't execute body with fibnum = `RT_ALL_FIBS`

Differential Revision: https://reviews.freebsd.org/D35523
MFC after:	2 weeks
2022-08-12 11:43:37 +00:00
Alexander V. Chernikov
730bfa2805 routing: add rib_match_gw() helper
Finish 02e05b8fae:
* add gateway matcher function that can be used in rib_del_route_px()
 or any rib_walk-family functions. It will be used in the upcoming
 migration to the new KPI
* rename gw_fulter_func to match_gw_one() to better signal the
 function purpose / semantic.

MFC after:	1 month
2022-08-12 09:31:21 +00:00
Maxim Sobolev
6a70a0c8bf Document implicit dependencies of the mlx5(4) & friends.
MFC after:      2 weeks
2022-08-11 16:33:09 -07:00
Warner Losh
4c8ea3efe7 stand: Go back to a.out format for /boot/loader
Turns out there's two hidden a.out dependencies. pxeldr.S assumes it has
access to the a.out header from /boot/loader and cdboot.S assumes that
/boot/loader is also a.out and doesn't use boot2.

So, go back to making a.out files for these and adjust the size checks
to use ls, but we only need to check loader.bin. Trim the size we check
against by 2,000. The difference in size between loader and loader.bin
is about 3000 bytes, but clang15 produces binaries that are a smidge
bigger so we need to relax the check just a little and accept some
additional risk for the moment.

Add some comments to loader's Makefile about this.

Sponsored by:		Netflix
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D36142
2022-08-11 17:29:10 -06:00
Alex Richardson
ac175bd33a Install working pkgconfig .pc files for compat libraries
The default ones are install them to /usr/libdata/pkgconfig, and we can't
use this path for compat libraries, so we use /usr/lib<suffix>/pkgconfigi here.

Test Plan:	grep -rn libdir= ./usr/lib32/pkgconfig/*.pc
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D34939
2022-08-11 23:18:34 +01:00
Mateusz Guzik
92b5b97cb0 mac: s/0/false/ in macros denoting probe enablement
No functional changes.
2022-08-11 22:11:24 +00:00
Mateusz Guzik
f73e4f6c58 routing: unbreak the build of a bunch of kernels
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-08-11 21:50:37 +00:00
Mateusz Guzik
648edd6378 x86: remove MP_WATCHDOG
It does not work with ULE, which is the default scheduler for over a
decade.

Reviewed by:	emaste, kib
Differential Revision:	https://reviews.freebsd.org/D36094
2022-08-11 21:35:32 +00:00
Alexander Motin
5244006fea ctladm: Fix typo in command line help.
MFC after:	1 week
2022-08-11 16:53:50 -04:00
Alexander V. Chernikov
d8b42ddcac rtsock: subscribe to ifnet eventhandlers instead of direct calls.
Stop treating rtsock as a "special" consumer and use already-provided
 ifaddr arrival/departure notifications.

MFC after:	2 weeks

Test Plan:
```
21:05 [0] m@devel0 route -n monitor

-> ifconfig vtnet0.2 create

got message of size 24 on Tue Aug  9 21:05:44 2022
RTM_IFANNOUNCE: interface arrival/departure: len 24, if# 3, what: arrival

got message of size 168 on Tue Aug  9 21:05:54 2022
RTM_IFINFO: iface status change: len 168, if# 3, link: up, flags:<BROADCAST,RUNNING,SIMPLEX,MULTICAST>

-> ifconfig vtnet0.2 destroy

got message of size 24 on Tue Aug  9 21:05:54 2022
RTM_IFANNOUNCE: interface arrival/departure: len 24, if# 3, what: departure

```

Reviewed By: glebius
Differential Revision: https://reviews.freebsd.org/D36095
MFC after:	2 weeks
2022-08-11 20:36:59 +00:00
Kyle Evans
693f88c9da iconv_std: complete the //IGNORE support
Previously, it would only ignore failures due to csmapper conversion
failure.  It may be the case that the input string contains invalid
sequences that also need to be ignored.

A good example of //IGNORE application is sanitizing user- or remotely-
specified strings that are expected to be UTF-8; perhaps as part of a
pipeline that will feed the result into a system less tested against or
tolerant of illegal UTF-8 sequences.

Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34345
2022-08-11 11:42:20 -05:00
Kyle Evans
2300a22c97 libc: iconv: add mb_cur_min for encoder traits
A future commit will actually implement //IGNORE so that applications
using base iconv can, e.g., sanitize UTF-8 strings.  To do this, the
iconv_std module needs to be able to determine the minimum width for any
given encoding so that it can skip that many bytes in the input buffer.
This is mainly an issue for UTF-16 and UTF-32.

This commit bumps shlib versions to 5 for libiconv modules to reflect
the ABI change.  It also fixes OptionalObsoleteFiles to remove the
libiconv modules if WITHOUT_ICONV is in use.

re: _ENCODING_MB_CUR_MIN, note that this file (citrus_stdenc_template.h)
is included at the bottom of an encoding *implementation*, so the
implementation is free to #define it prior.  UTF1632 is a good example,
as it redefines the minimum to be a property on the encodinginfo, and
the minimum is set to 2 or 4 bytes for UTF-16 and UTF-32 respectively.

Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34344
2022-08-11 11:42:17 -05:00
Kyle Evans
c1f46b8fcb libc: iconv: push option ignore into citrus_iconv_open()
Make it vaguely aware of options in the sense that it now knows that it
can zap any trailing //.  It now copies the entire string in realsrc and
realdst, then terminates them at the options.

__bsd___iconv_open can now stop trying to allocate memory just for this
purpose, and the new version is technically more correct.  GNU libiconv
will ignore options on the `in` codeset and still do the right thing.

Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34343
2022-08-11 11:33:28 -05:00
Kyle Evans
ea0f37dec6 iconv: only conditionally use ICONV_SET_DISCARD_ILSEQ
If the -c flag is used, then we can set it with ICONV_SET_DISCARD_ILSEQ;
otherwise, leave it alone.  The user may have specified //IGNORE in the
'to' codeset specification, there's no reason we can't allow that but
we'll currently turn it off.

Reviewed by:	thj
Sponsored by: Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34342
2022-08-11 11:33:28 -05:00
Kyle Evans
814bd1ed43 tools: test: iconv: fix open_2 to not segfault
Record error condition when iconv_open() fails rather than leaving a
bogus iconv_t that iconv_close() can later choke on; this is one failure
mode.

If we opened MAX_LIMIT files with success, we need to rewind one so that
we don't iconv_close() one past the end of cd; this is the second
failure mode.

Sponsored by:	Klara, Inc.
2022-08-11 11:33:28 -05:00
Warner Losh
7d72ff9057 stand: Make BIOS loader size limits settable
It's sometimes desirable to override the size limit: It's a soft limit
and there are times we exceed the limit by just a little bit and don't
want the build to fail (or we are hitting runtime failures below the
510,000 byte limit).

Sponsored by:		Netflix
2022-08-11 10:27:17 -06:00