FreeBSD/src c818089sys/fs/nfsserver nfs_nfsdstate.c

nfs_nfsdstate.c: Add sanity checks for lock stateids

Bugzilla PR reported a crash caused by a synthetic client
doing a Lock operation request with a delegation stateid.

This patch fixes the problem by adding sanity checks
for the type of stateid provided as an argument to the
Lock and LockU operations.

It has been tested with the FreeBSD, Linux and Solaris 11.4
clients.  Hopefully, other NFSv4 clients will work ok
as well.

PR:     291080

(cherry picked from commit aa1cf240887ddcca66dfb969fdc5a8d545396037)
DeltaFile
+14-0sys/fs/nfsserver/nfs_nfsdstate.c
+14-01 files

FreeBSD/src ffd47a4sys/fs/nfsserver nfs_nfsdstate.c

nfs_nfsdstate.c: Add sanity checks for lock stateids

Bugzilla PR reported a crash caused by a synthetic client
doing a Lock operation request with a delegation stateid.

This patch fixes the problem by adding sanity checks
for the type of stateid provided as an argument to the
Lock and LockU operations.

It has been tested with the FreeBSD, Linux and Solaris 11.4
clients.  Hopefully, other NFSv4 clients will work ok
as well.

PR:     291080

(cherry picked from commit aa1cf240887ddcca66dfb969fdc5a8d545396037)
DeltaFile
+14-0sys/fs/nfsserver/nfs_nfsdstate.c
+14-01 files

FreeBSD/src cc1e4aalibexec/rc/rc.d ipfilter

rc.d/ipfilter: ipfilter must be enabled for options to take

ipfilter options are erased and reset to default when ipfilter is
disabled. This results in nullifying options from rc.conf that were
previously set.

8d6feaaaa26f, which added this code, was incorrect as it was for a bug in
ipfilter 4.2.28 and no longer applies to ipfilter 5.1.2.

Fixes:          8d6feaaaa26f
MFC after:      1 day
DeltaFile
+3-6libexec/rc/rc.d/ipfilter
+3-61 files

FreeBSD/src a837d1fsys/kern uipc_socket.c

splice: Fix leaks that can happen when initiating a splice

- change the state to SPLICE_EXCEPTION to allow so_unsplice() to work
  to cleanup failed splices (fixes socket reference leak)
- NULL out sp->dst when unsplicing from so_splice() before so2 has been
   been referenced.
- Deal with a null sp->dst / so2 in so_unsplice
- Fix asserts that talked about sp->state == SPLICE_INIT; that state
  is not possible here.

Differential Revision: https://reviews.freebsd.org/D54157
Reviewed by: markj
Sponsored by: Netflix
Fixes: c0c5d01e5374 ("so_splice: Synchronize so_unsplice() with so_splice()")
MFC after: 3 days
DeltaFile
+27-17sys/kern/uipc_socket.c
+27-171 files

FreeBSD/src f04b23clibexec/rc/rc.d ippool ipfilter

rc.d/{ipfilter,ippool}: Fix typo in variable name

MFC after:      1 day
DeltaFile
+1-1libexec/rc/rc.d/ippool
+1-1libexec/rc/rc.d/ipfilter
+2-22 files

FreeBSD/src ca942absys/dev/bhnd bhnd.h bhnd_subr.c, sys/dev/bhnd/bcma bcma_subr.c

bhnd_bus_*_resource: Remove redundant type and rid arguments

Remove type and rid arguments from
bhnd_bus_(activate|deactivate|release)_resource.  This should have
been done earlier to match the changes made to bus_release_resource,
etc.

While fixing up the callers, remove rid members from softc structures
since the only time a value is needed is as a constant input to
bhnd_bus_alloc_resource*.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53410
DeltaFile
+9-24sys/dev/bhnd/bhnd.h
+10-10sys/dev/bhnd/bhnd_subr.c
+6-10sys/dev/bhnd/cores/chipc/chipc_subr.c
+3-11sys/dev/bhnd/bhnd_erom.c
+5-5sys/dev/bhnd/bhndb/bhndb.c
+4-6sys/dev/bhnd/bcma/bcma_subr.c
+37-6616 files not shown
+58-11122 files

FreeBSD/src 1033312sys/dev/bhnd bhnd_subr.c bhnd.h, sys/dev/bhnd/cores/chipc chipc_gpio.c chipc_subr.c

bhnd_bus_alloc_resource*: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53409
DeltaFile
+4-4sys/dev/bhnd/bhnd_subr.c
+3-3sys/dev/bhnd/bhnd.h
+1-1sys/dev/bhnd/bhnd_erom.c
+1-1sys/dev/bhnd/cores/chipc/chipc_gpio.c
+1-1sys/dev/bhnd/cores/chipc/chipc_subr.c
+1-1sys/dev/bhnd/cores/pci/bhnd_pci.c
+11-116 files not shown
+17-1712 files

FreeBSD/src d08fac0sys/dev/dpaa2 dpaa2_rc.c

dpaa2_rc_add_res: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53408
DeltaFile
+14-16sys/dev/dpaa2/dpaa2_rc.c
+14-161 files

FreeBSD/src 01dcb4esys/dev/gpio gpiobus.c gpioaei.c

gpio_alloc_intr_resource: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53407
DeltaFile
+2-2sys/dev/gpio/gpiobus.c
+1-1sys/dev/gpio/gpioaei.c
+1-1sys/dev/gpio/gpiobusvar.h
+1-1sys/dev/gpio/gpioc.c
+1-1sys/dev/gpio/gpiokeys.c
+1-1sys/dev/gpio/gpiopps.c
+7-72 files not shown
+9-98 files

FreeBSD/src 1056844sys/dev/acpica acpi_perf.c acpi_package.c

acpi_PkgGas: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53406
DeltaFile
+3-3sys/dev/acpica/acpi_perf.c
+2-2sys/dev/acpica/acpi_package.c
+1-1sys/dev/acpica/acpi_cpu.c
+1-1sys/dev/acpica/acpivar.h
+7-74 files

FreeBSD/src 2a23faesys/dev/acpica acpi.c acpi_throttle.c

acpi_bus_alloc_gas: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53405
DeltaFile
+4-4sys/dev/acpica/acpi.c
+2-2sys/dev/acpica/acpi_throttle.c
+2-2sys/dev/acpica/acpi_apei.c
+2-2sys/dev/acpica/acpi_cpu.c
+1-1sys/dev/acpica/acpi_package.c
+1-1sys/dev/acpica/acpivar.h
+12-121 files not shown
+13-137 files

FreeBSD/src d9f1922sys/compat/linuxkpi/common/src linux_pci.c, sys/dev/pci pci.c pci_private.h

pci_reserve_map: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53404
DeltaFile
+15-15sys/dev/pci/pci.c
+1-1sys/compat/linuxkpi/common/src/linux_pci.c
+1-1sys/dev/pci/pci_private.h
+17-173 files

FreeBSD/src e279724sys/dev/acpica acpi.c, sys/dev/dpaa2 dpaa2_rc.c

resource_list_reserve: Pass rid by value

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53403
DeltaFile
+11-12sys/dev/pci/pci.c
+3-3sys/kern/subr_bus.c
+1-1sys/dev/acpica/acpi.c
+1-1sys/dev/dpaa2/dpaa2_rc.c
+1-1sys/sys/bus.h
+17-185 files

FreeBSD/src 5756395sys/dev/pccbb pccbb.c, sys/dev/pci pci.c pci_pci.c

bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHOD

The wrapper functions such as bus_alloc_resource_any() still support
passing the rid by value or pointer, but the underlying implementation
now passes by value.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D53402
DeltaFile
+22-22sys/sys/bus.h
+14-14sys/dev/pci/pci.c
+11-11sys/dev/pccbb/pccbb.c
+11-11sys/kern/subr_bus.c
+9-9sys/dev/pci/pci_pci.c
+8-8sys/x86/isa/isa.c
+75-7577 files not shown
+276-28283 files

FreeBSD/src 12165acsys/netlink netlink_snl.h

Revert "netlink: Fix overallocation of netlink message buffers"

This patch was based on an incorrect assumption that the linear buffer
chain for an snl_writer only contained the netlink message body.

This reverts commit 828df4d36d9d5a6ca0dcc294d65572b4a0474142.

Sponsored by:   AFRL, DARPA
DeltaFile
+11-16sys/netlink/netlink_snl.h
+11-161 files

FreeBSD/src cf39b51sys/compat/linuxkpi/common/include/linux radix-tree.h, sys/compat/linuxkpi/common/src linux_radix.c

linuxkpi: Take const root in read-only radix tree functions

This is a preparation step for a future addition to this file. This is
also closer to what Linux does.

Reviewed by:    emaste
Sponsored by:   The FreeBSD Foundation
DeltaFile
+4-4sys/compat/linuxkpi/common/src/linux_radix.c
+2-2sys/compat/linuxkpi/common/include/linux/radix-tree.h
+6-62 files

FreeBSD/src 0f12ee8sys/compat/linux linux_if.c

linux: fix build without VIMAGE

Fixes:  fbf05d2147b1add8b760be166c4b1fd4499ebce8
DeltaFile
+1-0sys/compat/linux/linux_if.c
+1-01 files

FreeBSD/src 63b77absys/kgssapi gss_impl.c

kgssapi: Remove broken MOD_UNLOAD code

The module panicked at unload with "recursing but non-recursive rw".
There is a comment that "Unloading of the kgssapi module is not
currently supported" and the MOD_UNLOAD case falls through to returning
EOPNOTSUPP anyway.  Just #if 0 the code in the unload path, leaving it
as a hint in case someone implements unload support later on.

PR:             291249
Reviewed by:    rmacklem
Fixes: ad704a34bc2c ("Use syscall_helper_register(9) rather than syscall_register().")
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53949

(cherry picked from commit 6901376f59b870ddbb0d922e3455a388333cd460)
(cherry picked from commit ab4f4f4efaac85bbf235e60f2ced4876a9e916f2)
DeltaFile
+4-0sys/kgssapi/gss_impl.c
+4-01 files

FreeBSD/src 224d650sys/dev/vt vt_core.c

vt: Allow VT_SETMODE with frsig=0

Linux does not check that any of the signals in vt_mode VT_SETMODE ioctl
(relsig, acqsig, frsig) are valid, but FreeBSD required that all three
are valid.  frsig is unusued in both Linux and FreeBSD, and software
typically leaves it unset.  To improve portability, allow frsig to be
set to zero.

PR:             289812
Reported by:    Dušan Gvozdenović
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52835

(cherry picked from commit 5198c32210039d8dc92554647384eee75688848c)
DeltaFile
+3-3sys/dev/vt/vt_core.c
+3-31 files

FreeBSD/src 56bdfd2contrib/diff/src diff3.c

diff3: Use logical-not, not bitwise for booleans

And compare impcompat != 0 as it's actually an integer incremented on
each use of one of the AeExX3 options.

Reviewed by:    fuz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53808

(cherry picked from commit abcb80f46c2607fc16564ca87cc25f0908f29f99)
DeltaFile
+3-3contrib/diff/src/diff3.c
+3-31 files

FreeBSD/src 3f2d86bshare/man/man4 fdc.4

fdc.4: Correct igor-reported warnings

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit e1b027b276dfba017d12b8a112af3251e79effc5)
DeltaFile
+6-4share/man/man4/fdc.4
+6-41 files

FreeBSD/src de67d3cshare/man/man5 boot.config.5

boot.config.5: Clarify that this controls legacy boot blocks

Reviewed by;    ziaee
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52460

(cherry picked from commit e96359d111aaffa6bf0ea72a6f183eb3b91e6c72)
DeltaFile
+4-4share/man/man5/boot.config.5
+4-41 files

FreeBSD/src 437c774contrib/diff/lib getopt.h

diff3: Remove bespoke getopt.h

diff3's getopt.h included a function declaration without a prototype,
which produces a compiler warning.  Just remove the bespoke getopt.h
and use the system header.

Reported by:    Mark Millard
Reviewed by:    fuz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53802

(cherry picked from commit 38829592dc77e9ead4259785e0bfb93bd4c2fe34)
DeltaFile
+0-176contrib/diff/lib/getopt.h
+0-1761 files

FreeBSD/src ab4f4f4sys/kgssapi gss_impl.c

kgssapi: Remove broken MOD_UNLOAD code

The module panicked at unload with "recursing but non-recursive rw".
There is a comment that "Unloading of the kgssapi module is not
currently supported" and the MOD_UNLOAD case falls through to returning
EOPNOTSUPP anyway.  Just #if 0 the code in the unload path, leaving it
as a hint in case someone implements unload support later on.

PR:             291249
Reviewed by:    rmacklem
Fixes: ad704a34bc2c ("Use syscall_helper_register(9) rather than syscall_register().")
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53949

(cherry picked from commit 6901376f59b870ddbb0d922e3455a388333cd460)
DeltaFile
+4-0sys/kgssapi/gss_impl.c
+4-01 files

FreeBSD/src 661b40fshare/man/man4 fdc.4, usr.sbin/fdcontrol fdcontrol.8

Deprecate fdc(4) and floppy utilities

Floppies have been obsolete for over a decade.  Add a deprecation note
now and plan to remove fdc(4) support in 16.

Reviewed by:    ziaee
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D41549

(cherry picked from commit 4c736cfc69a7ef81c48c8431b31c7e31746fe816)
DeltaFile
+7-1share/man/man4/fdc.4
+6-1usr.sbin/fdcontrol/fdcontrol.8
+6-1usr.sbin/fdformat/fdformat.8
+6-1usr.sbin/fdread/fdread.1
+6-1usr.sbin/fdwrite/fdwrite.1
+31-55 files

FreeBSD/src 8befd2dsys/modules/agp Makefile

agp: Export intel_gtt_read_pte, required by i915kms

This isn't used by modern cards, but is needed for i915kms to load
on a system that has agp as a module not compiled into the kernel.

PR:             291214
Reviewed by:    cy
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53906

(cherry picked from commit a87c1e2dd8fc997d6ee603c252c543afe8a4d2a4)
DeltaFile
+1-0sys/modules/agp/Makefile
+1-01 files

FreeBSD/src e969481sys/modules/mqueue Makefile

mqueue: Export kern_kmq_* symbols from kernel module

linux.ko supports POSIX message queues using these symbols, so they need
to be exported rather than relying on the kernel linker's misfeature of
linking against debug or local symbols (which will soon be disabled by
default).

Reported by:    mav
Reviewed by:    zlei
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53907

(cherry picked from commit e00a781c216cb12603a0a71c9ca293dde3e06250)
(cherry picked from commit eb90470f5f2a0e5c820c47be329423f5c60ca247)
DeltaFile
+8-0sys/modules/mqueue/Makefile
+8-01 files

FreeBSD/src 701e4b3sys/modules/zfs Makefile

zfs: Reuse ZINCDIR variable from kmod.mk

Reviewed by:    brooks, imp
Differential Revision:  https://reviews.freebsd.org/D54147
DeltaFile
+5-6sys/modules/zfs/Makefile
+5-61 files

FreeBSD/src 305f85asys/kern subr_rman.c, sys/sys rman.h

rman: Embed the mutex in struct rman instead of using a separate allocation

This used a separate allocation when rman was first imported (back
when the lock was a pre-SMPng "simplelock" instead of a mutex).

Reported by:    des
Reviewed by:    des
Differential Revision:  https://reviews.freebsd.org/D54143
DeltaFile
+32-36sys/kern/subr_rman.c
+2-1sys/sys/rman.h
+34-372 files

FreeBSD/src a35eae8sys/kern subr_rman.c

rman: Simplify initialization of internal globals

Use TAILQ_HEAD_INITIALIZER and MTX_SYSINIT to remove the 'once' code
from rman_init.

Reviewed by:    des
Differential Revision:  https://reviews.freebsd.org/D54142
DeltaFile
+3-9sys/kern/subr_rman.c
+3-91 files