Commit Graph

281332 Commits

Author SHA1 Message Date
Kyle Evans
deb63adf94 top: fix sorting by pid (-o pid)
The 'pid' order was added, but the equivalent comparator was not back in
8b800d3af2 ("Add the PID column to the list of sort keys.").
`ordernames` indices need to match `compares` indices in order for this
to work.

A future commit will restructure all of this to make it less error prone
going forward (see D37083).

MFC after:	3 days
Reviewed by:	pstef (D37083)
2023-02-13 00:43:32 -06:00
Kyle Evans
f123c6c425 libc: popen: slightly simplify cloexec logic
No need to check the mode again here; we know that `iop` wraps the
correct fd.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D37987
2023-02-13 00:33:57 -06:00
Kyle Evans
8d78a0d331 md5: fix *sum -c with missing files
If we fail to open one of the files in the file listing, we still need
to advance `rec` along with `argv` so that the checksum we're checking
against lines up with the file we're hashing.

Tests added both for the -c flag, as well as the -b and -t modes of
the *sum programs.

PR:		267722
Reviewed by:	emaste (earlier version)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D37374
2023-02-13 00:32:38 -06:00
Kyle Evans
7e688ed493 patch: omit filename if the prompt was ignored
When a file is missing, patch(1) will prompt for a filename to try and
patch it.  If we're doing a dry-run, we'll output that the patch to the
source file was either ignored/failed.  If you ignore the prompt in a
dry-run (i.e. just hit enter), we'll output:

X out of X hunks ignored while patching (null)

Let's improve the aesthetics a bit and just omit the last part if the
prompt was ignored:

X out of X hunks ignored

Unfortunately we can't really test this without expect(1) because both
force and batch mode will use the first best guess, which is wiped out
by the "File to patch:" prompt.  We could record the initially derived
bestguess there and use *that*, but given that this is only possible in
an interactive session I think it's fine to just omit the filename
rather than adding a fair amount of complexity (which could also break
other scenarios I haven't considered yet)..

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38179
2023-02-13 00:15:08 -06:00
Kyle Evans
e63dcbe7a2 wg: tests: remove an obsolete workaround
PR 254212 was resolved to avoid issues with not having IPv6 addresses
present in the jail, so we can safely drop this workaround now...

Reviewed by:	jhb, markj
Differential Revision:	https://reviews.freebsd.org/D37755
2023-02-12 23:59:46 -06:00
Kyle Evans
96f4ab2663 wg: add a test for the home jail socket feature
This adds a test for a semantic that we added to mirror a feature of
the Linux implementation w/ netns: if a wg interface is moved into a
jail, we still create the socket in the context of the home vnet.  With
this added, one can actually create vnet jails that only have a wg
tunnel to the outside world providing network connectivity without any
epairs in the setup.

Reviewed by:	jhb, markj (both earlier version)
Differential Revision:	https://reviews.freebsd.org/D37755
2023-02-12 23:59:35 -06:00
Mateusz Guzik
71948c15ba rpc: ansify
Reported by:	clang 15
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-13 05:39:10 +00:00
Xin LI
39e8c2a29a cleanvar: Be more careful when cleaning up /var.
The cleanvar script uses find -delete to remove stale files under /var,
which could lead to unwanted removal of files in some unusual scenarios.
For example, when a mounted fdescfs(5) is present under /var/run/samba/fd,
find(1) could descend into a directory that is out of /var/run and remove
files that should not be removed.

To mitigate this, modify the script to use find -x, which restricts the
find scope to one file system only instead of descending into mounted
file systems.

PR:		269213
MFC after:	1 week
2023-02-12 20:56:17 -08:00
Ceri Davies
81b9905234 man5/rc.conf.5: document utx_enable variable. 2023-02-12 22:17:46 +00:00
Rick Macklem
ab0440af75 nfsd: Continue adding macros so nfsd can run in a vnet prison
Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more of them.

MFC after:	3 months
2023-02-12 13:52:13 -08:00
Mateusz Guzik
16d10ee023 lge: ansify
Reported by:	clang 15
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-12 21:38:11 +00:00
Joerg Wunsch
57228a4933
ARM release build: enable IPv6 SLAAC by default
When building ARM release images, enable IPv6 SLAAC by default in
addition to IPv4 DHCP.

Unlike amd64 (and other desktop/server) releases, ARM releases on SoC
setups are usually deployed by just using the installation image, so
there is no interactive network configuration. Not having IPv6
included by default is kind of an anachronism these days, given that
FreeBSD with the KAME project once pioneered IPv6 technology.

MFC after:	2 weeks
2023-02-12 22:32:16 +01:00
Mateusz Guzik
eca005d853 zlib: silence K&R warns
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-02-12 21:12:34 +00:00
Dmitry Chagin
10d16789a3 linux(4): Get rid of the opt_compat.h include.
Since e013e369 COMPAT_LINUX, COMPAT_LINUX32 build options are removed,
so include of opt_compat.h is no more needed.

MFC after:		2 weeks
2023-02-12 20:24:32 +03:00
Rick Macklem
fcfdb76e12 nfsd: Fix initialization broken by 7344856e3a6d
Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d did change where things are initialized
and one of the initialization functions was not being called
early enough.  This patch moves nfsrvd_init(0) to the
function called via (VNET_)SYSINIT() to fix this.

Reported by:	olivier
MFC after:	3 months
2023-02-12 09:16:56 -08:00
Alexander V. Chernikov
6d7da7c849 Revert "netlink: make netlink_snl(3) c++ friendly."
Was pushed accidentally.

This reverts commit 629d9219d9.
2023-02-12 12:17:05 +00:00
Alexander V. Chernikov
69e7d9b7e6 fibs: restrict jail_attach(2) if process fibnum >= numfibs in the jail.
Reported by:	olivier
Tested by:	olivier
Reviewed by:	kp, glebius
Differential Revision: https://reviews.freebsd.org/D38505
MFC after:	1 week
2023-02-12 11:46:38 +00:00
Alexander V. Chernikov
629d9219d9 netlink: make netlink_snl(3) c++ friendly. 2023-02-12 11:46:38 +00:00
Rick Macklem
4d68605f31 nfsd: Delete nfsrv_prison_cleanup() until vneting enabled
Oops, although the vneting macros do not do anything yet,
commit 7344856e3a6d enabled the prison cleanup function, that
would get called and crash the system when a jail was terminated.

This patch gets rid of nfsrv_prison_cleanup() for now.
It can go in when the vnet macros are enabled as
front ends to the vnet macros.

MFC after:	3 months
2023-02-11 18:27:59 -08:00
Rick Macklem
7e44856e3a nfsd: Prepare the NFS server code to run in a vnet prison
This patch defines null macros that can be used to apply
the vnet macros for global variables and SYSCTL flags.
It also applies these macros to many of the global variables
and some of the SYSCTLs.  Since the macros do nothing, these
changes should not result in semantics changes, although the
changes are large in number.

The patch does change several global variables that were
arrays or structures to pointers to same.  For these variables,
modified initialization and cleanup code malloc's and free's
the arrays/structures.  This was done so that the vnet footprint
would be about 300bytes when the macros are defined as vnet macros,
allowing nfsd.ko to load dynamically.

I believe the comments in D37519 have been addressed, although
it has never been reviewed, due in part to the large size of the patch.
This is the first of a series of patches that will put D37519 in main.

Once everything is in main, the macros will be defined as front
end macros to the vnet ones.

MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D37519
2023-02-11 15:51:19 -08:00
Konstantin Belousov
6957cd86d9 man: some typesetting and style fixes for recent additions
Mostly start each sentence from a new line.  Also add more pretty
typesetting to cdce(4).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D38501
2023-02-11 19:23:54 +02:00
Rick Macklem
5fd0916cdb nfsd: Add a KASSERT in nfsvno_open
Commit ded5f2954e defined done_namei to indicate that
nd_repstat was set after a successful nfsvno_namei(),
so that a cleanup needs to be done in nfsvno_open().
This only happens when nfsvno_namei() is done with CREATE.

This patch adds a KASSERT() to check for that.

PR:	268971
2023-02-11 07:14:08 -08:00
Fedor Uporov
cbac1f3464 Fix pjfstest issue tests/rename/09.t
Fix rename when renamed directory not owned by user,
but when user owns the sticky parent directory.

Reviewed by:    kib
MFC after:      2 week
Differential revision:  https://reviews.freebsd.org/D38245
2023-02-11 10:01:16 +03:00
Peter Holm
32ded86a06 stress2: Fix compiler warning about unused variables 2023-02-11 06:36:39 +01:00
Kyle Evans
d646513e57 getopt_long(3): note an inconsistency with getopt(3) in BUGS
getopt_long(3) will not allow an `optind` setting of 0 to be bug-for-bug
compatible with the GNU implementation, as some software does rely on
it.  Document it as a BUG, since it affects previous declarations of
compatibility with getopt(3).

Reviewed by:	pauamma (markup)
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37867
2023-02-10 23:32:50 -06:00
Rick Macklem
3e230e0cc4 nfsd: Fix handling of the error case for nfsvno_open some more
Commit ded5f2954e defined done_namei to indicate that
nd_repstat was set after a successful nfsvno_namei(),
so that a cleanup needs to be done in nfsvno_open().
However, it missed the case where a call to
nfsrv_opencheck() in nfsvno_open() sets nd_repstat non-zero.

This would cause panics due to a dangling locked vnode
when nfsrv_opencheck() set nd_repstat, such as during grace
just after a server boot.

This patch fixes the problem.

PR:	268971
2023-02-10 19:34:57 -08:00
Michael Paepcke
c92790b3fb UPDATING: add UPDATING section for HUAWEI 3G/4G Devices change
help users to migrate existing devices

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/645
2023-02-10 16:35:39 -07:00
Michael Paepcke
08ecb40e88 u3g: add huawei device id
Add missing entry for E3372h Model already in NCM mode

Noticed by: David BOYER
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/645
2023-02-10 16:29:54 -07:00
Michael Paepcke
58e1d01022 cdce: add to cdce.4 information about NCM network mode
add a new section how to use NCM network mode and specify the required
kernel modules

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/646
2023-02-10 16:28:34 -07:00
Dimitry Andric
1329d49440 Add libclang_rt files for powerpc64le to ObsoleteFiles.inc
Since f5024381ac we have also built and installed several clang
runtime support libraries (for sanitizers) on powerpc64le, so add
entries to properly clean these up when upgrading.

Reported by:	pkubaj
PR:		269423
MFC after:	2 weeks
2023-02-10 20:10:44 +01:00
Jung-uk Kim
47131a3278 cxgbe: fix module loading
After c034143269, if_cxgbe.ko fails to load if crypto is not compiled
in kernel, e.g., MINIMAL.

link_elf_obj: symbol hmac_init_ipad undefined
linker_load_file: /boot/kernel/if_cxgbe.ko - unsupported file type
kldload: an error occurred while loading module if_cxgbe. Please check dmesg(8) for more details.

Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D38482
2023-02-10 13:27:20 -05:00
Dag-Erling Smørgrav
af0435e16b tarfs: Fix deadlock between descent and ascent in tarfs_lookup().
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D38486
2023-02-10 17:19:45 +00:00
Mariusz Zaborski
346483b1f1 ahci: increase timout
For some devices, like Marvell 88SE9230, it takes more time
to connect to the device. This patch introduces a special flag
that extends the timeout from around 100ms to around 500ms.

This change is based on the work of: Peter Eriksson <pen@lysator.liu.se>

PR:		243401
Reviewed by:	imp
Tested by:	dch
MFC after:	3 days
Sponsored by:	Equinix
Sponsored by:	SkunkWerks, GmbH
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38413
2023-02-10 17:10:04 +01:00
Ihor Antonov
0a402ad2e6 daemon: add long_opts
Long options improve readability of scripts, makes code comprehension
easier.  This patch adds long options while preserving the existing CLI
interface.

Also --help/-h option is added.

Reviewed by:	allanjude, pauamma (both earlier versions), kevans
Differential Revision:	https://reviews.freebsd.org/D38244
2023-02-09 22:36:07 -06:00
Kyle Evans
f44df7959a libc: ssp: remove some GCC 4.2 remnants
With GCC 4.2 out of the tree for a while now and no sign of it
returning, we don't really need to support older versions that don't
allow us to specify a ctor priority anymore.

Noticed by:	mjg
2023-02-09 22:11:54 -06:00
Simon J. Gerraty
dc1b8c9a84 Merge bmake-20230208
Merge commit 'f4d51098686d961fc03dc5aa327619d0af3c9dcd'
2023-02-09 17:23:23 -08:00
Simon J. Gerraty
f4d5109868 Import bmake-20230208
ChangeLog since bmake-20230126

        * VERSION (_MAKE_VERSION): 20230208
        Merge with NetBSD make, pick up
        o var.c: always use SCOPE_GLOBAL for :_ to avoid problems
        when it has been used within conditional expressions

        * install-sh: if making directories ensure umask is set
        to match mode.

        * Makefile: use DIRMODE for directories and
        NONBINMODE for man pages and mk files
2023-02-09 17:20:05 -08:00
Elliott Mitchell
cd3193f640 Add ck.h userspace shims for CK_SLIST_
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38471
2023-02-09 16:30:17 -07:00
Alan Somers
09f29b03dd sesutil: plug memory leaks
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D33955
2023-02-09 14:43:17 -07:00
Mark Johnston
4130ea611f inpcb: Split in_pcblookup_hash_locked() and clean up a bit
Split the in_pcblookup_hash_locked() function into several independent
subroutine calls, each of which does some kind of hash table lookup.
This refactoring makes it easier to introduce variants of the lookup
algorithm that behave differently depending on whether they are
synchronized by SMR or the PCB database hash lock.

While here, do some related cleanup:
- Remove an unused ifnet parameter from internal functions.  Keep it in
  external functions so that it can be used in the future to derive a v6
  scopeid.
- Reorder the parameters to in_pcblookup_lbgroup() to be consistent with
  the other lookup functions.
- Remove an always-true check from in_pcblookup_lbgroup(): we can assume
  that we're performing a wildcard match.

No functional change intended.

Reviewed by:	glebius
Differential Revision:	https://reviews.freebsd.org/D38364
2023-02-09 16:15:03 -05:00
Mark Johnston
b265a2e0d7 vmm: Fix AP startup compatibility for old bhyve executables
These changes unbreak AP startup when using a 13.1-RELEASE bhyve
executable with a newer kernel:
- Correct the destination mask for the VM_EXITCODE_IPI message generated
  by an INIT or STARTUP IPI in vlapic_icrlo_write_handler().
- Only initialize vlapics on active vCPUs.  13.1-RELEASE bhyve activates
  AP vCPUs only after the BSP starts them with an IPI, and vmm now
  allocates vcpu structures lazily, so the STARTUP handling in
  vm_handle_ipi() could trigger a page fault.
- Fix an off-by-one setting the vcpuid in a VM_EXITCODE_SPINUP_AP
  message.

Fixes:	7c326ab5bb ("vmm: don't lock a mtx in the icr_low write handler")
Reviewed by:	jhb, corvink
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38446
2023-02-09 16:14:33 -05:00
Mark Johnston
ba34de1b3b vmm: Remove an unneeded initialization of "retu"
vm_handle_ipi() unconditionally initializes "retu".  No functional
change intended.

Reviewed by:	jhb, corvink
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38446
2023-02-09 16:14:33 -05:00
Mark Johnston
f3bbd0e818 vmm: Collapse identical case statements in vlapic_icrlo_write_handler()
No functional change intended.

Reviewed by:	jhb, corvink
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38446
2023-02-09 16:14:33 -05:00
Mitchell Horne
78919798e7 kern_poll: include sys/sched.h
For sched_relinquish(). This fixes the build for some kernel configs.

Reported by:	Jenkins
Fixes:		1029dab634 ("mi_switch(): clean up switch types and their usage")
2023-02-09 17:13:02 -04:00
Alex
aca7ff471a .github: Restrict permissions on cross-build jobs. 2023-02-09 12:12:17 -08:00
Andrew Gallatin
d24b032bec ktls: Fix comments & whitespace issues with c0e4090e3d
Address some last minute review feedback on c0e4090e3d
by fixing spacing around comments, and clarifying that the
newly added destroy_task is not related to tls 1.0.
No functional change intended.

Pointed out by: jhb
Sponsored by: Netflix
2023-02-09 14:11:24 -05:00
Warner Losh
e9eee0f256 lua: Export loaded modules env vars via environment
To make auditing and debugging easier, export foo_load=XXX foo_name=yyy
etc to the loader env that we export to the kernel.

Original by:		dhw
Sponsored by:		Netflix
Discussed with:		kevans
Differential Revsion:	https://reviews.freebsd.org/D38466
2023-02-09 11:56:20 -07:00
Dag-Erling Smørgrav
71e0c8906e tzcode: Resurrect tzsetwall(3) with a deprecation warning.
This function has been around since 4.4BSD but was dropped upstream in 2020.  This went unnoticed when tzcode was updated.  Bring it back, but prepare for removing it before 14.0 is released.

PR:		269445
MFC after:	3 days
Reported by:	val@packett.cool
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D38445
2023-02-09 19:35:34 +01:00
Andrew Gallatin
c0e4090e3d ktls: Accurately track if ifnet ktls is enabled
This allows us to avoid spurious calls to ktls_disable_ifnet()

When we implemented ifnet kTLSe, we set a flag in the tx socket
buffer (SB_TLS_IFNET) to indicate ifnet kTLS.  This flag meant that
now, or in the past, ifnet ktls was active on a socket.  Later,
I added code to switch ifnet ktls sessions to software in the case
of lossy TCP connections that have a high retransmit rate.
Because TCP was using SB_TLS_IFNET to know if it needed to do math
to calculate the retransmit ratio and potentially call into
ktls_disable_ifnet(), it was doing unneeded work long after
a session was moved to software.

This patch carefully tracks whether or not ifnet ktls is still enabled
on a TCP connection.  Because the inp is now embedded in the tcpcb, and
because TCP is the most frequent accessor of this state, it made sense to
move this from the socket buffer flags to the tcpcb. Because we now need
reliable access to the tcbcb, we take a ref on the inp when creating a tx
ktls session.

While here, I noticed that rack/bbr were incorrectly implementing
tfb_hwtls_change(), and applying the change to all pending sends,
when it should apply only to future sends.

This change reduces spurious calls to  ktls_disable_ifnet() by 95% or so
in a Netflix CDN environment.

Reviewed by: markj, rrs
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D38380
2023-02-09 12:44:44 -05:00
Dag-Erling Smørgrav
ce6a0c776b tarfs: Fix issues revealed by static analysis and testing.
* tarfs_alloc_mount(): Remove an unnecessary null check (CID 1504505) and an unused variable.

* tarfs_alloc_one(): Verify that the file size is not negative (CID 1504506).  While there, also validate the mode, owner and group.

* tarfs_vget(), tarfs_zio_init(): Explicitly ignore return value from getnewvnode(), which cannot fail (CID 1504508)

* tarfs_lookup_path(): Fix a case where a specially-crafted tarball could trigger a null pointer dereference by first descending into, and then backing out of, a previously unknown directory. (CID 1504515)

* mktar: Construct a tarball that triggers the aforementioned null pointer dereference.

Reported by:	Coverity
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D38463
2023-02-09 17:35:47 +00:00