Commit graph

300321 commits

Author SHA1 Message Date
SHENGYI HUNG
4acd63a626 libusb: Fix netlink sysevent multicast group name
Reviewed by:	hrs
Differential Revision: https://reviews.freebsd.org/D50739
2025-06-13 04:30:29 +09:00
Hiroki Sato
0c89182231 netinet6: Remove ndpr_raf_ra_derived flag
This flag was introduced at 8036234c72
to prevent the SIOCSPFXFLUSH_IN6 ioctl from removing manually-added
entries.  However, this flag did actually not work due to an
incomplete implementation making prelist_update() not handle it before
calling nd6_prelist_add().

This patch removes the flag because a prefix is derived from an RA
always has an entry in the ndpr_advrtrs member in the struct
nd_prefix.  Having a separate flag is not a good idea because it can
cause a mismatch between the flag and the ndpr_advrtrs entry.  Testing
using LIST_EMPTY() is simpler for the origial goal.

This also removes in a prefix check in the ICMPV6CTL_ND6_PRLIST sysctl
to exclude manually-added entries.  This ioctl is designed to list all
entries, and there is no relationship to SIOCSPFXFLUSH_IN6.

Differential Revision:	https://reviews.freebsd.org/D46441
2025-06-13 03:47:06 +09:00
Nathan Whitehorn
7b7ba7857c Implement CLOCK_TAI
Provide a clock through clock_gettime() that returns the current TAI
time (UTC without leap seconds) as a complement to CLOCK_REALTIME. This
provides compatibility with Linux, which also provides a CLOCK_TAI since
kernel 2.6.26, and this seems to be becoming the standard way to acquire
TAI time. Unlike Linux, this code will return EINVAL if the TAI offset
(set by ntpd, ptpd, etc.) is not known since it seems pathological for
CLOCK_TAI to silently give the wrong (UTC) time if the offset is not
known as it does on Linux.

Reviewed by: imp
Differential Revision:	https://reviews.freebsd.org/D46268
2025-06-12 12:25:31 -06:00
Hiroki Sato
4deb9760a9
rc: Disable pathname expansion when calling run_rc_command()
Variables for command-line options like $foo_flags can contain characters
that perform pathname expansions, such as '[', ']', and '*'.  They were
passed without escaping, and the matched entries in the working directory
affected the command-line options.  This change turns off the expansion
when run_rc_command() is called.

While this changes the current behavior, an invocation of a service
program should not depend on entries in the working directory.

Differential Revision:	https://reviews.freebsd.org/D45855
2025-06-13 03:19:32 +09:00
Hiroki Sato
b60053fde1 libcasper: Fix inconsistent error codes of cap_get{addr,name}info()
The get{addr,name}info(3) API is designed to return an API-specific error
code that is independent of errno.  The cap_get{addr,name}info() functions
returned either an errno or API-specific error code inconsistently.
This change fixes this mismatch.

When the API returns an errno, the return value itself is set to
EAI_SYSTEM and errno is set depending on the actual error.  So, usually
this API is called in the following form:

    error = getnameinfo(...);
    if (error == EAI_SYSTEM)
        perror("getnameinfo");
    else if (error)
        errx(1, "getnameinfo: %s", gai_strerror(error);

If the above getnameinfo() call is replaced with cap_getnameinfo(),
it breaks the error handling.  For example, the cap_get{addr,name}info()
functions can return ENOTCAPABLE.

This change simply adds "errno", in addition to "error", to the nvlout and
cap_get{addr,name}info() restores the errno if the error code is EAI_SYSTEM.

Reviewed by:	oshogbo
Differential Revision:	https://reviews.freebsd.org/D45859
2025-06-13 03:16:49 +09:00
Hiroki Sato
6501b68ffb
libcasper: Use __VA_ARGS__ for function-like macros
cap_net.h uses "#define cap_f(chan, a) f(a)" to call the conventional
service function with the first argument of cap_f() dropped for
compatibility with the environment where the casper service is
unavailable.  However, this function-like macro does not work when the
arguments contains C99 compound literals, such as f(chan, (int[]){1,2,3}).
The following is a typical example:

    error = cap_getaddrinfo(capnet, "192.168.0.1", "100",
        &(struct addrinfo){
            .ai_family = AF_INET,
            .ai_flags = AI_NUMERICHOST
    }, &res);

Using cap_f(chan, ...) and __VA_ARGS__ in C99 seems a reasonable solution
for this problem.  While there is a workaround using parenthesis around
the compound literal like f(chan, ((int[]){1,2,3})), it is not intuitive
and the above example works when the cap_net is available and f() is
defined as a function.

A possible moot point is that __VA_ARGS__ cannot control how many
arguments are passed at the macro level, and "chan" is not protected.
However, "chan" is less likely to be written in compound literal, and
the function prototype should check the remaining arguments.

Reviewed by:	oshogbo
Differential Revision:	https://reviews.freebsd.org/D45858
2025-06-13 03:04:21 +09:00
Aymeric Wibo
4c556a4e8d libusb: implement libusb_get_parent
Newer versions of drivers such as libwacom (graphics tablets) or
libfprint (fingerprint scanners) call g_usb_device_get_parent.  This in
turn calls libusb_get_parent on platforms which implement it, and
returns NULL on platforms that don't.  This patch implements this
function on FreeBSD.

Reviewed by:	bapt, kevans
Differential Revision:	https://reviews.freebsd.org/D46992
2025-06-12 11:56:31 -05:00
Bjoern A. Zeeb
55efb3bf2b loader.conf: add LinuxKPI based wireless drivers to module_blacklist
Despite being discouraged in the man page people are trying to load
the driver from loader.  In that case firmware is missing and the
root file system is not there yet and the LinuxKPI based drivers
will panic the system on boot.  Simply avoid any further support
trouble by disallowing them to be loaded from loader.
If someone still wants to do it, they will need to figure out how
to remove them from the blocklst and how to loader the firmware
file(s) in advance themselves.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
PR:		287480
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D50817
2025-06-12 15:34:07 +00:00
Konstantin Belousov
cd7af78e12 rpcbind: do not exit abruptly if krpc.ko is not available
Reviewed by:	glebius, rmacklem
Sponsored by:	The FreeBSD Foundation
2025-06-12 17:09:01 +03:00
Brooks Davis
6d0a335aaa fcntl.h: warn that bits for O_* flags are scarce
Running out of O_* flag bits will end out ability to make additions that
are source compatible with other operating systems.

Add a warning to coordinate all additions with srcmgr@.

Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D50703
2025-06-12 14:34:05 +01:00
Warner Losh
8fa4a4eb70 service: Fix repeated -v in man page
Fix accidental repeated -v for -q.

Fixes: 37983aef7c
Noticed by: Gary Jennejohn
2025-06-12 07:28:37 -06:00
Brooks Davis
12913e4ddf fix build after _types.h changes
Reported by:	imp, Jenkins CI
Fixes:		b01e971fd3 ("Don't rely on sys/_types.h including sys/cdefs.h")
2025-06-12 14:22:17 +01:00
Andrew Turner
e6928c33f6 arm64: Reduce the kernel executable pages
When creating the kernel page tables we create them all executable to
allow the kernel to boot.

We can reduce the number of l2 blocks or l3 pages created as executable
by looking where the end of the .text section is and only marking
memory up to this as executable (rounded up to the block/page size).

Memory after the .text is marked as execute never as it will be data.

Reviewed by:	alc
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45063
2025-06-12 10:48:57 +01:00
Andrew Turner
95059bef24 arm64: Use tables to find early page tables
Use the existing lables to find the early page tables. This allows
us to change the size and layout of these as needed, e.g. adding a
new level.

Reviewed by:	alc
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45062
2025-06-12 10:48:57 +01:00
Stefan Eßer
dab9ef5448 snd_hda: fix attaching to some AMD Radeon GPUs
HDMI audio did not work on my older Radeon GPU, the error message
during attach was:

hdac0: hdac_get_capabilities: Invalid corb size (0)

This is fixed by calling hdac_reset() before the HDA device
capabilities are retrieved. This solution was proposed by Andriy Gapon
in 2010, but apparently did not solve the problem reported at the time.

Approved by:	christos
Differential Revision:	https://reviews.freebsd.org/D50737
2025-06-12 10:15:59 +02:00
Warner Losh
d8b51259ca ssp: Protect sig2str with proper visibility markers
We only define SIG2STR_MAX with careful visibility, but define the
fortified version unconditionally. It needs to have the same visibility
both places.

Fixes:		3d12567133
Reviewed by:	jrtc27, kevans
Sponsored by:	Netflix
2025-06-11 21:19:05 -06:00
Warner Losh
86c3a22b6e nanobsd: Fix kernel build
'device crypto' is now required for 'device pf' so add it.

Sponsored by:		Netflix
2025-06-11 20:40:57 -06:00
Brooks Davis
4f4c465b45 arm: fix build after _types.h changes
Reported by:	alc
Fixes:		b01e971fd3 ("Don't rely on sys/_types.h including sys/cdefs.h")
2025-06-12 01:38:00 +01:00
Lexi Winter
daf47b9ec9 style.9: relax "return (value)" requirement for C++
consider the following C++ code:

	struct S { int a, b; };
	S f() { return {1, 2}; }

according to style(9), the return statement should be formatted as:

	return ({1, 2});

however, this is not valid C++ code and will not compile.

add an exception to style(9) to cover this case.

Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1623
Closes: https://github.com/freebsd/freebsd-src/pull/1623
2025-06-11 18:21:44 -06:00
yu shan wei
1ae6faf164 LoongArch: elftoolchain: add support
According to the latest elftoolchain r4191, add support for Loongarch

Co-authored-by: haowuge <gehaowu@bitmoe.com>
Co-authored-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: yu shan wei <mpysw@vip.163.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1682
Closes: https://github.com/freebsd/freebsd-src/pull/1682
2025-06-11 18:21:30 -06:00
Alexander Ziaee
342e9f2f30 puc.4: Cleanup
+ Alphabetize and condense supported hardware.
+ Mention PCI/PCIe where applicable.
+ Move hardware support file to FILES
+ Tag spdx

MFC after:	3 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1692
Closes: https://github.com/freebsd/freebsd-src/pull/1692
2025-06-11 17:37:01 -06:00
Ricardo Branco
b0334450aa include: ssp: fortify <signal.h>
sig2str(3)

Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
Closes: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:22 -06:00
Ricardo Branco
d580567dfb Add tests for sig2str() / str2sig()
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:22 -06:00
Ricardo Branco
36679f7d7b kill: Use POSIX str2sig()
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:22 -06:00
Ricardo Branco
f942680e8e Fix proc_signame() to use sig2str()
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:22 -06:00
Ricardo Branco
b826e88d38 fstat: Use POSIX str2sig(3)
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:22 -06:00
Ricardo Branco
3d12567133 Add the POSIX sig2str(3) & str2sig(3) calls
Signed-off-by: Ricardo Branco <rbranco@suse.de>
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:22 -06:00
Ricardo Branco
6ff5a5bc1a Remove definition of SIG2STR_MAX from libproc.h
Reviewed by: imp, kib, des, jilles
Pull Request: https://github.com/freebsd/freebsd-src/pull/1696
2025-06-11 17:16:21 -06:00
tropicahq
150274edd2 Update tramp.S comment
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1705
Closes: https://github.com/freebsd/freebsd-src/pull/1705
2025-06-11 17:16:21 -06:00
Tom Hukins
f850a9288b su.1: refer to mdo(1) and improve manual syntax
Running `mandoc -Tlint usr.bin/su/su.1` spotted the syntax problem.

Reviewed by: imp, ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/1712
Closes: https://github.com/freebsd/freebsd-src/pull/1712
2025-06-11 17:16:21 -06:00
Tom Hukins
a27c25625d mdo.1: Describe this command's history
Reviewed by: imp, ziaee
Pull Request: https://github.com/freebsd/freebsd-src/pull/1712
2025-06-11 17:16:21 -06:00
Jan Biedermann
50461a68e0 Add USB quirk for Creative Stage SE mini
Note: The commit in main was modified for the new macros in main.
stable merge will need to use the version originally in #1715

MFC After: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/1715
Closes: https://github.com/freebsd/freebsd-src/pull/1715
2025-06-11 17:16:21 -06:00
Jan Biedermann
c2794499be usb: Don't call usb_msc_auto_quirk for UQ_MSC_IGNORE devices
usb_msc_auto_quirk() potentially crashes usb devices with a hidden
storage (see bug 287333). These devices may still operate normally if
usb_msc_auto_quirk() would not be called all and the hidden storage is
ignored. This patch makes sure, that usb_msc_auto_quirk() is not called
when the UQ_MSC_IGNORE quirk is set for a device. It shouldn't be called
anyway if the hidden storage supposed to be ignored. This gives users a
chance to get their devices working by using

'usbconfig add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> UQ_MSC_IGNORE'.

Reviewed by: imp
MFC After: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1716
Closes: https://github.com/freebsd/freebsd-src/pull/1716
2025-06-11 17:16:21 -06:00
Dan Mahoney
37983aef7c Add quiet/-q option to /usr/sbin/service
Signed-off-by: Dan Mahoney <freebsd@gushi.org>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1709
Closes: https://github.com/freebsd/freebsd-src/pull/1709
2025-06-11 17:16:21 -06:00
Ricardo Branco
86f06e612b Add POSIX NSIG_MAX & _SC_NSIG
Signed-off-by: Ricardo Branco <rbranco@suse.de>
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1710
Closes: https://github.com/freebsd/freebsd-src/pull/1710
2025-06-11 17:16:20 -06:00
Olivier Certner
94828b3380
mac_do(4): Examples: Fix some descriptions and a typo
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
2025-06-11 19:10:37 -04:00
Alan Cox
797020a764 vm: retire vm_page_lock()
vm_page_lock() and its underlying array of locks, pa_lock[], have been
replaced throughout the virtual memory system by either atomics or
busy-style, per-page synchronization.  The Linux KPI support contained
the only remaining use cases.  Eliminate or update them as appropriate
to each case.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D50767
2025-06-11 15:19:41 -05:00
Brooks Davis
e50304c2fb vfs_syscalls.c: fix type
Fixes:		e453e498cb ("machine/stdarg.h -> sys/stdarg.h")
2025-06-11 20:04:49 +01:00
Christos Margiolis
4a7b8cd705 sound: Add AFMT_FLOAT to feed_volume_info_tab
Fixes:		e1bbaa71d6 ("sound: Implement AFMT_FLOAT support")
Reported by:	bz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D50793
2025-06-11 13:10:54 -04:00
Brooks Davis
e453e498cb machine/stdarg.h -> sys/stdarg.h
Switch to using sys/stdarg.h for va_list type and va_* builtins.

Make an attempt to insert the include in a sensible place.  Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Brooks Davis
2d92a5abef Add sys/stdarg.h
While the type of va_list and implementation of va_*() psuedo functions
varies (sometimes greatly) by architecture, they will always be defined
by the compiler in a consistant way that does not require machine
dependent handling.

MFC after:	1 week

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Brooks Davis
c190cd94b7 sys/_stdarg.h: drop cdefs.h and _types.h polution
Rely in sys/_visible for visibility macros and use __buitin_va_list
instead of __va_list everywere we declare va_list.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Brooks Davis
2e783ea70a stddef.h: don't include sys/cdefs.h
Switch to sys/_visible.h for visibility macros.

Prefer __builtin_offsetof over __offset.  sys/cdefs.h always defines
__offsetof to __builtin_offsetof so just use the latter to remove a
dependency on sys/cdefs.h.  Realistically, we're never going to care
about a compiler that doesn't supply this builtin.

Add a somewhat questionable guard around the offsetof() definition
because the compiler no longer thinks it the same as a number of other
redundent definitions scattered around (e.g., in the openzfs codebase).
It is actually the same and those defintions likely shouldn't exist at
all, but it's easy to add a guard for now.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:02 +01:00
Brooks Davis
5a2f6016de sys/cdefs.h: extract __*_VISIBLE to sys/_visible.h
Some headers need to support our non-portable visibility macros, but
would be more portable if they provided less overall pollution (e.g.,
stddef.h currently provides __BEGIN_DECLS/__END_DECLS).

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:01 +01:00
Brooks Davis
92ff108e99 sys/_types.h: drop sys/cdefs.h include
We no longer use it and it pollutes downstream headers.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:01 +01:00
Brooks Davis
ab3d713e93 sys/_types.h: use builtins to for __max_align_t
Use __attribute__((__aligned__(x))) and __alignof__(x) in places of local
macros that ultimately wrap these.  We don't support compilers that don't
define these so there's little loss of generality.

This mirrors Clang's stddef.h.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:01 +01:00
Brooks Davis
b01e971fd3 Don't rely on sys/_types.h including sys/cdefs.h
These headers relied in __BEGIN_DECS/__END_DECLS being defined when
sys/_types.h was included, but there's not a requirement that this be
the case.

Reviewed by:	imp
Exp-run by:	antoine (PR 286274)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1595
2025-06-11 17:39:01 +01:00
Bjoern A. Zeeb
8ac82ba19e iwlwifi: add message how to install firmware on FreeBSD
While it is too late for 14.3-R point people at fwget(8) to install
firmware if the driver cannot find any.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste, ziaee
Differential Revision: https://reviews.freebsd.org/D50777
2025-06-11 16:32:27 +00:00
Andrew Turner
d41a2ba73c scmi: Avoid a use-after-free
Use LIST_FOREACH_SAFE to avoid a use-after-free in scmi_reqs_pool_free.
The next pointer will be invalid after the call to free meaning
LIST_FOREACH will dereference a freed struct to move to the next item.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D50753
2025-06-09 23:32:11 +01:00
Ali Abdallah
1254c42c68 fwget: fix pci id 15d8 firmware
Pci video graphic card is 15d8 needs gpu-firmware-amd-kmod-picasso and
it won't work with gpu-firmware-amd-kmod-raven.

Tested on Thinkpad T495.

PR:		287441
MFC After:	3 days
2025-06-11 09:27:54 +02:00