HardenedBSD/src b53c5cblib/libc/gen uexterr_format.c, share/man/man4 rge.4

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+189-102usr.sbin/lpr/lpd/recvjob.c
+25-9sys/dev/ath/if_ath_keycache.c
+20-12usr.sbin/lpr/lpd/lpd.c
+20-8lib/libc/gen/uexterr_format.c
+18-8sys/dev/mwl/if_mwl.c
+8-8share/man/man4/rge.4
+280-1475 files not shown
+306-15611 files

HardenedBSD/src 0ddb183lib/libc/gen uexterr_format.c, share/man/man4 rge.4

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+189-102usr.sbin/lpr/lpd/recvjob.c
+25-9sys/dev/ath/if_ath_keycache.c
+20-12usr.sbin/lpr/lpd/lpd.c
+20-8lib/libc/gen/uexterr_format.c
+18-8sys/dev/mwl/if_mwl.c
+8-8share/man/man4/rge.4
+280-1475 files not shown
+306-15611 files

HardenedBSD/src b126abclib/libfetch common.c, sys/kern subr_module.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+46-56lib/libfetch/common.c
+14-11usr.sbin/bsdinstall/scripts/bootconfig
+18-0tools/build/mk/OptionalObsoleteFiles.inc
+7-6usr.bin/diff/diffreg_new.c
+4-4usr.bin/m4/eval.c
+0-8sys/kern/subr_module.c
+89-8518 files not shown
+133-9524 files

HardenedBSD/src 6fd9887lib/libc/gen uexterr_format.c err.3

Refinements to the output when the EXTERROR_VERBOSE environment is set

When kernel external errors are available they are included in the
err(3) library function messages. In addition to the extended error
itself, the kernel also tracks the kernel file and line number at
which the error was generated. This additional information is not
included in the err(3) messages unless the EXTERROR_VERBOSE environment
variable is present. Currently, when EXTERROR_VERBOSE is present,
all the internal extended error information associated with the
error is printed most of which is redundant with the formatted error
message printed by err(3). This change will add only the kernel
file and line number to the err(3) message when EXTERROR_VERBOSE
is present and set to "brief".

Sample output with bad protection bits to mmap:

guest_16 % ./Example bigfile
Example: mmap bigfile: Invalid argument (unknown PROT bits 0x8)


    [12 lines not shown]
DeltaFile
+20-8lib/libc/gen/uexterr_format.c
+7-1lib/libc/gen/err.3
+27-92 files

HardenedBSD/src 56fbfd1usr.sbin/lpr/lpd lpd.c lpd.8

lpd: Add timeout option

Set a 120-second receive timeout on all client connections, and add a
command-line option to change that value.

MFC after:      1 week
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55400
DeltaFile
+20-12usr.sbin/lpr/lpd/lpd.c
+7-1usr.sbin/lpr/lpd/lpd.8
+27-132 files

HardenedBSD/src 9065be0usr.sbin/lpr/lpd recvjob.c

lpd: Improve robustness

* Check for integer overflow when receiving file sizes.

* Check for buffer overflow when receiving file names, and fully
  validate the names.

* Check for integer overflow when checking for available disk space.

* Check for I/O errors when sending status codes.

* Enforce one job per connection and one control file per job (see
  code comments for additional details).

* Simplify readfile(), avoiding constructs vulnerable to integer
  overflow.

* Don't delete files we didn't create.


    [9 lines not shown]
DeltaFile
+189-102usr.sbin/lpr/lpd/recvjob.c
+189-1021 files

HardenedBSD/src 9b75d6eusr.sbin/lpr/chkprintcap chkprintcap.8, usr.sbin/lpr/lp lp.1

lpr: Add deprecation notice

These programs require elevated privileges to work and have not seen
regular maintenance in decades.  Unless someone steps up and overhauls
them, we will have to remove them before 16.0.  Better-maintained
alternatives are available in ports (print/cups, sysutils/LPRng).

MFC after:      3 days

(cherry picked from commit d57dee7ab66f60537b557cb602be194e3eed253d)
DeltaFile
+3-0usr.sbin/lpr/lpr/lpr.1
+3-0usr.sbin/lpr/chkprintcap/chkprintcap.8
+3-0usr.sbin/lpr/lp/lp.1
+3-0usr.sbin/lpr/lpc/lpc.8
+3-0usr.sbin/lpr/lpd/lpd.8
+3-0usr.sbin/lpr/lpq/lpq.1
+18-04 files not shown
+30-010 files

HardenedBSD/src 122de34etc/mtree BSD.usr.dist BSD.debug.dist, share/examples Makefile

build: Move all of lp under LPR option

* Tag related directories with package=lp

* Make the examples/printing directory conditional on MK_LPR

* Make the hosts.lpd(5) manual page conditional on MK_LPR

MFC after:      3 days

(cherry picked from commit d4f6cb75424950ee776833ebc6b57855c094a610)
DeltaFile
+18-0tools/build/mk/OptionalObsoleteFiles.inc
+3-3etc/mtree/BSD.usr.dist
+2-2etc/mtree/BSD.debug.dist
+3-1share/examples/Makefile
+1-1share/man/man5/Makefile
+27-75 files

HardenedBSD/src d58ab2ausr.bin/diff diffreg_new.c

diff: Drop unnecessary casts, fix none algo

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D55349

(cherry picked from commit d5404462f691230423dc8cc543c6fdc44f34ec31)
DeltaFile
+7-6usr.bin/diff/diffreg_new.c
+7-61 files

HardenedBSD/src 8124bd4usr.bin/m4 eval.c misc.c, usr.bin/m4/tests eval.m4 regress.eval.out

m4: Fix eval output width

According to POSIX, the optional third argument is the minimum number
of digits to print regardless of sign.  We interpreted it as the minimum
width of the output including the sign.  Additionally, the variable used
to hold this value was confusingly named “maxdigits”.

PR:             293214
MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55311

(cherry picked from commit 507c611aeac7ca9aed12353b1044bb21ab00afae)
DeltaFile
+4-4usr.bin/m4/eval.c
+0-2usr.bin/m4/misc.c
+2-0usr.bin/m4/tests/eval.m4
+2-0usr.bin/m4/tests/regress.eval.out
+8-64 files

HardenedBSD/src 3b879f7lib/libfetch common.c

libfetch: Fail hard if interrupted while connecting

This fixes an issue where the first address that DNS returns is blocked
by a packet filter, so we hang for a while, then the user hits Ctrl-C,
interrupting connect(2), whereupon we move on to the next address, get
a connection, request the file, and return to fetch(1), which sees that
SIGINT was caught and bails.

Note that we make no attempt to enforce fetchTimeout in the connection
phase, and never have.  It's feasible, but non-trivial, so we'll leave
it as an exercise for future us.

PR:             293312
MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55406

(cherry picked from commit afbdcd402bb439bd3d487baaad63b68e95929265)
DeltaFile
+7-1lib/libfetch/common.c
+7-11 files

HardenedBSD/src 4587768lib/libfetch common.c

libfetch: Clean up fetch_info usage

* Provide a wrapper for the common if (verbose) fetch_info(...) idiom.

* Replace remaining instances of fprintf(stderr, ...) with fetch_info().

* Fix a few style nits.

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55405

(cherry picked from commit 1b7c4d29fdfc975facdc43f6da50947cf3bb8e4a)
DeltaFile
+34-54lib/libfetch/common.c
+34-541 files

HardenedBSD/src d699baclib/libfetch common.c

libfetch: Gracefully skip unsupported protocols

If socket() fails because the address family or protocol is unsupported,
just continue with the next address.

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55407

(cherry picked from commit b5d570e711da1dad303312bebaf1bd2fb720f0dc)
DeltaFile
+5-1lib/libfetch/common.c
+5-11 files

HardenedBSD/src 8ebc054sys/dev/mwl if_mwl.c

mwl: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Notably this driver was very clear about its expectation the net80211
key layout w/ key, TX MIC and RX MIC matches the firmware layout
and just memcpy()'ed it.  That has been refactored.

Differential Revision:  https://reviews.freebsd.org/D54484
DeltaFile
+18-8sys/dev/mwl/if_mwl.c
+18-81 files

HardenedBSD/src 70786desys/dev/wpi if_wpi.c

wpi: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Differential Revision:  https://reviews.freebsd.org/D54482
DeltaFile
+6-3sys/dev/wpi/if_wpi.c
+6-31 files

HardenedBSD/src 76a2032sys/dev/iwi if_iwi.c

iwi: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Differential Revision:  https://reviews.freebsd.org/D54481
DeltaFile
+3-2sys/dev/iwi/if_iwi.c
+3-21 files

HardenedBSD/src fec9453sys/dev/ipw if_ipw.c

ipw: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Differential Revision:  https://reviews.freebsd.org/D54480
DeltaFile
+3-2sys/dev/ipw/if_ipw.c
+3-21 files

HardenedBSD/src a54a36csys/dev/ath if_ath_keycache.c

ath: migrate to new net80211 encryption key API

Migrate to the new encryption key API rather than poking at the
key struct directly.

Differential Revision:  https://reviews.freebsd.org/D54479
DeltaFile
+25-9sys/dev/ath/if_ath_keycache.c
+25-91 files

HardenedBSD/src 25e8905share/man/man4 rge.4

rge.4: correct media types in the manual page

Correct media types for 1000Mbit/s, 2500Mbit/s, 5000Mbit/s and 10Gbit/s.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D55496
DeltaFile
+8-8share/man/man4/rge.4
+8-81 files

HardenedBSD/src 5425bdausr.sbin/bsdinstall/scripts bootconfig

bsdinstall: fix EFI boot entry creation

update_uefi_bootentry assumes that the caller sets FREEBSD_BOOTNAME and
mntpt, which isn't the case anymore. The result is that there is no
"FreeBSD" boot entry created/updated after install. Most machines manage
to boot from the removable media path (if the loader is installed there
too), but some don't.

Take the loader's path as an argument and rename the variable used in
the ZFS mirror loop so mntpt can be reused below.

Also mark nentries as a local variable so it doesn't leak out of the
function.

PR:             293385
Fixes:          494de51bc0074472d1b01604f085daea0844f240
MFC after:      2 days
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D55469

    [2 lines not shown]
DeltaFile
+14-11usr.sbin/bsdinstall/scripts/bootconfig
+14-111 files

HardenedBSD/src a369760usr.sbin/efibootmgr efibootmgr.8

efibootmgr.8: capitalize examples section header

MFC after:      3 days

(cherry picked from commit fac9ae3db4e6a28dfd467369e262f636e10a3b01)
DeltaFile
+1-1usr.sbin/efibootmgr/efibootmgr.8
+1-11 files

HardenedBSD/src 923b3fcsys/kern subr_module.c

sys/subr_module: remove useless macro gates

These constants are always defined by sys/sys/linker.h.

Reviewed by: vexeduxr
Signed-off-by: Quentin Thébault <quentin.thebault at defenso.fr>
Sponsored by: Defenso
MFC after: 2 weeks
Closes: https://github.com/freebsd/freebsd-src/pull/2004

(cherry picked from commit 912418193ed1f9a0f58b083037751b1fbc4c30ef)
DeltaFile
+0-8sys/kern/subr_module.c
+0-81 files

HardenedBSD/src 92e8425lib/libc/stdlib system.c system.3, lib/libc/tests/stdlib system_test.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+174-0lib/libc/tests/stdlib/system_test.c
+76-46lib/libc/stdlib/system.c
+35-0lib/libnetbsd/sys/time.h
+14-0lib/libnetbsd/math.h
+5-3lib/libc/stdlib/system.3
+4-2usr.bin/procstat/procstat_kqueue.c
+308-512 files not shown
+311-538 files

HardenedBSD/src 627d8aalib/libc/stdlib system.c system.3, lib/libc/tests/stdlib system_test.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+174-0lib/libc/tests/stdlib/system_test.c
+76-46lib/libc/stdlib/system.c
+35-0lib/libnetbsd/sys/time.h
+14-0lib/libnetbsd/math.h
+5-3lib/libc/stdlib/system.3
+4-2usr.bin/procstat/procstat_kqueue.c
+308-512 files not shown
+311-538 files

HardenedBSD/src 2a6c2d9lib/libnetbsd math.h, lib/libnetbsd/sys time.h

libnetbsd: add math.h and sys/time.h

- `math.h`: `isinff(..)`
- `sys/time.h`: `timespec*(x)`

These two headers are used by tests in newer snapshots of
`contrib/netbsd-tests`.

MFC after:      1 week
DeltaFile
+35-0lib/libnetbsd/sys/time.h
+14-0lib/libnetbsd/math.h
+49-02 files

HardenedBSD/src 8ae3f44lib/libc/stdlib system.c, lib/libc/tests/stdlib system_test.c

system(3): Fix null case

Our manual page states that if given a null pointer, system() returns
non-zero if the shell is available and zero if it is not.  This is
consistent with the C standard's description of system(), but it is not
what we actually do.  What we actually do is always return non-zero, as
required by POSIX.

As the POSIX rationale explains, implementing the logic required by the
C standard does not violate POSIX, since a conforming system always has
a shell, therefore the logic will always return non-zero.

Since our libc is commonly used in non-conforming situations such as
chroots or thin jails, we should implement the full logic required by
the C standard.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    obiwac, bnovkov, kevans
Differential Revision:  https://reviews.freebsd.org/D55484
DeltaFile
+10-0lib/libc/tests/stdlib/system_test.c
+1-1lib/libc/stdlib/system.c
+11-12 files

HardenedBSD/src 7305604lib/libc/stdlib system.3

system(3): Clarify return values

Our manual page currently states that system() will return 127 if it
fails to execute the shell.  The actual return value is, to quote POSIX,
“as if the command language interpreter had terminated using exit(127)
or _exit(127)”.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    bnovkov, kevans
Differential Revision:  https://reviews.freebsd.org/D55483
DeltaFile
+5-3lib/libc/stdlib/system.3
+5-31 files

HardenedBSD/src 7a1ade5lib/libc/tests/stdlib system_test.c Makefile

system(3): Write our own tests

Replace the somewhat perfunctory NetBSD tests with our own.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    bnovkov, kevans
Differential Revision:  https://reviews.freebsd.org/D55482
DeltaFile
+164-0lib/libc/tests/stdlib/system_test.c
+2-1lib/libc/tests/stdlib/Makefile
+166-12 files

HardenedBSD/src 6e589e6lib/libc/stdlib system.c

system(3): Improve signal handling

Ignore SIGINT and SIGQUIT and block SIGCHLD, as POSIX requires.

To deal with the concurrency problem described in POSIX, we keep track
of the count of concurrent invocations.  We ignore and block signals
only when the counter was zero before we incremented it, and restore
them only when the counter reaches zero after we decrement it.

Note that this does not address the issue of thread cancellation.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Reviewed by:    bnovkov, sef, kevans
Differential Revision:  https://reviews.freebsd.org/D55471
DeltaFile
+76-46lib/libc/stdlib/system.c
+76-461 files

HardenedBSD/src f2a6282sys/dev/mlx5/mlx5_accel mlx5_ipsec.c, sys/fs/nullfs null_vfsops.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+32-20sys/dev/mlx5/mlx5_accel/mlx5_ipsec.c
+28-6sys/netipsec/ipsec_offload.c
+4-10sys/fs/nullfs/null_vfsops.c
+5-2sys/netinet/tcp_input.c
+4-1sys/netinet/tcp_ecn.c
+4-1sys/netinet/tcp_stacks/rack.c
+77-406 files not shown
+91-4512 files