Commit Graph

283914 Commits

Author SHA1 Message Date
Kristof Provost
81877287a9 if_ovpn: ensure we never re-use sequence numbers
if_ovpn already notified userpsace when there was a risk of sequence
number re-use, but it trusted userspace to actually rotate the key.

Convert the internal sequence number counter to 64 bits so we can detect
overflows and then refuse to send packets.

Event:		BSDCan 2023
Reviewed by:	Leon Dang <ldang@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40187
2023-05-23 16:11:26 +02:00
Kristof Provost
c4a32455d9 pf: remove the use of caddr_t
Replace caddr_t with void *, or more accurate types.

Suggested by:	glebius
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D40186
2023-05-23 16:11:13 +02:00
Christos Margiolis
ecca318085 kinst: replace KINST_TRAMP_INIT
The current implementation of KINST_TRAMP_INIT is working only on amd64,
where the breakpoint instruction is one byte long, which might not be
the case for other architectures (e.g in RISC-V it's either 2 or 4
bytes). This patch introduces two machine-dependent constants,
KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE, which hold the fill
instruction and the size of that instruction in bytes respectively.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39504
2023-05-23 16:58:36 +03:00
Mitchell Horne
940e6d36de riscv: Print less CPU info
Change the reporting strategy to more closely follow what arm64
implements:
 - Always print the one-line CPU summary when a core comes online
 - Only print the additional fields (e.g. ISA) when they differ from the
   CPU before it

In the common case of identical CPUs this results in informative but
non-repetitive output. For example, in QEMU:

  CPU 0  : Vendor=Unspecified Core=Unknown (Hart 0)
    marchid=0x80032, mimpid=0x80032
    MMU: 0x7<Sv39,Sv48,Sv57>
    ISA: 0x112d<Atomic,Compressed,Double,Float,Mult/Div>
  real memory  = 8589934592 (8192 MB)
  avail memory = 8332300288 (7946 MB)
  FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs
  CPU 1  : Vendor=Unspecified Core=Unknown (Hart 1)
  CPU 2  : Vendor=Unspecified Core=Unknown (Hart 2)
  CPU 3  : Vendor=Unspecified Core=Unknown (Hart 3)

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40024
2023-05-23 10:19:46 -03:00
Mitchell Horne
7245ffd10e riscv: MMU detection
Detect and report the supported MMU for each CPU. Export the
capabilities to the rest of the kernel and use it in pmap_bootstrap() to
check for Sv48 support.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39814
2023-05-23 10:19:26 -03:00
Mitchell Horne
78a3420c20 riscv: Print ISA extensions
Report the CPU's single-letter ISA extensions in printcpuinfo().

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39813
2023-05-23 10:19:26 -03:00
Mitchell Horne
b37dc09033 riscv: Rework CPU identification (second part)
Modify when and how we perform parsing and reporting. Most notably,
everything now executes on CPU 0.

The de-facto standard way to enumerate CPU features (ISA extensions) on
RISC-V is by parsing each CPU's ISA string. We currently obtain this
information from the device tree, and in the future will be able to pull
it from ACPI tables.

Eliminate the SYSINIT from identcpu.c. We still need to walk the /cpus
list in the device tree, but now do this one CPU at a time, as a step in
the identify_cpu() procedure. This is slightly less error prone, and
allows us to parse ISA features for CPU 0 much earlier.

Make use of the SMP hooks cpu_mp_start() and cpu_mp_announce() to
identify and print secondary CPU info, respectively. This causes
secondary processor identification to be printed much earlier in boot;
everything is done by SI_SUB_CPU, SI_ORDER_THIRD. Adjust some other
printf() calls so that we get enough useful info to debug under
bootverbose.

Reviewed by:	markj (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39811
2023-05-23 10:06:29 -03:00
Mitchell Horne
b0d45b023e riscv: Call identify_cpu() earlier for CPU 0
It is advantageous to have knowledge of ISA features as early as
possible. For example, the presence of newer virtual memory extensions
may be useful to pmap_bootstrap().

To achieve this, split out the printf() parts of identify_cpu() into a
separate function, printcpuinfo(). This latter function will be called
later in boot after the console has been initialized.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39810
2023-05-23 10:00:25 -03:00
Mitchell Horne
88b4d124ef riscv: Rework CPU identification (first part)
Make better use of the RISC-V identification CSRs: mvendorid, marchid,
and mimpid. This code was written before these registers were
well-specified, or even available to the kernel. It currently fails to
recognize any CPU or platform.

Per the privileged specification, mvendorid contains the JEDEC vendor ID,
or zero.

The marchid register denotes the CPU microarchitecture. This is either
one of the globally allocated open-source implementation IDs, or the
field has a custom encoding. Therefore, for known vendors (SiFive) we
can also maintain a list of known marchid values. If we can not give a
name to the CPU but marchid is non-zero, then just print its value in
the report.

The mimpid (implementation ID) could be used in the future to more
uniquely identify the micro-architecture, but it really remains to be
seen how it gets used. For now we just print its value.

Thank you to Danjel Qyteza <danq1222@gmail.com> who submitted an early
version of this change to me, although it has been almost entirely
rewritten.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39809
2023-05-23 10:00:25 -03:00
Christos Margiolis
6265da14c9 libdtrace: get rid of illumos ifdefs in dt_module_update(), fix dm_file and dm_modid
Because dt_module_update() is highly OS-specific, the ifdefs make it
hard to read and follow what is going on. Also handle dm_modid, and
remove handling of the ".filename" section, since we can easily fetch
the filename from the module's pathname (k_stat->pathname).

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39177
2023-05-23 15:54:58 +03:00
Mike Karels
1082307434 pwd.1: replace /home with /sys in example
The default location for home directories is moving from /usr/home
to /home, and the /home symlink will no longer exist.  Switch to
another example that is in base, /sys.

Reviewed by:	fernape
Differential Revision:	<https://reviews.freebsd.org/D40204
2023-05-23 07:21:50 -05:00
Mike Karels
9a6a948128 hier.7: update /home
The default for home directories is changing from /usr/home to
/home; update the corresponding entries.  Also move /home into
alphabetical order.

Reviewed by:	mhorne, manpages(bcr)
Differential Revision:	https://reviews.freebsd.org/D40203
2023-05-23 07:21:12 -05:00
Mike Karels
d3c32c80a1 release/tools/vmimage.subr: switch zfs dataset from /usr/home to /home
Change the vmimage script for zfs to create /home as a dataset
rather than /usr/home, ala change to bsdinstall's zfs script.

Reviewed by:	markj
Differential Revision:	<https://reviews.freebsd.org/D40111
2023-05-23 07:18:58 -05:00
Mike Karels
3bb92304b4 bsdinstall on zfs: create dataset for /home rather than /usr/home
Now that pw (hence adduser and the initial install) use /home for
user home directories rather than /usr/home, create a dataset for
/home rather than /usr/home.  Update the man page to match.

Reviewed by:	rgrimes, markj
Differential Revision:	https://reviews.freebsd.org/D40086
2023-05-23 07:18:27 -05:00
Mike Karels
bbb2d2ce42 pw: do not move /home/$user to /usr/home
When adding a user, pw will create the path to the home directory
if needed.  However, if creating a path with just one component,
i.e.  that appears to be in the root directory, pw would create the
directory in /usr, and create a symlink from the root directory.
Most commonly, this meant that the default of /home/$user would turn
into /usr/home/$user.  This was added in a self-described kludge 26
years ago.  It made (some) sense when root was generally a small
partition, with most of the space in /usr.  However, the default is
now one large partition.  /home really doesn't belong under /usr,
and anyone who wants to use /usr/home can specify it explicitly.
Remove the kludge to move /home under /usr and create the symlink,
and just use the specified path.  Note that this operation was
done only on the first invocation for a path, and this happened most
commonly when adding a user during the install.

Modify the test that checked for the creation of the symlink to
verify that the symlink is *not* made, but rather a directory.
Add a test that intermediate directories are still created.

Reviewed by:	rgrimes, bapt
Differential Revision:	https://reviews.freebsd.org/D40085
2023-05-23 07:17:42 -05:00
Martin Matuska
c0a83fe074 zfs: merge openzfs/zfs@ad0a55461
Notable upstream pull request merges:
  #12355 Teach zpool scrub to scrub only blocks in error log
  #14811 Refine special_small_blocks property validation
  #14854 zil: Some micro-optimizations
  #14855 zil: Free lwb_buf after write completion
  #14860 Fixes for issues identified by recent Coverity defect reports
  #14861 Probe vdevs before marking removed
  #14873 Add the ability to uninitialize a zpool
  #14875 Hold db_mtx when updating db_state

Obtained from:	OpenZFS
OpenZFS commit:	ad0a554614
2023-05-23 11:51:52 +02:00
Xin LI
634a770a5e /etc/rc.d/motd: Update to accommodate changes in uname(1) and newvers.sh
The recent changes to the uname(1) command removed trailing spaces for
better POSIX conformance, but it broke the regular expression used by
the motd script which expected it.  This commit addresses this by removing
the requirement, as it is no longer present.

Additionally, a recent change in newvers.sh introduced a new format for
uname -v, which omited the build number and build dates to improve
reproducible build support.  This commit adds support for this new format.

Reported-by:	Jamie Landeg-Jones <jamie@catflap.org>
Reviewed-by:	imp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40225
2023-05-22 22:05:35 -07:00
Rose
5a9c724847 Correct size parameter to strncmp
The wrong value passed to strncmp meant that only enable and disable were being
accepted. This change corrects the logic so enabled and disabled are also
accepted.

Pull Request: https://github.com/freebsd/freebsd-src/pull/739
MFC after: 1 week
Reviewed by: delphij, ngie
2023-05-22 18:16:29 -07:00
Christos Margiolis
cef2565587 dtrace: export dtrace_dis_get_byte()
kinst uses this function as well, but because it is not exported, it
implements its own copy of it. The patch also exposes the function to
userland, so programs that need to use dtrace_disx86() can use this
function instead of rolling their own copies.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39871
2023-05-22 23:21:25 +03:00
Christos Margiolis
3c6fb586b9 riscv: do not duplicate sd of tp
Reviewed by:	jhb
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39894
2023-05-22 23:03:06 +03:00
Christos Margiolis
136b8bd610 arm64: use PSR_DAIF instead of each individual flag
No functional change intended.

Reviewed by:	mhorne, andrew
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40165
2023-05-22 22:49:33 +03:00
Christos Margiolis
94fe28babf Add christos as a src committer and markj as mentor
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40210
2023-05-22 22:49:32 +03:00
Christos Margiolis
0c08479898 git-arc: mention creation of separate reviews in man page
Reviewed by:	imp
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D39963
2023-05-22 22:49:32 +03:00
Christos Margiolis
0688eac1f9 git-arc: fix spelling error in -s option
Reviewed by:	imp
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D39962
2023-05-22 22:49:32 +03:00
Kyle Evans
172af24449 arm64: gicv3: setup PPIs on all APs after they're online
For all PPIs setup earlier than SI_SUB_SMP, PIC_INIT_SECONDARY ends up
cleaning these up for each AP as it comes online.  Once they're online,
we don't currently do anything to make sure they're configured for other
APs.  Fix it by using smp_rendezvous for the meaty bits of configuring a
PPI, which will just do single-thread behavior before APs are online but
do the right thing for other CPUs after.

While we're here, make sure redistributor config is correct for other
APs as they come online in gic_v3_init_secondary.

Reported/Tested by:	Souradeep Chakrabarti (Microsoft/Hyper-V)
Reviewed by:		andrew (before slight refactor)
Differential Revision:	https://reviews.freebsd.org/D40112
2023-05-22 10:23:53 -05:00
Alexander V. Chernikov
26056fa8d3 Revert "ifconfig: switch IPv4/IPv6 address manipulations to Netlink"
Revert the change as 2 non-expected issues have been reported.

This reverts commit 54418f79fd.
2023-05-22 15:17:57 +00:00
Alexander V. Chernikov
454d72ec40 Revert "ifconfig: Fix the build"
This reverts commit 5b8ce85e1a.
2023-05-22 15:17:45 +00:00
Mark Johnston
5b8ce85e1a ifconfig: Fix the build
Fix indentation in warn_nomask() while here.

Fixes:	54418f79fd ("ifconfig: switch IPv4/IPv6 address manipulations to Netlink")
2023-05-22 10:53:38 -04:00
Kristof Provost
af15ae9dd1 prepare-commit-msg: add 'Event'
Add 'Event' to the pre-commit template.

The key word is already documented at
https://docs.freebsd.org/en/articles/committers-guide/#_include_appropriate_metadata_in_a_footer

Suggested by:	imp@
Event:		BSDCan 2023
Differential Revision:	https://reviews.freebsd.org/D40184
2023-05-22 16:01:09 +02:00
Konstantin Belousov
6f49eafb05 libthr rtld locks: do not leak URWLOCK_READ_WAITERS into child
Since there is only the current thread in the child, no pending readers
exist.  Clear the bit, since it confuses future attempts to acquire
write ownership of the rtld locks, due to URWLOCK_PREFER_READERS flag.

To be future-proof, clear all state about pending writers and readers.

PR:	271490
Reported and tested by:	KJ Tsanaktsidis <kj@kjtsanaktsidis.id.au>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40178
2023-05-22 16:46:42 +03:00
Alexander V. Chernikov
54418f79fd ifconfig: switch IPv4/IPv6 address manipulations to Netlink
Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D40182
2023-05-22 13:45:33 +00:00
Alexander V. Chernikov
050815ae7f netlink: call IPv6 hook when adding IPv4 addresses.
This provides compatibility with ifioctl() version of SIOCAIFADDR.
This change is temporary until the IPv4/IPv6 address handling code
 is moved to netinet[6].
2023-05-22 13:42:28 +00:00
Mark Johnston
e3f7081b1c fusefs: Remove an unused pbuf zone
The zone has been dead ever since commit
b9e2019755 ("fusefs: rewrite vop_getpages and vop_putpages")

No functional change intended.

Reviewed by:	asomers
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40143
2023-05-22 09:33:57 -04:00
Hans Petter Selasky
47c887be4a Revert "mlx4: Move DEFINE_MUTEX() outside function body."
Requested by:	jrtc27@

This reverts commit 805d759338.
2023-05-22 12:53:38 +02:00
Dag-Erling Smørgrav
c8d84fa75e pam_tacplus: Mention nss_tacplus in the manual page.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D40135
2023-05-22 10:14:52 +00:00
Dag-Erling Smørgrav
6c5cdba1ba Add nss_tacplus, a TACACS+ NSS module.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D40133
2023-05-22 10:14:52 +00:00
Dag-Erling Smørgrav
951beab15d taclib: 0 (not set) is a valid auth type in authorization requests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rew
Differential Revision:	https://reviews.freebsd.org/D40132
2023-05-22 10:01:04 +00:00
Peter Holm
be8d01b515 stress2: Added a faster test of fsck_ffs by omitting mount(8) and umount(8) 2023-05-22 10:07:40 +02:00
Peter Holm
ca0088ae27 stress2: Occasionally modify 8 bits 2023-05-22 10:05:34 +02:00
Bjoern A. Zeeb
046d8d89ed LinuxKPI: fix WRITE_ONCE(), remove ACCESS_ONCE()
Fix a gcc warning: "to be safe all intermediate pointers in cast from
'...' to '...' must be 'const' qualified [-Wcast-qual]".
Doing what is essentially a __DECONST() adding the uintptr_t gets
rid of the massive amount of warnings we get in LinuxKPI and lets
us see the actual problems a lot better.
This is a follow-up to 74e908b3c6 which
fixed READ_ONCE().
ACCESS_ONCE() seems to be an obsolete KPI these days in Linux and
FreeBSD does not use it either directly so we can entirely remove
it now.

Sponsored by:	The FreeBSD Foundation
Suggested by:	jhb
Reviewed by:	hselasky
MFC after:	10 days
Differential Revision: https://reviews.freebsd.org/D40084
2023-05-21 23:14:05 +00:00
Hans Petter Selasky
805d759338 mlx4: Move DEFINE_MUTEX() outside function body.
Move static mutex declaration outside function body, to avoid global
variables being declared on the stack, when using SYSINITs.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-05-21 18:20:16 +02:00
Alexander V. Chernikov
63ad5ce733 ifconfig: simplify ifconfig() by factoring out ifa add/del logic
Reviewed by:	kp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40180
2023-05-21 09:42:11 +00:00
Alexander V. Chernikov
197bff385e ifconfig: split argument parsing
Simplify main() by factoring out argument parsing code.

Reviewed by:	kp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40179
2023-05-21 09:42:11 +00:00
Fedor Uporov
50be18cc77 ext2fs: Add large sectorsize disks support
The ext2fs does not support disks with sectorsize more 512 bytes.
The main issue is in reading/writing superblock, which is not aligned
with 4k value. Reimplement the superblock reading logic to make it
indifferent to disk logical sector size. The logical sector size
more then page size is not supported, like it is doing on Linux side.

PR:             271105
Reported by:    k(at)vodka.home.kg
Reviewed by:    pfg
MFC after:      2 week
Differential Revision:  https://reviews.freebsd.org/D40047
2023-05-21 08:17:47 +03:00
Bjoern A. Zeeb
525dd4acaa LinuxKPI: implement pci_rescan_bus()
Try to implement pci_rescan_bus().  pci_rescan_method() is already
doing most of the job.  We only have to do the count for the return
value again ourselves.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D40122
2023-05-21 00:31:25 +00:00
Enji Cooper
902dc544cc Revert "Require the OpenSSL 1.1 APIs when compiling ldns"
This particular change appears to have broken the build; the change
needs some massaging to work with OpenSSL 1.1.

This reverts commit c6750ddec9.
2023-05-20 12:00:34 -07:00
Enji Cooper
c6750ddec9 Require the OpenSSL 1.1 APIs when compiling ldns
Moving the APIs from OpenSSL 1.1 supporting APIs to 3.x supporting APIs
is a non-trivial effort. Require 1.1 API compatibility to unblock
updating OpenSSL in base to 3.x.

This mirrors what upstream has done in their configure.ac file.

Submitted by:	Pierre Pronchery <pierre@freebsdfoundation.org>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40082
2023-05-20 11:41:24 -07:00
John Baldwin
c98146ae22 cxgbe: Move ethofld_transmit under #ifdef INET || INET.
This fixes a -Wunused-function warning when building LINT-NOIP.

Reported by:	rpokala
2023-05-20 09:27:40 -07:00
John Baldwin
ac6dd01259 netlink: Move an INET-only variable under #if.
This fixes the LINT-NOIP build.
2023-05-20 09:26:46 -07:00
Mateusz Guzik
e0c86f5c2f td: line up with other clean up in thread_reap_domain
NFC
2023-05-20 12:48:15 +00:00