FreeBSD/src c38abd6sys/net if_epair.c, tests/sys/common vnet.subr

if_epair: support IFCAP_MEXTPG

Enable IFCAP_MEXTPG by default, which may bring performance benefits.
Allow it to be disabled, and when disabled assert that we do not receive
any mbufs with M_EXTPG set. This is useful for testing.
Default the tests to disabling MEXTPG support.

Reviewed by:    zlei
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D58054
DeltaFile
+6-1sys/net/if_epair.c
+3-1tests/sys/common/vnet.subr
+9-22 files

FreeBSD/src 8a14fcdsys/netpfil/pf pf.c, tests/sys/netpfil/pf unmapped_mbuf.sh Makefile

pf: fix a crash on sendfile()

The network layer must not pass unmapped (M_EXTPG) mbufs to if_output()
of network interfaces without IFCAP_MEXTPG. pf should convert these
mbufs by mb_unmapped_to_ext() for such interfaces but it didn't.
The problem had occurred on sendfile because sendfile system call
uses unmapped mbufs for the file data.

Reported by:    feld
Reviewed by:    kp, glebius
Differential Revision:  https://reviews.freebsd.org/D58021
DeltaFile
+145-0tests/sys/netpfil/pf/unmapped_mbuf.sh
+35-0sys/netpfil/pf/pf.c
+2-1tests/sys/netpfil/pf/Makefile
+182-13 files

FreeBSD/src 2039fe8tests/sys/common sendfile_helper.c

tests/sendfile_helper: support remote connection

In order to use the sendfile_helper program in a pf test script that
requires non-loopback interfaces, add functionality to sendfile with a
TCP socket that is connected to a remote host.
The behavior for unix sockets and TCP loopback sockets is unchanged.

Reviewed by:    glebius
Differential Revision:  https://reviews.freebsd.org/D58041
DeltaFile
+64-6tests/sys/common/sendfile_helper.c
+64-61 files

FreeBSD/src 6a5ba65. ObsoleteFiles.inc, tests/sys/common sendfile_helper.c Makefile

tests/sendfile: move the helper program to common

In order to reuse the sendfile_helper program in pf tests, move it
to tests/sys/common directory, indicatint that it is also used from
another places than sys/kern.
Also make the readlen variable static.

Reviewed by:    gelbius, kp
Differential Revision:  https://reviews.freebsd.org/D58040
DeltaFile
+177-0tests/sys/common/sendfile_helper.c
+0-177tests/sys/kern/sendfile_helper.c
+4-0tests/sys/common/Makefile
+3-0ObsoleteFiles.inc
+0-2tests/sys/kern/Makefile
+1-1tests/sys/kern/sendfile_test.sh
+185-1806 files

FreeBSD/src a2426d1lib/libsys pdfork.2

pdfork.2: grammar

Submitted by:   des
MFC after:      1 week
DeltaFile
+2-2lib/libsys/pdfork.2
+2-21 files

FreeBSD/src 4e0fc4dsys/dev/firewire fwcam.c

fwcam: set ISO speed from device link speed

iso_speed was never initialized, defaulting to S100 regardless of the
camera's actual link speed. Some cameras firmwares reject ISO_EN
when the speed field in the ISO_CHANNEL register
does not match their capabilities.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58091
DeltaFile
+1-0sys/dev/firewire/fwcam.c
+1-01 files

FreeBSD/src 84044a7sys/dev/firewire fwcam.c fwcam.h

fwcam: write video mode registers before enabling ISO streaming

The IIDC spec (s3.1) requires the video mode to be programmed before ISO
enable. Without this, cameras that power up with invalid default
mode/rate combinations reject the ISO_EN write.

This can happen when the firmware of teh camera is outdated or
vendor never updated it.

Differential Revision:  https://reviews.freebsd.org/D58092
DeltaFile
+37-3sys/dev/firewire/fwcam.c
+7-0sys/dev/firewire/fwcam.h
+44-32 files

FreeBSD/src 94f24c0sys/dev/firewire fwcam.h fwcam.c, usr.sbin Makefile

fwcamctl: add control utility for fwcam(4) IIDC FireWire cameras

fwcamctl provides userland access to /dev/fwcam0.  Supported
subcommands: info (camera state, format, mode, rate, features),
snap (capture a frame as PPM), mode (set format/mode/rate), and
feat (get/set camera feature registers).

snap converts YUV422, YUV411, YUV444, RGB8, and Mono8 pixel
formats to RGB24 PPM with no external dependencies.  A configurable
frame skip (default 5) allows auto-exposure and auto-white-balance
to settle before capture.

(from adrian - yes, I've successfully captured images from an
Apple isight camera on firewire with this tool and in-tree support.)

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D57914
DeltaFile
+450-0usr.sbin/fwcamctl/fwcamctl.c
+156-0usr.sbin/fwcamctl/fwcamctl.8
+64-0sys/dev/firewire/fwcam.h
+0-21sys/dev/firewire/fwcam.c
+9-0usr.sbin/fwcamctl/Makefile
+1-0usr.sbin/Makefile
+680-216 files

FreeBSD/src 4b3d035sys/dev/firewire fwohci.c fwohcivar.h

fwohci: fix LPS delay, PHY_INT storm, and SID timeout recovery

Fixed the post-LPS delay from 500us to the IEEE 1394a-2000 s6.1 mandated
10ms ceiling. Handled PHY_INT by clearing W1C status bits in register 5
(masked ISBR to avoid spurious bus resets). Added a SID timeout callout
that recovers the state machine when a remote device fails to complete
self-ID. Fixed FW_PHY_SPD operator precedence and gated noisy messages
behind bootverbose/firewire_debug.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58033
DeltaFile
+51-8sys/dev/firewire/fwohci.c
+3-0sys/dev/firewire/fwohcivar.h
+54-82 files

FreeBSD/src f4825e9sys/dev/firewire fwcam.c fwcam.h

fwcam: add dynamic resolution and frame rate support

Read V_MODE_INQ and V_RATE_INQ registers for all supported formats
during probe, caching the camera's actual capabilities.  Use these
to validate SMODE ioctl requests before writing to the camera.

Writing an unsupported combination caused the camera to
stop responding, requiring a physical power cycle.

Tested with: Apple iSight (external FireWire)

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58090
DeltaFile
+30-3sys/dev/firewire/fwcam.c
+2-0sys/dev/firewire/fwcam.h
+32-32 files

FreeBSD/src 3eb80d8sys/ufs/ffs ffs_vfsops.c ffs_subr.c

ufs: Allow read-only mounting of NetBSD FFSv2 WAPBL filesystems

Skip UFS2 fs_metaspace upper-bound validation that rejects NetBSD FFSv2
WAPBL filesystems due to differing superblock layouts.

Detect the condition during mount instead and permit read-only mounts
while rejecting read-write mounts with EROFS.  This follows NetBSD's
recommendation for systems without WAPBL support and avoids modifying
unsupported journal metadata.

PR: 296022
Signed-off-by: Ricardo Branco <rbranco at suse.de>
Reviewed by: imp, kirk
Pull Request: https://github.com/freebsd/freebsd-src/pull/2279
DeltaFile
+27-0sys/ufs/ffs/ffs_vfsops.c
+13-1sys/ufs/ffs/ffs_subr.c
+40-12 files

FreeBSD/src f723b28sbin/reboot reboot.c

reboot: fix openlog(3) calls

LOG_CONS was OR'd into the facility argument instead of logopt, leaving
logopt as 0.  The correct call is openlog(ident, LOG_CONS, LOG_AUTH),
as shutdown(8) and init(8) already do.

PR:     296315
Signed-off-by: Ricardo Branco <rbranco at suse.de>
Reviewed by: imp, des
Pull Request: https://github.com/freebsd/freebsd-src/pull/2300
DeltaFile
+5-5sbin/reboot/reboot.c
+5-51 files

FreeBSD/src f5329a0sys/kern imgact_elf.c kern_exec.c, sys/sys imgact.h

kern: imgact: fix imgp->interpreted

This is a mask, so the new value should have taken the next bit to avoid
breaking a shell script that's interpreted by a binmisc-activated
interpreter.

Add a brief note that the new value is only used within the ELF
activator.

Fixes:  389c124fecb0 ("imgact_elf.c indicate that interpreter [...]")
Reported by:    "polyduekes" on discord, madpilot
Reviewed by:    kib, sjg (both previous version)
Differential Revision:  https://reviews.freebsd.org/D58063
DeltaFile
+2-2sys/kern/imgact_elf.c
+1-2sys/kern/kern_exec.c
+1-1sys/sys/imgact.h
+4-53 files

FreeBSD/src 407c7c3sys/compat/linux linux_futex.c

linux/futex: Don't load a timeout when try-locking a mutex

linux_sys_futex() does not copyin a timespec for the timeout if the
operation is LINUX_FUTEX_TRYLOCK_PI, presumably because it doesn't make
sense to specify a timeout for a try-lock operation.  However, this
means that we pass a userspace timespec pointer to
linux_umtx_abs_timeout_init().

Modify linux_futex_lock_pi() to not initialize the timeout if we're
try-locking.

Reviewed by:    kib, dchagin
Reported by:    Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
                and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58061
DeltaFile
+8-5sys/compat/linux/linux_futex.c
+8-51 files

FreeBSD/src 23e94b0tests/sys/kern procdesc.c

pddupfd(2): add basic test

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+74-0tests/sys/kern/procdesc.c
+74-01 files

FreeBSD/src f87f97dsys/kern sys_process.c

kern/sys_process.c: clean up includes

Order them alphabetically.
Remove redundand sys/param.h.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+9-10sys/kern/sys_process.c
+9-101 files

FreeBSD/src 2a41a8flib/libsys Symbol.sys.map, sys/sys procdesc.h

libsys: export pddupfd(2)

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+1-0lib/libsys/Symbol.sys.map
+1-0sys/sys/procdesc.h
+2-02 files

FreeBSD/src c20558elib/libsys pdfork.2 Makefile.sys

pdfork.2: document pddupfd()

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+53-4lib/libsys/pdfork.2
+2-1lib/libsys/Makefile.sys
+55-52 files

FreeBSD/src 1ad21a6sys/kern sys_procdesc.c kern_descrip.c

kern: add pddupfd(2)

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+82-0sys/kern/sys_procdesc.c
+6-2sys/kern/kern_descrip.c
+7-0sys/kern/syscalls.master
+95-23 files

FreeBSD/src 080a7fesys/compat/freebsd32 freebsd32_systrace_args.c freebsd32_syscall.h, sys/kern systrace_args.c

Regen.
DeltaFile
+30-0sys/compat/freebsd32/freebsd32_systrace_args.c
+30-0sys/kern/systrace_args.c
+7-0sys/sys/sysproto.h
+2-1sys/sys/syscall.h
+2-1sys/compat/freebsd32/freebsd32_syscall.h
+2-1sys/sys/syscall.mk
+73-36 files not shown
+81-312 files

FreeBSD/src 046a4efsys/kern subr_capability.c, sys/sys capsicum.h caprights.h

Add CAP_PDDUPFD capability

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+4-2sys/sys/capsicum.h
+1-0sys/sys/caprights.h
+1-0sys/kern/subr_capability.c
+6-23 files

FreeBSD/src 193fd49sys/sys capsicum.h

sys/capsicum.h: fix comment for CAP_PDWAIT

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+1-6sys/sys/capsicum.h
+1-61 files

FreeBSD/src 77b6adbsys/kern kern_descrip.c sys_generic.c, sys/sys file.h

fget_remote(): return fcaps and fde_flags if requested

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D57163
DeltaFile
+16-3sys/kern/kern_descrip.c
+2-2sys/kern/sys_generic.c
+2-1sys/sys/file.h
+1-1sys/kern/kern_event.c
+21-74 files

FreeBSD/src dfad790sys/kern sys_generic.c kern_sendfile.c, sys/sys syscallsubr.h

sendfile: stop abusing kern_writev()

Provide convenient wrapper kern_filewrite() around fo_write().
Switch to use it in vn_sendfile().  This allows to avoid duplicate
fget() when we already have the reference to the file, which creates a
correctness race with the userspace.  Also td_retval[0] clearing hack
can be removed.

Reviewed by:    glebius, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58035
DeltaFile
+30-11sys/kern/sys_generic.c
+13-12sys/kern/kern_sendfile.c
+2-0sys/sys/syscallsubr.h
+45-233 files

FreeBSD/src 11bd6adsys/compat/linux linux_if.c

linux: switch off interface name translation and schedule its removal

Modern Linuxes don't use ethX for almost 15 years already, see [1] and
[2].  The translation logic has always been a source of bugs and PITA.
Switch default to not translate (long due!) and schedule removal of the
code for FreeBSD 17.

[1] https://systemd.io/PREDICTABLE_INTERFACE_NAMES/
[2] https://www.freedesktop.org/software/systemd/man/latest/systemd.net-naming-scheme.html

Reviewed by:            iwtcex_gmail.com, vvd, melifaro, dchagin
Differential Revision:  https://reviews.freebsd.org/D57852
DeltaFile
+18-3sys/compat/linux/linux_if.c
+18-31 files

FreeBSD/src 6cfc526sys/dev/acpica acpi_apei.c

acpi: fix instant panic in hest_attach()

Since now there is a pseudo-bus between our device and acpi0, we need to
go deeper.

Fixes:  9313f6b01485ad9a0b7cc59b459f5714533587c3
DeltaFile
+1-1sys/dev/acpica/acpi_apei.c
+1-11 files

FreeBSD/src 81bab70usr.sbin/acpi Makefile, usr.sbin/acpi/einj einj.c einj.8

einj: Tool to manage APEI error injection

This tool supports two commands.  The list command outputs a summary
of injectable errors supported by the current system.  The inject
command injects the requested error.

Reviewed by:    gallatin, imp
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D58026
DeltaFile
+256-0usr.sbin/acpi/einj/einj.c
+73-0usr.sbin/acpi/einj/einj.8
+4-0usr.sbin/acpi/einj/Makefile
+1-1usr.sbin/acpi/Makefile
+334-14 files

FreeBSD/src bc49842share/man/man4 acpi_einj.4 Makefile, sys/dev/acpica acpi_einj.c acpiio.h

acpi_einj: Support for ACPI error injection

This driver parses the ACPI EINJ table and builds a list of
instructions associated with known actions.  It then exports ioctls to
fetch the set of supported errors and inject system errors by
executing specific sequences of actions.  This can be used to test
error reporting facilities for events such as ECC errors.

Reviewed by:    gallatin
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D58025
DeltaFile
+777-0sys/dev/acpica/acpi_einj.c
+58-0share/man/man4/acpi_einj.4
+39-0sys/dev/acpica/acpiio.h
+7-0sys/modules/acpi/acpi_einj/Makefile
+1-0share/man/man4/Makefile
+1-0sys/modules/acpi/Makefile
+883-06 files

FreeBSD/src 9313f6bsys/conf files, sys/dev/acpica acpi_apei_bus.c acpi_apei.c

acpi: Add a pseudo-bus for APEI devices to manage resources

Different APEI tables can reuse the same registers (and sometimes
different views of the same register, e.g. 32- vs 64-bit mappings of
the same register).  To enable this sharing, apei0 now acts as a bus
device managing a pool of allocated resources and handing out mappings
to child devices which handle individual tables.

Most of the previous apei(4) driver has been moved into a new
hest0 device that is a child of apei0.

Reviewed by:    gallatin
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D58024
DeltaFile
+435-0sys/dev/acpica/acpi_apei_bus.c
+39-120sys/dev/acpica/acpi_apei.c
+54-0sys/dev/acpica/apeivar.h
+49-0sys/dev/acpica/apei_if.m
+2-0sys/conf/files
+579-1205 files

FreeBSD/src e1f4a8csys/x86/include apicvar.h, sys/x86/x86 local_apic.c

x86/local_apic.c: Thermal interrupt support: Additional style fixes

Rename handler function type 'lapic_thermal_handle_function' to the
shorter 'lapic_thermal_handler_t'.  Move it closer to the function
declaration block where it is used.  Make it a true function type (no
pointer) and add explicit pointer marks on usage.

Rename 'lapic_thermal_function_value' to the more immediately clear
'lapic_thermal_function_arg'.  In lapic_thermal_enable(), use 'func_arg'
as the argument name for the handler argument, which at least refers to
function 'func', rather than the generic 'value'.

Finally, rename the global handler variable from
'lapic_thermal_function_ptr' to the shorter 'lapic_thermal_function'
(dynamic functions can be referenced only through a pointer).

MFC with:       87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler")
Sponsored by:   The FreeBSD Foundation
DeltaFile
+11-11sys/x86/x86/local_apic.c
+4-2sys/x86/include/apicvar.h
+15-132 files