Commit Graph

282092 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
fa3af3ce50 tail: Verify correct behavior when input does not end in a newline.
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D39116
2023-03-16 15:37:02 +00:00
Ed Maste
4d3fc8b057 ssh: Update to OpenSSH 9.3p1
This release fixes a number of security bugs and has minor new
features and bug fixes.  Security fixes, from the release notes
(https://www.openssh.com/txt/release-9.3):

This release contains fixes for a security problem and a memory
safety problem. The memory safety problem is not believed to be
exploitable, but we report most network-reachable memory faults as
security bugs.

 * ssh-add(1): when adding smartcard keys to ssh-agent(1) with the
   per-hop destination constraints (ssh-add -h ...) added in OpenSSH
   8.9, a logic error prevented the constraints from being
   communicated to the agent. This resulted in the keys being added
   without constraints. The common cases of non-smartcard keys and
   keys without destination constraints are unaffected. This problem
   was reported by Luci Stanescu.

 * ssh(1): Portable OpenSSH provides an implementation of the
   getrrsetbyname(3) function if the standard library does not
   provide it, for use by the VerifyHostKeyDNS feature. A
   specifically crafted DNS response could cause this function to
   perform an out-of-bounds read of adjacent stack data, but this
   condition does not appear to be exploitable beyond denial-of-
   service to the ssh(1) client.

   The getrrsetbyname(3) replacement is only included if the system's
   standard library lacks this function and portable OpenSSH was not
   compiled with the ldns library (--with-ldns). getrrsetbyname(3) is
   only invoked if using VerifyHostKeyDNS to fetch SSHFP records. This
   problem was found by the Coverity static analyzer.

Sponsored by:	The FreeBSD Foundation
2023-03-16 10:29:55 -04:00
Andrew Turner
7d0b915919 Add PSCI affinity info return values
These can be returned from the PSCI AFFINITY_INFO call. This is not
marked as optional so bhyve will need to implement it & can use these
macros.

Sponsored by:	Arm Ltd
2023-03-16 13:08:00 +00:00
Andrew Turner
e89be21854 Add a psci macro to build a version value
Add PSCI_VER that takes a major and minor version and builds the value
returned by the firmware. This will be used by bhyve.

Sponsored by:	Arm Ltd
2023-03-16 13:08:00 +00:00
Andrew Turner
473ab212dc Allow psci.h to be used by userspace
Wrap parts of psci.h that aren't usable by userspace in _KERNEL checks.
This allows it to be used to implement PSCI and SMCCC by bhyve in
userspace.

Sponsored by:	Arm Ltd
Sponsored by:	Innovate UK
Sponsored by:	The FreeBSD Foundation
2023-03-16 13:08:00 +00:00
Peter Holm
79f5d67caa stress2: New problem found was added 2023-03-16 13:59:16 +01:00
Ed Maste
36b354d74b Vendor import of OpenSSH 9.3p1 2023-03-16 08:41:22 -04:00
Dag-Erling Smørgrav
ef184e989b tarfs: Fix backtracking during node creation.
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39082
2023-03-16 11:31:22 +00:00
Dag-Erling Smørgrav
e81d55b439 tarfs: Support tar files which include file modes with permissions.
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39020
2023-03-16 11:31:22 +00:00
Dag-Erling Smørgrav
fd8c98a52f tarfs: Correctly track link count.
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39019
2023-03-16 11:31:22 +00:00
Dag-Erling Smørgrav
6cb78fa479 tarfs: Repeat tests using GNU tar if available.
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	ngie, asomers
Differential Revision:	https://reviews.freebsd.org/D39018
2023-03-16 11:31:22 +00:00
Zhenlei Huang
49cad3daf2 carp: carp_master_down_locked() requires net epoch
Reviewed by:	kp
Fixes:		1d126e9b94 carp: Widen epoch coverage
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D39113
2023-03-16 18:07:03 +08:00
Kristof Provost
225e85513f pf tests: test IPv6 fragmentation with link-local addresses
We've observed a panic after pf_refragment6() with link-local addresses,
because pf_refragment6() calls ip6_forward() even for a simple output
case.
That results in us entering ip6_forward() with an mbuf with a NULL
m->m_pkthdr.rcvif, which can cause a NULL deref (but seemingly not for
GUAs.

Test sending fragmented link-local packets to pf.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39063
2023-03-16 10:59:04 +01:00
Kristof Provost
80e76c61cc pf: set scope in pf_refragment6()
Link-local traffic needs to have a scope embedded before it's passed on
to ip6_output(). Do so in pf_refragment6(), because when we end up here
in the output path we may have passed through ip6_output() already
(before being reassembled), where the scope would have been removed.

Re-embed the scope so that link-local traffic is sent correctly.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39062
2023-03-16 10:59:04 +01:00
Kristof Provost
b52b61c0b6 pf: distinguish forwarding and output cases for pf_refragment6()
Re-introduce PFIL_FWD, because pf's pf_refragment6() needs to know if
we're ip6_forward()-ing or ip6_output()-ing.

ip6_forward() relies on m->m_pkthdr.rcvif, at least for link-local
traffic (for in6_get_unicast_scopeid()). rcvif is not set for locally
generated traffic (e.g. from icmp6_reflect()), so we need to call the
correct output function.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revisi:	https://reviews.freebsd.org/D39061
2023-03-16 10:59:04 +01:00
Michael Tuexen
c91ae48a25 sctp: don't do RTT measurements with cookies
When receiving a cookie, the receiver does not know whether the
peer retransmitted the COOKIE-ECHO chunk or not. Therefore, don't
do an RTT measurement. It might be much too long.
To overcome this limitation, one could do at least two things:
1. Bundle the INIT-ACK chunk with a HEARTBEAT chunk for doing the
   RTT measurement. But this is not allowed.
2. Add a flag to the COOKIE-ECHO chunk, which indicates that it
   is the initial transmission, and not a retransmission. But
   this requires an RFC.

MFC after:	1 week
2023-03-16 10:45:13 +01:00
Michael Tuexen
cee09bda03 sctp: allow disabling of SCTP_ACCEPT_ZERO_CHECKSUM socket option 2023-03-15 22:55:23 +01:00
Michael Tuexen
6026b45aab sctp: improve negotiation of zero checksum feature
Enforce consistency between announcing 0-cksum support and actually
using it in the association. The value from the inp when the
INIT ACK is sent must be used, not the one from the inp when the
cookie is received.
2023-03-15 22:29:52 +01:00
Alexander V. Chernikov
73ae25c174 netlink: improve snl(3)
Summary:
* add snl_send_message() as a convenient send wrapper
* add signed integer parsers
* add snl_read_reply_code() to simplify operation result checks
* add snl_read_reply_multi() to simplify reading multipart messages
* add snl_create_genl_msg_request()
* add snl_get_genl_family() to simplify family name->id resolution
* add tests for some of the functionality

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D39092
MFC after:	2 weeks
2023-03-15 20:53:20 +00:00
Andrew Turner
cc67cd58fc arm64: Support stage 2 mappings in pmap_remove_all
This has been hit when testing bhyve.

Sponsored by:	Arm Ltd
2023-03-15 18:24:50 +00:00
Ed Maste
6834ca8a43 ssh: update FREEBSD-upgrade instructions
Make it clear that the 'freebsd-configure.sh' and 'freebsd-namespace.sh'
scripts are run from the crypto/openssh directory.

Sponsored by:	The FreeBSD Foundation
2023-03-15 13:37:49 -04:00
Andrew Turner
5c4bd8756f Stop using the rid as an index in the arm timer
The order of the interrupt array doesn't matter. Store the described
interrupts at the start of the array to simplify iterating over them.

Reviewed by:	imp, kevans
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39094
2023-03-15 15:49:00 +00:00
Andrew Turner
02f3d094ae Use the arm physical timer when able
To allow bhyve manage the virtual timer while in a guest have FreeBSD
use the virtual timer only when bhyve will be unavailable due to not
starting at EL2 where the hypervisor switcher will run.

Reviewed by:	imp, kevans
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39093
2023-03-15 15:49:00 +00:00
Andrew Turner
51308cd29b Support the arm64 pmap_remove_write for stage 2
The fields we need to adjust are different in stage 1 and stage 2
tables. Handle this by adding variables to hold the bits to check,
set, and clear.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37399
2023-03-15 15:49:00 +00:00
Mitchell Horne
8937bd37d0 arm64: limit EFI excluded regions to physical memory types
Consolidate add_efi_map_entry() and exclude_efi_map_entry() into a
single function, handle_efi_map_entry(), so that the exact set of entry
types handled is the same in the addition or exclusion cases. Before,
exclude_efi_map_entry() had a 'default' case that would exclude all
entry types that were not listed explicitly in the switch statement.

Logically, we do not need to exclude a range that could not possibly be
added to physmem, and we do not need to exclude bus ranges that are not
physical memory, for example EFI_MD_TYPE_IOMEM.

Since physmem's ram0 device will reserve bus memory resources for its
owned ranges, this was preventing attachment of the watchdog device on
the RPI4B. For some reason its region of memory-mapped I/O appeared in
the EFI memory map (with the aforementioned EFI_MD_TYPE_IOMEM type).
This change fixes the attachment issue, as we prevent the physmem API
from messing with this range of bus space.

PR:		270044
Reported by:	karels, Mark Millard
Reviewed by:	andrew, karels, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39003
2023-03-15 12:28:35 -03:00
Alexander V. Chernikov
83b5c80c69 net: refactor if_clone.c #1
* Add ifc_find_cloner()
* Rename current ifc_find_cloner() to ifc_find_cloner_in_vnet()
* Add ifc_find_cloner_match()

This change simplifies the code a bit and reduces the diff to
 the netlink interface cloners merge (D39032).

Reviewed by:	glebius, kp
Differential Revision: https://reviews.freebsd.org/D39046
MFC after:	2 weeks
2023-03-15 13:54:22 +00:00
Andrew Turner
6419b48f7d Support arm64 stage2 TLB invalidation
To invalidate stage 2 mappings on arm64 we may need to call into the
hypervisor so add a function pointer that bhyve can use to implement
this.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37254
2023-03-15 11:34:32 +00:00
Andrew Turner
b71ef90ec2 Keep per-timer interrupt data together
Eliminate a redundant resource array allow possible use by bhyve later.

Reviewed by:	kevans
Sponsored by:	Arm Ltd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37424
2023-03-15 11:34:31 +00:00
Warner Losh
559e41a11b veriexec: Improve comments
Make it clear we're checking to see if the target is a verified file and
prevent its replacement if so.

Sponsored by:		Netflix
Reviewed by:		rpokala
Differential Revision:	https://reviews.freebsd.org/D39079
2023-03-14 23:00:16 -06:00
John Grafton
8e933d9c59 libbe: Avoid double printing cloning errors.
be_clone calls be_clone_cb and both call set_error on the return
error path.  set_error prints the error resulting in a double print.
be_clone_cb should just return the error code and allow be_clone
to print it.

PR: 265248
Reported by: Graham Perrin
Reviewed by: imp, kevans
Pull Request: https://github.com/freebsd/freebsd-src/pull/685
2023-03-14 21:15:17 -06:00
Mina Galić
0b0ae2e4cd jail: convert several functions from int to bool
these functions exclusively return (0) and (1), so convert them to bool

We also convert some networking related jail functions from int to bool
some of which were returning an error that was never used.

Differential Revision: https://reviews.freebsd.org/D29659
Reviewed by: imp, jamie (earlier version)
Pull Request: https://github.com/freebsd/freebsd-src/pull/663
2023-03-14 21:05:33 -06:00
Mina Galić
3693d9140e rc: ignore .pkgsave files
The local parts of rc already skip .sample files; we add .pkgsave to the
list, and add logic for base.

Thanks to @RhodiumToad for getting this started.

Differential Revision: https://reviews.freebsd.org/D27962
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/662
2023-03-14 20:52:15 -06:00
Elyes Haouas
44357c18cc ppp: Remove trailing semicolon
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654
2023-03-14 20:39:34 -06:00
Elyes Haouas
94dcc95fdf pmccontrol: Remove trailing semicolon
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654
2023-03-14 20:39:34 -06:00
Elyes Haouas
365348f66a lpr: Remove trailing semicolon
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654
2023-03-14 20:39:34 -06:00
Elyes Haouas
1308a17bad bhyve: Remove trailing semicolon
Macros shouldn't use trailing semicolon.

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/654
2023-03-14 20:39:34 -06:00
Ed Maste
2ed0305bc3 CI: Run pkgbase METALOG lint script
tools/pkgbase/metalog_reader.lua checks for errors in METALOG (for
pkgbase staging), such as hard links with differing modes, duplicate
entries, etc.  Run it as part of the Cirrus-CI job to prevent
regressions.

Reviewed by:	manu, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37521
2023-03-14 21:13:46 -04:00
Jessica Clarke
f13b4e460c .github: Test DISK_IMAGE_TOOLS_BOOTSTRAP in CI
Building the tools is quick so we should provide coverage of this to
ensure it keeps working, especially on non-FreeBSD.

Reviewed by:	emaste, arichardson
Differential Revision:	https://reviews.freebsd.org/D39073
2023-03-15 00:06:53 +00:00
Jessica Clarke
9e914c7af1 Add new DISK_IMAGE_TOOLS_BOOTSTRAP option
This will build etdump, makefs and mkimg as bootstrap tools to allow
easily creating disk images. Note that etdump is bootstrapped due to its
use in the release scripts for building ISO images.

Reviewed by:	emaste, arichardson
Differential Revision:	https://reviews.freebsd.org/D39072
2023-03-15 00:06:53 +00:00
Jessica Clarke
379954d06c src.conf.5: Regen after ZFS-related options changes
Since 9503d2704c LOADER_ZFS gets turned off when ZFS is, and since
63715498ac ZFS is no longer disabled on powerpc and powerpcspe.

Reviewed by:	emaste
Fixes:	9503d2704c ("opts: Minor cleanup of ZFS options")
Fixes:	63715498ac ("powerpc: enable ZFS on 32 bit powerpc/powerpcspe")
Differential Revision:	https://reviews.freebsd.org/D39071
2023-03-15 00:06:52 +00:00
Warner Losh
a06761e3f4 secure_getenv: Put under __BSD_VISIBLE
Sponsored by:		Netflix
Reviewed by:		delphij
Differential Revision:	https://reviews.freebsd.org/D39076
2023-03-14 17:43:13 -06:00
Rick Macklem
c0f94fee0b jail.8: Update the allow.nfsd section
This patch updates the information for "allow.nfsd"
and adds configuration information.

This is a content change.

Reviewed by:	karels, markj, pauamma (manpages)
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D39033
2023-03-14 15:28:02 -07:00
Bjoern A. Zeeb
d7fb679dc9 net80211: make ieee80211_scan_dump_channels private
ieee80211_scan_dump_channels() is only used locally and only when
IEEE80211_DEBUG is compiled.  Stop exporting it, make it file local
and hide under the #ifdef to reduce the footprint for production
kernels a tiny bit.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D38833
2023-03-14 22:17:03 +00:00
Bjoern A. Zeeb
3346164ce8 net80211: define mask for ss_flags rather than using hardcoded 0xfff
scan state ss_flags in two places cut off the "internal" GOTPICK
options.  Replace the hardcoded 0xfff with a defined mask.
Note that "internal" flags is confusing as we also supplement the
the 16bit by another 16bit of "internal flags" passed around but
comaparing to GOTPICK never stored to my understanding.

No functional change.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D38832
2023-03-14 22:16:41 +00:00
Vincenzo Maffione
6c9fe35743 netmap: get rid of save_if_input for emulated adapters
The save_if_input function pointer was meant to save the previous
value of ifp->if_input before replacing it with the emulated
adapter hook.
However, the same pointer value is already stored in the if_input
field of the netmap_adapter struct, to be used for host TX ring processing.

Reuse the netmap_adapter if_input field to simplify the code
and save some space.

MFC after:	14 days
2023-03-14 22:04:23 +00:00
Justin Hibbits
adf62e8363 infiniband: Convert BPF handling for IfAPI
Summary:
All callers of infiniband_bpf_mtap() call it through the wrapper macro,
which checks the if_bpf member explicitly.  Since this is getting
hidden, move this check into the internal function and remove the
wrapper macro.

Reviewed by:	hselasky
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39024
2023-03-14 15:51:32 -04:00
Ed Maste
19aba210e1 ssh: fix leak and apply style(9) to hostname canonicalization
Fixes:		bf2e2524a2 ("ssh: canonicize the host name before...")
Fixes:		3e74849a1e ("ssh: canonicize the host name before...")
Reviewed by:	rew
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38441
2023-03-14 13:16:57 -04:00
Ed Maste
96ab5023fd compiler-rt: remove eprintf
It was used by ancient GCC assert.h.  Prior to 2001 GCC used to provide
its own assert.h  The GCC assert.h required __eprintf to emit the error
message.  FreeBSD's own assert.h never used this.

Reviewed by:	ed (previously), imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D2597
2023-03-14 13:13:51 -04:00
Ed Maste
d0f1f38202 Reserve u2f group for FIDO/U2F key support (SSH, etc.)
We have FIDO/U2F support in the base system now, so reserve a group ID
for it (maching the security/u2f-devd port).

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34341
2023-03-14 13:09:40 -04:00
Jose Luis Duran
6d33121337 ping: Remove ifndef icmp_data guards
Early versions of <netinet/ip_icmp.h> [1] did not have icmp_data
defined, but FreeBSD has always had.  Remove these guards.

NetBSD [2] and OpenBSD [3] have already removed them.

[1]: https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/netinet/ip_icmp.h
[2]: 203dfd3486
[3]: d83449c83c

Reviewed by:	markj
MFC after:	1 week
2023-03-14 11:58:03 -04:00