Commit Graph

281626 Commits

Author SHA1 Message Date
Mark Johnston
8c8574acb8 config: Include errno.h in mkmakefile.cc
Commit da88842029 ("config: error out on malformed env/hint lines")
added a reference to EINVAL.  In some configurations the bootstrap tools
build fails for lack of errno definitions.

Fixes:	da88842029 ("config: error out on malformed env/hint lines")
Reported by:	syzbot+b1a5d112a737d9a2be9b@syzkaller.appspotmail.com
2023-02-23 21:53:06 -05:00
Kyle Evans
4e696aff69 iconvlist(3): fix count argument type
count is just an unsigned int, not a pointer.

Sponsored by:	Klara, Inc.
2023-02-23 15:22:12 -06:00
Mina Galić
0455b90bee tools/git: fix typos in documentation
and change mention of svn to git.

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/659
2023-02-23 16:15:19 -05:00
Bjoern A. Zeeb
c9ba91435a net80211: ieee80211_swscan_bg_scan() track return variable under lock
As the comment says it probably does not matter but use a local
variable to track state under lock so we can return the last known
good state of what we thought we were operating under after unlocking.

Likely no functional changes.

Sponsored by:	The FreeBSD Foundation
MFC atfer:	3 days
Reviewed by:	enweiwu, adrian
Differential Revision: https://reviews.freebsd.org/D38660
2023-02-23 21:12:23 +00:00
Ed Maste
17a5a29003 efibootmgr: add missing break for 'u' case
Reviewed by:	imp, zlei
Reported by:	Coverity
CID:		1505695
Fixes:		9a79152994 ("efibootmgr: Add --efidev (-u) to dis...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38747
2023-02-23 14:13:18 -05:00
Zhenlei Huang
7f0ebf0876 Delete obsolete Solaris compat header file stdlib.h
This drops function `getexecname()` redirection.

Historically `getexecname()` is a compatibility definition. Since
openzfs has its own implementation of function `getexecname()` in libspl
and has been merged into base, the compat header file stdlib.h is
no longer needed and should not be used.

Also without this fix libspl will end up an incompatible version of
`getprogname()` with libc. In particular, if zfs is enabled, programs
such as pgrep in /rescue can be wrongly statically linked with libspl
and will not function properly.

PR:		269738
Reviewed by:	markj
Fixes:		9e5787d228 Merge OpenZFS support in to HEAD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38733
2023-02-24 02:00:09 +08:00
Alexander V. Chernikov
d2deebe21b netlink: fix addition of blackhole/reject routes.
* Make nhop_set_blackhole() set all necessary properties for the
 nexthop
* Make nexthops blackhole/reject based on the rtm_type netlink
 property instead of using rtflags.

Reported by:	Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after:	3 days
2023-02-23 17:43:18 +00:00
Kornel Dulęba
98c666cf87 arm: Fix initialization of VFP context
Make sure that pcb_vfpsaved is always initialized.
Create a vfp_new_thread helper that is heavily based on the arm64 logic.
While here remove un unnecessary assigment and add an assertion
to make sure that it's been properly initialized before we return
from a VFP exception.

Reported by: Mark Millard <marklmi@yahoo.com>
Tested by: Mark Millard <marklmi@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D38698
2023-02-23 17:50:26 +01:00
Kornel Dulęba
4d2427f2c4 arm: Unbreak debugging programs that use FP instructions
Contrary to arm64, on armv7 get_vfpcontext/set_vfpcontext can be called
from cpu_ptrace. This can be triggered when gdb hits a breakpoint
in a userspace program.
Relax td == currthread assertion to account for that situation.
While here update an outdated comment in vfp_discard.

Reported by: Mark Millard <marklmi@yahoo.com>
Tested by: Mark Millard <marklmi@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D38696
2023-02-23 17:50:26 +01:00
Mateusz Guzik
f4a9e9fc79 x86: whack kernel gcov vestige
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-23 16:42:38 +00:00
Zhenlei Huang
3dd5524264 ctfdump: Use getprogname()
Also remove no longer used function `getpname()`.

Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D38740
2023-02-24 00:28:35 +08:00
Mateusz Guzik
3a01a97d23 mroute: partially sanitize the file
There is rampant inconsistent formatting all around, make it mostly
style(9)-conformant.

While here:
- drop malloc casts
- rename a rw lock from mroute_mtx to mroute_lock
- replace NOTREACHED comment with __assert_unreachable

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38652
2023-02-23 13:35:44 +00:00
Konstantin Belousov
15df90218b tmpfs: support the nosymfollow mount option
PR:	269772
Reported by:	firk@cantconnect.ru
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-02-23 15:15:17 +02:00
Mina Galić
7e2af4f90b veriexec(4): Fix a compiler error
When building WITH_BEARSSL=1 veriexec(4) failes to compile.
So update the function prototype so that veriexec(4)
compiles again.

Reported by:	gbe
Reviewed by:	mjg, gbe
Approved by:	mjg
Pull Request:	https://github.com/freebsd/freebsd-src/pull/657
2023-02-23 12:14:41 +01:00
Dmitry Chagin
e55e4a6ba3 linux(4): Fixup the interface name translation in netlink
Netlink should translate a FreeBSD interface name to a Linux
interface name.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D38715
MFC after:		3 days
2023-02-23 11:01:18 +03:00
Dmitry Chagin
3ab3c9c29c linux(4): Consolidate a FreeBSD interface names translation code
We have some amount of interface names translation functions which are
differs by bugs implementation. Consolidates it in a one place.

Fixup loopback interface names translation and use ifnet methods and
accessors, where possible.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D38714
MFC after:		3 days
X-MFC with:		32fdc75fe7
2023-02-23 11:00:29 +03:00
Dmitry Chagin
200fe6e3a0 linux(4): Use predefined constant instead of hardcoded value
Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D38713
MFC after:		3 days
2023-02-23 10:59:34 +03:00
Kristof Provost
57fcf46dee if_ovpn: ovpn_find_peer_by_ip() is unused without INET
Don't define ovpn_find_peer_by_ip() if INET is not set, and do the same
for ovpn_find_peer_by_ip6() and INET6.

Reported by:	mjg
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-23 05:56:56 +01:00
Gleb Smirnoff
a170657108 unix/dgram tests: match the kernel behavior
In CURRENT for some time an overflowed unix/dgram socket would
return EAGAIN if it has O_NONBLOCK set.  This proved to be
undesired.  See 71e70c25c0 for details.  Update tests to match
the "new" behavior, which actually is the historical behavior.
2023-02-22 20:44:46 -08:00
Robert Herndon
3ff497061b Fix Coverity issue in the NVDIMM driver
Summary:
Coverity reports a potential memory leak in the nvdimm
driver. Examination shows it's real; fix it.

Sponsored by: Dell Technologies
MFC after: 1w

Test Plan: Changes in use at $WORK

Reviewers: robert.herndon_dell.com, vangyzen, bret_ketchum_dell.com

Subscribers: imp, badger

Differential Revision: https://reviews.freebsd.org/D38676
2023-02-22 20:42:12 -06:00
Michael Tuexen
453aa7fac9 tcp: ensure the tcpcb is not NULL when logging an event
When calling tcp_bblog_pru() on some error paths, tp is NULL,
therefore handle it.

Sponsored by:	Netflix, Inc.
2023-02-23 02:04:17 +01:00
Rick Macklem
fe5c211ba8 nfsd.c: Log a more meaningful failure message
For the cases where the nfsd(8) daemon is already running or
has failed to start within a prison due to an incorrect prison
configuration, the failure message logged is:
  Can't read stable storage file: operation not permitted

This patch replaces the above with more meaningful messages.
It depends on commit 10dff9da97 to differentiate between the
above two cases, however even without this commit, the messages
should be an improvement.

MFC after:	3 months
2023-02-22 14:09:15 -08:00
Rick Macklem
10dff9da97 nfsd: Return ENXIO instead of EPERM when nfsd(8) already running
The nfsd(8) daemon generates an error message that does not
indicate that the nfsd daemon is already running when the nfssvc(2)
syscall fails for the NFSSVC_STABLERESTART.  Also, the check for
running nfsd(8) in a vnet prison will return EPERM when it fails.

This patch replaces EPERM with ENXIO so that the nfsd(8) daemon
can generate more reasonable failure messages.  The nfsd(8) daemon
will be patched in a future commit.

MFC after:	3 months
2023-02-22 13:19:07 -08:00
Dag-Erling Smørgrav
30c91a3cee byacc: Adjust expected test output to match our patches.
Sponsored by:	Klara, Inc.
2023-02-22 20:05:02 +01:00
Alan Somers
5f51c9c328 fusefs: add some more test cases for bad fuse servers
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D38719
2023-02-22 10:03:58 -07:00
Alan Somers
0c9df4afc2 fusefs: fix a buffer overflow in the tests
The actual overflow occured in the ReadAhead.readahead test.
Surprisingly it has never segfaulted or resulted in any bad behavior.

MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D38718
2023-02-22 10:03:01 -07:00
Elyes Haouas
ce7db385f5 include: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-02-22 11:52:57 -05:00
Mitchell Horne
9a7f7c26c5 lockmgr: upgrade panic return checks
We short-circuit lockmgr functions in the face of a kernel panic. Other
lock implementations do this with a SCHEDULER_STOPPED() check, which
covers the additional case where the debugger is active but the system
has not panicked. Update this code to match that behaviour.

Reviewed by:	mjg, kib, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38655
2023-02-22 11:12:22 -04:00
Michael Tuexen
624de4eca5 tcp: remove unused function prototype
tcp_trace was implemented in tcp_debug.c, which was removed recently.

Reviewed by:		rscheff@, zlei@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D38712
2023-02-22 13:28:17 +01:00
Gordon Bergling
49bf65be44 arm ti: Fix a typo in a kernel message
- s/adress/address/

MFC after:	5 days
2023-02-22 09:43:49 +01:00
John-Mark Gurney
ee97f198b4 Support SMBIOS v3 for 64-bit entry systems
Summary:
Under QEMU on arm64 systems, the smbios table is above 4GB
requiring a 64-bit address to access.

Reviewers: manu

Subscribers: imp, bcran, dab

Differential Revision: https://reviews.freebsd.org/D38721
2023-02-22 04:10:12 +00:00
Justin Hibbits
19850ee073 Revert "linprocfs: Migrate to IfAPI"
This reverts commit 5243598927.

Requested by:	dchagin
2023-02-21 18:17:26 -05:00
Allan Jude
8b04c1cbfc Fix per-jail zfs.mount_snapshot setting
When jail.conf set the nopersist flag during startup, it was
incorrectly destroying the per-jail ZFS settings.

PR:	260160
Reported by:	imp (previous version), mm (upstream), freqlabs (upstream)
MFC after:	immediately
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38662
2023-02-21 22:42:28 +00:00
Michael Tuexen
76578d601e bblog: improve timeout event handling
Extend the BBLog RTO event to deal with all timers of the base
stack. Also provide information about starting, stopping, and
running off. The expiration of the retransmission timer is
reported as it was done before.

Reviewed by:		rscheff@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D38710
2023-02-21 22:46:15 +01:00
Rick Macklem
88175af8b7 vfs_export: Add mnt_exjail to control exports done in prisons
If there are multiple instances of mountd(8) (in different
prisons), there will be confusion if they manipulate the
exports of the same file system.  This patch adds mnt_exjail
to "struct mount" so that the credentials (and, therefore,
the prison) that did the exports for that file system can
be recorded.  If another prison has already exported the
file system, vfs_export() will fail with an error.
If mnt_exjail == NULL, the file system has not been exported.
mnt_exjail is checked by the NFS server, so that exports done
from within a different prison will not be used.

The patch also implements vfs_exjail_destroy(), which is
called from prison_cleanup() to release all the mnt_exjail
credential references, so that the prison can be removed.
Mainly to avoid doing a scan of the mountlist for the case
where there were no exports done from within the prison,
a count of how many file systems have been exported from
within the prison is kept in pr_exportcnt.

Reviewed by:	markj
Discussed with:	jamie
Differential Revision:	https://reviews.freebsd.org/D38371
MFC after:	3 months
2023-02-21 13:00:42 -08:00
Michael Tuexen
6b802933f1 tcp: rearrange enum and remove unused variable
Rearrange the enum tt_which such that TT_REXMIT is 0. This allows
an extension of the BBLog event RTO in a backwards compatible way.
Remove tcptimers, which was only used in trpt, a utility removed
from the source tree recently.

Reviewed by:		glebius@, guest-ccui@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D38547
2023-02-21 18:26:49 +01:00
Justin Hibbits
e9e637bf24 Revert "Port Linuxulator to IfAPI"
Revert pending netlink fixes, and further fixes to this.

This reverts commit 52d984831d.

Requested by:	dchagin
2023-02-21 12:20:24 -05:00
Michael Tuexen
4065becf3f bblog: unbreak build
Ensure that tp is always declared and set.

Reported by:	Michael Butler
Sponsored by:	Netflix, Inc.
2023-02-21 18:16:59 +01:00
Gleb Smirnoff
71e70c25c0 Revert "unix/dgram: return EAGAIN instead of ENOBUFS when O_NONBLOCK set"
This API change led to unexpected consequences with Go runtime. The
Go runtime emulates blocking sockets over non-blocking sockets and
for that uses available event dispatcher on the target OS, which is
kevent(2) if availabe, with OS independent layer on top.  It expects
that if whatever O_NONBLOCK socket returned ever EAGAIN, then it is
supposed to be reported as writable by the event dispatcher. kevent(2)
would never report a unix/dgram socket, since they never change their
state, they always are writeable.  The expectations of Go are not
literally specified by SUS, however they are in its spirit.  The SUS
specifies EAGAIN for send(2) as "The socket's file descriptor is marked
O_NONBLOCK and the requested operation would block" [1].  This doesn't
apply to FreeBSD unix/dgram socket, it never blocks on send(2).

Thus, changing API trying to mimic Linux was a mistake.  But what about
the problem we tried to fix? Discussed that with Max Dounin of nginx,
and we agreed that the log bomb described shall be fixed on nginx side,
and it actually isn't specific to FreeBSD, may happen with nginx on any
non-Linux system with a certain configuration.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html

This reverts commit 65572cade3.
2023-02-21 08:50:07 -08:00
Zhenlei Huang
fb9b76e052 vnet: Make vnet_sys[un]init() static
These two functions are intended to be used only when allocating or
destroying vnet instances.

No functional change intended.

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37955
2023-02-22 00:22:23 +08:00
Zhenlei Huang
b2d76b52fd jail: Fix redoing ip restricting
`prison_ip_restrict()` is called in loop FOREACH_PRISON_DESCENDANT_LOCKED.
While under low memory, it is still possible that in subsequent rounds
`prison_ip_restrict()` succeed and `redo_ip[46]` flip over from true to
false, thus leave some prisons's IPv[46] addresses unrestricted.

Reviewed by:	jamie
Fixes:		8bce8d28ab jail: Avoid multipurpose return value of function prison_ip_restrict()
Differential Revision:	https://reviews.freebsd.org/D38697
2023-02-21 23:43:25 +08:00
Mateusz Guzik
192a001984 i386: whack LINT-NO* kernels
there is nothing i386-specific about them and equivalent configs already
build for amd64.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D38700
2023-02-21 15:36:48 +00:00
Konstantin Belousov
836e4b371b kern/sysv_ipc.c: use ANSI C function definition
Also remove pointless return's.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2023-02-21 16:02:46 +02:00
Mateusz Guzik
de709b1455 sx: whack set-but-not-used warn in _sx_slock_hard
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-21 13:49:14 +00:00
Mateusz Guzik
dbcd7e7e32 vfs cache: whack set-but-not-used warn in cache_purgevfs
Reported by:	kib
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-21 13:48:35 +00:00
Mateusz Guzik
7f337c94b5 sdt: add __sdt_used
To pacify set-but-not-used warns when compiling without sdt probes.

Reviewed by:
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:
2023-02-21 13:43:00 +00:00
Alexander V. Chernikov
b9b2184322 netlink: clear IPv6 embedded scope when dumping route gateways.
Reported by:	zarychtam@plan-b.pwste.edu.pl
MFC after:	3 days
2023-02-21 12:27:26 +00:00
Michael Tuexen
00812bbda2 bblog: add logging of protocol user requests
This information was available in trpt and is useful. So provide
a way to get this information via TCP BBLog.

Reviewed by:		rscheff@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D38701
2023-02-21 12:07:35 +01:00
Thomas Munro
58e3631bd0 truss: Add preadv(2) and pwritev(2).
We already knew how to decode readv(2)/writev(2).  Add the versions with
an offset.

Reviewed by:            asomers
Differential Revision:  https://reviews.freebsd.org/D27531
MFC after:              2 weeks
2023-02-21 22:40:14 +13:00
Simon J. Gerraty
9c474dc51b Merge commit 'd84e570b54961e8874bbd8de25635eb96be0977e' 2023-02-20 22:13:27 -08:00