Commit Graph

292491 Commits

Author SHA1 Message Date
Warner Losh
fa1e8538d1 math.h: Remove support for old gcc versions
Remove support for old gcc versions by unconditionally defining
__MATH_BUILTIN_RELOPS and __MATH_BUILTIN_CONSTANTS. Per kib's request,
don't #undef those so it's easier to understand what the builtins are
doing.

Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D45655
Sponsored by:		Netflix
2024-06-20 20:41:09 -06:00
Warner Losh
67d1a1cd9e cdefs.h: Remove support for pre gcc 4.0
All supported compilers support the gcc 3 attribute extensions. Remove
the #else clauses for this. Also, latter-day pcc compilers also define
__GNUC__, so there's not need to also test for __PCC__.

Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D45654
Sponsored by:		Netflix
2024-06-20 20:41:08 -06:00
Warner Losh
2508372b7b cdefs.h: Assume the compiler supports at least GNU C 3.0 extensions
All compilers that can build FreeBSD binaries (as opposed to the entire
system) support at least gcc 9 (gcc, clang, tcc). Even pcc supports most
of the gcc 4.3 attributes. Make this file simpler by removing support
for pre-3.0 compilers.

Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D45653
Sponsored by:		Netflix
2024-06-20 20:41:08 -06:00
Colin Percival
836f00ebb9 release: Don't publish CW if !WITH_CLOUDWARE
If WITH_CLOUDWARE is not set, we didn't build BASIC-CLOUDWARE; don't try
to install it into the /VM-IMAGES/ directory as part of ftp-stage.

Fixes:	4771c2e9d1 "release: Publish non-uploaded cloudware bits"
MFC after:	6 days
2024-06-20 17:41:14 -07:00
Enji Cooper
1070e7dca8 Import OpenSSL 3.0.14
This release resolves 3 upstream found CVEs:
- Fixed potential use after free after SSL_free_buffers() is called (CVE-2024-4741)
- Fixed an issue where checking excessively long DSA keys or parameters may be very slow (CVE-2024-4603)
- Fixed unbounded memory growth with session handling in TLSv1.3 (CVE-2024-2511)
2024-06-20 16:24:17 -07:00
Gleb Smirnoff
f34aca55ad netlink/route: provide pre-2.6.19 Linux compat shim
The old Linux used 8-bit rtm_table field of the RTM_NEWROUTE message to
specify routing table id.  Modern netlink uses RTA_TABLE 32-bit attribute.

Unfortunately, there is modern software (namely bird) that would prefer
the old API as long as the routing table id fits into 8-bit.

PR:		279662
2024-06-20 16:10:39 -07:00
Gleb Smirnoff
969cb79f5b netlink/route: reformat comment to fit 80 chars
No functional or content changes.
2024-06-20 16:10:39 -07:00
Mark Johnston
d03e1ffbea arm64: Remove some redundant calculations from pmap_bootstrap{,_san1}()
No functional change intended.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
2024-06-20 17:53:54 -04:00
Mark Johnston
f45213c74c physmem: Correct a comment
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
2024-06-20 17:45:40 -04:00
Navdeep Parhar
aee4c9c5b8 Makefile.inc1: Fix typo affecting incremental pkgbase builds.
Fixes:	4231a5e504 release: don't keep old packages if the BRANCH changes
Sponsored by:	Chelsio Communications
2024-06-20 12:17:46 -07:00
Mitchell Horne
18051cc694 riscv: drop l1pt argument from pmap_bootstrap()
And from struct riscv_bootparams. It is no longer needed.

Reviewed by:	br, markj
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45470
2024-06-20 15:33:19 -03:00
Mitchell Horne
762a3224cd riscv: smarter DMAP construction
Currently we create the DMAP by mapping the entire range between the
smallest and largest physical memory addresses with L1 superpages. This
is obviously overkill, and we may end up mapping all kinds of ranges that
are not real memory.

In the case of the HiFive Unmatched (obsolete hardware), there is an
errata resulting in faults when a TLB mapping spans PMP (firmware)
protection regions. So, when our DMAP mapping spans into the memory
reserved by OpenSBI, we get a fatal fault. This highlights the need to
be smarter here.

Therefore, let's attempt to build the DMAP a little more correctly by
walking the physmap array and mapping each range individually. It is not
perfect in that we still only respect the range to a 2MB granularity,
but this could be improved in the future.

Reviewed by:	markj
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45328
2024-06-20 15:33:19 -03:00
Mitchell Horne
de09dcebd7 riscv: rework page table bootstrap
The overall goal of the change is to reduce the amount of work done in
locore assembly, and defer as much as possible until pmap_bootstrap().
Currently, half the setup is done in assembly, and then we pass the l1pt
address to pmap_bootstrap() where it is amended with other mappings.

Inspiration and understanding has been taken from amd64's
create_pagetables() routine, and I try to present the page table
construction in the same way: a linear procedure with commentary
explaining what we are doing and why. Thus the core of the new
implementation is contained in pmap_create_pagetables().

Once pmap_create_pagetables() has finished, we switch to the new
pagetable root and leave the bootstrap ones created by locore behind,
resulting in a minimal 8kB of wasted space.

Having the whole procedure in one place, in C code, allows it to be more
easily understood, while also making it more amenable to future changes
which depend on CPU feature/errata detection.

Note that with this change the size of the early devmap is bumped up
from one to four L2 pages (8MB).

Reviewed by:	markj
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45327
2024-06-20 15:33:19 -03:00
Mitchell Horne
bfb8575469 riscv: Construct an identity map in locore.S
This is useful for two reasons. Within this change, it allows the
early DTB mapping to be eliminated, as we can now just dereference the
physical address provided by FW and copy the DTB contents into KVA.

It will also aid in an upcoming change: the larger reworking of page
table bootstrapping on this platform.

Reviewed by:	markj, jhb
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45324
2024-06-20 15:33:19 -03:00
Baptiste Daroussin
e402155e1a ncurses: reinstantiate bsd specific code
This fixes ncurses 6.5 badly reading termcap
2024-06-20 20:27:15 +02:00
Mateusz Guzik
b6196537b0 pf: fix the "keepcounters" to stop truncating to 32-bit
The machinery to support 64-bit counters even on 32-bit kernels had a
bug where it would unitentionally truncate the value back to 32-bits
when transferring to a new counter. This resulted in buggy be behavior
on 64-bit kernels as well.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-06-20 17:55:43 +00:00
Gleb Smirnoff
3beb43dd4f callout: assert that callout_init_*lock* functions are called with a lock
Quick grep around kernel confirms they all do.
2024-06-20 10:53:31 -07:00
Gleb Smirnoff
39afff09c5 callout: tidy up _callout_init_lock()
Separate function into assertive part and into assigning part.
Consistently use __func__ in the assertions.  Write the assigning code in
a declarative style.

The functional change is that we no longer validate flags in the
non-INVARIANT kernel.  The assertion that checks flags has been there for
17 years, so all code that calls with invalid flags must have been
filtered and fixed.
2024-06-20 10:53:31 -07:00
Gleb Smirnoff
95a9594adc mutex: add static qualifier to implementations previously declared static 2024-06-20 10:53:31 -07:00
Gleb Smirnoff
aaef18e6ae rwlock: add static qualifier to implementations previously declared static 2024-06-20 10:53:31 -07:00
Mark Johnston
bae00433f0 dtrace: Add a partial implementation of dtrace_getarg() on arm64
For invop providers (i.e., fbt and kinst) we can simply reach into the
invop trapframe to fetch argument registers for arguments 0-7; for
argument 8 and beyond we have to read the value off of the stack.

Reviewed by:	Domagoj Stolfa, avg
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D45649
2024-06-20 12:41:01 -04:00
Mark Johnston
70c712a86d sdt: Support fetching the probe sixth argument with MI machinery
SDT calls dtrace_probe() directly, and this can be used to pass up to
five probe arguments directly.  To pass the sixth argument (SDT
currently doesn't support more than this), we use a hack: just add
additional parameters to the call and cast dtrace_probe accordingly.
This happens to work on amd64, but doesn't work in general.

Modify SDT to call dtrace_probe() after storing arguments beyond the
first five in thread-local storage.  Implement sdt_getargval() to fetch
extra argument values this way.  An alternative would be to use invop
handlers instead and make sdt_probe_func point to a breakpoint
instruction, so that one can extract arguments using the breakpoint
exception trapframe, but this makes the providers more expensive when
enabled and doesn't seem justified.  This approach works well unless we
want to add more than one or two more parameters to SDT probes, which
seems unlikely at present.

In particular, this fixes fetching the last argument of most ip and tcp
probes on arm64.

Reported by:	rwatson
Reviewed by:	Domagoj Stolfa
MFC after:	1 month
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D45648
2024-06-20 12:40:25 -04:00
Baptiste Daroussin
0667538b88 ee: fix wprintw usage (highlighted by ncurses 6.5)
Reported by: cy
2024-06-20 15:43:44 +02:00
Baptiste Daroussin
8d9900a313 ncurses: readd 2 html files in the doc (fix MK_HTML=yes)
Reported by:	Michael Butler <imb@protected-networks.net>
2024-06-20 15:34:17 +02:00
Baptiste Daroussin
35e941ce55 systat: fix build with newer ncurses 2024-06-20 15:10:38 +02:00
Baptiste Daroussin
822ca32763 byacc: really import 20240109 2024-06-20 14:34:49 +02:00
Baptiste Daroussin
85a764b2c5 byacc: readd tests in the import 2024-06-20 13:48:44 +02:00
Baptiste Daroussin
0b234d7a89 byacc: actually import version 20240109 2024-06-20 13:46:15 +02:00
Baptiste Daroussin
7b7e898c2b byacc: import version 20240109 2024-06-20 13:38:00 +02:00
Baptiste Daroussin
21817992b3 ncurses: vendor import version 6.5 2024-06-20 13:26:22 +02:00
Andrew Turner
6eeedf35c3 libc: Replace armv6 with armv7 in a comment
Armv6 is being removed from the treem and the comment applies to armv7.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45645
2024-06-20 09:26:22 +00:00
Andrew Turner
4f351c1ddc tools/boot/universe.sh: Remove armv6 from a comment
It is in the process of being removed.

Reviewed by:	manu, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45642
2024-06-20 09:26:20 +00:00
Andrew Turner
68f044de29 binmiscctl.8: Change the example to armv7
armv6 is in the process of being removed.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45641
2024-06-20 09:26:18 +00:00
Andrew Turner
a2054786c2 uefi.8: Remove a reference to armv6
It is in the process of being removed from the tree.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45640
2024-06-20 09:26:16 +00:00
Andrew Turner
e726eed75d share/mk: Remove pre-armv7 example architectures
These are already removed from the tree, or are in the process of being
removed.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45638
2024-06-20 09:26:14 +00:00
Andrew Turner
8203cf1c53 md.4: Remove armv6 as it is being removed
Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45637
2024-06-20 09:26:12 +00:00
Andrew Turner
eda7eff0d2 share/examples/etc/make.conf: Remove old arm archs
Remove the pre-armv7 architecture options from the example make.conf.
These have either been removed, or will soon be removed from the build.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45636
2024-06-20 09:26:10 +00:00
Andrew Turner
a67a0a6a20 nanobsd: Remove armv6 support
In preparation for removing armv6 remove it from nanobsd.

Reviewed by:	imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45635
2024-06-20 09:26:06 +00:00
Baptiste Daroussin
24fa7a5107 Vendor import ncurses 6.5 2024-06-20 10:11:38 +02:00
Siva Mahadevan
4231a5e504 release: don't keep old packages if the BRANCH changes 2024-06-20 10:02:34 +02:00
Zhenlei Huang
34c98f40f5 net80211: Correct a comment
MFC after:	3 days
2024-06-20 12:27:43 +08:00
Brooks Davis
42c545c5f8 libsys: sort Symbol.map
Fixes:		7448408656 Make __libsys_interposing_slot libsys only
2024-06-19 23:08:05 +01:00
Mark Johnston
ddf0ed09bd sdt: Implement SDT probes using hot-patching
The idea here is to avoid a memory access and conditional branch per
probe site.  Instead, the probe is represented by an "unreachable"
unconditional function call.  asm goto is used to store the address of
the probe site (represented by a no-op sled) and the address of the
function call into a tracepoint record.  Each SDT probe carries a list
of tracepoints.

When the probe is enabled, the no-op sled corresponding to each
tracepoint is overwritten with a jmp to the corresponding label.  The
implementation uses smp_rendezvous() to park all other CPUs while the
instruction is being overwritten, as this can't be done atomically in
general.  The compiler moves argument marshalling code and the
sdt_probe() function call out-of-line, i.e., to the end of the function.

Per gallatin@ in D43504, this approach has less overhead when probes are
disabled.  To make the implementation a bit simpler, I removed support
for probes with 7 arguments; nothing makes use of this except a
regression test case.  It could be re-added later if need be.

The approach taken in this patch enables some more improvements:
1. We can now automatically fill out the "function" field of SDT probe
   names.  The SDT macros let the programmer specify the function and
   module names, but this is really a bug and shouldn't have been
   allowed.  The intent was to be able to have the same probe in
   multiple functions and to let the user restrict which probes actually
   get enabled by specifying a function name or glob.
2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability
   to include blocks of code in the out-of-line path.  For example:

	if (SDT_PROBES_ENABLED()) {
		int reason = CLD_EXITED;

		if (WCOREDUMP(signo))
			reason = CLD_DUMPED;
		else if (WIFSIGNALED(signo))
			reason = CLD_KILLED;
		SDT_PROBE1(proc, , , exit, reason);
	}

could be written

	SDT_PROBE1_EXT(proc, , , exit, reason,
		int reason;

		reason = CLD_EXITED;
		if (WCOREDUMP(signo))
			reason = CLD_DUMPED;
		else if (WIFSIGNALED(signo))
			reason = CLD_KILLED;
	);

In the future I would like to use this mechanism more generally, e.g.,
to remove branches and marshalling code used by hwpmc, and generally to
make it easier to add new tracepoint consumers without having to add
more conditional branches to hot code paths.

Reviewed by:	Domagoj Stolfa, avg
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D44483
2024-06-19 16:57:41 -04:00
Mark Johnston
e5a7890dc0 zfs: Use a statement expression to implement SET_ERROR()
This way we can avoid making assumptions about the SDT probe
implementation.  No functional change intended.

This was submitted upstream as https://github.com/openzfs/zfs/pull/16284

MFC after:	1 week
2024-06-19 16:57:30 -04:00
Mark Johnston
bc2901144c dtrace: Remove LOCK_LEVEL
It is unused on FreeBSD.  No functional change intended.

MFC after:	1 week
2024-06-19 16:54:02 -04:00
Brooks Davis
d511e97c54 libsysdecode: support rfork(RFSPAWN)
Match the "U" in RFSPAWN's value (1U<<31) (and "u" for completeness).
Reject kernel-only RFPPWAIT to avoid a duplicate entry.

Reviewed by:	imp, markj
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D45597
2024-06-19 21:38:31 +01:00
Colin Percival
4771c2e9d1 release: Publish non-uploaded cloudware bits
While most "cloudware" (AWS, Azure, GCP, Vagrant) images get uploaded
to their respective clouds, we have two images -- BASIC-CI and
BASIC-CLOUDINIT -- which are published via the FTP mirrors.  We have
been handling these using a manual and error-prone process of copying
them from the internal build directories into the FTP staging tree,
but they should be handled using the "make install ftp-stage"
mechanism which is used for all the other published images.

This commit 1. Adds a new 'make cloud-install' target which is run as
part of 'make install' and installs BASIC-CI and BASIC-CLOUDINIT images,
and 2. Extends 'make ftp-stage' in Makefile.mirrors to copy those bits
into the FTP staging area.

As a side benefit, this will also make BASIC-CI and BASIC-CLOUDINIT
images available for arm64; until now they have only been available
for amd64.

MFC after:	1 week
2024-06-19 12:36:44 -07:00
Ed Maste
42fbb55d45 arch.7: armv6 will be removed prior to FreeBSD 15.0
Reviewed by:	andrew, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45633
2024-06-19 13:40:08 -04:00
Doug Rabson
b2ebcd19f4 p9fs: Fix the build for 32-bit kernels
MFC after: 3 months
2024-06-19 15:16:38 +01:00
Doug Rabson
e97ad33a89 Add an implementation of the 9P filesystem
This is derived from swills@ fork of the Juniper virtfs with many
changes by me including bug fixes, style improvements, clearer layering
and more consistent logging. The filesystem is renamed to p9fs to better
reflect its function and to prevent possible future confusion with
virtio-fs.

Several updates and fixes from Juniper have been integrated into this
version by Val Packett and these contributions along with the original
Juniper authors are credited below.

To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf. The
bhyve virtio-9p device allows access from the guest to files on the host
by mapping a 'sharename' to a host path. It is possible to use p9fs as a
root filesystem by adding this to /boot/loader.conf:

	vfs.root.mountfrom="p9fs:sharename"

for non-root filesystems add something like this to /etc/fstab:

	sharename /mnt p9fs rw 0 0

In both examples, substitute the share name used on the bhyve command
line.

The 9P filesystem protocol relies on stateful file opens which map
protocol-level FIDs to host file descriptors. The FreeBSD vnode
interface doesn't really support this and we use heuristics to guess the
right FID to use for file operations.  This can be confused by privilege
lowering and does not guarantee that the FID created for a given file
open is always used for file operations, even if the calling process is
using the file descriptor from the original open call. Improving this
would involve changes to the vnode interface which is out-of-scope for
this import.

Differential Revision: https://reviews.freebsd.org/D41844
Reviewed by: kib, emaste, dch
MFC after: 3 months
Co-authored-by: Val Packett <val@packett.cool>
Co-authored-by: Ka Ho Ng <kahon@juniper.net>
Co-authored-by: joyu <joyul@juniper.net>
Co-authored-by: Kumara Babu Narayanaswamy <bkumara@juniper.net>
2024-06-19 13:12:04 +01:00