HardenedBSD/src adadc53sys/kern subr_fattime.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+21-20sys/kern/subr_fattime.c
+21-201 files

HardenedBSD/src 6291d6bsys/kern subr_fattime.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+21-20sys/kern/subr_fattime.c
+21-201 files

HardenedBSD/src 97dbc5fsys/dev/cxgbe/tom t4_tom.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+4-2sys/dev/cxgbe/tom/t4_tom.c
+4-21 files

HardenedBSD/src 3cc37e4sys/dev/cxgbe/tom t4_tom.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+4-2sys/dev/cxgbe/tom/t4_tom.c
+4-21 files

HardenedBSD/src c252950sys/fs/nfs nfsport.h, sys/fs/nfsclient nfs_clbio.c nfs_clvnops.c

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+47-190sys/fs/nfsclient/nfs_clbio.c
+2-22sys/fs/nfsclient/nfs_clvnops.c
+14-6sys/fs/nfsclient/nfs_clrpcops.c
+8-11sys/fs/nfsclient/nfs_clnfsiod.c
+0-3sys/fs/nfsclient/nfsnode.h
+0-2sys/fs/nfs/nfsport.h
+71-2342 files not shown
+71-2368 files

HardenedBSD/src 7932d85sys/fs/nfs nfsport.h, sys/fs/nfsclient nfs_clbio.c nfs_clvnops.c

Merge branch 'freebsd/13-stable/main' into hardened/13-stable/master
DeltaFile
+47-190sys/fs/nfsclient/nfs_clbio.c
+2-22sys/fs/nfsclient/nfs_clvnops.c
+14-6sys/fs/nfsclient/nfs_clrpcops.c
+8-11sys/fs/nfsclient/nfs_clnfsiod.c
+0-3sys/fs/nfsclient/nfsnode.h
+0-2sys/fs/nfs/nfsport.h
+71-2342 files not shown
+71-2368 files

HardenedBSD/src 0fe60dcsys/kern subr_fattime.c

fattime: fix fattime to timespec conversion of dates beyond 2106-02-06

It turns out that the only conversion issue was in fattime2timespec, where
multiplying the number of seconds in a day by the number of days overflowed
32-bit unsigned int for dates beyond 2106-02-07 06:28:15.

Casting one of the multiplicands as time_t forces a 64-bit multiplication on
systems where time_t is 64-bits and produces no binary changes on the one
remaining system with 32-bit time_t (namely i386).

Since the code is now tested & fixed, this change removes the fixme comments.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44755
DeltaFile
+3-14sys/kern/subr_fattime.c
+3-141 files

HardenedBSD/src 9d1396csys/kern subr_fattime.c

fattime: make the test code check beyond 32-bit time_t limits

On systems that have a 64-bit time_t, the test code now exercises the whole
range of fattime.  To do this, this commit...

1. replaces the call to random() with two calls to arc4random() to
   generate a 33-bit number of seconds in order to cover the entire range of
   fattime [1970,2107].  (32-bits stops just short - in January 2106.)
   On systems with 32-bit time_t, the extra bits are discarded and only the
   time_t expressible range is tested.
2. casts time_t values passed to printf as longs and changes the format
   string to match.

Now, the test code builds, runs, and exercises what it can (i.e., the whole
fattime range or the 32-bit time_t subset of it) on both 32-bit and 64-bit
time_t systems.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44754
DeltaFile
+11-4sys/kern/subr_fattime.c
+11-41 files

HardenedBSD/src 7b8b613sys/kern subr_fattime.c

fattime: make the test code build again

This change...

1. replaces calls to timet2fattime/fattime2timet with calls to
   timespec2fattime/fattime2timespec.  The functions got renamed shortly
   after they landed in the kernel but the test code wasn't updated (see
   7ea93e912bf0ef).
2. adds a utc_offset stub.

With this, the test code builds and runs as a 32-bit binary (cc -Wall -O2
-m32 subr_fattime.c).

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44753
DeltaFile
+7-2sys/kern/subr_fattime.c
+7-21 files

HardenedBSD/src 825cb4csys/fs/nfs nfsport.h, sys/fs/nfsclient nfs_clbio.c nfs_clvnops.c

nfscl: Clear out a lot of cruft related to B_DIRECT

There is only one place in the unpatched sources where B_DIRECT is
set in the NFS client and this code is never executed. As such, this patch
removes this code that is never executed, since B_DIRECT should never
be set.

During a IETF testing event this week, I saw a crash in ncl_doio_directwrite(),
but this function is only called if B_DIRECT is set.
I cannot explain how ncl_doio_directwrite() got called, but once this patch
was applied to the sources, the crash did not recur. This is not surprising,
since this patch deleted the function.

(cherry picked from commit 03a39a17089adc1d0e28076670e664dcdebccf73)
DeltaFile
+47-190sys/fs/nfsclient/nfs_clbio.c
+2-22sys/fs/nfsclient/nfs_clvnops.c
+8-11sys/fs/nfsclient/nfs_clnfsiod.c
+0-3sys/fs/nfsclient/nfsnode.h
+0-2sys/fs/nfs/nfsport.h
+0-1sys/fs/nfsclient/nfs.h
+57-2291 files not shown
+57-2307 files

HardenedBSD/src 19b6aa0sys/fs/nfsclient nfs_clrpcops.c

nfscl: Do not use nfso_own for delayed nfsrpc_doclose()

When an initial attempt to close an NFSv4 lock returns NFSERR_DELAY,
the open structure is put on a list for delayed closing.  When this
is done, the nfso_own field is set to NULL, so it cannot be used by
nfsrpc_doclose().

Without this patch, the NFSv4 client can crash when a NFSv4 server
replies NFSERR_DELAY to a Close operation.  Fortunately, most extant
NFSv4 servers do not do this.  This patch avoids the crash for any
that do return NFSERR_DELAY for Close.

Found during a IETF bakeathon testing event this week.

(cherry picked from commit 6251027c4252edb3b8f8fc359a40e610349e9af3)
DeltaFile
+14-6sys/fs/nfsclient/nfs_clrpcops.c
+14-61 files

HardenedBSD/src a3b8266sys/fs/nfs nfsport.h, sys/fs/nfsclient nfs_clbio.c nfs_clvnops.c

nfscl: Clear out a lot of cruft related to B_DIRECT

There is only one place in the unpatched sources where B_DIRECT is
set in the NFS client and this code is never executed. As such, this patch
removes this code that is never executed, since B_DIRECT should never
be set.

During a IETF testing event this week, I saw a crash in ncl_doio_directwrite(),
but this function is only called if B_DIRECT is set.
I cannot explain how ncl_doio_directwrite() got called, but once this patch
was applied to the sources, the crash did not recur. This is not surprising,
since this patch deleted the function.

(cherry picked from commit 03a39a17089adc1d0e28076670e664dcdebccf73)
DeltaFile
+47-190sys/fs/nfsclient/nfs_clbio.c
+2-22sys/fs/nfsclient/nfs_clvnops.c
+8-11sys/fs/nfsclient/nfs_clnfsiod.c
+0-3sys/fs/nfsclient/nfsnode.h
+0-2sys/fs/nfs/nfsport.h
+0-1sys/fs/nfsclient/nfs.h
+57-2291 files not shown
+57-2307 files

HardenedBSD/src c91861csys/fs/nfsclient nfs_clrpcops.c

nfscl: Do not use nfso_own for delayed nfsrpc_doclose()

When an initial attempt to close an NFSv4 lock returns NFSERR_DELAY,
the open structure is put on a list for delayed closing.  When this
is done, the nfso_own field is set to NULL, so it cannot be used by
nfsrpc_doclose().

Without this patch, the NFSv4 client can crash when a NFSv4 server
replies NFSERR_DELAY to a Close operation.  Fortunately, most extant
NFSv4 servers do not do this.  This patch avoids the crash for any
that do return NFSERR_DELAY for Close.

Found during a IETF bakeathon testing event this week.

(cherry picked from commit 6251027c4252edb3b8f8fc359a40e610349e9af3)
DeltaFile
+14-6sys/fs/nfsclient/nfs_clrpcops.c
+14-61 files

HardenedBSD/src c6c6d4asys/dev/cxgbe/tom t4_tom.c

cxgbe/tom: Fix the rx channel selection in options2.

This affects TOE operation when multiple rx c-channels are in use for
offload, which is an unusual configuration.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+4-2sys/dev/cxgbe/tom/t4_tom.c
+4-21 files

HardenedBSD/src 04c5fealib/libthr/thread thr_private.h

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-5lib/libthr/thread/thr_private.h
+0-51 files

HardenedBSD/src 6c0415econtrib/libarchive/libarchive archive_read_support_format_zip.c archive_write_set_format_zip.c, contrib/libarchive/libarchive/test test_compat_lzip_4.tlz.uu test_compat_lzip_3.lz.uu

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

Conflicts:
        lib/libthr/thread/thr_private.h (unresolved)
DeltaFile
+1,474-0contrib/libarchive/libarchive/test/test_compat_lzip_4.tlz.uu
+1,461-0contrib/libarchive/libarchive/test/test_compat_lzip_3.lz.uu
+337-175contrib/libarchive/libarchive/archive_read_support_format_zip.c
+276-0contrib/libarchive/libarchive/test/test_write_format_zip64_stream.c
+247-0contrib/libarchive/libarchive/test/test_write_format_zip_stream.c
+115-78contrib/libarchive/libarchive/archive_write_set_format_zip.c
+3,910-253744 files not shown
+6,581-1,886750 files

HardenedBSD/src bf58f90stand/userboot/test test.c, sys/dev/cxgbe t4_main.c t4_sge.c

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/cross-dso-cfi
DeltaFile
+168-42stand/userboot/test/test.c
+20-18sys/dev/cxgbe/common/t4_hw.c
+25-10sys/dev/cxgbe/t4_main.c
+10-9sys/dev/cxgbe/t4_sge.c
+13-1sys/kern/kern_cons.c
+10-0sys/sys/_maxphys.h
+246-8015 files not shown
+275-10421 files

HardenedBSD/src 06104f0stand/userboot/test test.c, sys/dev/cxgbe t4_main.c t4_sge.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+168-42stand/userboot/test/test.c
+20-18sys/dev/cxgbe/common/t4_hw.c
+25-10sys/dev/cxgbe/t4_main.c
+10-9sys/dev/cxgbe/t4_sge.c
+13-1sys/kern/kern_cons.c
+10-0sys/sys/_maxphys.h
+246-8015 files not shown
+275-10421 files

HardenedBSD/src 7f10048sys/dev/cxgbe t4_main.c, sys/dev/cxgbe/common t4_hw.c common.h

cxgbe(4): Query TPCHMAP once and not once per port.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+2-9sys/dev/cxgbe/common/t4_hw.c
+8-0sys/dev/cxgbe/t4_main.c
+3-1sys/dev/cxgbe/common/common.h
+13-103 files

HardenedBSD/src 480ff89sys/dev/cxgbe t4_main.c adapter.h, sys/dev/cxgbe/common t4_hw.c

cxgbe(4): Rename rx_c_chan to rx_chan.

It is the equivalent of tx_chan but for receive so rx_chan is a better
name.  Initialize both using helper functions and make sure both are
displayed in the sysctl MIB.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+10-2sys/dev/cxgbe/common/t4_hw.c
+4-2sys/dev/cxgbe/t4_main.c
+2-2sys/dev/cxgbe/adapter.h
+1-1sys/dev/cxgbe/crypto/t4_crypto.c
+17-74 files

HardenedBSD/src 4a5e2ddsys/arm/include armreg.h

arm: Remove duplicate definitions in armreg.h

No functional change intended.

MFC after:      1 week
DeltaFile
+0-2sys/arm/include/armreg.h
+0-21 files

HardenedBSD/src 2c18289. .clang-format

clang-format: Minor tweaks

Invert KeepEmptyLinesAtTheStartOfBlocks.  We used to require an empty
line at the beginning of functions with no local variables, which I
believe is the reason for this setting.  Now it is discouraged in new
code.

Tell clang-format to align consecutive macros, since we tend to do that.
clang-format's output isn't quite what we want here.  Typically we have
a tab after a #define for some reason, and clang-format doesn't appear
to have an option for that.  clang-format will also use a mix of tabs
and spaces to minimize indentation, which is also against our
convention.  However, the result looks better with this setting than
without.

Reviewed by:    emaste
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D29870
DeltaFile
+3-1.clang-format
+3-11 files

HardenedBSD/src 46b606cstand/userboot/test test.c

userboot: support environment and symlinks in test application

Pass the environment on to the loader.
Also define USERBOOT=1 in the environment varables.

Add support for symlinks in the test application open callback.

stat the root directory when opening file
Without this, running "ls" command on the root directory encounters
issues getting the directory listing.

Reviewed by:    jhb
Obtained from:  Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D44625
DeltaFile
+168-42stand/userboot/test/test.c
+168-421 files

HardenedBSD/src 2cb4909sys/kern kern_cons.c subr_boot.c, sys/sys cons.h reboot.h

cons: Add boot option to mute boot messages after banner

This is useful for embedded systems, where it provides feedback that the
kernel has booted, but avoids printing the probe messages.  If both
mutemsgs and verbose are set, verbose cancels the mute.

Additionally, this unmutes the console on panic, so a user can see what
happened leading up to the panic.

Obtained from:  Juniper Networks, Inc.
DeltaFile
+13-1sys/kern/kern_cons.c
+4-2sys/kern/subr_boot.c
+3-0sys/kern/kern_shutdown.c
+2-0sys/sys/cons.h
+1-0sys/sys/reboot.h
+23-35 files

HardenedBSD/src 21aba39sys/dev/cxgbe t4_main.c

cxgbe(4): Minor tweaks to comments.

No functional change intended.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+7-5sys/dev/cxgbe/t4_main.c
+7-51 files

HardenedBSD/src 9de0036sys/dev/cxgbe t4_main.c, sys/dev/cxgbe/common t4_hw.c

cxgbe(4): Initialize mps_bg_map to an invalid value if it's not known.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+1-1sys/dev/cxgbe/common/t4_hw.c
+1-1sys/dev/cxgbe/t4_main.c
+2-22 files

HardenedBSD/src 4d1362csys/dev/cxgbe/common t4_hw.c

cxgbe(4): Do not read hardware registers to determine the number of ports.

PORTVEC obtained from the firmware is the authoritative source of this
information, and nports (calculated from PORTVEC) is available by the
time t4_port_init runs.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+7-6sys/dev/cxgbe/common/t4_hw.c
+7-61 files

HardenedBSD/src 13a5a46sys/compat/linux linux_socket.c, sys/dev/md md.c

Fix new users of MAXPHYS and hide it from the kernel namespace

In cd8537910406, kib made maxphys a load-time tunable.  This made
the #define MAXPHYS in sys/param.h  almost entirely obsolete, as
it could now be overridden by kern.maxphys at boot time, or by
opt_maxphys.h.

However, decades of tradition have led to several new, incorrect, uses
of MAXPHYS in other parts of the kernel, mostly by seasoned
developers.  I've corrected those uses here in a mechanical fashion,
and verified that it fixes a bug in the md driver that I was
experiencing.

Since using MAXPHYS is such an easy mistake to make, it is best to
hide it from the kernel namespace.  So I've moved its definition to
_maxphys.h, which is now included in param.h only for userspace.

That brings up the fact that lots of userspace programs use MAXPHYS
for different reasons, most of them probably wrong.  Userspace consumers

    [8 lines not shown]
DeltaFile
+10-0sys/sys/_maxphys.h
+1-7sys/sys/param.h
+3-3sys/dev/md/md.c
+2-2sys/dev/rtsx/rtsx.c
+1-1sys/compat/linux/linux_socket.c
+1-0sys/kern/subr_param.c
+18-136 files

HardenedBSD/src 857d74bsys/dev/cxgbe t4_sge.c t4_main.c

cxgbe(4): Allocate a taskqueue per port instead of per channel.

All the channels are not used on all boards and there's no point
allocating taskqueues that will never be used.

MFC after:      1 week
Sponsored by:   Chelsio Communications
DeltaFile
+10-9sys/dev/cxgbe/t4_sge.c
+5-2sys/dev/cxgbe/t4_main.c
+2-1sys/dev/cxgbe/adapter.h
+17-123 files

HardenedBSD/src 397d8f3lib/libsys Symbol.map

libsys: don't try to expose freebsd7___semctl

This has always been in libc and never exported directly.  I accidently
included it along side some freebsd11_* symbols based on a tree where I
moved semctl(2).

Fixes:          df1a09ba524d0 libsys: expose a few more symbols for libc's use
DeltaFile
+0-1lib/libsys/Symbol.map
+0-11 files