HardenedBSD/hardenedbsd 4377f87tests/sys/kern ptrace_test.c

MFC r318246,r324566,r324668,r324701:

  r318246:
    Add a regression test for r318191.
  r324566:
    Fix shadowed variable hidden by WARNS changing to 3 in r313006.
  r324668:
    This child is expected to exit on SIGTRAP, don't leave a core behind.
  r324701:
    Add a test for r324671 along with some other masked tests.

HardenedBSD/hardenedbsd 437420blib/libc/sys write.2

MFC r324683: write.2: correct maximum nbytes size for EINVAL error

In FreeBSD 11 and later debug.iosize_max_clamp defaults to 0, and the
maximum nbytes count for write(2) is SSIZE_MAX. Update the man page to
document this, and mention the sysctl that can be set to obtain the
previous behaviour.

PR:            196666
Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd 98a14afusr.sbin/diskinfo diskinfo.8

MFC r324241:

Fix copy/paste error in diskinfo.8 from r320555

Sponsored by:   Spectra Logic Corp

HardenedBSD/hardenedbsd 9a7206flib/libugidfw ugidfw.c, share/man/man8 uefi.8

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

* origin/hardened/current/master:
  After jemalloc was updated to version 5.0.0 in r319971, i386 executables linked with 
AddressSanitizer (even those linked on earlier versions of FreeBSD, or with external 
versions of clang) started failing with errors similar to:
  Some cache related optimizations
  uefi.8: mention use on (32-bit) arm
  Clean up trailing whitespace
  Remove dead stores
  Expand explanation of atomicity.
  Remove resource_set_*() declarations from sys/bus.h.
  Move clear_unrhdr to tmpfs_free_tmp.

HardenedBSD/hardenedbsd d55ef98lib/libugidfw ugidfw.c, share/man/man8 uefi.8

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

* freebsd/current/master:
  After jemalloc was updated to version 5.0.0 in r319971, i386 executables linked with 
AddressSanitizer (even those linked on earlier versions of FreeBSD, or with external 
versions of clang) started failing with errors similar to:
  Some cache related optimizations
  uefi.8: mention use on (32-bit) arm
  Clean up trailing whitespace
  Remove dead stores
  Expand explanation of atomicity.
  Remove resource_set_*() declarations from sys/bus.h.
  Move clear_unrhdr to tmpfs_free_tmp.

HardenedBSD/hardenedbsd 3a2ec82contrib/jemalloc/include/jemalloc/internal tsd.h

After jemalloc was updated to version 5.0.0 in r319971, i386 executables
linked with AddressSanitizer (even those linked on earlier versions of
FreeBSD, or with external versions of clang) started failing with errors
similar to:

  ==14688==AddressSanitizer CHECK failed:
  /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36
  "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)

This is because AddressSanitizer expects all the TLS data in the program
to be aligned to at least 8 bytes.

Before the jemalloc 5.0.0 update, all the TLS data in the i386 version
of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this
grow to 2404 bytes (not a multiple of 8).  This is due to added caching
data in jemalloc's internal struct tsd_s.

To fix AddressSanitizer, ensure this struct is aligned to at least 16
bytes, which can be done unconditionally for all architectures.  (An
earlier version of the fix aligned the struct to 8 bytes, but only for
ILP32 architectures.  This was deemed unnecessarily complicated.)

PR:            221337
X-MFC-With:     r319971

HardenedBSD/hardenedbsd 8b51323sys/net iflib.c

Some cache related optimizations

1. prefetch 128 bytes of mbufs.
2. Re-order filling the pkt_info so cache stalls happen at the end
3. Define empty prefetch2cachelines() macro when the function isn't present.

Provides small performance improvments on some hardware

Reviewed by:    sbruno
Approved by:    sbruno (mentor)
Sponsored by:   Limelight Networks
Differential Revision:  https://reviews.freebsd.org/D12447
DeltaFile
+16-7sys/net/iflib.c
+16-71 files

HardenedBSD/hardenedbsd 14295bdshare/man/man8 uefi.8

uefi.8: mention use on (32-bit) arm

Sponsored by:   The FreeBSD Foundation

HardenedBSD/hardenedbsd b29554fsys/kern kern_sig.c

MFC r324671:
Re-evaluate thread' signal mask after ptracestop().
DeltaFile
+24-7sys/kern/kern_sig.c
+24-71 files

HardenedBSD/hardenedbsd 095310bsys/sys proc.h

Fix struct thread padding field names.

Direct commit to stable/11.
DeltaFile
+4-4sys/sys/proc.h
+4-41 files

HardenedBSD/hardenedbsd 527ac79sys/sys proc.h

struct ksiginfo has MD size, so use it as the padding type to avoid the wrong size.

This is a direct commit to stable/11 to fix r324932.

Spotted by:     kib
DeltaFile
+1-1sys/sys/proc.h
+1-11 files

HardenedBSD/hardenedbsd 4b13cb3lib/libprocstat core.c libprocstat.c, sys/kern imgact_elf.c kern_sig.c

MFC r316286:

  Add support for capturing 'struct ptrace_lwpinfo' for signals resulting in a
  process dumping core in the corefile.

  Direct stable changed: Padding added to struct thread and td_si added to end
  with explicit bzeroing when forking/initializing a thread to preserve KBI.

HardenedBSD/hardenedbsd 7e9da6dlib/libugidfw ugidfw.c Makefile

Clean up trailing whitespace

MFC after:      1 week

HardenedBSD/hardenedbsd 597ef9blib/libugidfw ugidfw.c

Remove dead stores

The return value of various snprintf calls was stored in `len` and not used
in many functions.

MFC after:      1 week
Reported by:    clang-scanbuild
DeltaFile
+50-64lib/libugidfw/ugidfw.c
+50-641 files

HardenedBSD/hardenedbsd 1b05c1dshare/man/man9 atomic.9

Expand explanation of atomicity.

Mention per-location total order, out of thin air, and torn writes
guarantees.  Mention C11 standard' memory model and one most important
FreeBSD additional requirement, that is aligned ordinary loads and
stores are atomic on processors.

The text is introductional and informal.  Reference the C11 and
C++1{1,4,7} standards for authorative description.

In collaboration with:  alc
Sponsored by:   The FreeBSD Foundation (kib)
MFC after:      1 week

HardenedBSD/hardenedbsd a57e72esys/sys bus.h

Remove resource_set_*() declarations from sys/bus.h.

The corresponding definitions were removed in r78135.

PR:            223189
Submitted by:   marc.priggemeyer at gmail.com
MFC after:      1 week
DeltaFile
+0-7sys/sys/bus.h
+0-71 files

HardenedBSD/hardenedbsd 119849asys/amd64/amd64 pmap.c, sys/arm/arm pmap-v6.c

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

* origin/hardened/current/master:
  Fix the VM_NRESERVLEVEL == 0 build.

HardenedBSD/hardenedbsd ea01113sys/amd64/amd64 pmap.c, sys/arm/arm pmap-v6.c

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

* freebsd/current/master:
  Fix the VM_NRESERVLEVEL == 0 build.

HardenedBSD/hardenedbsd d7ecc62sys/fs/tmpfs tmpfs_vfsops.c

Move clear_unrhdr to tmpfs_free_tmp.

Clearing the unr in tmpfs_unmount is not correct. In the case of
multiple references to the tmpfs mount (e.g. when there are lookup
threads using it) it will not be the one to finish tmpfs_free_tmp. In
those cases tmpfs_free_node_locked will be the final one to execute
tmpfs_free_tmp, and until then the unr must be valid.

Reported by:    pho
Approved/reviewed by:   rstone (mentor)
Sponsored by:   Dell EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D12749

HardenedBSD/hardenedbsd 1588800sys/amd64/amd64 pmap.c, sys/arm/arm pmap-v6.c

Fix the VM_NRESERVLEVEL == 0 build.

Add VM_NRESERVLEVEL guards in the pmaps that implement transparent
superpage promotion using reservations.

Reviewed by:    alc, kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D12764

HardenedBSD/hardenedbsd 4686cdcshare/mk src.opts.mk

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

* origin/hardened/current/master:
  Fix an omission in a comment

HardenedBSD/hardenedbsd 9517a5dshare/mk src.opts.mk

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

* freebsd/current/master:
  Fix an omission in a comment

HardenedBSD/hardenedbsd e193753share/man/man4 bridge.4, sys/amd64/amd64 pmap.c

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

* origin/hardened/11-stable/master:
  MFC r324670: Improve assertion that an ignored or blocked signal is not delivered.
  MFC r324669: Style.
  MFC r324665: Fix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().
  MFC r324661: Add Creative vendor ID.
  MFC r324659: Update details of interface capabilities changed by bridge(4).

HardenedBSD/hardenedbsd da51a5fshare/man/man4 bridge.4, sys/amd64/amd64 pmap.c

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

* freebsd/11-stable/master:
  MFC r324670: Improve assertion that an ignored or blocked signal is not delivered.
  MFC r324669: Style.
  MFC r324665: Fix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().
  MFC r324661: Add Creative vendor ID.
  MFC r324659: Update details of interface capabilities changed by bridge(4).

HardenedBSD/hardenedbsd b916159sys/kern kern_sig.c

MFC r324670:
Improve assertion that an ignored or blocked signal is not delivered.

HardenedBSD/hardenedbsd 1354506sys/kern kern_sig.c

MFC r324669:
Style.

HardenedBSD/hardenedbsd 60151aesys/amd64/amd64 pmap.c, sys/amd64/include pmap.h

MFC r324665:
Fix the pv_chunks pc_lru tailq handling in reclaim_pv_chunk().

HardenedBSD/hardenedbsd 57255bashare/mk src.opts.mk

Fix an omission in a comment

Soft float API support applies to armv7 too after r324340

HardenedBSD/hardenedbsd 7fdc453sys/dev/sound/pci/hda hdac.h hdac.c

MFC r324661: Add Creative vendor ID.

HardenedBSD/hardenedbsd 20f2b84share/man/man4 bridge.4

MFC r324659: Update details of interface capabilities changed by bridge(4).

PR:            221122

HardenedBSD/hardenedbsd 5581627sys/boot uboot.mk, sys/boot/arm/uboot Makefile

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

* origin/hardened/current/master:
  Bump WITNESS_PENDLIST to accomodate sleepq chain bump.
  Use preferred defined paths, rather than relative paths in fdt.
  Create a shell script to build sys/boot on all the architectures.
  Use SYSDIR instead of ${.CURDIR}/../..<etc>/sys.
  Use BOOTSRC here.
  Prefer SRCTOP paths for bits we're grabbing from libc.
  Make at91 boot loader compile again.
  End source directories with SRC rather than a hodgepodge of names
  Move fdt and uboot defines into common uboot.mk.

HardenedBSD/hardenedbsd 8c891c0sys/boot uboot.mk, sys/boot/arm/uboot Makefile

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

* freebsd/current/master:
  Bump WITNESS_PENDLIST to accomodate sleepq chain bump.
  Use preferred defined paths, rather than relative paths in fdt.
  Create a shell script to build sys/boot on all the architectures.
  Use SYSDIR instead of ${.CURDIR}/../..<etc>/sys.
  Use BOOTSRC here.
  Prefer SRCTOP paths for bits we're grabbing from libc.
  Make at91 boot loader compile again.
  End source directories with SRC rather than a hodgepodge of names
  Move fdt and uboot defines into common uboot.mk.

HardenedBSD/hardenedbsd 1429e06usr.bin/bsdcat/tests Makefile

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

* origin/hardened/10-stable/master:
  Install missing test input file missed in r324418

HardenedBSD/hardenedbsd 38d7403usr.bin/bsdcat/tests Makefile

Merge remote-tracking branch 'origin/hardened/10-stable/master' into 
hardened/10-stable/master-libressl

* origin/hardened/10-stable/master:
  Install missing test input file missed in r324418

HardenedBSD/hardenedbsd 1cd9036usr.bin/bsdcat/tests Makefile

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

* freebsd/10-stable/master:
  Install missing test input file missed in r324418

HardenedBSD/hardenedbsd fcca532sys/kern subr_witness.c

Bump WITNESS_PENDLIST to accomodate sleepq chain bump.

Reported by:    ngie

HardenedBSD/hardenedbsd 9a320besys/boot/fdt Makefile

Use preferred defined paths, rather than relative paths in fdt.

Sponsored by: Netflix

HardenedBSD/hardenedbsd f006648tools/boot universe.sh

Create a shell script to build sys/boot on all the architectures.

One could run this from any directory, but it's designed to do
regression testing on sys/boot (it only tests on a subset of
architectures since all of them would take a lot longer and not help).
This will also ensure that future commits to sys/boot compile
everywhere.

Sponsored by: Netflix

HardenedBSD/hardenedbsd 37e025esys/boot/geli Makefile, sys/boot/libsa Makefile

Use SYSDIR instead of ${.CURDIR}/../..<etc>/sys.

Sponsored by: Netflix

HardenedBSD/hardenedbsd d4ab563sys/boot/i386 Makefile.inc

Use BOOTSRC here.

sponsored by: Netflix

HardenedBSD/hardenedbsd 98291b9sys/boot/geli Makefile, sys/boot/powerpc/boot1.chrp Makefile

Prefer SRCTOP paths for bits we're grabbing from libc.

Sponsored by: Netflix

HardenedBSD/hardenedbsd 1c88600sys/boot/arm/at91/boot2 boot2.c

Make at91 boot loader compile again.

No clue if it actually still works, but it might.

HardenedBSD/hardenedbsd 51c6162sys/boot defs.mk loader.mk, sys/boot/ficl Makefile

End source directories with SRC rather than a hodgepodge of names

BOOTDIR->BOOTSRC
FICLDIR->FICLSRC
LDR_MI->LDRSRC

This matches the patterns used in the rest of the system a bit vetter.

Suggested by: rgrimes@
Sponsored by: Netflix

HardenedBSD/hardenedbsd ee4a355sys/boot uboot.mk defs.mk, sys/boot/arm/uboot Makefile

Move fdt and uboot defines into common uboot.mk.

Sponsored by: Netflix

HardenedBSD/hardenedbsd 1b781abcddl/contrib/opensolaris/lib/libctf/common ctf.5, libexec/rtld-elf libmap.c

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

* origin/hardened/current/master: (23 commits)
  HBSD: Resolve merge conflict
  Make the sleepq chain hash size configurable per-arch and bump on amd64.
  sdt: make all sdt probe sites test one variable
  Delete declarations of struct pfs_bitmap, removed in r143841.
  sdt: whack unused SDT_PROBE_ENABLED
  libc: Do not refer to _DefaultRuneLocale in ctype inlines
  Address some miscellaneous issues in the CTF man page.
  MFV r323105 (partial): 8300 fix man page issues found by mandoc 1.14.1
  Change kdb_active type to u_char.
  Clean up trailing whitespace in kdb_thr_ctx(..)
  Modernise this man page somewhat.
  Add Prolific PL27A1 USB 3.0 Host-Host device to udbp(4).
  Add OID for the vm.overcommit sysctl. This makes it possible to remove one call to 
sysctl(2) from jemalloc startup code. (That also requires changes to jemalloc, but I plan 
to push those to upstream first.)
  Don't call realpath(3) from libmap rtld code. This gets rid of a few calls to fstatat(2) 
at binary startup; the difference looks like this:
  Remove the support for mknod(S_IFMT), which created dummy vnodes with VBAD type.
  Regenerate src.conf(5) after r324340 (armv7 addition)
  Define LIBSA32 to LIBSA on i386 to fix build.
  Add note to updating about shifting LOADER_*SUPPORT options.

    [4 lines not shown]

HardenedBSD/hardenedbsd bad180ecddl/contrib/opensolaris/lib/libctf/common ctf.5, include runetype.h

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

* freebsd/current/master:
  Make the sleepq chain hash size configurable per-arch and bump on amd64.
  sdt: make all sdt probe sites test one variable
  Delete declarations of struct pfs_bitmap, removed in r143841.
  sdt: whack unused SDT_PROBE_ENABLED
  libc: Do not refer to _DefaultRuneLocale in ctype inlines
  Address some miscellaneous issues in the CTF man page.
  MFV r323105 (partial): 8300 fix man page issues found by mandoc 1.14.1

HardenedBSD/hardenedbsd a9af7b5. ObsoleteFiles.inc, tools/build/mk OptionalObsoleteFiles.inc

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

* origin/hardened/11-stable/master:
  HBSD: clean up LibreSSL related ObsoleteFiles breakage, which will render the system 
into unbootable state

HardenedBSD/hardenedbsd a32eaaashare/man/man5 src.conf.5

HBSD: Resolve merge conflict

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
Sponsored-by:   SoldierX

HardenedBSD/hardenedbsd d229459libexec/rtld-elf libmap.c, share/man/man4 udbp.4

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

Conflicts:
        share/man/man5/src.conf.5 (unresolved)

HardenedBSD/hardenedbsd 700d0d0usr.bin/bsdcat/tests Makefile

Install missing test input file missed in r324418

While here, remove an unnecessary PACKAGE variable definition (only applies to
^/stable/11+).

This is a direct commit to ^/stable/10