Commit graph

292527 commits

Author SHA1 Message Date
Warner Losh a1cfe4c764 style(9): Delete __FBSDID straggler
We no longer need advice on __FBSDID, so delete it.

Sponsored by:		Netflix
2024-07-02 17:19:32 -06:00
Niko Sonack d6888e211b ums(4): fix incorrect mouse button reporting via evdev
when ums driver receives non-mouse HID report. This results in
unexpected button release event. Reuse existing sysmouse logic to
keep button pressed.

Reviewed by:	imp, wulf
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45838
2024-07-03 02:15:50 +03:00
Igor Ostapenko 78918c9b27 pf: Fix NULL deref in m_pullup failure case
Reviewed by:	glebius, kp
Differential Revision:	https://reviews.freebsd.org/D45832
2024-07-02 21:58:32 +02:00
Ryan Libby 3cfcbbfaf8 cdefs.h __generic: avoid gcc -Wunused-value
Fixup after
9d2f979817 <sys/cdefs.h>: Decay expression passed to fallback version of __generic()

Reviewed by:	imp, jrtc27, kib
Differential Revision:	https://reviews.freebsd.org/D45825
2024-07-02 12:12:59 -07:00
Ryan Libby 19008cdf7b gsb_crc32.c: avoid gcc -Wunused-const-variable in user build
Fixup after
56e9a0136f gsb_crc32: Fix a warning when compiled in userland.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45824
2024-07-02 12:12:22 -07:00
Warner Losh de1e91339b clock_gettime: Catch up with the CLOCK_BOOTTIME changes
When CLOCK_BOOTTIME was made an alias for CLOCK_MONOTONIC, the man page
wasn't updated. Update to include the changed semantics (it was to be
better compatible with Linux). Clarify the details of these clocks.
Provide a reference to the UTC standard, and a clarifying remark
about leap second encoding (fun fact: POSIX provides no unique
value for these, nor definitive values to use).

Sponsored by:		Netflix
2024-07-02 11:27:35 -06:00
Cormac Stephenson 172328c477 timerfd.2: Add documentation for CLOCK_UPTIME and CLOCK_BOOTTIME
Add CLOCK_UPTIME and CLOCK_BOOTTIME options and a quick pointer
to clock_gettime(2) for a better definition of these values.

Reviewed-by: imp (small tweaks and added Xr)
Pull-Request: https://github.com/freebsd/freebsd-src/pull/1302
2024-07-02 10:40:04 -06:00
Igor Ostapenko 239e24eb0c pf: Handle (*m0)->m_len < sizeof(struct ip) case
if_enc(4) can pass IPsec payload to pfil(9) with the outer header or without
it. In case of a small packet like ICMP, when mbuf cluster is not used,
everything works fine. Otherwise, the first mbuf in a chain has m_len == 0
if it is asked to strip the outer header. pf was not handling such case, and
erroneous reading of the outer IP header led to unexpected behavior.

Reviewed by:	kp, glebius
Differential Revision:	https://reviews.freebsd.org/D45780
2024-07-02 14:43:46 +02:00
Zhenlei Huang 087f5e08ab if_vxlan(4): Plug a memory leak
On clone creating, either failure from vxlan_set_user_config() or
ifc_copyin() will result in leaking previous allocated counters.

Since counter_u64_alloc(M_WAITOK) never fails, make vxlan_stats_alloc()
void and move the allocation for counters below checking ifd->params to
avoid memory leak.

Reviewed by:	kp, glebius
Fixes:	b092fd6c97 if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45822
2024-07-02 12:57:02 +08:00
Zhenlei Huang d6963b9ed3 if_vxlan(4): Exclude ETHER_CRC_LEN from macro VXLAN_MAX_MTU
The encapsulated (original) frame does not count in FCS as per Section 5
of RFC 7348.

Reviewed by:	afedorov, bryanv, #network
Fixes:		b7592822d5 Allow set MTU more than 1500 bytes
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45195
2024-07-02 12:57:01 +08:00
Ryan Libby f8a46de2dd bluetooth socket sysinit: correct memset initialization
gcc -Wmemset-elt-size diagnosed this.  The code was only initializing
the first 1/sizeof(long) bytes.  On 64-bit systems, this would mean only
events up to 0x20 were initialized.

This effectively reverses the security policy for some events with
higher ids, now permitting them on unprivileged sockets.  Two that are
defined are NG_HCI_EVENT_LE (0x3e) and NG_HCI_EVENT_BT_LOGO (0xfe).

PR:		280039
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45707
2024-07-01 08:22:31 -07:00
Philip Paeps 2abea9df01 openssh: Fix pre-authentication remote code execution in sshd.
Reported by:	Qualys Threat Research Unit (TRU)
Approved by:	so
Security:	FreeBSD-SA-24:04.openssh
Security:	CVE-2024-6387
2024-07-01 16:20:01 +08:00
Dag-Erling Smørgrav 4ce4a0fe14 diff: Document the --no-dereference option.
Also, --no-dereference should not imply --recurse.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45779
2024-06-30 17:55:27 +02:00
Zhenlei Huang 9738277b5c ifnet: Remove dead code
Since change [1], if_bpf will not be detached by the interface departure
eventhandler and will not be NULL. Then the logic to re-attach if_bpf
becomes dead and serves no purpose any more.

This partially reverts commit 05fc416403.

1. 9ce40d321d bpf: Fix incorrect cleanup

Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45599
2024-06-30 17:44:21 +08:00
Igor Ostapenko 4ca4a3b1c8 enc.4: Remove a redundant word
Reviewed by:	zlei
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45706
2024-06-30 17:27:05 +08:00
Michael Tuexen 811d831050 tcp: minor cleanup
Fix two KASSERTs to catch the condition they are intended to,
add two asserts to ensure that the appropriate locking is in
place and fix some things related to style.
No functional change intended.

MFC after:	1 week
Sponsored by:	Netflix, Inc.
2024-06-29 11:06:35 +02:00
Simon J. Gerraty 8d5c8e21c6 Merge bmake-20240625
Merge commit 'dbb5be7f07456d02ce444484c683b130439acb45'
2024-06-28 17:22:11 -07:00
Simon J. Gerraty dbb5be7f07 Import bmake-20240625
Intersting/relevant changes since bmake-20240520

ChangeLog since bmake-20240520

2024-06-25  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240625
	Merge with NetBSD make, pick up
	o job.c: ensure shellPath is always duped, avoid upsetting free()

2024-06-16  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240616
	Merge with NetBSD make, pick up
	o clean up collection of context information for error messages
	o in warnings, move the word "warning" to the front
	o var.c: throw an error on attempt to override an internal
	read-only variable

2024-06-10  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240610
	Merge with NetBSD make, pick up
	o for.c: remove redundant shortcut for building the .for loop body

2024-06-02  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240602
	Merge with NetBSD make, pick up
	o rename some VarEvalMode constants to better match debug names.
	o var.c: avoid out-of-bounds read when parsing indirect modifiers.

2024-06-01  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240601
	Merge with NetBSD make, pick up
	o add .export-all rather than allow .export with no argument
	which can happen accidentally.
	o if lua is available, run check-expect.lua after unit-tests
	o main.c: use snprintf rather than strncpy
	fix memory leak when purging realpath cache.

2024-05-28  Simon J Gerraty  <sjg@beast.crufty.net>

	* VERSION (_MAKE_VERSION): 20240528
	Merge with NetBSD make, pick up
	o fix a number of memory leaks
	o replace magic numbers with POSIX FILENO constants
	o hash.c: remove dead code from HashTable_DeleteEntry
	o main.c: when complaining about unusable .OBJDIR
	call PrintOnError if MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is true.
	o parse.c: use fewer technical terms in debug message for dependency

mk/ChangeLog since bmake-20240520

2024-06-22  Simon J Gerraty  <sjg@beast.crufty.net>

	* install-mk (MK_VERSION): 20240616

	* dirdeps.mk: apply DEP_DIRDEPS_BUILD_DIR_FILTER after we have
	computed build dirs, since some filters cannot be easily expressed via
	DEP_DIRDEPS_FILTER.

2024-05-31  Simon J Gerraty  <sjg@beast.crufty.net>

	* dirdeps.mk: move reset of DIRDEPS_EXPORT_VARS
	until after we a finished with it if building a cache.
2024-06-28 17:16:32 -07:00
Colin Percival 59c21ed6e8 release: Bump default VM size for riscv64 to 6 GB
Due to issues with the riscv64 toolchain, some binaries end up
significantly larger on riscv64 than they should be.  This results
in riscv64 VM images -- and at present *only* riscv64 images -- not
fitting within the default 5 GB filesystem size.

Bump the default size for riscv64 to 6 GB until the toolchain issues
can be resolved.

MFC after:	1 week
Sponsored by:	Amazon
2024-06-28 15:47:11 -07:00
Ed Maste 5654b42142 libusb: claim to be version 1.0.16
We are not 100% compatible with 1.0.16, but implement some
functionality from that version that is required by certain ports.

PR:		277799
PR:		279555 (exp-run)
Event:		Kitchener-Waterloo Hackathon 202406
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45514
2024-06-28 12:18:34 -04:00
Sebastian Huber fc3e5334ab Fix "%hhi" conversion for kvprintf()
The signedness of "char" is implementation-dependent.

Reviewed by: imp,zlei,nightquick@proton.me
Pull Request: https://github.com/freebsd/freebsd-src/pull/1290
2024-06-28 08:57:39 -06:00
wy-chung 2eb64df7f5 riscv: remove a redundant check on PGA_WRITEABLE
This is achieved by the preceding call to pmap_page_is_write_mapped().
It appears the second check and comment were left mistakenly when the
intent was to remove them.

Reviewed by:	mhorne
MFC after:	1 week
Fixes:	638f867814 ("(6/6) Convert pmap to expect busy in write... ")
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1304
2024-06-28 11:10:57 -03:00
Mariusz Zaborski d3bb35d4e5 jail: allow adjustment of host time
Add a special permission to the jail to adjust and to set the host time.
This can be useful if we want to compartmentalize the NTP daemon
from the rest of the system.

Reviewed by:	olce, imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45545
2024-06-28 12:23:31 +02:00
Zhenlei Huang aa3860851b net: Remove unneeded NULL check for the allocated ifnet
Change 4787572d05 made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

No functional change intended.

Reviewed by:	kp, imp, glebius, stevek
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45740
2024-06-28 18:16:29 +08:00
Ryan Libby 0d8da0df41 tcp_rack: avoid gcc -Werror=pointer-to-int-cast on 32-bit arch
Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D45752
2024-06-27 20:40:12 -07:00
Ryan Libby c02a8caf50 tcp_bbr: avoid gcc -Werror=pointer-to-int-cast on 32-bit arch
Reviewed by:	tuexen
Differential Revision:	https://reviews.freebsd.org/D45751
2024-06-27 20:37:26 -07:00
Ahmad Khalifa ab08da5328 loader: Increase buffer size to accommodate longer commands
The longest command we have is "efi-autoresizecons". That combined with
the two spaces before and after the command gives us a total of 23
characters including the null-terminator.

Also move the two trailing spaces to their own pager_output call so they
don't get truncated if the command is too long and increase the minimum
string length to 20 in order to fix alignment issues caused by the
increased buffer size.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1277
2024-06-27 18:40:15 -06:00
Alexander Ziaee cf9c4b32cc RELNOTES: mention moving filesystems to section 4
Fixes:		1687d7 (move filesystems to s4)
Reported by:	mhorne
Reviewed by:	imp, mhorne
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1289
2024-06-27 18:37:20 -06:00
Alexander Ziaee a85d870007 man.sh: revert trapping SIGPIPE
PR:		279542
Fixes:		14a5c1068d
Reported by:	emaste
Reviewed by: imp, emaste, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1283
2024-06-27 18:34:33 -06:00
Alexander Ziaee 088cc7d221 man filesystems: fix more xrefs after move to s4
Fixes: 1a720cbec5
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1282
2024-06-27 18:32:05 -06:00
Alexander Ziaee cfe55a8af8 fwget.8: polish
MFC after:	3 days
Reviewed by:	imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1269
2024-06-27 18:28:32 -06:00
Mitchell Horne 32d2a1de3d arm64: correct physmap bounds in pmap_bootstrap()
physmap_idx now contains the raw value; we should not multiply it.

Reviewed by:	markj
Fixes:	d03e1ffbea ("arm64: Remove some redundant calculations...")
2024-06-27 16:32:44 -03:00
Doug Moore 995730a635 swap_pager: cleanup swapoff_object
Function swap_pager_swapoff_object calls vm_pager_unswapped (via
swp_pager_force_dirty) for every page that must be unswapped. That
means that there's an unneeded check for lock ownership (the caller
always owns it), a needless PCTRIE_LOOKUP (the caller has already
found it), a call to free one page of swap space only, and a check to
see if all blocks are empty, when the caller usually knows that the
check is useless.

Isolate the essential part, needed however swap_pager_unswapped is
invoked, into a smaller function swap_pager_unswapped_acct.  From
swapoff_object, invoke swp_pager_update_freerange for each appropriate
page, so that there are potentially fewer calls to
swp_pager_freeswapspace.  Consider freeing a set of blocks (a struct
swblk) only after having invalidated all those blocks.

Replace the doubly-nested loops with a single loop, and refetch and
rescan a swblk only when the object write lock has been released and
reacquired.

After getting a page from swap, dirty it immediately to address a race
condition observed by @kib.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D45668
2024-06-27 14:06:09 -05:00
Michael Tuexen 14fee5324a tcp: improve failure handling in tcp_newtcpcb()
In case of a failure of tcp_newtcpcb, where NULL is returned,
* call CC_ALGO(tp)->cb_destroy, after CC_ALGO(tp)->cb_init was called.
* call khelp_destroy_osd(), after khelp_init_osd() was called.

Reviewed by:		glebius, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45753
2024-06-27 08:26:34 +02:00
Mitchell Horne a35f665109 if_genet: don't load DMA mapping when tx_queue is full
gen_encap() always calls bus_dmamap_load_mbuf_sg() into 'map' (which is
the current tx_queue). If the tx_queue is full, it will load with a
'map' that already has a currently active mapping. This violates the
busdma(9) KPI.

Checking for a full queue and returning ENOBUFS will allow
gen_start_locked() to set the IFF_DRV_OACTIVE faster without having to
needlessly check if the mbuf will fit (it won't).

PR:		256482
Reviewed by:	mhorne
MFC after:	1 week
Submitted by:	ghuckriede@blackberry.com
2024-06-27 14:44:36 -03:00
Michael Tuexen 3703e1a73e tcp: improve error handling in syncache_socket()
If syncache_socket() fails after calling tcp_newtcpcb(), the resources
allocated in tcp_newtcpcb() needs to be freed. Just call
tcp_discardcb() to do this.
Thanks to jtl for making me aware of the issue and proposing a fix.
Reviewed by:		glebius, jtl, rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D45749
2024-06-27 07:25:15 +02:00
Alexander Ziaee 18a27dd641 wpa_cli.8: describe better + tag spdx + linter nit
"how do I switch active wifi network on console"
"% apropos wifi"

MFC after:	3 days
Reviewed by:	mhorne, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1299
2024-06-27 11:55:41 -03:00
Alexander Motin 87085c12ba Fix SATA NCQ error recovery after 25375b1415
Since that commit ahci(4), siis(4) and mvs(4) drivers ended up
using wrong command to fetch error information for NCQ commands.
Since ATA errors are not very informative to begin with, the only
noticeable effect is a lack of retries on those errors by CAM.

MFC after:	1 week
PR:		279978
2024-06-27 09:29:23 -04:00
Andriy Gapon a743e280ea rk_i2c: use the register read mode even if the read ends with IIC_M_NOSTOP
Tested with max44009(4).

MFC after:	2 weeks
2024-06-27 13:32:47 +03:00
Andriy Gapon 0deaf4be34 rk_i2c: emulate repeated start
rk_i2c_send_stop is modified so that it sends a stop condition, like it
always did, if there is no IIC_M_NOSTOP flag.
But if the flag is set then the function completely resets the control
register and sets the driver state to transfer completed.
Something like this was previously done for a write with IIC_M_NOSTOP.
Now it is done for a read with IIC_M_NOSTOP as well.

Linux code says that the hardware does not support the repeated start
condition and the documentation, indeed, does not mention it.
But according to the Linux driver clearing the control register and then
sending a start condition acts as if it were a repeated start.

While here, add braces around a single-line 'if' branch to balance it
with a multi-line 'else' branch.

Tested with max44009(4).

MFC after:	2 weeks
2024-06-27 13:32:15 +03:00
Baptiste Daroussin cde6642431 nuageinit: check for both user_data and user-data
openstack, ec2 and other implementation of cloudinit disagrees on the
name of the file "user-data" or "user_data", test both and use the first
found

PR:	279876
2024-06-27 10:32:14 +02:00
Zhenlei Huang ef4f4a44d9 ifnet: Restore curvnet earlier
This improves readability a little. As a side effect, a redundant
CURVNET_RESTORE is removed.

No functional change intended.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45595
2024-06-27 12:38:04 +08:00
Ryan Libby b195d7498b nvme: avoid gcc -Werror=int-to-pointer-cast on 32-bit arch
Reviewed by:	chuck (previous version), imp
Differential Revision:	https://reviews.freebsd.org/D45750
2024-06-26 20:50:04 -07:00
Enji Cooper 303596eac3 Update config/build info for OpenSSL
This is a companion commit to the OpenSSL 3.0.14 update.

MFC after:      3 days
MFC with:       44096ebd22
2024-06-26 16:51:25 -07:00
Enji Cooper 44096ebd22 Update to 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)

MFC after:	3 days
Merge commit '1070e7dca8223387baf5155524b28f62bfe7da3c'
2024-06-26 16:50:13 -07:00
Vladimir Kondratyev 8c5c572125 LinuxKPI: Add DEFINE_DEBUGFS_ATTRIBUTE_SIGNED to linux/debugfs.h
Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45615
2024-06-26 23:51:34 +03:00
Vladimir Kondratyev e1b0f431a1 LinuxKPI: Remove vmas argument from get_user_pages on KPI layer
To chase Linux kernel 6.5

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, emaste
Differential Revision:	https://reviews.freebsd.org/D45614
2024-06-26 23:51:04 +03:00
Vladimir Kondratyev 889f74af66 LinuxKPI: Add linux/nodemask.h
and dummy num_possible_nodes() implementation.
We do not fully support NUMA in LinuxKPI yet.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45613
2024-06-26 23:49:52 +03:00
Vladimir Kondratyev 256eb8d536 LinuxKPI: Remove linux/sched.h include from linux/kernel.h header
This include prevents usage of any kernel.h helpers in sched.h and
all of dependencies. Linux does not have it too.
Fix building of kernel and drm-kmod after than.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45692
2024-06-26 23:47:12 +03:00
Vladimir Kondratyev d21316ff22 LinuxKPI: Add header polution to compile linux/numa.h
Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz, emaste
Differential Revision:	https://reviews.freebsd.org/D45612
2024-06-26 23:44:56 +03:00