Commit Graph

285013 Commits

Author SHA1 Message Date
Jessica Clarke
0a5e35a7b1 Makefile.libcompat: Be consistent about not installing includes
Currently we only pass MK_INCLUDES=no for distribute and install, since
it's only in LIB${_LIBCOMPAT}IMAKE, which means that we enable includes
during libraries and thus install includes into worldtmp, despite it
being shared these days across native and libcompats. This also means
we're at risk of having headers needed for building against a libcompat
that don't get installed to the system, but do end up being installed to
worldtmp. In particular, lib/msun has different fenv.h for aarch64 and
arm, so aarch64 will need arm's copy when it grows lib32 support, and
this would be installed to worldtmp, but not to the system, meaning any
programs that use fenv.h wouldn't be able to be built.

Instead, be consistent, and don't install includes at all during any of
the libcompat phases, so that we can detect these issues and ensure any
needed headers are installed for both worldtmp and the system.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D41030
2023-07-14 02:36:04 +01:00
Jessica Clarke
587458b7d6 rpcgen: Perform shell-style word expansion on RPCGEN_CPP
Up until recently, CPP has been a list of space-separated words, with no
quotes, backslashes or other characters with special meaning to a shell.
However, as of 8fad2cda93, (escaped) quotes appear in CPP, and the
rudimentary parser in rpcgen is insufficient, since it will leave the
escaped quotes as escaped rather than performing one level of expansion
as would be done by a shell (whether in a script or a Makefile).

Rather than hack around this in all the places RPCGEN_CPP gets set,
implement proper expansion inside rpcgen. Note that this only deals with
a subset of shell syntax, since we don't handle any of:

  | & ; < > ( ) $ ` * ? [ # ˜ = %

having special meaning (with the exception of how a backslash behaves
inside double quotes, where \$ means a literal $ inside double quotes
but \a means a literal \a), instead using their literal value, but those
are all reasonable restrictions, and can be worked around by avoiding
their use; what's important is that we get the quoting and splitting
right.

This fixes -Winvalid-pp-token spew during build${libcompat}.

Reviewed by:	brooks
Fixes:		8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make variables")
Differential Revision:	https://reviews.freebsd.org/D41013
2023-07-14 02:35:25 +01:00
John Baldwin
39248950a0 nvmecontrol.8: Fix a few formatting nits. 2023-07-13 17:10:36 -07:00
Jose Luis Duran
d234c8228c xargs: Install missing test output.
Fixes:		eab91d0081
MFC after:	1 week
Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D41033
2023-07-13 23:39:51 +00:00
Dag-Erling Smørgrav
c65845d0bb xargs: Fix test case count.
MFC after:	1 week
Sponsored by:	Klara, Inc.
2023-07-13 21:40:36 +00:00
Dag-Erling Smørgrav
eab91d0081 xargs: Prevent overflow in linelen calculation if nargs is large.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D41023
2023-07-13 21:35:23 +00:00
Daniel Tameling
1048a870e3 xargs: disallow -R0 and -L0
Both cases were interpreted as these flags are unset. This meant that
-R0 got converted to -R5 and that -L0 didn't have any effect at all.
Since make at most 0 replacements isn't useful and since call utility
for every 0 lines read doesn't make sense, throw an error for these
two cases.

MFC after:	1 week
Reviewed by:	des, kevans
Differential Revision:	https://reviews.freebsd.org/D41022
2023-07-13 21:35:23 +00:00
Daniel Tameling
202adb2236 xargs: fix -R so that it accepts negative numbers again
fbc445addf converted the parsing of arguments to strtonum but made
the accepted range for -R too restrictive. As documented in the man
page, it should accept negative numbers.

Added a test for this, which was provided by Jose Luis Duran.

Fixes:		fbc445addf
MFC after:	1 week
Reviewed by:	des, kevans
Differential Revision:	https://reviews.freebsd.org/D41021
2023-07-13 21:35:23 +00:00
Dmitry Chagin
c3f58005d9 signal: Remove gsignal references from manuals
Reported by:		Mina Galić, mhorne
Reviewed by:		Mina Galić, mhorne
Differential Revision:	https://reviews.freebsd.org/D41020
MFC after:		1 week
2023-07-14 00:15:47 +03:00
Michael Tuexen
be78a31188 tcp: fix build issue for some cc modules
The TCP_HHOOK option was moved from opt_inet.h to opt_global.h in
https://cgit.FreeBSD.org/src/commit/?id=e68b3792440cac248347afe08ba5881a00ba6523
The corresponding changes in two Makefiles were missed, which resulted
in not building cc_cdg, cc_chd, cc_hd, and cc_vegas anymore.

Reported by:		void@f-m.fm
Reviewed by:		rrs, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D41010
2023-07-13 18:56:25 +02:00
Dimitry Andric
1cd9788408 Merge commit fde5924dcc69 from llvm-project (by Serge Pavlov):
[clang] Reset FP options before template instantiation

  AST nodes that may depend on FP options keep them as a difference
  relative to the options outside the AST node. At the moment of
  instantiation the FP options may be different from the default values,
  defined by command-line option. In such case FP attributes would have
  unexpected values. For example, the code:

      template <class C> void func_01(int last, C) {
        func_01(last, int());
      }
      void func_02() { func_01(0, 1); }
      #pragma STDC FENV_ACCESS ON

  caused compiler crash, because template instantiation takes place at the
  end of translation unit, where pragma STDC FENV_ACCESS is in effect. As
  a result, code in the template instantiation would use constrained
  intrinsics while the function does not have StrictFP attribute.

  To solve this problem, FP attributes in Sema must be set to default
  values, defined by command line options.

  This change resolves https://github.com/llvm/llvm-project/issues/63542.

  Differential Revision: https://reviews.llvm.org/D154359

Requested by:	pkubaj
PR:		265755, 265758
MFC after:	1 month
2023-07-13 20:57:22 +02:00
Doug Moore
8f056492c5 vfs_bio: initialize pctries
bufobj_init depends on fields bo_dirty.bv_root and bo_clean.bv_root
being zeroed on entry and pctrie_init zeroing whatever is passed to
them, and so does not call pctrie_init for either of them. That fails
if pctrie_init ever changes to do something other that zeroing data,
so add explicit calls to them.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D40978
2023-07-13 13:28:21 -05:00
Luiz Amaral
6fc7fc2dbb pfsync: transport over IPv6
Implement pfsync over IPv6.

Submitted by:	Luiz Amaral <email@luiz.eng.br>
Submitted by:	Naman Sood <naman@freebsdfoundation.org>
Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D40102
2023-07-13 08:09:42 +02:00
Dmitry Chagin
17cb2ac3df signal: Get rid of gsignal() as it not used anywhere
Reviewed by:		imp, kib
Differential Revision:	https://reviews.freebsd.org/D41007
MFC after:		1 week
2023-07-13 10:41:51 +03:00
Kajetan Staszkiewicz
6b4ed16d74 pf: Simplify rule actions logic
Actions applied to a processed packet come in case of stateless
firewalling from a rule or in case of statefull firewalling from a
state. The state obtains the actions from a rule when it is created by a
rule or by pfsync. The logic for deciding if actions come from a rule or
a state is spread across many places in pf.

There already is struct pf_rule_actions in struct pf_pdesc and thus it
can be used as a central place for storing actions and their parameters.
OpenBSD does something similar: they also store the actions in struct
pf_pdesc and have no variables in pf_test() but they use separate
variables instead of a structure. By using struct pf_rule_actions we can
simplify the code even further. Applying of actions is done *only* in
pf_rule_to_actions() no matter if for the legacy scrub rules or for the
normal match / pass rules. The logic of choosing if rule or state
actions are used is applied only once in pf_test() by copying the whole
struct.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D41009
2023-07-13 07:36:39 +02:00
Jessica Clarke
9d843ba324 rpcgen: Clarify behaviour for idx
The re-initialisation of idx in the later else branch is a bit hidden,
and results in deviation from the earlier two paths. Use more consistent
code instead to make it abundantly clear what's going on.
2023-07-13 06:22:59 +01:00
Konstantin Belousov
7cd7a32041 Document fdescfs mount option "rdlnk"
Reviewed by:	dchagin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40969
2023-07-13 04:14:29 +03:00
Konstantin Belousov
3905309dfe fdescfs: add a mount option rdlnk
which changes /dev/fd/N files types to symbolic link with the behavior
of symbolic links.

PR:	272127
Reported by:	Peter Eriksson <pen@lysator.liu.se>
Reviewed by:	dchagin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40969
2023-07-13 04:14:20 +03:00
Konstantin Belousov
9c3bfe2ad0 Revert "VFS: Remove VV_READLINK flag" and "fdescfs: improve linrdlnk mount option"
This reverts commits 4a402dfe0b and
3bffa22623.

The fix will be implemented in somewhat different manner.  The semantic
adjustment is incompatible with linuxolator expectations.

Reported and reviewed by:	dchagin
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40969
2023-07-13 04:14:12 +03:00
Glen Barber
510fd83138 release: remove a stray backslash
PR:		272354 (related)
MFC after:	3 days
MFC with:	0ed426276f
MFC with:	cd8cad0ef5
Sponsored by:	GoFundMe https://www.gofundme.com/f/gjbbsd
2023-07-12 16:57:57 -04:00
Glen Barber
cd8cad0ef5 release: follow-up to previous commit to install lang/python{,3}
PR:		272354
Sponsored by:	GoFundMe https://www.gofundme.com/f/gjbbsd
2023-07-12 16:49:53 -04:00
Glen Barber
0ed426276f release: ensure gce-check-depends installs lang/python{,3}
PR:		272354
Sponsored by:	GoFundMe https://www.gofundme.com/f/gjbbsd
2023-07-12 16:08:40 -04:00
Kajetan Staszkiewicz
f2064dd1f1 pf: Fix duplicate storage of direction
The variable storing the direction of a processed packet is passed
around to many functions. Most of those functions already have a pointer
to struct pf_pdesc which also contains the direction. By using the one
in struct pf_pdesc we can reduce the amount of arguments passed around.

Reviewed by:	kp
Sponsored by:	InnGames GmbH
Differential Revision:	https://reviews.freebsd.org/D41008
2023-07-12 18:05:47 +02:00
Yufeng Zhou
294c52d969 amd64 pmap: Fix compilation when superpage reservations are disabled
The function pmap_pde_ept_executable() should not be conditionally
compiled based on VM_NRESERVLEVEL. It is required indirectly by
pmap_enter(..., psind=1) even when reservation-based allocation is
disabled at compile time.

Reviewed by:	alc
MFC after:	1 week
2023-07-12 12:07:42 -05:00
Gleb Smirnoff
0d1ff2b04d vmm: don't leak locks exiting vmmdev_ioctl()
At least an error from vcpu_lock_all() at line 553 would leak
memseg lock.  There might be other cases as well.

Reviewed by:		corvink, markj
Differential Revision:	https://reviews.freebsd.org/D40981
2023-07-12 09:16:40 -07:00
Gleb Smirnoff
30f0328a32 vmm: don't return random error from vcpu_lock_all() if vcpu is empty
When vcpu array is empty, function would return random value from
stack.  What I observed was -1.

Reviewed by:		corvink, markj
Differential Revision:	https://reviews.freebsd.org/D40980
2023-07-12 09:16:40 -07:00
Eric van Gyzen
dad11f990e dtrace: prevent forked child from running after an error condition
The pid/killonerror test uses an invalid probe specifier to verify that
the child process is killed.  It occasionally fails because the "date"
command is allowed to run long enough to print the date.  This is harmless
in this case, but is clearly not ideal.

When the dt_proc_control thread is about to exit, and the dtrace command
forked the child, do not make the child runnable.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D40976
2023-07-12 10:33:28 -05:00
Kristof Provost
df56c8069a pf: fix error descriptions in the man page
PR:		272459
Submitted by:	alex@inferiorhumanorgans.com
MFC after:	1 week
2023-07-12 13:17:14 +02:00
Kristof Provost
64b30b7aeb pf: fix pfi_kif definition in the man page
PR:		272455
Submitted by:	alex@inferiorhumanorgans.com
MFC after:	1 week
2023-07-12 11:43:43 +02:00
Jessica Clarke
3a46fe2261 getlocalbase: Make default path actually configurable
We include paths.h in getlocalbase.c, which defines _PATH_LOCALBASE.
This will override a definition on the command line, meaning it is
impossible to override like how the manpage says you can, and it means
the code to provide a fallback default is dead as the macro is always
defined.

Instead, introduce a new LOCALBASE_PATH macro like LOCALBASE_CTL_LEN
that can be set on the command line and will default to the system's
existing _PATH_LOCALBASE to avoid duplicating the default here.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40975
2023-07-11 21:49:22 +01:00
Jessica Clarke
d1e44bc944 kmod.mk: Use portable printf '%s' over non-portable echo -n
Whilst /bin/echo on macOS and Linux implement -n, as do the builtin
echos in bash and zsh, the builtin echo in dash does not, causing the
first line of the output to be -n foo rather than just foo, and there to
be an extra newline in the output and thus blank line, both of which
result in "Symbol ... is not present in *.kld" warnings appearing in the
build output (once for -n foo and once for the empty string for each
module where EXPORT_SYMS is a list of symbols).

MFC after:	1 week
2023-07-11 21:30:06 +01:00
Mark Johnston
0dea4f064d bhyve: Deduplicate some code in modify_bar_registration()
No functional change intended.

Reviewed by:	corvink, jhb
MFC after:	1 week
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D40877
2023-07-11 15:22:37 -04:00
Jessica Clarke
bfc47586ac getlocalbase.3: Fix AUTHORS formatting
MFC after:	1 week
2023-07-11 18:50:32 +01:00
Jessica Clarke
f8cabe5550 libutil: Delete trailing whitespace 2023-07-11 18:45:23 +01:00
Piotr Kubaj
5ddb1aa305 ix, ixv: fix kernel build
struct adapter was renamed to struct sc.

Reported by: FreeBSD User <freebsd@walstatt-de.de>
2023-07-11 19:41:26 +02:00
Piotr Kubaj
6ad2a9a64f ix: remove stale comment
Reported by:	Navdeep Parhar
2023-07-11 18:45:04 +02:00
Piotr Pietruszewski
a0302c9231 ix, ixv: Update link status with autonegotiated baudrate value
Use autonegotiated link speed value while updating link status
to iflib.

This patch is part of change made in NetBSD kernel
by Masanobu Saitoh, NetBSD maintainer.

Differential Revision:	https://reviews.freebsd.org/D19176
Approved by:	erj
2023-07-11 18:14:26 +02:00
Kristof Provost
66f2f9ee08 ipfw: teach ipfw that pfsync is an upper layer protocol
Explicitly add pfsync as a know upper layer protocol so we don't
automatically discard pfsync packets (carried over IPv6).

net.inet6.ip6.fw.deny_unknown_exthdrs defaults to 1, so even if
net.inet.ip.fw.default_to_accept is set to 1 we'd discard pfsync (over
IPv6).

Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D40973
2023-07-11 14:59:08 +02:00
Dmitry Chagin
d744a37a3a csu: Implement _start using as to satisfy unwinders on i386
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

The hack localizing _start1 symbol removed.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40624
2023-07-11 15:12:01 +03:00
Dmitry Chagin
d7e2580a14 csu: Add the prologue and epilogue to the _init and _fini on i386
Normally, modern unwinders uses Dwarf information to unwind stack,
however in case when the code is not annotated by Dwarf instructions,
unwinders fallbacks to a frame-pointer based algorithm.

That is allows libunwind to unwind stack from global constructors and
destructors. Also it makes gdb happy as it printed nonexistent frame
before.

Reviewed by:		kib, imp
Differential Revision:	https://reviews.freebsd.org/D40948
2023-07-11 15:11:22 +03:00
Dmitry Chagin
e541cf8316 rtld: Annotate .rtld_start on i386
Add a stop indicator to rtld_start to satisfy unwinders:
The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

That is allows gdb and libunwind successfully stop when unwinding stack
from global constructors and destructors.

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40949
2023-07-11 15:10:32 +03:00
Dmitry Chagin
86c63225ea rtld: Microoptimize rtld_start on i386
Initial stack pointer is preserved in calle-saved %esi,
use it bellow to pass initial stack pointer to _rtld().

Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D40950
2023-07-11 15:10:08 +03:00
Peter Holm
972e60da74 stress2: Added two syzkaller reproducers 2023-07-11 10:24:19 +02:00
Kyle Evans
5d0826017f libbe: promote activated BEs all the way
This matches the beadm behavior; generally, we need to keep promoting
until the BE is no longer a clone from a snapshot.  This fixes scenarios
where the dataset associated with a BE's origin is itself a clone,
activating the BE previously would promote it to a clone of the origin's
origin.

We could keep using be_get_dataset_props here, except for two
annoyances:

1.) I couldn't find a clean way to just clear an nvlist rather than
    having to re-alloc it, and I didn't want to just remove the one prop
    we're inspecting out of it.

2.) That's a lot of overhead when all we want to do is fetch the origin
    anyways.

Note that this is not a complete fix, but it does fix the majority of
cases; deep BE subordinates are still notably broken, pending a patch
from Christian.

Reported by:	R. Christian McDonald <rcm@rcm.sh>
Reviewed by:	rew
Differential Revision:	https://reviews.freebsd.org/D40903
2023-07-11 00:44:13 -05:00
Peter Grehan
43ed91e00b igc: Increase default per-queue interrupt rate to 20000.
The default per-queue packet rate of 8000 will cause packet loss when
forwarding at 2.5G with a single stream, as is common when using e.g.
iperf3 to test a platform.

Bump this to 20000 (the "low latency" value in the Linux driver) which
avoids packet loss for this type of test.

Future work will use adaptive interrupt rate in a similar fashion
to the ixgbe driver.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Reviewed by:	erj, kp
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D40904
2023-07-11 13:29:37 +10:00
Jessica Clarke
1ec7cb1b5d depend-cleanup: Add verbose (-v) and pretend/dry-run (-n) flags
These are useful for testing new additions to the script. Whilst here,
harden the script a little and improve error messages.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31007
2023-07-11 01:53:04 +01:00
Jessica Clarke
c70dd03a7f Make sure MACHINE(_ARCH) are exported for depend-cleanup.sh
We run depend-cleanup.sh twice during the build. The second time is the
normal run, where we run it under WMAKEENV and thus have CROSSENV's
MACHINE(_ARCH)=${TARGET(_ARCH)} in the environment. However, the first
time is for bootstrap-tools, where it's run under BMAKEENV and we don't
have any assignments to MACHINE(_ARCH) in the environment, meaning the
script sees them as unset. In practice this doesn't matter since the
only use doesn't apply to bootstrap-tools, but it could be a future
issue. Thus, explicitly export them for depend-cleanup.sh and have the
script verify they're set.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40968
2023-07-11 01:53:04 +01:00
Konstantin Belousov
565a343ae3 sigqueue_delete_set_proc(): initialize sq_proc for worklist
This should fix leaks for the p_killpg_cnt counter, because
sigqueue_flush() drops ksi's.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-11 03:52:16 +03:00
Konstantin Belousov
7e4c6b2163 msdosfs: zero partially valid extended cluster
It contains arbitrary garbage, which is not cleared by vfs_bio_clrbuf()
which only zeroes invalid portions of the pages.

Reported by:	Maxim Suhanov <dfirblog@gmail.com>
Discussed with:	so
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-11 03:49:09 +03:00
Jessica Clarke
f3674213e3 depend-cleanup.sh: Fix whitespace
Fixes:	45c4ff15e3 ("depend-cleanup.sh: Handle libc bcmp.S moving to bcmp.c on amd64.")
2023-07-11 00:18:15 +01:00