Commit Graph

285047 Commits

Author SHA1 Message Date
Warner Losh
d3152ab23e tcbpcb: Always define t_osd
Always define t_osd. congestion control modules access it
unconditionally. This fixes the build.

However, this is, at best, a temporary band-aide until the
larger issues are sorted.

Sponsored by:		Netflix
2023-07-17 11:22:45 -06:00
Mark Johnston
af20d58ef1 bhyve: Remove an unneeded vm_get_register() call in main()
At one point the RIP value was passed to fbsdrun_addcpu(), but this is
no longer the case.  No functional change intended.

Reviewed by:	jhb, corvink
Sponsored by:	Innovate UK
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40988
2023-07-17 11:15:54 -04:00
Mark Johnston
0855749d29 bhyve: Fix whitespace in bhyverun.c
No functional change intended.

MFC after:	1 week
2023-07-17 11:15:49 -04:00
Mateusz Piotrowski
9e850513da style.Makefile.5: Wordsmith .PATH description
MFC after:	3 days
Fixes:	1ac5586c6d style.Makefile.5: Do not require $FreeBSD$ SCM IDs
2023-07-17 15:06:02 +02:00
Mateusz Piotrowski
22faf70d7e style.Makefile.5: Remove $FreeBSD$ from examples
MFC after:	3 days
2023-07-17 15:01:52 +02:00
Mateusz Piotrowski
73fb7a7a73 style.Makefile.5: Stop documenting NO_MAN
NO_MAN has been an error since 2020 according to UPDATING.

PR:		231357
MFC after:	3 days
2023-07-17 14:52:28 +02:00
Steve Kargl
be4c7f2735 libm: correctly test for for NaN and Infinity in sinpi(), cospi(), and tanpi()
The current versions of lib/msun/src/s_cospi.c, s_sinpi.c and s_tanpi.c
all exhibit the same defect. After checking for various numeric ranges,
they check to see whether the input argument is a NaN or an Infinity.
However, the code uses a value of 0x7f80000 instead of the correct value
of 0x7ff00000.

If you review s_cospif.c, s_sinpif.c, and s_tanpif.c, you will see that
the equivalent statements in these functions are accurate and have
appropriate source comments.

The impact of these defects is to flag some valid input values as
invalid and raise a pole error (divide by zero).

Reported by:	Paul Green <Paul.Green@stratus.com>
PR:	272539
MFC after:	1 week
2023-07-17 08:23:27 +03:00
Doug Moore
b8cc13fa21 riscv pmap: another vm_radix_init
pmap_pinit0 also needs to initialize a vm_radix, in case vm_radix_init
does anything but zeroing fields.

Reported by:	alc
Reviewed by:	alc
Differential Revision:	https://reviews.freebsd.org/D41055
2023-07-16 15:48:43 -05:00
Dimitry Andric
881fc20356 Merge commit 8757ce490130 from llvm-project (by Simon Pilgrim):
[PowerPC] Replace PPCISD::VABSD cases with generic ISD::ABDU(X,Y) node

    A move towards using the generic ISD::ABDU nodes on more backends

    Also support ISD::ABDS for v4i32 types using the existing signbit flip trick

    PowerPC has a select(icmp_ugt(x,y),sub(x,y),sub(y,x)) -> abdu(x,y) combine that I intend to move to DAGCombiner in a future patch.

    The ABS(SUB(X,Y)) -> PPCISD::VABSD(X,Y,1) v4i32 combine wasn't legal (https://alive2.llvm.org/ce/z/jc2hLU) - so I've removed it, having already added the legal sub nsw tests equivalent.

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

This fixes a "Wasn't expecting to be able to lower this!" fatal error
when compiling graphics/opencv for PowerPC.

Requested by:	pkubaj
PR:		271047
MFC after:	1 month
2023-07-16 20:45:29 +02:00
Robert Clausecker
4da7282a18 lib/libc/string/bcmp.c: fix integer overflow bug
bcmp() returned the number of remaining bytes when the main loop exits.
In case of a match, this is zero, else a positive integer.  On systems
where SIZE_MAX > INT_MAX, the implicit conversion from size_t to int in
the return value may cause the number of remaining bytes to overflow,
becoming zero and falsely indicating a successful comparison.

Fix the bug by always returning 0 on equality, 1 otherwise.

PR:		272474
Approved by:	emaste
Reviewed by:	imp
MFC After:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41011
2023-07-16 20:36:17 +03:00
Robert Clausecker
c1e63e352e libexec/rtld-elf/rtld-libc/Makefile.inc: do not use machdep string functions
With ifunc based SIMD dispatch, we cannot use the amd64 assembly
implementations of string functions.  Modify rtld to instead use
the generic functions.  To avoid an architecture-specific special
case, this change is applied to all architectures.

This change is a prerequisite to and formerly part of D40693.

Sponsored by:	FreeBSD Foundation
Approved by:	kib
See also:	D40693
Differential Revision: https://reviews.freebsd.org/D41050
2023-07-16 18:41:55 +03:00
Konstantin Belousov
1005d3d053 rtld: fix dlopen() for an object that is already mapped but not yet initialized
For instance, dso might be mapped as needed but not yet initialized from
the other subtree of needed objects, while current object' constructor
does dlopen() for the dso.  Right now rtld does relocations and other
processing based on the arrival of new objects in the global list, which
is not happens there.  Directly check for the initialization state of
the object, for which we would return the handle.

One practical use case of this support is e.g. dlopen("libthr.so",
RTLD_NOLOAD) by libraries that are threading-aware but happy to live
with libc pthread shims if the program is not multithreaded.

Reviewed by:	tijl
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2023-07-16 15:34:34 +03:00
Konstantin Belousov
ad056b5d35 libthr: trigger library initialization on rwlock calls
Reviewed by:	tijl
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-16 15:34:34 +03:00
Konstantin Belousov
80c5588495 libthr: some style in thr_rwlock.c
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-16 15:34:23 +03:00
Warner Losh
a9490b81b0 Merge LUA 5.4.6
This is a bug fix to Lua 5.4.4 (5.4.5 was withdrawn due to ABI issues
and 5.4.6 is 5.4.5 with those fixed).
2023-07-15 11:31:04 -06:00
Warner Losh
71944acbe7 lua: Update to 5.4.6
Sponsored by:		Netflix
2023-07-15 11:25:52 -06:00
Doug Rabson
5ac2a874d0 /etc/rc.subr: rename sysctl.conf.d to sysctl.kld.d
This better reflects the intent that this directory is indexed by kld
name and removes a conflict with D32128 which aims to split sysctl.conf.

Reviewed by:	kevans imp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D41043
2023-07-15 14:16:08 +01:00
Alan Somers
2a0c0aea42 Fix zfsd unittests after 92642bba4d
At the time we ensured that the more important functional tests were
working, but neglected to update the unit tests.

MFC after:	2 weeks
MFC with:	92642bba4d
Sponsored by:	Axcient
2023-07-14 15:57:40 -06:00
Robert Clausecker
3f5788e0ed lib/libc/string/ffs*.c: work around gcc warning
Gcc warns of infinite recursion if we use __builtin_ffs*() to
implement ffs*().  This is because gcc uses ffs() to implement
these on some platforms.  Sidestep the warning by using
__builtin_ctz*() for these.

Sponsored by:	FreeBSD Foundation
Reported by:	jlduran@gmail.com, jhb
Fixes:		ee8b0c43 (D40730)
Reviewed by:	jhb, mhorne
Approved by:	jhb
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D40966
2023-07-14 22:26:43 +02:00
Kyle Evans
e74bc7757a lib/libc/string/ffs*.c: fix problems introduced with D40730
Remove stale dependencies on the remaining old assembly
ffs*/fls* implementations.

Sponsored by:	FreeBSD Foundation
Reported by:	jlduran@gmail.com, jhb
Fixes:		ee8b0c43 (D40730)
Approved by:	jhb
Differential Revision: https://reviews.freebsd.org/D40966
2023-07-14 22:23:31 +02:00
John Baldwin
c9b1980394 memdesc: Retire MEMDESC_BIO.
Instead, change memdesc_bio to examine the bio and return a memdesc of
a more generic type describing the data buffer.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D41029
2023-07-14 11:32:40 -07:00
John Baldwin
bab38b44dd memdesc: Add a MEMDESC_VMPAGES descriptor type.
This memory descriptor is backed by an array of VM pages.  This type
requires adding a new field to 'struct memdesc' to hold the offset
within the first page.  For LP64 systems, this new field is added in
an existing padding hole so does not increase the size.  For ILP32
systems, this grows 'struct memdesc' from 12 to 16 bytes.

Reviewed by:	imp, markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D41028
2023-07-14 11:32:24 -07:00
John Baldwin
3dba010e49 memdesc: Replace md_opaque with a union of type-specific fields.
Reviewed by:	imp, markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D41027
2023-07-14 11:32:21 -07:00
John Baldwin
60381fd1ee memdesc: Retire MEMDESC_CCB.
Instead, change memdesc_ccb to examine the CCB and return a memdesc of
a more generic type describing the data buffer.

Reviewed by:	imp, markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D40880
2023-07-14 11:32:16 -07:00
John Baldwin
6582301f83 PCI DEN0115: Reliably check for a memory resource during probe.
rid was stack garbage, so the bus_alloc_resource_any() call could fail
and fall through to the SMCCC version check even if a bridge had a
memory resource.

Debugging help:	jrtc27
Reviewed by:	jrtc27
Fixes:		c9a05c0722 Add a PCI driver that follows the Arm DEN0115 spec
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D41025
2023-07-14 10:27:40 -07:00
John Baldwin
a248abb55a Obsoletefiles.inc: A few OpenSSL 3 cleanups.
- Treat old engine DSOs from OpenSSL 1.1.1 as OLD_LIBS, not OLD_FILES.
  These should only be deleted by make delete-old-libs similar to how
  PAM modules are treated.

- Add /usr/lib32/engines to OLD_DIRS.  lib32 automation does not apply
  to OLD_DIRS.

Reviewed by:	Pierre Pronchery <pierre@freebsdfoundation.org>
Differential Revision:	https://reviews.freebsd.org/D41034
2023-07-14 10:25:54 -07:00
Olivier Certner
f58378393f vn_lock_pair(): Support passing LK_NODDLKTREAT
Since this function ultimately calls vn_lock() or VOP_LOCK1(), allows it to
receive and pass this flag which is used in the lookup code and doesn't
interfere with the function's operation.

Reviewed by:    kib, markj
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D40954
2023-07-14 14:36:12 +03:00
Doug Rabson
09267cc152 /etc/rc.subr: add support for kld sysctl variables
For kernel modules loaded by scripts in /etc/rc.d and
/usr/local/etc/rc.d, if there is a file in /etc/sysctl.conf.d named <kld
name>.conf, then this will be loaded using the sysctl(8) utility. For
instance, sysctl variable changes for the pf kernel module would be
placed in the file /etc/sysctl.conf.d/pf.conf.

PR:		272129
Reviewed by:	imp freebsd_igalic.co
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40886
2023-07-14 10:49:47 +01:00
Kristof Provost
f53b28c6df Fix i386 MINIMAL build
Include systm.h in i386's counter.h, so it can use critical_*().

In file included from /usr/src/sys/netinet6/ip6_var.h:250:
In file included from /usr/src/sys/sys/counter.h:37:
./machine/counter.h:191:3: error: call to undeclared function 'critical_enter'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                critical_enter();
                ^
./machine/counter.h:193:3: error: call to undeclared function 'critical_exit'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                critical_exit();
                ^
2023-07-14 09:18:44 +02:00
Kristof Provost
b8039bf5b3 Fix MINIMAL build
Pre-declare struct ucred, to fix build issues on the MINIMAL config:

In file included from /usr/src/sys/netpfil/pf/pfsync_nv.c:40:
/usr/src/sys/netinet6/ip6_var.h:384:31: error: declaration of 'struct ucred' will not be visible outside of this function [-Werror,-Wvisibility]
        struct ip6_pktopts *, struct ucred *, int);
                                     ^
/usr/src/sys/netinet6/ip6_var.h:408:28: error: declaration of 'struct ucred' will not be visible outside of this function [-Werror,-Wvisibility]
    struct inpcb *, struct ucred *, int, struct in6_addr *, int *);
                           ^
2 errors generated.
2023-07-14 09:18:43 +02:00
Kristof Provost
208fcb55e3 Fix MINIMAL build on amd64
amd64/include/counter.h uses KASSERT, but failed to include the
kassert.h header.
2023-07-14 09:18:43 +02:00
Kristof Provost
77c9e60885 pfsync: fix NOINET6 build
While here also fix a few minor style(9) issues.
2023-07-14 09:18:43 +02:00
Doug Moore
3e04ae433f vm_radix_init: use initializer
Several vm_radix tries are not initialized with vm_radix_init. That
works, for now, since static initialization zeroes the root field
anyway, but if initialization changes, these tries will fail. Add
missing initializer calls.

Reviewed by:	alc, kib, markj
Differential Revision:	https://reviews.freebsd.org/D40971
2023-07-14 01:49:55 -05:00
Jessica Clarke
5d4f8df451 Makefile.libcompat: Make quoting for CC/CXX/CPP more future-proof
bmake's :Q is for quoting outside of double quotes, but here is inside
double quotes, and as a result it ends up quoting characters that don't
have a special meaning inside double quotes. On the surface this would
seem harmless, but POSIX sh has a strange behaviour (differing from
outside double quotes) that, inside double quotes, a backslash before a
character that never has a special meaning inside double quotes is
passed through. As a result, should LIB${_LIBCOMPAT}CFLAGS contain
something like -DFOO\(x\)=x, we would form "... -DFOO\\\(x\\\)=x ...",
which would be parsed as -DFOO\\(x\\)=x, since the parentheses are never
special inside double quotes (but the backslash itself is), not the
original -DFOO\(x\)=x as intended.

Instead, construct the whole string as a bmake expression and use :Q on
that, without the manual double quotes around everything. Note that the
:L modifier lets you treat an expression like a variable expansion and
apply modifiers to it, i.e. ${expr:L:...} is the same as tmp=expr
${tmp:...} (in essence, ignoring possible differences due to deferred
substitution).

Improves:	537f945fc8 ("Makefile.libcompat: Quote CFLAGS and CXXFLAGS for sub-make")
2023-07-14 05:34:03 +01:00
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