HardenedBSD/src bfa93d2lib/libc/gen posix_spawnattr_getexecfd_np.3, lib/libsys pdfork.2

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+278-127sys/kern/kern_exit.c
+68-26sys/kern/kern_fork.c
+81-8lib/libsys/pdfork.2
+86-0lib/libc/gen/posix_spawnattr_getexecfd_np.3
+68-0sys/kern/systrace_args.c
+68-0sys/compat/freebsd32/freebsd32_systrace_args.c
+649-16155 files not shown
+1,117-18961 files

HardenedBSD/src 556161csbin/camcontrol camcontrol.c, sys/cam/scsi scsi_all.c scsi_all.h

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+34-0sys/cam/scsi/scsi_all.c
+4-0sys/cam/scsi/scsi_all.h
+1-1sys/dev/ufshci/ufshci_sim.c
+0-2sys/cam/scsi/scsi_cd.c
+0-1sbin/camcontrol/camcontrol.c
+0-1sys/dev/mpr/mpr_sas_lsi.c
+39-52 files not shown
+39-78 files

HardenedBSD/src 8ef8c6asys/cam cam_periph.c, sys/cam/scsi scsi_all.c scsi_all.h

cam/scsi: Restore scsi_start_stop() and add scsi_start_stop_pc()

Revert the argument change that broke libcam in 8c35de49 and move
power_condition support to scsi_start_stop_pc().

Reported by:            imp
Reviewed By:            #cam, imp (mentor)
Sponsored by:           Samsung Electronics
Differential Revision:  https://reviews.freebsd.org/D54822
DeltaFile
+34-0sys/cam/scsi/scsi_all.c
+4-0sys/cam/scsi/scsi_all.h
+0-2sys/cam/scsi/scsi_cd.c
+1-1sys/dev/ufshci/ufshci_sim.c
+0-1sys/dev/mps/mps_sas_lsi.c
+0-1sys/cam/cam_periph.c
+39-52 files not shown
+39-78 files

HardenedBSD/src 7c49c67lib/libc/gen posix_spawn.c, sys/kern kern_fork.c

HBSD: Resolve merge conflicts

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+1-6lib/libc/gen/posix_spawn.c
+0-3sys/kern/kern_fork.c
+1-92 files

HardenedBSD/src 0662f0dlib/libc/gen posix_spawnattr_getexecfd_np.3, lib/libsys pdfork.2

Merge remote-tracking branch 'origin/freebsd/current/main' into hardened/current/master

Conflicts:
        lib/libc/gen/posix_spawn.c (unresolved)
        sys/kern/kern_fork.c (unresolved)
DeltaFile
+278-127sys/kern/kern_exit.c
+71-26sys/kern/kern_fork.c
+81-8lib/libsys/pdfork.2
+86-0lib/libc/gen/posix_spawnattr_getexecfd_np.3
+68-0sys/compat/freebsd32/freebsd32_systrace_args.c
+68-0sys/kern/systrace_args.c
+652-16147 files not shown
+1,084-18053 files

HardenedBSD/src 9d71290sys/compat/linuxkpi/common/src linux_current.c linux_shmemfs.c, sys/dev/asmc asmc.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+55-0sys/dev/asmc/asmc.c
+6-6sys/dev/iicbus/adc/ads111x.c
+5-5sys/dev/isl/isl.c
+5-5sys/dev/jme/if_jme.c
+2-8sys/compat/linuxkpi/common/src/linux_current.c
+3-4sys/compat/linuxkpi/common/src/linux_shmemfs.c
+76-285 files not shown
+83-3511 files

HardenedBSD/src 36daea2tools/build make_libc_exterr_cat_filenames.sh

exterr: Sort output from make_libc_exterr_cat_filenames.sh

Otherwise the script may permute the order of entries in the file since
find(1) output is not stable.

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54669

(cherry picked from commit bda6ed2ee4d8e836b1b2f8ca7a6ed72034e5f231)
DeltaFile
+1-1tools/build/make_libc_exterr_cat_filenames.sh
+1-11 files

HardenedBSD/src f1e1bfesys/compat/linuxkpi/common/src linux_shmemfs.c

linuxkpi: Clean up linux_shmem_file_setup() a bit

- Free the pointer that was returned by the allocator, instead of the
  address of the first member.  These will be equal in practice, but
  it's sketchy and won't work on CHERI with subobject bounds checking.
- Use an anonymous struct, there's no need to name it.

Reviewed by:    bz, brooks, emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54673

(cherry picked from commit 251662e5abdd85f5a83766b400e23c2ac5597fb9)
DeltaFile
+3-4sys/compat/linuxkpi/common/src/linux_shmemfs.c
+3-41 files

HardenedBSD/src a11b4f7sys/dev/asmc asmc.c

asmc: add per-fan manual mode control via sysctl

Add per-fan manual mode control via dev.asmc.0.fan.N.manual sysctl.

Apple SMCs support manual fan control via the FS! SMC key,
a 16-bit bitmask where each bit controls one fan (0=auto, 1=manual).

This change adds a new sysctl per fan:
    dev.asmc.0.fan.N.manual (0=auto, 1=manual)

When set to manual mode (1), the fan runs at the speed set via
dev.asmc.0.fan.N.targetspeed instead of automatic thermal control.  When
set to auto mode (0), the SMC controls fan speed automatically.

The FS! key was already defined in asmcvar.h but not accessible.
This exposes it for debugging, testing, and advanced fan control.

Implementation uses read-modify-write to allow independent control of
each fan without affecting others.

    [6 lines not shown]
DeltaFile
+55-0sys/dev/asmc/asmc.c
+55-01 files

HardenedBSD/src 6cbd76esys/dev/jme if_jme.c

jme: Convert driver to CTLFLAG_MPSAFE

Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE for all interrupt
coalescing sysctls. The driver uses jme_mtx mutex for proper
synchronization and does not require Giant lock.

Sysctls converted:
- dev.jme.X.tx_coal_to (TX coalescing timeout)
- dev.jme.X.tx_coal_pkt (TX coalescing packet count)
- dev.jme.X.rx_coal_to (RX coalescing timeout)
- dev.jme.X.rx_coal_pkt (RX coalescing packet count)
- dev.jme.X.process_limit (max RX events to process)

Reviewed by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54618

(cherry picked from commit c2a55efd74cccb3d4e7b9037b240ad062c203bb8)
DeltaFile
+5-5sys/dev/jme/if_jme.c
+5-51 files

HardenedBSD/src fd6bccclib/libc/gen exterr_cat_filenames.h

exterr: Regenerate exterr_cat_filenames.h
DeltaFile
+1-1lib/libc/gen/exterr_cat_filenames.h
+1-11 files

HardenedBSD/src 72dc1a1sys/compat/linuxkpi/common/src linux_current.c

linuxkpi: Fix an error path in linux_alloc_current()

If the allocation fails we should free the task struct.

While here get rid of a couple of unnecessary assertions.

Reported by:    Kevin Day <kevin at your.org>
Reviewed by:    emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54671

(cherry picked from commit a4955b0143361900140df640d116891f047f5431)
DeltaFile
+2-8sys/compat/linuxkpi/common/src/linux_current.c
+2-81 files

HardenedBSD/src 4d9eaa0sys/arm64/iommu smmu.c

arm64/iommu: Fix a resource leak in smmu_domain_alloc()

We should free the allocated ASID if smmu_init_cd() fails.

Move the allocation of "domain" to simplify the first error path.

Reported by:    Kevin Day <kevin at your.org>
Reviewed by:    br
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54676

(cherry picked from commit 6740cccb1eff2a0e1e6d451fa9676a21736937d2)
DeltaFile
+2-3sys/arm64/iommu/smmu.c
+2-31 files

HardenedBSD/src da714e3sys/dev/isl isl.c

isl: Convert driver to CTLFLAG_MPSAFE

Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE for all light sensor
sysctls.  All of the sysctl handlers are serialized by a driver mutex.

Sysctls converted:
- dev.isl.X.als (ambient light sensor)
- dev.isl.X.ir (infrared sensor)
- dev.isl.X.prox (proximity sensor)
- dev.isl.X.resolution (sensor resolution)
- dev.isl.X.range (sensor range)

Reviewed by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54621

(cherry picked from commit 0672e0e38a08c580f723a02bb183344d8c7cee65)
DeltaFile
+5-5sys/dev/isl/isl.c
+5-51 files

HardenedBSD/src a3b3be5sys/compat/linuxkpi/common/src linux_firmware.c

linuxkpi: Avoid a potential null pointer dereference in an error path

Reported by:    Kevin Day <kevin at your.org>
Reviewed by:    bz, emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54672

(cherry picked from commit aa1eb623389008c95b897976f4d28a7fe0acd93c)
DeltaFile
+2-1sys/compat/linuxkpi/common/src/linux_firmware.c
+2-11 files

HardenedBSD/src 0e2e588sys/arm64/vmm/io vgic_v3.c

arm64/vgic_v3: Fix an inverted test when reading GICD_I<C|S>ENABLER

On read, these registers' fields return 1 if forwarding of the
corresponding interrupt is enabled, and 0 otherwise.  The test in
read_enabler() was inverted.

Reported by:    Kevin Day <kevin at your.org>
Reviewed by:    andrew
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54678

(cherry picked from commit 6fef0c9ee64cea1f22b6a33a0c4dd39f605b7465)
DeltaFile
+1-1sys/arm64/vmm/io/vgic_v3.c
+1-11 files

HardenedBSD/src 714d5b3sys/dev/iicbus/adc ads111x.c

ads111x: Convert driver to CTLFLAG_MPSAFE

Replace CTLFLAG_NEEDGIANT with CTLFLAG_MPSAFE for all ADC sensor
sysctls.  All of the sysctl handlers are serialized by a driver mutex.

Sysctls converted:
- dev.ads111x.X.channelN.gain_index (PGA setting)
- dev.ads111x.X.channelN.rate_index (sample rate)
- dev.ads111x.X.channelN.voltage (sampled voltage)
- dev.ads111x.X.config (configuration register)
- dev.ads111x.X.lo_thresh (comparator low threshold)
- dev.ads111x.X.hi_thresh (comparator high threshold)

Reviewed by:    markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54620

(cherry picked from commit 2c029cff5ba3716757646a2d2c89db49987c1e98)
DeltaFile
+6-6sys/dev/iicbus/adc/ads111x.c
+6-61 files

HardenedBSD/src 4efe75alib/libsys kqueue.2

kqueue.2: Fix reference to unexisting kevent1()

kqueue1() was meant.

While here, make the wording in the AUTHORS section more clear.

PR:             291908
Fixes:          9b1585384d53 ("kqueue.2: Editorial pass")
Reviewed by:    kib, dab
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54858
DeltaFile
+4-4lib/libsys/kqueue.2
+4-41 files

HardenedBSD/src d6bc31fusr.sbin/makefs/tests makefs_zfs_tests.sh

makefs/zfs/tests: Force-destroy md devices

Most of these tests create a md(4) device backed by a makefs-generated
image, then import the pool, using the md device as a pool vdev.  When
a test finishes, it destroys the pool, then destroys the md device.

Once in a while md device destruction fails with EBUSY.  This happens
when a GEOM consumer is holding the device open; kern_mddetach_locked()
simply fails if any consumers are present.  zpool destruction is
synchronous so ZFS is innocent, rather, the problem seems to be that
GEOM re-tastes the device after the zpool reference goes away.  This
operation creates a transient reference that causes the spurious
failure.

Use "mdconfig -o force" to work around this.

MFC after:      2 weeks
DeltaFile
+2-2usr.sbin/makefs/tests/makefs_zfs_tests.sh
+2-21 files

HardenedBSD/src 37183a4sys/compat/linuxkpi/common/include/linux seq_buf.h bitops.h, sys/compat/linuxkpi/common/src linux_seq_buf.c linux_pci.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+73-0sys/compat/linuxkpi/common/include/linux/seq_buf.h
+64-0sys/compat/linuxkpi/common/src/linux_seq_buf.c
+36-0sys/compat/linuxkpi/common/src/linux_pci.c
+6-6sys/compat/linuxkpi/common/include/linux/bitops.h
+4-5tools/tools/nanobsd/defaults.sh
+9-0sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+192-118 files not shown
+207-1214 files

HardenedBSD/src 48052cesys/dev/clk/rockchip rk_clk_fract.c, sys/netpfil/ipfw ip_fw_table_value.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+1-1sys/dev/clk/rockchip/rk_clk_fract.c
+1-1sys/netpfil/ipfw/ip_fw_table_value.c
+2-22 files

HardenedBSD/src 60e75e9sys/netpfil/ipfw ip_fw_table_value.c

netpfil/ipfw: Fix a typo in a source code comment

- s/vaues/values/

(cherry picked from commit 9be9ab2a242080dea6254e187cf211604170de07)
DeltaFile
+1-1sys/netpfil/ipfw/ip_fw_table_value.c
+1-11 files

HardenedBSD/src ad9c5a6sys/dev/clk/rockchip rk_clk_fract.c

rockship: Fix a typo in a source code comment

- s/vaues/values/

(cherry picked from commit cabb5add07a60c146698d09759445276aa96757a)
DeltaFile
+1-1sys/dev/clk/rockchip/rk_clk_fract.c
+1-11 files

HardenedBSD/src 58580dclib/libc/gen posix_spawnattr_getexecfd_np.3 Makefile.inc

libc: document posix_spawnattr_getexecfd_np(3)

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54862
DeltaFile
+86-0lib/libc/gen/posix_spawnattr_getexecfd_np.3
+2-0lib/libc/gen/Makefile.inc
+2-0lib/libc/gen/posix_spawn.3
+90-03 files

HardenedBSD/src 3f0aea0include spawn.h, lib/libc/gen posix_spawn.c Symbol.map

libc: add posix_spawnattr_{get,set}execfd_np(3)

If execfd is set, the fexecve(2) is used by posix_spawn() instead of the
provided path.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D54862
DeltaFile
+21-1lib/libc/gen/posix_spawn.c
+7-0include/spawn.h
+5-0lib/libc/gen/Symbol.map
+33-13 files

HardenedBSD/src 45658a7release/tools vmimage.subr

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-4release/tools/vmimage.subr
+0-41 files

HardenedBSD/src fbcb045sys/compat/linuxkpi/common/include/linux seq_buf.h bitops.h, sys/compat/linuxkpi/common/src linux_seq_buf.c linux_pci.c

Merge remote-tracking branch 'internal/freebsd/current/main' into hardened/current/master

Conflicts:
        release/tools/vmimage.subr (unresolved)
DeltaFile
+73-0sys/compat/linuxkpi/common/include/linux/seq_buf.h
+64-0sys/compat/linuxkpi/common/src/linux_seq_buf.c
+36-0sys/compat/linuxkpi/common/src/linux_pci.c
+6-6sys/compat/linuxkpi/common/include/linux/bitops.h
+4-5tools/tools/nanobsd/defaults.sh
+9-0sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+192-118 files not shown
+211-1214 files

HardenedBSD/src a200c8esys/compat/linuxkpi/common/include/linux eventfd.h, sys/compat/linuxkpi/common/src linux_eventfd.c

linuxkpi: Add eventfd_*()

Add <linux/eventfd.h> and expose the `eventfd_*()` API. This is used by
DRM drivers for some time, but the code was commented out so far.

Note that Linux uses `struct eventfd_ctx`, but FreeBSD defines `struct
eventfd`. We define `eventfd_ctx` as a synonym to `eventfd`.

Reviewed by:    christos, markj
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50853
DeltaFile
+63-0sys/compat/linuxkpi/common/src/linux_eventfd.c
+54-0sys/compat/linuxkpi/common/include/linux/eventfd.h
+2-0sys/conf/files
+1-0sys/modules/linuxkpi/Makefile
+0-0sys/compat/linuxkpi/dummy/include/linux/eventfd.h
+120-05 files

HardenedBSD/src 28d6ffesys/kern sys_eventfd.c, sys/sys eventfd.h

eventfd: Add eventfd_signal()

The `eventfd_signal()` function is the equivalent to a write to an
eventfd file descriptor: it bumps the internal counter and wakes up
processes waiting for it.

`eventfd_signal()` is meant to be used by kernel drivers. DRM drivers
will call it through linuxkpi.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50850
DeltaFile
+22-3sys/kern/sys_eventfd.c
+1-0sys/sys/eventfd.h
+23-32 files

HardenedBSD/src d185e9fsys/sys param.h

Bump __FreeBSD_version to 1600011 after changes to eventfd

This covers the commits that updated the API and the commit that exposes
that API in linuxkpi for DRM drivers.

Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1sys/sys/param.h
+1-11 files