Commit Graph

281587 Commits

Author SHA1 Message Date
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
Simon J. Gerraty
d84e570b54 Vendor import BearSSL hash 79c060e 2023-02-20 22:06:34 -08:00
Kyle Evans
c32946d8be kern: physmem: fix the format string again, i is a size_t
Fixes the riscv LINT build.

Fixes:	7b5cb32fca ("kern: physmem: properly cast %jx [...]")
2023-02-20 23:39:38 -06:00
Rick Macklem
ef4e8f0cf9 nfscommon: Use IS_DEFAULT_VNET() in the vnet initialization
Another oopsie.  The vnet initialization function in
nfs_commonport.c for initializing prison0 by testing
curthread->td_ucred->cr_prison == &prison0. This is bogus
and always true.  Replace it with IS_DEFAULT_VNET(curvnet).

MFC after:	3 months
2023-02-20 19:43:37 -08:00
Rick Macklem
357492c995 nfscl: Add NFSD_CURVNET macros to nfsclient syscall
Although the nfsclient syscall is used for client side,
it does set up server side krpc for callbacks.  As such,
it needs to have the vnet set.  This patch does this.
Without this patch, the system would crash when the
nfscbd(8) daemon was killed.

Reported by:	freebsd@walstatt-de.de
MFC after:	3 months
2023-02-20 16:40:07 -08:00
Dag-Erling Smørgrav
8e022d3cde byacc: Update to 20230201.
Note that this enables the backtracking extension, which we had previously left disabled.

PR:		244149, 269425
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38421
2023-02-20 23:35:32 +01:00
Michael Tuexen
b16a37eda8 bblog: sync tcp_log_events with Netflix tree
This allows the addition of entries to tcp_log_events without
causing conflicts in the Netflix tree.
rrs@ will upstream the related functional changes eventually.

Reviewed by:		guest-ccui@, rrs@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D38646
2023-02-20 21:42:57 +01:00
Kyle Evans
7b5cb32fca kern: physmem: properly cast %jx arguments to uintmax_t
While we're here, slap prfunc with a __printflike to get compiler
checking on args to catch silly mistakes like this.

Reported by:	jrtc27
2023-02-20 16:12:55 -06:00
Dag-Erling Smørgrav
d481dcee72 tarfs: Really prevent descending into a non-directory.
The previous fix was incorrect: we need to verify that the current node, if it exists, is not a directory, but we were checking the parent node instead.  Address this, add more tests, and fix the test cleanup routines.

PR:		269519, 269561
Fixes:		ae6cff8973
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D38645
2023-02-20 21:29:19 +00:00
Rick Macklem
ef6fcc5e2b nfsd: Add VNET_SYSUNINIT() macros for vnet cleanup
Commit ed03776ca7 enabled the vnet front end macros.
As such, for kernels built with the VIMAGE option will malloc
data and initialize locks on a per-vnet basis, typically
via a VNET_SYSINIT().

This patch adds VNET_SYSUNINIT() macros to do the frees
of the per-vnet malloc'd data and destroys of per-vnet
locks.  It also removes the mtx_lock/mtx_unlock calls
from nfsrvd_cleancache(), since they are not needed.

Discussed with:	bz, jamie
MFC after:	3 months
2023-02-20 13:11:22 -08:00
Kyle Evans
cd73914b01 kern: physmem: don't truncate addresses in DEBUG output
Make it consistent with the above region printing, otherwise it appears
to be somewhat confusing.
2023-02-20 12:55:04 -06:00
Alexander V. Chernikov
c7c3481621 netlink: fix IPv6 route addition with link-local gateway
Currently kernel assumes that IPv6 gateway address is in "embedded"
 form - that is, for the link-local IPv6 addresses, interface index
 is embedded in bytes 2 and 3 of the address.
Fix address embedding in netlink by wrapping nhop_set_gw() in the
 netlink-specific nl_set_nexthop_gw(), which does such embedding
 automatically.

Reported by:	Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after:	3 days
2023-02-20 14:29:48 +00:00
Mark Johnston
0de03c306c man9: Add an smr(9) manual page
Also update the UMA manual page to mention its SMR-enabled
functionality, and update locking.9 to mention both epoch and SMR.
Details of its usage are provided in the SMR manual page.

Reviewed by:	Olivier Certner, mhorne, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38108
2023-02-20 08:58:19 -05:00
Andrew Turner
24abb6b821 When saving a context on arm call the vfp handler
When adding kernel VFP support on arm a comparison instruction was
removed, however the branch to vfp_save_state was still conditional.
Remove the conditional check and always call into vfp_save_state as
it could cause unexpected results otherwise.

Sponsored by:	Arm Ltd
2023-02-20 12:29:56 +00:00
Andrew Turner
8aad241ed0 Add myself to the github code owners file 2023-02-20 12:29:55 +00:00
Fernando Apesteguía
e6ffcf4ac7 zless(1): handle uncompressed files
In the manual page for zmore(1) and zless(1) it is said that zless(1) is
equivalent to zmore(1) except that it uses less(1) as a pager. However
zmore(1) is able to handle uncompressed files transparently while zless(1)
is not.

Add another case to the switch in lesspipe.sh to handle non-compressed files.

PR:		196437
Reported by:	marquis@roble.com
Approved by:	mjg@
Differential Revision: https://reviews.freebsd.org/D38674
2023-02-20 11:15:09 +01:00
Peter Holm
187f4fce3b stress2: Added a fsck check to the scenario 2023-02-20 12:04:24 +01:00
Jose Luis Duran
5b8af90fe3 ping: Add ATF-Python tests
ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of tests.
Attempt to remedy the current situation by introducing a way to easily add tests.

Differential Revision: https://reviews.freebsd.org/D38053
2023-02-20 10:34:33 +00:00
Alexander V. Chernikov
3d360ca49c Revert "ping: Add ATF-Python tests"
This reverts commit 0343e90f39.
2023-02-20 10:34:09 +00:00
Alexander V. Chernikov
0343e90f39 ping: Add ATF-Python tests
ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of tests.
Attempt to remedy the current situation by introducing a way to easily add tests.

Differential Revision: https://reviews.freebsd.org/D38053
2023-02-20 10:31:38 +00:00
Alexander V. Chernikov
828d3c6c4c tests: add netlink large dump buffer check
Differential Revision: https://reviews.freebsd.org/D38665
MFC after:	2 weeks
2023-02-20 10:20:54 +00:00
Warner Losh
d04c86717c bsd.sys.mk: Add NO_WSTRICT_PROTOTYPES like in kernel
Also add NO_WSTRICT_PROTOTYPES like we do for the kernel.

Sponsored by:		Netflix
2023-02-19 00:02:12 -07:00
Warner Losh
ef6f20ce47 tail: Retry kevent if the system call was interrupted
kevent returns EINTR when I suspend / resume. This causes tail -f
and tail -F to exit with interrupt system call. Ignore this error
and try kevent again.

Sponsored by:		Netflix
2023-02-18 20:09:26 -07:00
Warner Losh
e600bcfb87 stand: Better documentation for full-test.sh
Update now that things have been pushed into the tree.

Sponsored by:		Netflix
2023-02-18 19:53:19 -07:00
Rick Macklem
ed03776ca7 nfsd: Enable the NFSD_VNET vnet front end macros
Several commits have added front end macros for the vnet
macros to the NFS server, krpc and kgssapi.  These macros
are now null, but this patch changes them to front end
the vnet macros.

With this commit, many global variables in the code become
vnet'd, so that nfsd(8), nfsuserd(8), rpc.tlsservd(8) and
gssd(8) can run in a vnet prison, once enabled.
To run the NFS server in a vnet prison still requires a
couple of patches (in D37741 and D38371) that allow mountd(8)
to export file systems from within a vnet prison.  Once
these are committed to main, a small patch to kern_jail.c
allowing "allow.nfsd" without VNET_NFSD defined will allow
the NFS server to run in a vnet prison.

One area that still needs to be settled is cleanup when a
prison is removed.  Without this, everything should work
except there will be a leak of malloc'd data and mutex locks
when a vnet prison is removed.

MFC after:	3 months
2023-02-18 14:59:36 -08:00
Alexander V. Chernikov
79748cec1f tests: fix netlink test_dump_ifaces_many test.
Consider only loopback interfaces when counting.
Otherwise, if pf is loaded, 'pflog0' gets added to the vnet,
 breaking the test.

MFC after:	2 weeks
2023-02-18 22:28:01 +00:00
Joseph Koshy
8a3cca0d08
Sort a list of mentor/mentee relationships.
Approved by:	gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D38658
2023-02-18 21:11:59 +00:00
Alexander V. Chernikov
453c7d6803 netlink: do not crash when linux message translation fails.
CID:		1498889
MFC after:	2 weeks
2023-02-18 17:53:06 +00:00
Alexander V. Chernikov
8f7455a926 netlink: fix OOB read in genetlink
CID:		1498863
MFC after:	1 day
2023-02-18 17:53:06 +00:00
Alexander V. Chernikov
4404e840cf netlink: initialise error in nl_autobind_port().
CID:		1498877
MFC after:	2 weeks
2023-02-18 17:53:05 +00:00
Alexander V. Chernikov
3f70fca90f netlink: check result of sooptcopyin().
CID:		1498866
MFC after:	2 weeks
2023-02-18 17:53:05 +00:00
Alexander V. Chernikov
1ea58b4135 netlink: remove redundant check.
MFC after:	2 weeks
CID:		1498867
2023-02-18 17:53:05 +00:00
Fernando Apesteguía
91706f0d6d netstat.1: Clarify -i and -I priorities
netstat(1) allows to specify both -i (all interfaces) and -I <ifname>.
However, when both are specified, -I always overrides -i.
Add a comment where appropriate the same way we do in rm(1) for -f and -i.

PR:		202708
Reported by:	demon@
Approved by:	manpages (pauamma@)
Differential Revision: https://reviews.freebsd.org/D38654
2023-02-18 18:01:34 +01:00
Rick Macklem
cd406ac94d nfsd: Add NFSD_VNET() macros to nfs_fha_new.c
Although it is not 100% obvious if the affinity threads
lists need to be vnet'd when nfsd runs in a prison, I
think it is necessary for the unusual case where the
same file system is exported in multiple prisons.
For this case, the affinity code might try to assign
the RPC to a svc thread that runs in a different prison.
Also, it makes sense to vnet them, since there are
separate svc threads for each prison running nfsd(8).

This patch adds the macros for vnet'ng to nfs_fha_new.c.
The macros are still null, so the only semantics change
is malloc'ng the fha_param structure.

MFC after:	3 months
2023-02-18 07:45:38 -08:00
Allan Jude
df91d8167d mutex(9): correct man page, mtx_trylock_spin returns int not void
Reviewed by:	kib, pauamma, debdrup
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D35283
2023-02-18 02:30:18 +00:00
Alexander V. Chernikov
ff8da9b2ba netlink: improve attribute decoding in python tests
MFC after:	2 weeks
2023-02-17 18:16:08 +00:00
Alexander V. Chernikov
7cbe771f01 netlink: call genetlink notification handler upon successful family
search.

MFC after:	3 days
2023-02-17 18:16:07 +00:00
Alexander V. Chernikov
45356a1864 netlink: simplify temporary address allocation in rtnl_handle_getlink().
MFC after:	3 days
2023-02-17 18:16:07 +00:00
Alexander V. Chernikov
6694cb1f57 netlink: fix if_allocdescr() malloc options argument.
The current value was based on the initial revision of D37566 and
 was not updated afterwards.

MFC after:	1 day
2023-02-17 18:00:37 +00:00
Alexander V. Chernikov
f2f7911c55 netlink: validate rtable value in RTM_<NEW|DEL|GET>ROUTE.
Reported by:	Stefan Grundmann <sg2342@googlemail.com>
MFC after:	1 day
2023-02-17 18:00:37 +00:00