HardenedBSD/src 99e59cdlib/libpfctl libpfctl.c, lib/libusb libusb10.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+67-0lib/libpfctl/libpfctl.c
+41-0sys/netpfil/pf/pf_nl.c
+38-0tests/sys/netpfil/pf/table.sh
+7-14sbin/pfctl/pfctl_radix.c
+18-0lib/libusb/libusb10.c
+5-7sys/compat/freebsd32/freebsd32.h
+176-215 files not shown
+187-3111 files

HardenedBSD/src 533b755sys/net if_lagg.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+20-18sys/net/if_lagg.c
+20-181 files

HardenedBSD/src 281282elib/libpfctl libpfctl.c libpfctl.h, sbin/pfctl pfctl_radix.c

pf: convert DIOCRTSTADDRS to netlink

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+67-0lib/libpfctl/libpfctl.c
+41-0sys/netpfil/pf/pf_nl.c
+38-0tests/sys/netpfil/pf/table.sh
+7-14sbin/pfctl/pfctl_radix.c
+2-0lib/libpfctl/libpfctl.h
+1-0sys/netpfil/pf/pf_nl.h
+156-146 files

HardenedBSD/src 4ccca21sys/sys abi_types.h

sys/abi_types.h: time32_t is 64-bit on non-x86 architectures

As long as 'sys/compat/freebsd32/freebsd32.h' is used unconditionally on
all platforms (in 'kern_umtx.c' at least), the rule of thumb is to
ensure that 'struct foo32' on a 32-bit arch is type-compatible with
'struct foo' on the same arch.  In practice, this is very simple to
achieve: All 'foo32' types should be compatible with 'foo' on 32-bit
architectures, which is what we are supposed to do already for compat'
structures by design.  The recently introduced 'freebsd32_uint64_t' type
typically supports that.

This change fixes commit 87632ddf67b0 ("openzfs sys/types32.h: use
abi_compat.h for time32_t") which was defining 'time32_t' to 'in32_t'
for all 32-bit architectures, which is wrong but on i386.  By luck, this
did not change the size of whole 'struct ffclock_estimate32' (whose size
is compile-time asserted) because 'struct bintime32''s one would stay
the same, as even if its field 'sec' was incorrectly sized after that
commit, the 'frac' one is 64-bit and 64-bit aligned on all non-x86
architectures so its offset in 'struct bintime32' would stay the same.

    [5 lines not shown]
DeltaFile
+1-5sys/sys/abi_types.h
+1-51 files

HardenedBSD/src 7c2fc44sys/compat/freebsd32 freebsd32.h freebsd32_misc.c

sys/compat/freebsd32: FF clock struct: Don't pack, use 'ffcounter32'

Packing 'struct ffclock_estimate32', in absence of substitution of
'ffcounter' (some 'uint64_t') by a 32-bit compatible type, was necessary
on amd64 since 'uint64_t' is 8-byte aligned, which leaves a padding gap
of 4-byte between fields 'update_time' and 'update_ffcount'.  This gap
does not exist on i386 (or amd64 32-bit mode), as 'uint64_t' there is
only 4-byte aligned.

Change the type of the 'update_ffcount' and 'leapsec_next' fields to the
recently introduced 'freebsd32_uint64_t', and adapt copy-in and copy-out
accordingly.  Using `CP()` previously worked due to the '__packed__'
attribute.

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D55282
DeltaFile
+5-7sys/compat/freebsd32/freebsd32.h
+4-4sys/compat/freebsd32/freebsd32_misc.c
+9-112 files

HardenedBSD/src 6ceb731sys/net if_lagg.c

lagg: Make lagg_link_active() static

It is declared as static. Make the definition consistent with the
declaration.

It was ever fixed by commit 52e53e2de0ec, but the commit was reverted,
leaving it unfixed.

No functional change intended.

MFC after:      3 days

(cherry picked from commit 30988d0a7bd7ebd5f5825b9b7aa04ff0af788aa7)
DeltaFile
+1-1sys/net/if_lagg.c
+1-11 files

HardenedBSD/src fe1299fsys/net if_lagg.c

lagg: Avoid dropping locks when starting the interface

The init routine of a lagg(4) interface will not change during the whole
lifecycle. So we can call lagg_init() directly instead of through the
function pointer. Well, that requires a drop and pickup lock, which
unnecessarily expose a small race window. Refactor lagg_init() into
lagg_init_locked() and call the later one to avoid that.

Meanwhile, delay updating the driver managed status until after the
interface is really ready.

Reviewed by:    markj
MFC after:      5 days
Differential Revision:  https://reviews.freebsd.org/D55198

(cherry picked from commit c182cf646a4f995fa8506afd8afc9541c4d32905)
DeltaFile
+19-17sys/net/if_lagg.c
+19-171 files

HardenedBSD/src 38c1833lib/libusb libusb10.c

libusb: dequeue next transfer on completion to prevent stalls

The transfer proxy callbacks (bulk/interrupt, control, isochronous)
only called libusb10_submit_transfer_sub() in the START path to
pipeline the second kernel transfer slot. On completion or error,
no attempt was made to dequeue the next pending transfer from
tr_head onto the now-free slot.

When more than two async transfers were submitted on the same
endpoint, the third (and subsequent) transfers would remain stuck
on tr_head indefinitely, since no completion ever triggered their
submission. This caused a protocol-level deadlock in applications
like adb that submit header + payload + zero-length terminator as
three separate bulk transfers in sequence.

Fix by calling libusb10_submit_transfer_sub() after every
libusb10_complete_transfer() in all three proxy callbacks.

MFC After:      2 weeks

    [2 lines not shown]
DeltaFile
+18-0lib/libusb/libusb10.c
+18-01 files

HardenedBSD/src be52217lib/libusb libusb10_hotplug.c

libusb: make libusb_hotplug_get_user_data actually return user_data

MFC After:      2 days
Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D55291
DeltaFile
+3-1lib/libusb/libusb10_hotplug.c
+3-11 files

HardenedBSD/src d200489sys/dev/ichsmb ichsmb_pci.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+3-0sys/dev/ichsmb/ichsmb_pci.c
+3-01 files

HardenedBSD/src 4eaaf73sys/amd64/acpica acpi_wakeup.c, sys/compat/linux linux_file.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+35-22sys/amd64/acpica/acpi_wakeup.c
+7-5sys/kern/kern_event.c
+2-2sys/kern/vfs_mount.c
+1-1sys/compat/linux/linux_file.c
+1-1sys/sys/syscallsubr.h
+1-0sys/x86/include/frame.h
+47-316 files

HardenedBSD/src 203819esys/x86/include frame.h

x86: Note that trapframe is used by kernel debuggers

(cherry picked from commit 2088e742013bb1b9ca237a79767362efe92d9da8)
DeltaFile
+1-0sys/x86/include/frame.h
+1-01 files

HardenedBSD/src 71cc31csys/kern kern_event.c

kqtimer_proc_continue(): correct calculation of 'now'

PR:     293141

(cherry picked from commit e7f86f8b1383d278fff1d973230972325072ead6)
DeltaFile
+1-4sys/kern/kern_event.c
+1-41 files

HardenedBSD/src 22bf122sys/kern kern_event.c

filt_timerexpire_l(): re-insert restarted timer into head instead of tail

PR:     293141

(cherry picked from commit 75a30ea09f4e75480743fae5c2369d50a6d8526c)
DeltaFile
+6-1sys/kern/kern_event.c
+6-11 files

HardenedBSD/src daa5f78sys/compat/linux linux_file.c, sys/kern vfs_mount.c

kern/vfs_unmount.c: promote flags to uint64_t

(cherry picked from commit 8066b8923ebfd438dc8cb840d2f57066f4daa45d)
DeltaFile
+2-2sys/kern/vfs_mount.c
+1-1sys/compat/linux/linux_file.c
+1-1sys/sys/syscallsubr.h
+4-43 files

HardenedBSD/src a6c0d8bsys/amd64/acpica acpi_wakeup.c

amd64/acpica/acpi_wakeup.c: do not store to WARMBOOT_OFF in efi_boot case

(cherry picked from commit 5f3192b3fddd974db36af0279403aba1371c68ec)
DeltaFile
+35-22sys/amd64/acpica/acpi_wakeup.c
+35-221 files

HardenedBSD/src e4bcfe4sys/dev/ichsmb ichsmb_pci.c

ichsmb: Add Intel Raptor Lake SMBus controller support

Add PCI device ID 0x7a23 for Intel 700 Series (Raptor Lake) chipset SMBus controller.
This enables hardware monitoring functionality on 13th and 14th generation Intel Core platforms.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D54957
DeltaFile
+3-0sys/dev/ichsmb/ichsmb_pci.c
+3-01 files

HardenedBSD/src a4a785bcontrib/netbsd-tests/lib/libc/sys t_access.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+0-8contrib/netbsd-tests/lib/libc/sys/t_access.c
+0-81 files

HardenedBSD/src 2527e6cusr.bin/runat runat.c, usr.sbin/newsyslog newsyslog.conf.5

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+28-7usr.bin/runat/runat.c
+4-1usr.sbin/newsyslog/newsyslog.conf.5
+32-82 files

HardenedBSD/src b45447cusr.bin/runat runat.c

runat: Add -h to manipulate a symlink's named attribute dir

Lionel Cons <lionelcons1972 at gmail.com> requested
that a new option be added to runat(1) so that it could
be used to manipulate named attributes associated with
a symbolic link and not the file the symbolic link refers to).

This patch adds the option -h/--nofollow to do this.

(cherry picked from commit 4bfb7cfb70e62bc316de9e73cfd63a5c85541154)
DeltaFile
+28-7usr.bin/runat/runat.c
+28-71 files

HardenedBSD/src 817f0b8usr.sbin/newsyslog newsyslog.conf.5

newsyslog.conf.5: Add a CAVEAT

PR:                     282639
MFC after:              3 days
Reviewed by:            michaelo
Differential Revision:  https://reviews.freebsd.org/D55122

(cherry picked from commit 64e612b46290617ec753b4ee6ec633a3724940e3)
DeltaFile
+4-1usr.sbin/newsyslog/newsyslog.conf.5
+4-11 files

HardenedBSD/src 35237ffcontrib/netbsd-tests/lib/libc/sys t_access.c

t_access.c: remove unnecessary local modification

FreeBSD 11.x is no longer supported; there's no reason why the
`FreeBSD_version__` check is still required (now).

MFC after:      1 week
DeltaFile
+0-8contrib/netbsd-tests/lib/libc/sys/t_access.c
+0-81 files

HardenedBSD/src 27cb6accontrib/netbsd-tests/sbin/newfs_msdos t_create.sh, lib/libnetbsd/sys cdefs.h

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+69-0lib/libusb/libusb20_dev_open.3
+56-0lib/libusb/libusb20_be_device_foreach.3
+14-1lib/libnetbsd/sys/cdefs.h
+2-12contrib/netbsd-tests/sbin/newfs_msdos/t_create.sh
+2-4lib/libusb/Makefile
+2-0sbin/newfs_msdos/tests/Makefile
+145-176 files

HardenedBSD/src faaeb6elib/libnetbsd/sys cdefs.h

libnetbsd: import the `__nothing` macro

This macro is widely used in new NetBSD tests. Please see the comment
next to the imported macro for more details on its use.

Obtained from:  NetBSD (c26cc77b3a0b2)
MFC after:      1 week
DeltaFile
+14-1lib/libnetbsd/sys/cdefs.h
+14-11 files

HardenedBSD/src 411a566contrib/netbsd-tests/sbin/newfs_msdos t_create.sh, sbin/newfs_msdos/tests Makefile

t_create.sh: use `ATF_TESTS_SH_SED` & remove local mods

This particular change replaces all local modifications to the test
script like so:
- Use `ATF_TESTS_SH_SED_test` with a sed(1) statement in the Makefile,
  instead of the equivalent local modifications.
- Remove the need for expecting the output of newfs_msdos to be empty.
  There isn't much to gain from deviating from the upstream NetBSD test--it's
  just another local modification that would need to be carried forward. If
  it's worth testing this FreeBSD-specific behavior, it should be in a
  FreeBSD-specific test.

This makes moving new modifications to the script easier moving forward.

MFC after:      1 week
DeltaFile
+2-12contrib/netbsd-tests/sbin/newfs_msdos/t_create.sh
+2-0sbin/newfs_msdos/tests/Makefile
+4-122 files

HardenedBSD/src caf23c8lib/libusb libusb20_dev_open.3 libusb20_be_device_foreach.3

libusb20: Add dev_open + be_device_foreach manuals

Manual pages for libusb20_open(3) and libusb20_be_device_foreach(3).

PR:                     291675
MFC after:              3 days
Reviewed by:            adrian (usb), ziaee (manpages)
Differential Revision:  https://reviews.freebsd.org/D54231
DeltaFile
+69-0lib/libusb/libusb20_dev_open.3
+56-0lib/libusb/libusb20_be_device_foreach.3
+2-4lib/libusb/Makefile
+127-43 files

HardenedBSD/src 869c055sys/kern kern_exec.c

HBSD: ASLR: Use VMFS_NO_SPACE to map the stack

We want the stack to land where we calculated it based on the
precalculated delta. While VMFS_ANY_SPACE still gets the job done, it is
the wrong flag in this case. By using VMFS_NO_SPACE, we make the process
of mapping the stack a quicker operation.

However, the risk of a failed mapping increases since vm_map_find(9)
will fail if the requested virtual address is already allocated. The
risk of this is small since we're dealing with a fresh address space.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
MFC-to:         15-STABLE
MFC-to:         14-STABLE
(cherry picked from commit 1e761a51dc553a84f88f13e1231a6688a3fcd50d)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
(cherry picked from commit 15de57e616f7af3ea5fc02e9834515851cee3014)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+1-1sys/kern/kern_exec.c
+1-11 files

HardenedBSD/src 46a3370sys/amd64/conf HARDENEDBSD-CORE

HBSD: Disable WITNESS' checking of vnode locks

FreeBSD relatively recently changed how vnode locking works in the
kernel. There are a few places that still need to be updated.
HardenedBSD's use of filesystem extended attributes seems to trip
WITNESS vnode lock checking when ZFS is used. This causes a kernel
panic, which is more likely to be triggered during a package build.

So, for now, let's disable the vnode lock checks. I plan to revisit this
when I have more available time.

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
(cherry picked from commit 103903e6b27e557c93aa52e8cfbdcb103fb78f47)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
(cherry picked from commit 1676d6ab9a023e8feac2e345349a1ddbd74d024d)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+2-0sys/amd64/conf/HARDENEDBSD-CORE
+2-01 files

HardenedBSD/src 08693b5sys/hardenedbsd hbsd_grsec_tpe.c

HBSD: TPE: Ensure user-owned vnodes are unwritable

Neither the executable nor the directory containing it should be
writable if it's not owned by root (0).

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
MFC-to:         15-STABLE
MFC-to:         14-STABLE
(cherry picked from commit ffe9d2caea1bbab424281f5d784a551152e97d56)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
(cherry picked from commit 1d02b772d171d403e9d264916034c8806aca1d8a)
Signed-off-by: Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+12-6sys/hardenedbsd/hbsd_grsec_tpe.c
+12-61 files

HardenedBSD/src 53fb08fbin/pwd pwd.c, bin/pwd/tests pwd_test.sh

Merge remote-tracking branch 'origin/hardened/15-stable/main' into hardened/15-stable/main
DeltaFile
+249-0usr.bin/m4/tests/m4_test.sh
+54-47bin/pwd/pwd.c
+94-0bin/pwd/tests/pwd_test.sh
+44-0usr.bin/m4/tests/regress.gnuprefix.err
+22-22usr.bin/xinstall/xinstall.c
+0-44usr.bin/m4/tests/regress.gnuprefix.out
+463-11323 files not shown
+610-18529 files