HardenedBSD/hardenedbsd a906febsys/vm vm_unix.c

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-5sys/vm/vm_unix.c
+0-51 files

HardenedBSD/hardenedbsd 887d9e4lib/libcasper/services/cap_sysctl cap_sysctl.c cap_sysctl.3, lib/libcasper/services/cap_sysctl/tests sysctl_test.c

Merge remote-tracking branch 'origin/freebsd/current/master' into hardened/current/master

Conflicts:
        sys/vm/vm_unix.c (unresolved)

HardenedBSD/hardenedbsd db98f4csys/dev/iicbus sy8106a.c rtc8583.c

Add pnpinfo to all i2c drivers that have FDT compat data.

HardenedBSD/hardenedbsd 93e1f6fsys/dev/iicbus/twsi mv_twsi.c a10_twsi.c

Add pnpinfo.

HardenedBSD/hardenedbsd cdb9cd3sys/arm/allwinner/clkng aw_clk_nm.c aw_clk.h

arm: allwinner: Remove frac mode from NM clk

We have a correct clock type aw_clk_frac now for this.

HardenedBSD/hardenedbsd b770c8fsys/arm/allwinner/clkng ccu_a64.c ccu_a31.c

arm: allwinner: clk: Use the new frac clock

Some clocks used the NM type but this clock is for the ones with the
formula "clk = clkin / n / m" and not "clk = clkin * n / m"
Use the new frac clock for them.

HardenedBSD/hardenedbsd e9f04d6sys/arm/allwinner files.allwinner, sys/arm/allwinner/clkng aw_clk_frac.c aw_clk_frac.h

arm: allwinner: clk: Add new clock aw_clk_frac

Add a clock driver for clock that can either be used in integer mode
with one N factor and one M divider or in fractional mode where the
output frequency is chosen between two predifined output.

HardenedBSD/hardenedbsd 67e128bsys/arm/allwinner/clkng aw_ccung.c

allwinner: aw_ccu: Add some debug printfs (disabled by default)

Also print information about setting frequency at boot under bootverbose

HardenedBSD/hardenedbsd c1e091finclude mk-osreldate.sh

Move to using newvers -c instead of VARS_ONLY=1

Use newvers.sh -c to get the copyright, and newvers.sh -V RELDATE to
get the release date.

Differential Revision: https://reviews.freebsd.org/D19849

HardenedBSD/hardenedbsd 3ea41b6bin/freebsd-version Makefile

Convert freebsd-version to using -v

newvers.sh has supported a variable setting only mode, use that in
preference to grep to future proof this script from changes there.

Differential Revision: https://reviews.freebsd.org/D19849

HardenedBSD/hardenedbsd bbfd51ausr.sbin/amd/include newvers.sh

Convert amd newvers to using newvers.sh -v.

Rather than the tedious and error-prone grep of sys/conf/newvers.sh,
use the new -v arg to dig out the data that's desired.

Differential Revision: https://reviews.freebsd.org/D19849

HardenedBSD/hardenedbsd 2780538sys/conf newvers.sh

Implement "VARS_ONLY=1" via special command line args

Add -v to print TYPE REVISION BRANCH RELEASE VERSION RELDATE variables
Add -V var to print var's value
        Both of these in ${var}="${val}" format suitable for
               eval $(sh newvers.sh -v)
        in shell scripts / makefiles.
Add -c to print the copyright / license comment text only.

Document these, and remove soon-to-be obsolete comment.

Minor code motion as well bunded here to put functions after
VARS_ONLY and command line argument parsing.

Differential Revision: https://reviews.freebsd.org/D19849
DeltaFile
+91-68sys/conf/newvers.sh
+91-681 files

HardenedBSD/hardenedbsd 58c7e17sys/netinet sctputil.c sctp_usrreq.c

Merge remote-tracking branch 'origin/hardened/11-stable/master' into 
hardened/11-stable/unstable

* origin/hardened/11-stable/master:
  MFC r347975:

HardenedBSD/hardenedbsd 681a8bdsys/netinet sctputil.c sctp_usrreq.c

Merge branch 'freebsd/11-stable/master' into hardened/11-stable/master

* freebsd/11-stable/master:
  MFC r347975:

HardenedBSD/hardenedbsd 7577514sys/netinet sctputil.c sctp_usrreq.c

MFC r347975:

Improve input validation for the IPPROTO_SCTP level socket options
SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED.

MFC r347976:
Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state.
This issue was found by running syzkaller.

Approved by:           re (gjb@)

HardenedBSD/hardenedbsd addd3a6sys/dev/iicbus iicbus.h icee.c

Rename IICBUS_FDT_PNPINFO -> IICBUS_FDT_PNP_INFO because all the other
existing pnpinfo-related macros right now use PNP_INFO, not PNPINFO.

HardenedBSD/hardenedbsd f220b2fsys/dev/flash mx25l.c at45d.c, sys/dev/spibus spi.h

Use the new FDTCOMPAT_PNP_INFO() macro to define SPIBUS_FDT_PNP_INFO().
Also rename SPIBUS_PNP_INFO -> SPIBUS_FDT_PNP_INFO because there could be
other kinds of pnpinfo for other (non-fdt) bus attachments.

HardenedBSD/hardenedbsd f18d106share/man/man9 MODULE_PNP_INFO.9

Add warning that the PNP info has to follow the module declaration.

Due to how the linker.hints file is laid out, we'll associate the pnp
info with the wrong module if the module declaration comes after the
pnp info. Until that limiation is removed, we need to have this
ordering. Ideally, we'd also enforce the ordering somehow, but I've
come up with no way to do that yet...

HardenedBSD/hardenedbsd c8a5352sys/dev/iicbus icee.c

Add pnpinfo for icee(4) on fdt systems.

HardenedBSD/hardenedbsd e38bfb5sys/dev/iicbus iicbus.h, sys/dev/ofw ofw_bus_subr.h

Define macros making it easier to define bus-specific pnpinfo for FDT systems.

Pnpinfo is bus-specific and requires the bus name. The FDTCOMPAT_PNP_INFO()
macro makes it easier to define new FDT-based pnpinfo for busses other than
simplebus.

Differential Revision:  https://reviews.freebsd.org/D20382

HardenedBSD/hardenedbsd ef723f0usr.bin/posixshmcontrol posixshmcontrol.c

Use int for the getopt() result.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

HardenedBSD/hardenedbsd 424c561usr.bin Makefile, usr.bin/posixshmcontrol posixshmcontrol.c Makefile

Add posixshmcontrol(1), an utility to manipulate posix shared memory segments.

See usage for the command line structure.  Man page will come shortly.

Reviewed by:    jilles, tmunro
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D20258

HardenedBSD/hardenedbsd ab20dfbsys/arm/freescale/imx imx_i2c.c

Release the bus-recovery gpio pins in detach(), so that unload then
reload of the module works without "pin already allocated" errors.

HardenedBSD/hardenedbsd 4350cdausr.sbin/etcupdate etcupdate.sh

etcupdate: Add missing directory when building the tree

Missed in 348151

Reported by:    lwshu, ci

HardenedBSD/hardenedbsd c2cf124sys/dev/iicbus iiconf.c

Mark i2c slave devices busy while they own the bus.

Many i2c slave drivers are in modules that can be unloaded.  If they detach
while IO is in progress the bus would be hung forever.  Conversely,
lower-layer drivers (iicbus and the hardware driver) also live in modules
and other kinds of bad things happen if they get detached while IO is in
progress.  Because device_busy() propagates up to parents, marking the slave
device busy while it owns the bus solves both kinds of problems that come
with detaching i2c devices while IO is in progress.

HardenedBSD/hardenedbsd 330c653sys/amd64/amd64 pmap.c

MFC r347698:
amd64 pmap: sysctl vm.pmap.pcid_save_cnt should be read-only.

HardenedBSD/hardenedbsd 3bdbf36sys/kern subr_turnstile.c

MFC r347694:
subr_turnstile: Extract some common  code to a helper.

HardenedBSD/hardenedbsd 3d10b2dlibexec/rtld-elf rtld_malloc.c

MFC r347693:
rtld_malloc.c: cleanup morepages().

HardenedBSD/hardenedbsd f6e64bclibexec/rtld-elf rtld_malloc.c

MFC r347692:
Remove more dead definitions from rtld_malloc.c after r347019.

HardenedBSD/hardenedbsd 99452f5sys/dev/mrsas mrsas.c

add mrsas_shutdown method

It should be safer to flush controller and disk caches on the shutdown.
And to gracefully shut down the controller as well.
It seems that the Linux driver has been doing that for a long time.

Discussed with: scottl
Reviewed by:    imp, Sumit Saxena <sumit.saxena at broadcom.com>
               (both earlier version)
MFC after:      3 weeks
Sponsored by:   Panzura
Differential Revision: https://reviews.freebsd.org/D19817
DeltaFile
+34-0sys/dev/mrsas/mrsas.c
+34-01 files

HardenedBSD/hardenedbsd 83a359esys/kern uipc_shm.c

Add a kern.ipc.posix_shm_list sysctl.

The sysctl provides the listing on named linked posix shared memory
segments existing in the system.

Reuse shm_fill_kinfo() for filling individual struct kinfo_file.
Remove unneeded lock around reading of shmfd->shm_mode.

Reviewed by:    jilles, tmunro
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D20258
DeltaFile
+67-11sys/kern/uipc_shm.c
+67-111 files

HardenedBSD/hardenedbsd 669c4c5libexec/rc/rc.d Makefile, share/man/man4 gpioled.4

Merge remote-tracking branch 'origin/hardened/current/master' into 
hardened/current/unstable

* origin/hardened/current/master:
  gpioled: update the manual page after r348153
  gpioled: add a new hint for initial state
  Add USB ID for CP2112
  etcupdate: Fix -p after the move of the passwd related files
  pkgbase: Remove etc/zfs from being packaged

HardenedBSD/hardenedbsd b45119asys/kern uipc_shm.c

Report ref count of the backing object as st_nlink for posix shm fd.

Unless there are transient references to the object, the ref count is
equal to the number of the shared memory segment mappings plus one.

Reviewed by:    jilles, tmunro
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D20258

HardenedBSD/hardenedbsd f6d894csys/kern kern_descrip.c, sys/sys user.h

Make pack_kinfo() available for external callers.

Reviewed by:    jilles, tmunro
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D20258

HardenedBSD/hardenedbsd b271a80libexec/rc/rc.d Makefile, share/man/man4 gpioled.4

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  gpioled: update the manual page after r348153
  gpioled: add a new hint for initial state
  Add USB ID for CP2112
  etcupdate: Fix -p after the move of the passwd related files
  pkgbase: Remove etc/zfs from being packaged

HardenedBSD/hardenedbsd ef8e168share/man/man4 gpioled.4

gpioled: fix the manual page update in r348154

MFC after:      2 weeks

HardenedBSD/hardenedbsd c245b4dshare/man/man4 gpioled.4

gpioled: update the manual page after r348153

MFC after:      2 weeks

HardenedBSD/hardenedbsd 2c9d92dsys/dev/gpio gpioled.c

gpioled: add a new hint for initial state

hint.gpioled.%d.state determines the initial state of the LED when the
driver takes control over it:
  0 - the LED is off
  1 - the LED is on
 -1 - the LED is kept as it was

While here, add a module version declaration.

MFC after:      2 weks

HardenedBSD/hardenedbsd f97f5fesys/dev/usb usbdevs

Add USB ID for CP2112

This is a curious small widget for which I might write a driver.
It is bridge between USB HID interface and I2C interface plus some
GPIO pins.

MFC after:       2 weeks

HardenedBSD/hardenedbsd 1230d2busr.sbin/etcupdate etcupdate.sh

etcupdate: Fix -p after the move of the passwd related files

Since PREWORLD_FILES only contain files that needs to be copied into /etc
copy directly those files there.

Reported by:    many

HardenedBSD/hardenedbsd 87d597elibexec/rc/rc.d ntpd, sys/mips/mips elf_trampoline.c

Merge remote-tracking branch 'origin/hardened/current/master' into 
hardened/current/unstable

* origin/hardened/current/master:
  Delete unneeded #include <sys/inflate.h> from sys/mips.
  powerpc/mpc85xx: Use the proper (EREF) form of writing to DBCR0
  powerpc/booke: It helps to set variables before using them
  Fix typo from r348128: _func__ -> __func__
  Remove accidentally-added blank line; the style throughout this file is to use no 
whitespace between a comment block and the code it describes.
  Handle the driftfile option correctly when ntpd_flags is empty.

HardenedBSD/hardenedbsd dd6f658libexec/rc/rc.d Makefile

pkgbase: Remove etc/zfs from being packaged

This is an empty directory and it cause a FreeBSD-zfs package to
be created when we don't need one.

Reviewed by:    bapt

HardenedBSD/hardenedbsd cdc178flibexec/rc/rc.d ntpd, sys/mips/mips elf_trampoline.c

Merge branch 'freebsd/current/master' into hardened/current/master

* freebsd/current/master:
  Delete unneeded #include <sys/inflate.h> from sys/mips.
  powerpc/mpc85xx: Use the proper (EREF) form of writing to DBCR0
  powerpc/booke: It helps to set variables before using them
  Fix typo from r348128: _func__ -> __func__
  Remove accidentally-added blank line; the style throughout this file is to use no 
whitespace between a comment block and the code it describes.
  Handle the driftfile option correctly when ntpd_flags is empty.

HardenedBSD/hardenedbsd 17f41a7contrib/zlib deflate.c zlib.h, sys/contrib/zlib deflate.c zlib.h

MFC r347244:

Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel.
This is a prerequisite of unifying kernel zlib instances.

Submitted by:   Yoshihiro Ota <ota at j.email.ne.jp>

HardenedBSD/hardenedbsd fa1c6f9sys/mips/mips elf_trampoline.c

Delete unneeded #include <sys/inflate.h> from sys/mips.

PR:            229763
Submitted by:   Yoshihiro Ota <ota at j.email.ne.jp>
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D20190

HardenedBSD/hardenedbsd 7b0e540lib/libbe be_access.c, sys/net if_tap.c if_tun.c

Merge remote-tracking branch 'origin/hardened/11-stable/master' into 
hardened/11-stable/unstable

* origin/hardened/11-stable/master:
  MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none
  MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

HardenedBSD/hardenedbsd 8700ab4lib/libbe be_access.c, sys/net if_tap.c if_tun.c

Merge branch 'freebsd/11-stable/master' into hardened/11-stable/master

* freebsd/11-stable/master:
  MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none
  MFC r347578: tun/tap: Defer clearing if_softc until after if_detach

HardenedBSD/hardenedbsd 03ac35dsys/powerpc/mpc85xx platform_mpc85xx.c

powerpc/mpc85xx: Use the proper (EREF) form of writing to DBCR0

DBCR0, according to the Freescale EREF, is guaranteed to be updated, and
changes take effect, after an isync plus change of MSR[DE] from 0 to 1.
Otherwise it's guaranteed to be updated "eventually".  Use the expected
synchronization sequence to write it for resetting.

This prevents "Reset failed" from being printed immediately before the CPU
resets.

MFC after:      2 weeks

HardenedBSD/hardenedbsd d99f7d3sys/powerpc/booke pmap.c

powerpc/booke: It helps to set variables before using them

Actually set the source and destination VA's before using them.  Fixes a
bizarre panic on 32-bit Book-E.  Not sure why this wasn't caught by the
compiler.

HardenedBSD/hardenedbsd e183d96tools/boot rootgen.sh

MFC r346652-r346654

r346652:
Complain and exit the script if the 'make install' phase fails.  Also,
there is no need to install any debug files.

r346653:
The zfs module has grown a dependency on zcl_nfs4.ko, so copy it into all
the test images.

r346654:
For the geli-gpt-zfs test images, both bios and uefi flavors, add a dummy
ufs partition as p2, and put the zfs partition at p3, to test the ability
of the zfs probe code to find a zfs pool on something other than the first
partition.
DeltaFile
+34-11tools/boot/rootgen.sh
+34-111 files