FreeBSD/src 351462projects/clang900-import/lib/clang/libllvm Makefile, projects/clang900-import/usr.bin/clang/llvm-mca Makefile

Update build glue for a build of clang plus the extra tools (enabled via
MK_CLANG_EXTRAS).

FreeBSD/src 351461head/sbin/ping ping.c

ping: fix unaligned access to ancillary data

Use CMSG_FIRSTHDR rather than assume that an array is correctly aligned.
Fixes warnings on sparc64 and powerpcspe.

Submitted by:   Ján Sučan <sucanjan at gmail.com>
MFH:           2 weeks
Sponsored by:   Google LLC (Google Summer of Code 2019)
Differential Revision:  https://reviews.freebsd.org/D21406

FreeBSD/src 351460projects/clang900-import/lib/clang/libllvm Makefile

Update build glue for a build of clang plus default base tools (llvm-ar,
llvm-nm, llvm-objdump, llvm-symbolizer).

FreeBSD/src 351459head/usr.bin/last last.c

last(1): correction after r351413

Make that change no-op for C/POSIX locale just like for UTF-8
that it superset of US-ASCII.

MFC after:      2 weeks
X-MFC-With:     r351413

FreeBSD/src 351458head/share/man/man4 nvdimm.4 Makefile

Add nvdimm(4) man page.

Reviewed by:    emaste
Discussed with: scottl, scottph
Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Differential revision:  https://reviews.freebsd.org/D21386

FreeBSD/src 351457head/sys/amd64/amd64 machdep.c pmap.c, head/sys/amd64/include counter.h md_var.h

amd64: rework PCPU allocation

Move pcpu KVA out of .bss into dynamically allocated VA at
pmap_bootstrap().  This avoids demoting superpage mapping .data/.bss.
Also it makes possible to use pmap_qenter() for installation of
domain-local pcpu page on NUMA configs.

Refactor pcpu and IST initialization by moving it to helper functions.

Reviewed by:    markj
Tested by:      pho
Discussed with: jeff
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D21320

FreeBSD/src 351456head/sys/amd64/amd64 mp_machdep.c

Do not constrain allocations for doublefault, boot, and mce stacks.

All these stacks are used only once (doublefault, boot) or very rare
(mce).

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D21320

FreeBSD/src 351455head/sys/amd64/amd64 mp_machdep.c

Style.

FreeBSD/src 351454head/sys/amd64/amd64 mp_machdep.c

Remove unecessary VM_ALLOC_ZERO from allocation of the domain-local
page for pcpu.

Reviewed by:    markj
Tested by:      pho
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D21320

FreeBSD/src 351453head/sys/vm vm_map.c

Make stack grow use the same gap as stack create.

Store stack_guard_page * PAGE_SIZE into the gap->next_read field at
the time of the stack creation.  This makes the used guard size
consistent between stack creation and stack grow time.

Suggested by:   alc
Reviewed by:    alc, markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D21384
DeltaFile
+14-2head/sys/vm/vm_map.c
+14-21 files

FreeBSD/src 351452head/sys/dts/arm/overlays sun8i-h3-ths.dtso sun8i-h3-sid.dtso, head/sys/modules/dtb/allwinner Makefile

dtso: allwinner: Add an overlay for H3 thermal node

Reviewed by:    manu

FreeBSD/src 351451stable 12, stable/12/lib/libthr/thread thr_cancel.c thr_init.c

MFC r351349:
Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.

PR:     240022

FreeBSD/src 351450head/tests/sys/netpfil/common pass_block.sh, head/tests/sys/netpfil/pf pass_block.sh

Fix failure test cases after r351423 due to ping6(8) options changed

Failure test cases:
    sys.netpfil.common.pass_block.pf_v6
    sys.netpfil.pf.pass_block.noalias
    sys.netpfil.pf.pass_block.v6

Sponsored by:   The FreeBSD Foundation

FreeBSD/src 351449stable 12 11, stable/11/sys/amd64/amd64 pmap.c

MFC 350551:
Don't reset memory attributes when mapping physical addresses for ACPI.

Previously, AcpiOsMemory was using pmap_mapbios which would always map
the requested address Write-Back (WB).  For several AMD Ryzen laptops,
the BIOS uses AcpiOsMemory to directly access the PCI MCFG region in
order to access PCI config registers.  This has the side effect of
remapping the MCFG region in the direct map as WB instead of UC
hanging the laptops during boot.

On the one laptop I examined in detail, the _PIC global method used to
switch from 8259A PICs to I/O APICs uses a pair of PCI config space
registers at offset 0x84 in the device at 0:0:0 to as a pair of
address/data registers to access an indirect register in the chipset
and clear a single bit to switch modes.

To fix, alter the semantics of pmap_mapbios() such that it does not
modify the attributes of any existing mappings and instead uses the
existing attributes.  If a new mapping is created, this new mapping
uses WB (the default memory attribute).

Special thanks to the gentleman whose name I don't have who brought
two affected laptops to the hacker lounge at BSDCan.  Direct access to
the affected systems permitted finding the root cause within an hour
or so.

    [2 lines not shown]

FreeBSD/src 351448head/sys/kern subr_pcpu.c, head/sys/vm uma.h

Remove the obsolete pcpu_zone_ptr zone.

It was only used by flowtable (removed in r321618).

Sponsored by:   The FreeBSD Foundation

FreeBSD/src 351447head/sys/dev/nvme nvme.c nvme_ahci.c

It turns out the duplication is only mostly harmless.

While it worked with the kenrel, it wasn't working with the loader.
It failed to handle dependencies correctly. The reason for that is
that we never created a nvme module with the DRIVER_MODULE, but
instead a nvme_pci and nvme_ahci module. Create a real nvme module
that nvd can be dependent on so it can import the nvme symbols it
needs from there.

Arguably, nvd should just be a simple child of nvme, but transitioning
to that (and winning that argument given why it was done this way) is
beyond the scope of this change.

Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D21382

FreeBSD/src 351446head/sys/dev/cxgbe/tom t4_listen.c

cxgbe/t4_tom: Any invalid scaling factor in the hardware's wsf field
implies that window scaling is not in use.

MFC after:      3 days
Sponsored by:   Chelsio Communications

FreeBSD/src 351445head/sys/dev/cxgbe/tom t4_listen.c

whitespace nit.

FreeBSD/src 351444head/sys/dev/cxgbe t4_sge.c

cxgbe(4): Use the same buffer size for TOE rx queues as the NIC rx queues.

This is a minor simplification.

MFC after:      1 week
Sponsored by:   Chelsio Communications

FreeBSD/src 351443projects/clang900-import/lib/clang llvm.build.mk, projects/clang900-import/lib/clang/libclang Makefile

Update build glue for a minimal build of the clang executable.

FreeBSD/src 351442projects/clang900-import/lib/clang/include/clang/Basic Version.inc, projects/clang900-import/lib/clang/include/lld/Common Version.inc

Regenerate config and version headers.

FreeBSD/src 351441projects/clang900-import/etc/mtree BSD.debug.dist BSD.usr.dist, projects/clang900-import/lib/clang/headers Makefile

Change clang lib dir to 9.0.0.

FreeBSD/src 351440head/sbin/ping ping.c

ping: Fix alignment errors

This fixes -Wcast-align errors when compiled with WARNS=6.

Submitted by:   Ján Sučan <sucanjan at gmail.com>
MFC after:      2 weeks
Sponsored by:   Google LLC (Google Summer of Code 2019)
Differential Revision:  https://reviews.freebsd.org/D21327
DeltaFile
+104-98head/sbin/ping/ping.c
+104-981 files

FreeBSD/src 351439stable 11, stable/11/sys/amd64/amd64 pmap.c

MFC 339432: Do not flush cache for PCIe config window.

Apparently AMD machines cannot tolerate this. This was uncovered by
r339386, where cache flush started really flushing the requested range.

Introduce pmap_mapdev_pciecfg(), which simply does not flush cache
comparing with pmap_mapdev().  It assumes that the MCFG region was
never accessed through the cacheable mapping, which is most likely
true for machine to boot at all.

Note that i386 does not need the change, since the architecture
handles access per-page due to the KVA shortage, and page remapping
already does not flush the cache.

MFC note: 339386 has not been MFC'd to 11, but merging this change
should still be fine for 11 and reduces conflicts in MFCs of other
changes.

FreeBSD/src 351438head/sys/sys mount.h

vfs: assert the lock held in MNT_REF/MNT_REL

Sponsored by:   The FreeBSD Foundation

FreeBSD/src 351437head/sys/vm vm_page.c

Stop clearing page flags in vm_page_pqbatch_submit().

All existing callers guarantee that the page does not have a
pre-existing dequeue pending.  Thus, if the page is dequeued before
pqbatch_submit() acquires the page queue lock, we do not need to do
anything since vm_page_dequeue_complete() takes care of clearing all
page queue state flags for us.

With this change, vm_page_pqbatch_submit() has the nice property that it
does not directly modify any fields in the page structure.

Reviewed by:    alc, kib
Tested by:      pho (part of a larger change)
MFC after:      1 week
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D21372

FreeBSD/src 351436head/sys/vm vm_page.c vm_page.h

Make vm_pqbatch_submit_page() externally visible.

It will become useful for the page daemon to be able to directly create
a batch queue entry for a page, and without modifying the page
structure.  Rename vm_pqbatch_submit_page() to vm_page_pqbatch_submit()
to keep the namespace consistent.  No functional change intended.

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

FreeBSD/src 351435head/sys/kern vfs_mount.c vfs_subr.c, head/sys/sys mount.h

De-commision the MNTK_NOINSMNTQ kernel mount flag.

After all the changes, its dynamic scope is same as for MNTK_UNMOUNT,
but to allow the syncer vnode to be re-installed on unmount failure.
But the case of syncer was already handled by using the VV_FORCEINSMQ
flag for quite some time.

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

FreeBSD/src 351434head/sys/conf makeLINT.mk

Fix universe to include arm LINT kernel configs.

Strip comments from the NOTES.armv[57] files as is done for other
NOTES files when building the corresponding LINT configs.  Without
this, the LINT configs contained the NO_UNIVERSE comment from the
NOTES.armv[57] files.

Reviewed by:    imp
MFC after:      1 week
Sponsored by:   Netflix
Differential Revision:  https://reviews.freebsd.org/D21264

FreeBSD/src 351433stable 11, stable/11/contrib/telnet/telnetd telnetd.c

MFC r331074 (cem): telnetd(8): Fix dereference of uninitialized value 'IF'

Reported by:    Coverity

FreeBSD/src 351432stable/11/contrib/telnet/libtelnet auth-proto.h auth.c

MFC r351070: telnet: remove 3rd clause from Berkeley copyrights

Per the July 22, 1999 letter (in /COPYRIGHT) from
William Hoskins
Director, Office of Technology Licensing
University of California, Berkeley

FreeBSD/src 351431stable/12/contrib/telnet/arpa telnet.h, stable/12/contrib/telnet/libtelnet auth-proto.h auth.c

MFC r351070: telnet: remove 3rd clause from Berkeley copyrights

Per the July 22, 1999 letter (in /COPYRIGHT) from
William Hoskins
Director, Office of Technology Licensing
University of California, Berkeley

FreeBSD/src 351430head/share/mk bsd.sys.mk

Turn off -Werror for gcc 4.2.1 for userland

As discussed on arch@, gcc 4.2.1 is on its way out. Turn off Werror on gcc
versions < 5.0 permantly. This will allow older platforms to continue to compile
w/o new errors once we take them out of universe by default. This will also free
developers from chasing down obsolete warnings that produce no beneficial
changes to the source.

Discussed on: arch@
Reviewed by: jhb@, emaste@, pfg@
Differential Revision: https://reviews.freebsd.org/D21378

FreeBSD/src 351429head/sys/conf kern.pre.mk kmod.mk

Turn off -Werror for gcc 4.2.1

As part of marching gcc 4.2.1 out of the tree, turn off -Werror on gcc 4.2.1
compiles by default. It generates too many false positives and breaks CI
for no benefit.

Discussed on: arch@
Reviewed by: jhb@, emaste@, pfg@
Differential Revision: https://reviews.freebsd.org/D21378

FreeBSD/src 351428stable 11, stable/11/usr.bin/vtfontcvt vtfontcvt.c

vtfontcvt: improve BDF and hex font parsing

MFC r348661: vtfontcvt: rework height/width setting

Introduce VFNT_MAXDIMENSION to replace bare 128, add set_height, and
consistently use set_height and set_width.

Submitted by:   Dmitry Wagin

MFC r348662: vtfontcvt: include width and height in verbose info

Submitted by:   Dmitry Wagin

MFC r348668: vtfontcvt: zero memory allocated by xmalloc

Submitted by:   Dmitry Wagin

MFC r348692: vtfontcvt: exit on error if the input font has too many glyphs

The kernel has a limit of 131072 glyphs in a font; add the same check to
vtfontcvt so that we won't create a font file that the kernel will not
load.

MFC r348796: vtfontcvt: allow out-of-order glyphs


    [46 lines not shown]

FreeBSD/src 351427stable 11, stable/11/usr.bin/vtfontcvt vtfontcvt.c

MFC r305815: vtfontcvt: remove superfluous newlines in errx messages

FreeBSD/src 351426stable 12, stable/12/usr.bin/vtfontcvt vtfontcvt.c

vtfontcvt: improve BDF and hex font parsing

MFC r348661: vtfontcvt: rework height/width setting

Introduce VFNT_MAXDIMENSION to replace bare 128, add set_height, and
consistently use set_height and set_width.

Submitted by:   Dmitry Wagin

MFC r348662: vtfontcvt: include width and height in verbose info

Submitted by:   Dmitry Wagin

MFC r348668: vtfontcvt: zero memory allocated by xmalloc

Submitted by:   Dmitry Wagin

MFC r348692: vtfontcvt: exit on error if the input font has too many glyphs

The kernel has a limit of 131072 glyphs in a font; add the same check to
vtfontcvt so that we won't create a font file that the kernel will not
load.

MFC r348796: vtfontcvt: allow out-of-order glyphs


    [46 lines not shown]

FreeBSD/src 351425head/usr.bin/vtfontcvt vtfontcvt.c

vtfontcvt: simplify rshift_row

We don't need to specify the buffer size in both bytes and bits.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

FreeBSD/src 351424head/sbin/ping utils.h

ping: fix include guard symbol name to reflect the header file name

Submitted by:   Ján Sučan <sucanjan at gmail.com>
MFC after:      2 weeks
MFC-With:       351171
Sponsored by:   Google LLC (Google Summer of Code 2019)
Differential Revision:  https://reviews.freebsd.org/D21374

FreeBSD/src 351423head UPDATING, head/sbin/ping6 ping6.8 ping6.c

ping6: Rename options for better consistency with ping

Now equivalent options have the same flags, and nonequivalent options have
different flags.  This is a prelude to merging the two commands.

Submitted by:   Ján Sučan <sucanjan at gmail.com>
MFC:           Never
Sponsored by:   Google LLC (Google Summer of Code 2019)
Differential Revision:  https://reviews.freebsd.org/D21345

FreeBSD/src 351422head/usr.sbin/pciconf cap.c

Report Clock Power Management support and status.

Since we already report ASPM, why not to go further.

MFC after:      2 weeks
Sponsored by:   iXsystems, Inc.

FreeBSD/src 351421head/tests/sys/netpfil/common forward.sh Makefile

netpfil tests: Add forward test for the three firewalls

Submitted by:   Ahsan Barkati
Reviewed by:    kp
Sponsored by:   Google, Inc. (GSoC 2019)
Differential Revision:  https://reviews.freebsd.org/D21321

FreeBSD/src 351420stable 11, stable/11/sys/netinet tcp_input.c

MFC r350974:
  Save ip_ttl value and restore it after checksum calculation.

  Since ipvoly is used for checksum calculation, part of original IP
  header is zeroed. This part includes ip_ttl field, that can be used
  later in IP_MINTTL socket option handling.

  PR:           239799

FreeBSD/src 351419stable 12, stable/12/sys/netinet tcp_input.c

MFC r350974:
  Since ipvoly is used for checksum calculation, part of original IP
  header is zeroed. This part includes ip_ttl field, that can be used
  later in IP_MINTTL socket option handling.

  PR:          239799

FreeBSD/src 351418head/sys/netgraph ng_deflate.c

Convert ng_deflate to use new zlib.

This removes the last consumer of the modified zlib originally
bundled with Paul's PPP implementation, which will be removed
in a follow up commit.

PR:                   229763
Differential Revision:  https://reviews.freebsd.org/D21186

FreeBSD/src 351417head/sys/kern kern_mutex.c

INVARIANTS: treat LA_LOCKED as the same of LA_XLOCKED in mtx_assert.

The Linux lockdep API assumes LA_LOCKED semantic in lockdep_assert_held(),
meaning that either a shared lock or write lock is Ok.  On the other hand,
the timeout code uses lc_assert() with LA_XLOCKED, and we need both to
work.

For mutexes, because they can not be shared (this is unique among all lock
classes, and it is unlikely that we would add new lock class anytime soon),
it is easier to simply extend mtx_assert to handle LA_LOCKED there, despite
the change itself can be viewed as a slight abstraction violation.

Reviewed by:    mjg, cem, jhb
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D21362

FreeBSD/src 351416head/lib/libc/tests/gen getmntinfo_test.c

lib.libc.gen.getmntinfo_test.getmntinfo_test is unstable since 8/20, skip it
in CI env temporarily for more offline diagnosis

PR:            240049
Sponsored by:   The FreeBSD Foundation

FreeBSD/src 351415head/usr.sbin/makefs msdos.c msdos.h, head/usr.sbin/makefs/msdos msdosfs_vfsops.c

Properly update FSInfo block after generation.

After populating the filesystem, write a FSInfo block with
proper information.

Reviewed by:    emaste, cem
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D21363

FreeBSD/src 351414user/pho/stress2/misc gnop7.sh

Added a test scenario for "recovering from disk failures".

Sponsored by:   Dell EMC Isilon

FreeBSD/src 351413head/usr.bin/last last.c

last(1): unbreak for 8-bit locales

Ouput format of last(1) is broken for non UTF-8 locales
since it got libxo(3) support. It uses strftime(3) that produces
non UTF-8 strings passed to xo_emit(3) with wrong %s format -
it should be %hs in this case, so xo_emit(3) produces empty output.

This change is basically no-op when locale is of UTF-8 type,
f.e. en_GB.UTF-8 or ru_RU.UTF-8 or sr_RS.UTF-8 at latin.
It fixes output for other locales.

MFC after:      2 weeks