HardenedBSD/src c98064dsys/dev/pci pci_user.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+91-91sys/dev/pci/pci_user.c
+91-911 files

HardenedBSD/src 56ecc8asys/dev/pci pci_user.c

pci_user: Rename _old to _freebsd6

The pre-freebsd7 stuff is labeled _old right now. Relabel it as
_freebsd6 instead. No functional change intended. I selected freebsd6
because that's the last version to have the ioctls, although I know
there were changes in the interface for 4, 5 and 6. This broadly batches
what we do with system calls that accumulate changes until we break and
use a new one, we use the last major the system call was in.

Sponsored by:           Netflix
Differential Revision:  https://reviews.freebsd.org/D45867
DeltaFile
+91-91sys/dev/pci/pci_user.c
+91-911 files

HardenedBSD/src d24b8cbsys/net netisr.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+2-2sys/net/netisr.c
+2-21 files

HardenedBSD/src 1d897d1sys/net netisr.c

netisr: avoid ffs(0)

A rearrangement to avoid computing ffs(0) saves 128 bytes in resulting
amd64 object code.

Reviewed by:    brooks
Differential Revision:  https://reviews.freebsd.org/D41254
DeltaFile
+2-2sys/net/netisr.c
+2-21 files

HardenedBSD/src dfaea65lib/libc/net getnameinfo.c, share/man/man9 contigmalloc.9

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+30-72sys/kern/kern_malloc.c
+37-17lib/libc/net/getnameinfo.c
+6-25share/man/man9/contigmalloc.9
+17-12sys/amd64/amd64/pmap.c
+12-8sys/compat/linuxkpi/common/include/linux/fs.h
+8-8sys/dev/hptmv/entry.c
+110-14259 files not shown
+243-32065 files

HardenedBSD/src 1f7df75sys/compat/linuxkpi/common/include/linux slab.h, sys/compat/linuxkpi/common/src linux_slab.c

LinuxKPI: move __kmalloc from slab.h to slab.c

In order to allow the allocator to change in the future move it into
the implementation file from being an inline function in the header.

While here factor out the size calculation and add a comment as-to why
this is done.  We will need the size (_s) in the future to make a
decision on how to allocate.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D45815
DeltaFile
+11-0sys/compat/linuxkpi/common/src/linux_slab.c
+2-7sys/compat/linuxkpi/common/include/linux/slab.h
+13-72 files

HardenedBSD/src 5c3af1dsys/fs/nullfs null_vnops.c

nullfs: Use an a_gen field to cast to vop_generic_args

Instead of casting a vop_F_args object to vop_generic_args, use a
vop_F_args.a_gen field when calling null_bypass(). This way we don't
hardcode the vop_generic_args data type in the callers of null_bypass().

Before this change, there were 3 null_bypass() calls using
a vop_F_args.a_gen field and 5 null_bypass() calls using a cast to
vop_generic_args. This change makes all null_bypass() calls consistent
and easier to maintain.

Pointed out by: jrtc27
Reviewed by:    kib, oshogbo
Accepted by:    oshogbo (mentor)
Differential Revision: https://reviews.freebsd.org/D37359
DeltaFile
+5-5sys/fs/nullfs/null_vnops.c
+5-51 files

HardenedBSD/src 9776abasys/net80211 ieee80211_scan_sw.c ieee80211_scan.h

net80211: scan/internal: change boolean argument from int to bool

ieee80211_probe_curchan() passes a "force" argument which is bool.
Make it such.  Adjust the (*sc_scan_probe_curchan)() KPI to bool
as well. This is all a big NOP as the only implementor of this
function, ieee80211_swscan_probe_curchan(), does not use the argument
at all.

I came across this when pondering a different scan implementation.
Rather than dropping the change remove the argument from the function,
and push the cleanup out given it is purely net80211 internal code
(the argument may have reason for existance in the future).

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D45816
DeltaFile
+2-2sys/net80211/ieee80211_scan_sw.c
+2-2sys/net80211/ieee80211_scan.h
+1-1sys/net80211/ieee80211_hostap.c
+1-1sys/net80211/ieee80211_adhoc.c
+1-1sys/net80211/ieee80211_mesh.c
+1-1sys/net80211/ieee80211_scan.c
+8-81 files not shown
+9-97 files

HardenedBSD/src c179937lib/libc/net getnameinfo.c

libc/getnameinfo: stop adding NI_NUMERICHOST where inappropriate

Checking the first nibble of the IPv6 address to be 0 and then
excluding two well known cases (v4-mapped, loopback) leaves us with
more cases where the first nibble could be 0, e.g., the RFC 6052,
2.1 Well-Known Prefix 64:ff9b::/96.
It is not practical to track them all and it is not clear what lead
to this special casing originally, so remove them.

While here also remove the IN6_IS_ADDR_LINKLOCAL() + NI_NUMERICHOST
case as link-local address resolution does exist.

We do leave the IN6_IS_ADDR_MULTICAST() case for now as I could
not find any references to any official reverse lookups for these.

Adding comments for more case (and some historic behaviour) in order
to make it easier to follow the logic.

PR:             279618

    [4 lines not shown]
DeltaFile
+37-17lib/libc/net/getnameinfo.c
+37-171 files

HardenedBSD/src 5668c22sys/compat/lindebugfs lindebugfs.c, sys/compat/linuxkpi/common/include/linux fs.h

LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_buffer

Trying to use lindebugfs for debugging wirless drivers two issues
became apparent:
(a) a panic in lindebugfs calling a hard coded release function if the
    caller had not provided one.  This seems to be based on assumptions
    that no longer hold up.  Remove the hard coded release function to
    prevent panics.
(b) In LinuxKPI simple_read_from_buffer() would call copy_to_user() but
    buffers weren't setup for this (lindebugfs copies data from its
    own buffer) and then pseudofs will do another copyout to the user
    on this;  remove the copy_to_user() and simply copy the data over
    to the provided buffer; this works for as long as the only consumers
    remain debugfs callers (which currently seems to be the case).
    [the only out-of-tree consumers I am aware off are two drm-kmod
    drivers/gpu/drm/amd/pm/* debugfs functions I cannot test].

Sponsored by:   The FreeBSD Foundation
MFC after:      2 weeks

    [2 lines not shown]
DeltaFile
+12-8sys/compat/linuxkpi/common/include/linux/fs.h
+0-2sys/compat/lindebugfs/lindebugfs.c
+12-102 files

HardenedBSD/src 4fab5f0sys/kern kern_malloc.c

kern_malloc: fold free and zfree together into one __always_inline func

free() and zfree() are essentially the same copy and pasted code with
the extra explicit_bzero() (and formerly kasan) calls.  Add a bool to add
the extra functionality and make both functions a wrapper around the common
code and let the compiler do the optimization based on the bool input
when inlining.

No functional changes intended.

Suggested by:   kib (in D45812)
Sponsored by:   The FreeBSD Foundation
MFC after:      10 days
Reviewed by:    kib, markj
Differential Revision: https://reviews.freebsd.org/D46101
DeltaFile
+27-63sys/kern/kern_malloc.c
+27-631 files

HardenedBSD/src d1bdc28share/man/man9 contigmalloc.9, sys/dev/bwn if_bwn.c

Deprecate contigfree(9) in favour of free(9)

As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore.  We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e02 and is handled in D45813 (to be committed
seperately later).

Sponsored by:   The FreeBSD Foundation
Reviewed by:    markj, kib
Tested by:      pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099
DeltaFile
+6-25share/man/man9/contigmalloc.9
+8-8sys/dev/hptmv/entry.c
+6-8sys/dev/hyperv/vmbus/vmbus.c
+3-9sys/kern/kern_malloc.c
+2-10sys/dev/bwn/if_bwn.c
+6-6sys/dev/pst/pst-iop.c
+31-6645 files not shown
+123-19751 files

HardenedBSD/src 5b8c01dsys/amd64/amd64 pmap.c

amd64 pmap: Optimize PKU lookups when creating superpage mappings

Modify pmap_pkru_same() to update the prototype PTE at the same time as
checking the address range.  This eliminates the need for calling
pmap_pkru_get() in addition to pmap_pkru_same().  pmap_pkru_same() was
already doing most of the work of pmap_pkru_get().

Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D46135
DeltaFile
+17-12sys/amd64/amd64/pmap.c
+17-121 files

HardenedBSD/src 7857f7acontrib/llvm-project/llvm/lib/Transforms/Scalar DeadStoreElimination.cpp, sys/compat/linuxkpi/common/src linux_80211.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+87-5tests/sys/netinet6/ndp.sh
+39-0sys/netinet/tcp_subr.c
+38-0tests/sys/netinet6/ra.py
+18-16tests/sys/netinet6/Makefile
+30-0sys/compat/linuxkpi/common/src/linux_80211.c
+18-6contrib/llvm-project/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+230-2712 files not shown
+297-6218 files

HardenedBSD/src f5c8944lib/libthr/thread thr_stack.c

Revert "Avoid division in round_up."

This reverts commit 2b229739e7ca43b36e53f47147ac05a91333f7b9.

Pull Request:   https://github.com/freebsd/freebsd-src/pull/1343
DeltaFile
+4-1lib/libthr/thread/thr_stack.c
+4-11 files

HardenedBSD/src 2b22973lib/libthr/thread thr_stack.c

Avoid division in round_up.

Division may require a function call, leading to
dynamic function lookup, leading to deadlock in rtld.

Pull Request:   https://github.com/freebsd/freebsd-src/pull/1343
DeltaFile
+1-4lib/libthr/thread/thr_stack.c
+1-41 files

HardenedBSD/src feda329tests/sys/netinet6 ndp.sh ra.py

netinet6 tests: Add a regression test for default router handling

This serves as a regression test for commit a48df53e4249.

Reviewed by:    bz, allanjude
MFC after:      2 weeks
Sponsored by:   Klara, Inc.
Sponsored by:   Bell Tower Integration
Differential Revision:  https://reviews.freebsd.org/D46136
DeltaFile
+87-5tests/sys/netinet6/ndp.sh
+38-0tests/sys/netinet6/ra.py
+18-16tests/sys/netinet6/Makefile
+143-213 files

HardenedBSD/src 399362busr.sbin/nvmfd nvmfd.c nvmfd.8

nvmfd: Permit setting the MAXH2CDATA value via -H

This value is advertised to the remote host for TCP associations and
determines the maximum data payload size the remote host is permitted
to transmit in a single PDU.

Sponsored by:   Chelsio Communications
DeltaFile
+14-3usr.sbin/nvmfd/nvmfd.c
+8-2usr.sbin/nvmfd/nvmfd.8
+1-1usr.sbin/nvmfd/discovery.c
+1-1usr.sbin/nvmfd/io.c
+1-0usr.sbin/nvmfd/internal.h
+25-75 files

HardenedBSD/src 7f73c04usr.sbin/nvmfd nvmfd.c

nvmfd: Correct usage description

During development the command line options for PDU digests for
nvmecontrol(8) and nvmfd(8) were renamed to align with Linux's nvme(1)
command, but the usage description in nvmfd(8) had a mix of the old
and new options.

Sponsored by:   Chelsio Communications
DeltaFile
+2-2usr.sbin/nvmfd/nvmfd.c
+2-21 files

HardenedBSD/src 846d702lib/libnvmf nvmf_tcp.c

libnvmf: Reject invalid values of MAXH2CDATA for new associations

Sponsored by:   Chelsio Communications
DeltaFile
+9-2lib/libnvmf/nvmf_tcp.c
+9-21 files

HardenedBSD/src fd0e6aflib/libnvmf nvmf_tcp.c

libnvmf: Require MAXH2CDATA to be a multiple of 4

The spec says MAXH2CDATA to is "a multiple of dwords and should be no
less than 4,096".

Sponsored by:   Chelsio Communications
DeltaFile
+5-4lib/libnvmf/nvmf_tcp.c
+5-41 files

HardenedBSD/src 6549718usr.sbin/nvmfd nvmfd.8 io.c

nvmfd: Stop setting MAXR2T in association parameters

This is only used for the host side of an association.  The controller
obtains this value from the host during connection negotiation.

Sponsored by:   Chelsio Communications
DeltaFile
+3-4usr.sbin/nvmfd/nvmfd.8
+0-1usr.sbin/nvmfd/io.c
+0-1usr.sbin/nvmfd/discovery.c
+3-63 files

HardenedBSD/src 5d0498dshare/man/man4 nvmf_tcp.4, sys/dev/nvmf nvmf_tcp.c

nvmf_tcp: Rename max_c2hdata sysctl to max_transmit_data

This sysctl sets a cap on the maximum payload of transmitted data PDUs
including both C2H_DATA and H2C_DATA PDUs, not just C2H_DATA PDUs.

Sponsored by:   Chelsio Communications
DeltaFile
+11-4share/man/man4/nvmf_tcp.4
+1-1sys/dev/nvmf/nvmf_tcp.c
+12-52 files

HardenedBSD/src 4aff404sys/compat/linuxkpi/common/src linux_80211.c linux_80211.h

LinuxKPI: 802.11: support manual lladdr changes

Allow a user to change the "ether" address by ifconfig while a VAP is
not UP.  Compared to net80211 (given we have no callback) we register
an eventhandler per-vif (a global one would force us to use hacks to
derive if a vap is indeed also a lkpi_80211 vif).

Sponsored by:   The FreeBSD Foundation
PR:             277356
Tested by:      lwhsu
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D46121
DeltaFile
+30-0sys/compat/linuxkpi/common/src/linux_80211.c
+1-0sys/compat/linuxkpi/common/src/linux_80211.h
+31-02 files

HardenedBSD/src 9baed39share/misc committers-src.dot

Add osamaabb as src committer and cperciva as mentor

Approved by:   cperciva (mentor)
DeltaFile
+4-0share/misc/committers-src.dot
+4-01 files

HardenedBSD/src 55a2a91contrib/llvm-project/llvm/lib/Transforms/Scalar DeadStoreElimination.cpp

Merge commit 28a2b85602a5 from llvm-project (by Kazu Hirata):

  [DeadStoreElimination] Use SmallSetVector (NFC) (#79410)

  The use of SmallSetVector saves 0.58% of heap allocations during the
  compilation of a large preprocessed file, namely X86ISelLowering.cpp,
  for the X86 target.  During the experiment, the final size of ToCheck
  was 8 or less 88% of the time.

Merge commit 9e95c4947d31 from llvm-project (by Nikita Popov):

  [DSE] Fix non-determinism due to address reuse (#84943)

  The malloc->calloc fold creates a new MemoryAccess, which may end of at
  the same address as a previously deleted access inside SkipStores.

  To the most part, this is not a problem, because SkipStores is normally
  only used together with MemDefs. Neither the old malloc access nor the
  new calloc access will be part of MemDefs, so there is no problem here.

    [21 lines not shown]
DeltaFile
+18-6contrib/llvm-project/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+18-61 files

HardenedBSD/src f1fa268lib/libthr/arch/arm thr_rtld_arm.c, sys/compat/linuxkpi/common/include/linux skbuff.h

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+49-50sys/compat/linuxkpi/common/include/net/mac80211.h
+67-0lib/libthr/arch/arm/thr_rtld_arm.c
+5-5sys/compat/linuxkpi/common/src/linux_80211.c
+8-0sys/compat/linuxkpi/common/include/linux/skbuff.h
+3-3sys/netinet6/nd6.c
+6-0sys/compat/linuxkpi/common/src/linux_80211.h
+138-5819 files not shown
+191-6525 files

HardenedBSD/src 4aecf1csys/net pfvar.h, sys/netpfil/pf pf.c pf_ioctl.c

Merge branch 'freebsd/14-stable/main' into hardened/14-stable/master
DeltaFile
+38-36sys/netpfil/pf/pf.c
+32-0tests/sys/netpfil/pf/sctp.sh
+11-11sys/netpfil/pf/pf_ioctl.c
+8-4sys/netpfil/pf/if_pfsync.c
+5-3sys/net/pfvar.h
+94-545 files

HardenedBSD/src f138abasys/net pfvar.h, sys/netpfil/pf pf.c pf_ioctl.c

Merge branch 'freebsd/13-stable/main' into hardened/13-stable/master
DeltaFile
+38-36sys/netpfil/pf/pf.c
+32-0tests/sys/netpfil/pf/sctp.sh
+11-11sys/netpfil/pf/pf_ioctl.c
+8-4sys/netpfil/pf/if_pfsync.c
+5-3sys/net/pfvar.h
+94-545 files

HardenedBSD/src 9565854sys/netinet/cc cc_cubic.c cc_cubic.h

cc_cubic: remove the redundant variable num_cong_events from struct cubic.

Summary:
This variable was added by commit eb5bfdd06565, but unnecessarily needed.
No functional change.

Reviewed by: tuexen

Differential Revision: https://reviews.freebsd.org/D46042
DeltaFile
+0-2sys/netinet/cc/cc_cubic.c
+0-2sys/netinet/cc/cc_cubic.h
+0-42 files