SVNews

NOTE: This service is experimental and subject to change! Use at your own risk!

Year:   Month: - or - Filter committers: - or -
Filter paths:
Include diffs if smaller than lines.

2018 - 01 - 19   (today)
20:33:47 - r328171
( 31 minutes ago)
by ae
Affects:  /head/contrib/bsnmp/snmpd/action.c
/head/contrib/bsnmp/snmpd/main.c
Rename "index" variable to "idx" since gcc complains that it shadows
index(3) function declaration.

Reported by: lwhsu
MFC after: 2 weeks
19:18:14 - r328170
(1 hour 47 minutes ago)
by scottl
Affects:  /head/sys/cam/mmc/mmc_xpt.c
Fix compile errors in r328165

Reported by: O. Hartmann
Sponsored by: Netflix
19:09:17 - r328169
(1 hour 56 minutes ago)
by imp
Affects:  /head/stand/efi/loader/arch/i386/bootinfo.c
Remove extra copy of bootinfo.c. It's a bit rotted copy of the one in
efi/loader.

Differential Review: https://reviews.freebsd.org/D13986
17:46:31 - r328168
(3 hours 19 minutes ago)
by nwhitehorn
Affects: 
(13 files)
/head/sys/*
Remove SFBUF_OPTIONAL_DIRECT_MAP and such hacks, replacing them across the
kernel by PHYS_TO_DMAP() as previously present on amd64, arm64, riscv, and
powerpc64. This introduces a new MI macro (PMAP_HAS_DMAP) that can be
evaluated at runtime to determine if the architecture has a direct map;
if it does not (or does) unconditionally and PMAP_HAS_DMAP is either 0 or
1, the compiler can remove the conditional logic.

As part of this, implement PHYS_TO_DMAP() on sparc64 and mips64, which had
similar things but spelled differently. 32-bit MIPS has a partial direct-map
that maps poorly to this concept and is unchanged.

Reviewed by: kib
Suggestions from: marius, alc, kib
Runtime tested on: amd64, powerpc64, powerpc, mips64
16:06:52 - r328167
(4 hours 58 minutes ago)
by mav
Affects: 
(2 files)
/stable/11/sys/dev/aac/aac.c
MFC r323317 (by scottl): Move the intrhook release to later in the function
so that GEOM knows to wait longer for possible root devices to come online.
This fixes a race that seems to be triggered by EARLY_AP_STARTUP.

Submitted by: cgull@glup.org
15:42:34 - r328166
(5 hours 23 minutes ago)
by emaste
Affects:  /head/sys/amd64/amd64/machdep.c
/head/sys/x86/include/x86_var.h
/head/sys/x86/x86/identcpu.c
Enable KPTI by default on amd64 for non-AMD CPUs

Kernel Page Table Isolation (KPTI) was introduced in r328083 as a
mitigation for the 'Meltdown' vulnerability. AMD CPUs are not affected,
per https://www.amd.com/en/corporate/speculative-execution:

  We believe AMD processors are not susceptible due to our use of
  privilege level protections within paging architecture and no
  mitigation is required.

Thus default KPTI to off for AMD CPUs, and to on for others. This may
be refined later as we obtain more specific information on the sets of
CPUs that are and are not affected.

Submitted by: Mitchell Horne
Reviewed by: cem
Relnotes: Yes
Security: CVE-2017-5754
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13971
15:32:27 - r328165
(5 hours 33 minutes ago)
by scottl
Affects: 
(4 files)
/head/sbin/camcontrol/camcontrol.c
/head/sys/cam/*
Revert ABI breakage to CAM that came in with MMC/SD support in r320844.
Make it possible to retrieve mmc parameters via the XPT_GET_ADVINFO
call instead. Convert camcontrol to the new scheme.

Reviewed by: imp. kibab
Sponsored by: Netflix
Differential Revision: D13868
14:50:53 - r328164
(6 hours 14 minutes ago)
by pfg
Affects:  /head/sys/contrib/libnv/nv_impl.h
libnv: Use mallocarray(9) for the nv_calloc.
13:06:36 - r328163
(7 hours 58 minutes ago)
by hselasky
Affects:  /head/sys/dev/usb/serial/u3g.c
/head/sys/dev/usb/usbdevs
Add new USB ID to U3G driver.

PR: 134299
MFC after: 1 week
Sponsored by: Mellanox Technologies
12:59:14 - r328162
(8 hours 6 minutes ago)
by hselasky
Affects:  /head/sys/dev/usb/net/if_cdce.c
/head/sys/dev/usb/serial/u3g.c
/head/sys/dev/usb/serial/umodem.c
Improve support for USB based 3G/4G/5G dongles from Huawei.

PR: 192345
Sponsored by: Mellanox Technologies
12:50:03 - r328161
(8 hours 15 minutes ago)
by ae
Affects:  /head/sys/netpfil/ipfw/ip_fw2.c
/head/sys/netpfil/ipfw/ip_fw_dynamic.c
/head/sys/netpfil/ipfw/ip_fw_log.c
Add UDPLite support to ipfw(4).

Now it is possible to use UDPLite's port numbers in rules,
create dynamic states for UDPLite packets and see "UDPLite" for matched
packets in log.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC
08:48:14 - r328160
(12 hours 17 minutes ago)
by ae
Affects: 
(6 files)
/head/contrib/bsnmp/snmpd/*
Add to bsnmpd(1) ability to specify multiple community strings with
different access rights.

By default there are two community strings with index 1 and 2, one for
read-only access and second for read-write access:

  begemotSnmpdCommunityString.0.1 = $(read)
  begemotSnmpdCommunityString.0.2 = $(write)

Now it is possible to define additional community strings using different
indexes:

  begemotSnmpdCommunityString.0.3 = "SomeString1"
  begemotSnmpdCommunityPermission.0.3 = 1
  begemotSnmpdCommunityString.0.4 = "SomeString2"
  begemotSnmpdCommunityPermission.0.4 = 2
  begemotSnmpdCommunityString.0.5 = "SomeString3"
  begemotSnmpdCommunityString.0.6 = "SomeString4"

New attribute begemotSnmpdCommunityPermission can be used to specify access
rights: 1 means "read-only" access, 2 means "read-write" access. If
attribute is not specified for some index this means "read-only" rights.

Community strings must be unique, i.e. must not be the same for different
indexes.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D13785
04:34:06 - r328159
(16 hours 31 minutes ago)
by cem
Affects:  /head/sys/modules/Makefile
Unbreak i386 build

The logical result of a right shift >= the width of a type is zero, but our
compiler decides this is a warning (and thus, error). Just remove ccp(4)
from i386.

Reported by: cy
Sponsored by: Dell EMC Isilon
01:36:25 - r328158
(19 hours 29 minutes ago)
by jhb
Affects:  /head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
Recognize mchk_calltrap as a trapframe generator.

Should have been included in r328157.
2018 - 01 - 18   (yesterday)
23:50:21 - r328157
(21 hours 15 minutes ago)
by jhb
Affects: 
(7 files)
/head/sys/amd64/amd64/*
/head/sys/amd64/include/intr_machdep.h
Use a dedicated per-CPU stack for machine check exceptions.

Similar to NMIs, machine check exceptions can fire at any time and are
not masked by IF. This means that machine checks can fire when the
kstack is too deep to hold a trap frame, or at critical sections in
trap handlers when a user %gs is used with a kernel %cs. Use the same
strategy used for NMIs of using a dedicated per-CPU stack configured
in IST 3. Store the CPU's pcpu pointer at the stop of the stack so
that the machine check handler can reliably find the proper value for
%gs (also borrowed from NMIs).

This should also fix a similar issue with PTI with a MC# occurring
while the CPU is executing on the trampoline stack.

While here, bypass trap() entirely and just call mca_intr(). This
avoids a bogus call to kdb_reenter() (there's no reason to try to
reenter kdb if a MC# is raised).

Reviewed by: kib
Tested by: avg (on AMD without PTI)
Differential Revision: https://reviews.freebsd.org/D13962
22:46:47 - r328156
(22 hours 18 minutes ago)
by kevans
Affects:  /head/stand/arm/uboot/ldscript.arm
/head/stand/efi/loader/arch/arm/ldscript.arm
stand: Move sections around to fix stand/ build with ld.lld on armv7

When building loader bits, lld fails with the following error:
"ld: error: section: .dynamic is not contiguous with other relro sections"
on both ubldr and EFI loader.

Move .dynamic up to make ld.lld happy, adjust .got as necessary for ubldr.

Tested on: OrangePi One (ld.lld, ubldr)
Tested on: Banana Pi-M3 (ld.lld, ubldr)
Tested on: qemu-armv7 (ld.lld, EFI)
Tested on: qemu-armv7 (ld.bfd, EFI)
Tested on: Raspberry Pi 2 (ld.bfd, ubldr) [manu]
Tested on: Banana Pi-M2 (ld.bfd, ubldr) [manu]
Reviewed by: andrew, emaste, imp
Differential Revision: https://reviews.freebsd.org/D13942
22:23:16 - r328155
(22 hours 42 minutes ago)
by imp
Affects:  /head/share/man/man9/style.9
No need for the zero width space now that I put the comma in.
22:20:30 - r328154
(22 hours 45 minutes ago)
by imp
Affects:  /head/share/man/man9/style.9
Make igor happier with this file:
o Don't use contractions.
o Add common after e.g. where needed
22:13:53 - r328153
(22 hours 51 minutes ago)
by jhb
Affects:  /head/sys/amd64/amd64/exception.S
Remove two no-longer-used labels from the NMI interrupt handler.

Reviewed by: kib
22:13:31 - r328152
(22 hours 52 minutes ago)
by kevans
Affects: 
(2 files)
/stable/11/lib/libc/regex/engine.c
MFC r322288: regex(3): Refactor fast/slow stepping bits in matching engine

Adding features for matching is fairly straightforward, but this requires
some duplication because of this fast/slow setup. They can be fairly
trivially combined into a single walk(), so do it to make future additions
less error prone.
22:10:00 - r328151
(22 hours 55 minutes ago)
by kevans
Affects: 
(3 files)
/stable/11/lib/libc/regex/regcomp.c
/stable/11/lib/libc/regex/regex2.h
MFC r320742, r320750, r320796: Refactor regex(3) for maintainability

MFC r320742:
The impending libregex will implement GNU extensions to bring BREs and
EREs closer together. Prepare for this and reduce the diff of libregex
changes by refactoring and combining the top-level parsers for EREs/BREs
ahead of time.

Branching functionality has been split out to make it easier to follow the
combined version of the top-level parser. It may also be enabled in the
parsing context to make it easier when libregex enables branching for BREs.

A branching context was also added for the various branching functions and
so that BREs, for instance, can determine if they're the first expression in
a chain of expressions within the current branch and treat '*' as ordinary
if so.

This should have no functional impact and negligible performance impact.

MFC r320750: Fix sparc64 libc build after r320742.

p_branch_empty was declared but never used due to an oversight. Use it as
designed, further comment on its return value.

MFC r320796:
Correctly ignore branch operators in the top-level parser when applicable.

An oversight in r320742 caused BREs to become sensitive to the branching
operator prematurely, which caused breakage in some limited situations --
namely, those that tried to use branching in a BRE. Most of these scenarios
had already been corrected beforehand to properly use gsed or grep for GNU
extensions, so the damage is slightly mitigated.
22:01:30 - r328150
(23 hours 4 minutes ago)
by cem
Affects: 
(11 files)
/head/sys/crypto/ccp/*
/head/sys/modules/*
/head/tests/sys/opencrypto/cryptotest.py
Add ccp(4): experimental driver for AMD Crypto Co-Processor

* Registers TRNG source for random(4)
* Finds available queues, LSBs; allocates static objects
* Allocates a shared MSI-X for all queues. The hardware does not have
  separate interrupts per queue. Working interrupt mode driver.
* Computes SHA hashes, HMAC. Passes cryptotest.py, cryptocheck tests.
* Does AES-CBC, CTR mode, and XTS. cryptotest.py and cryptocheck pass.
* Support for "authenc" (AES + HMAC). (SHA1 seems to result in
  "unaligned" cleartext inputs from cryptocheck -- which the engine
  cannot handle. SHA2 seems to work fine.)
* GCM passes for block-multiple AAD, input lengths

Largely based on ccr(4), part of cxgbe(4).

Rough performance averages on AMD Ryzen 1950X (4kB buffer):
aesni: SHA1: ~8300 Mb/s SHA256: ~8000 Mb/s
ccp: ~630 Mb/s SHA256: ~660 Mb/s SHA512: ~700 Mb/s
cryptosoft: ~1800 Mb/s SHA256: ~1800 Mb/s SHA512: ~2700 Mb/s

As you can see, performance is poor in comparison to aesni(4) and even
cryptosoft (due to high setup cost). At a larger buffer size (128kB),
throughput is a little better (but still worse than aesni(4)):

aesni: SHA1:~10400 Mb/s SHA256: ~9950 Mb/s
ccp: ~2200 Mb/s SHA256: ~2600 Mb/s SHA512: ~3800 Mb/s
cryptosoft: ~1750 Mb/s SHA256: ~1800 Mb/s SHA512: ~2700 Mb/s

AES performance has a similar story:

aesni: 4kB: ~11250 Mb/s 128kB: ~11250 Mb/s
ccp: ~350 Mb/s 128kB: ~4600 Mb/s
cryptosoft: ~1750 Mb/s 128kB: ~1700 Mb/s

This driver is EXPERIMENTAL. You should verify cryptographic results on
typical and corner case inputs from your application against a known- good
implementation.

Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12723
21:59:13 - r328149
(23 hours 6 minutes ago)
by kevans
Affects: 
(2 files)
/stable/11/usr.bin/hexdump/display.c
MFC r327567: hexdump(1): Speed up -s flag on devices

Using the -s flag on devices is extraordinarily slow due to using fseek(3) a
little too conservatively. Address this by using fseek on character/block
devices as well, falling back to getchar(3) only if we fail to seek or we're
operating on tape drives, where fseek may succeed while not actually being
supported.

PR: 86485
21:53:07 - r328148
(23 hours 12 minutes ago)
by kevans
Affects: 
(2 files)
/stable/11/usr.bin/patch/patch.c
MFC r326084: patch(1): don't assume match if we run out of context to check

Patches with very little context (-U0 and -U1) could get misapplied if
the file to be patched changes and a hunk is no longer applicable. Matching
with fuzz would be attempted and default to a match when we unexpectedly ran
out of context.

This also affected patches with higher levels of context but had limited
actual context due to the hunk being located near the beginning/end of file.

PR: 74127
21:46:42 - r328147
(23 hours 18 minutes ago)
by kevans
Affects: 
(2 files)
/stable/11/usr.bin/patch/pch.c
MFC r324431: patch(1): Don't overrun line buffer in some cases

Patches like file.txt attached to PR 190195 with a final line formed
like ">(EOL)" could cause a copy past the end of the current line buffer. In
the case of PR 191641, this caused a duplicate line to be copied into the
resulting file.

Instead of running past the end, treat it as if it were a blank line.

PR: 191641
21:46:09 - r328146
(23 hours 19 minutes ago)
by dim
Affects:  /head/contrib/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
Pull in r322106 from upstream llvm trunk (by Alexey Bataev):

  [COST]Fix PR35865: Fix cost model evaluation for shuffle on X86.

  Summary:
  If the vector type is transformed to non-vector single type, the
  compile may crash trying to get vector information about non-vector
  type.

  Reviewers: RKSimon, spatel, mkuper, hfinkel

  Subscribers: llvm-commits

  Differential Revision: https://reviews.llvm.org/D41862

This should fix "Not a vector MVT!" errors when building the
games/dhewm3 port.

Reported by: jbeich
PR: 225271
21:44:07 - r328145
(23 hours 21 minutes ago)
by dim
Affects:  /head/contrib/llvm/lib/Analysis/ValueTracking.cpp
Pull in r322016 from upstream llvm trunk (by Sanjay Patel):

  [ValueTracking] remove overzealous assert

  The test is derived from a failing fuzz test:
  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5008

  Credit to @rksimon for pointing out the problem.

This should fix "Bad flavor while matching min/max" errors when building
the graphics/libsixel and science/kst2 ports.

Reported by: jbeich
PR: 225268, 225269
21:39:59 - r328144
(23 hours 25 minutes ago)
by emaste
Affects:  /head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp
lld: Fix incorrect physical address on self-referencing AT command.

When a section placement (AT) command references the section itself,
the physical address of the section in the ELF header was calculated
incorrectly due to alignment happening right after the location
pointer's value was captured.

The problem was diagnosed and the first version of the patch written
by Erick Reyes.

Obtained from: LLVM r322421 by Rafael Espindola
21:39:19 - r328143
(23 hours 26 minutes ago)
by emaste
Affects:  /head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp
lld: Handle parsing AT(ADDR(.foo-bar)).

The problem we had with it is that anything inside an AT is an
expression, so we failed to parse the section name because of the - in
it.

Requested by: royger
Obtained from: LLVM r322801 by Rafael Espindola
21:39:03 - r328142
(23 hours 26 minutes ago)
by kevans
Affects: 
(3 files)
/stable/11/lib/libusb/libusb.h
/stable/11/lib/libusb/libusb10_desc.c
MFC r322322: Expose device caps as libusb_bos_descriptor::dev_capability

Some libusb consumers in Linux-land (in this case, libusb4java) expect a
dev_capability member that they can use to enumerate the device
capabilities.

No particular layout is expected of this, just that it can be traversed
using the bLength member until bNumDeviceCapabilities are read and that the
consumer may then use one of the libusb_get_*_descriptor methods to extract
specific (usb 2.0 vs. ss) capability information.
21:38:21 - r328141
(23 hours 27 minutes ago)
by emaste
Affects:  /head/contrib/llvm/tools/lld/ELF/LinkerScript.cpp
/head/contrib/llvm/tools/lld/ELF/OutputSections.h
/head/contrib/llvm/tools/lld/ELF/ScriptParser.cpp
lld: Fix for ld.lld does not accept "AT" syntax for declaring LMA region

AT> lma_region expression allows to specify the memory region
for section load address.

Should fix [upstream LLVM] PR35684.

LLVM review: https://reviews.llvm.org/D41397

Obtained from: LLVM r322359 by George Rimar
21:35:18 - r328140
(23 hours 30 minutes ago)
by kevans
Affects: 
(3 files)
/stable/11/bin/df/df.1
/stable/11/bin/df/df.c
MFC r322293: df(1): Add --si as an alias for -H
21:32:50 - r328139
(23 hours 32 minutes ago)
by kevans
Affects: 
(4 files)
/stable/11/usr.bin/du/du.1
/stable/11/usr.bin/du/du.c
/stable/11/usr.bin/du/tests/du_test.sh
MFC r322291: du(1): Add --si option to display in terms of powers of 1000
21:29:47 - r328138
(23 hours 35 minutes ago)
by kevans
Affects: 
(3 files)
/stable/11/usr.bin/indent/indent.1
/stable/11/usr.bin/indent/indent.c
MFC r322177: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)

Instead of using a non-configurable ".BAK" suffix, respect the
SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This
simplifies cleanup operations in some patch/indent workflows.
21:19:57 - r328137
(23 hours 45 minutes ago)
by cem
Affects:  /head/sys/sys/elf_common.h
Add Elf_Nhdr definition to match NetBSD, OpenBSD, Linux

The mesa port started to use this type and fails to build without it.

NetBSD:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/exec_elf.h.diff?r1=1.26&r2=1.27&f=h
OpenBSD:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/exec_elf.h.diff?r1=1.21&r2=1.22&f=h

PR: 225302
Reported by: Greg V <greg AT unrelenting.technology>
Sponsored by: Dell EMC Isilon
20:45:41 - r328136
(1 day ago)
by brd
Affects:  /head/etc/defaults/rc.conf
/head/etc/rc.d/resolv
Teach the resolv startup script to respect its enable flag.

Reviewed by: will, imp
Approved by: imp
20:12:12 - r328135
(1 day ago)
by jhb
Affects:  /head/sys/amd64/amd64/exception.S
Adjust branch target in NMI handler for the !PTI case.

In the !PTI case the NMI handler jumped past the instructions that set
%rdi to point to the current PCB, but the target instructions assumed %rdi
were set.

Reviewed by: kib
Tested by: pho
19:43:02 - r328134
(1 day 1 hour ago)
by jhb
Affects:  /head/sys/sys/vmmeter.h
/head/usr.bin/vmstat/vmstat.8
Update various statements in vmstat(8) to match reality.

- The process stats are actually thread counts rather than process
  counts.
- Simplify various descriptions to remove mention of stats that are
  updated every 5 seconds (all VM related stats are now "instant",
  only the load average is updated every 5 seconds).
- Don't make any mention of special treatment for processes that have
  been active in the last 20 seconds. We don't track that stat.
- Rework the description of active virtual memory. Call it mapped
  virtual memory and explicitly point out it is not the same as the
  active page queue (which corresponds to "Active" in top(1)), and
  also hint at the possible bogusness of the value (e.g. if a process
  maps a single page out of a multiple GB file, the entire file's size
  is considered mapped).
- Simplify a few descriptions that implied their output was a value
  per interval. All of the "rate" values are per-second rates scaled
  across the interval.
- Update a few comments for 'struct vmtotal' along similar lines.

Reported by: mwlucas (indirectly)
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13905
18:19:31 - r328133
(1 day 2 hours ago)
by br
Affects:  /head/sys/dev/uart/uart_dev_msm.h
UART Clock Selection Register holds a divider value for a supplied clock,
not a final baud rate. The value for this register has to be calculated.

Sponsored by: DARPA, AFRL
17:43:32 - r328132
(1 day 3 hours ago)
by br
Affects:  /head/sys/dev/uart/uart_dev_msm.c
/head/sys/dev/uart/uart_dev_msm.h
Support for UART device found in Qualcomm Snapdragon 410E SoC.

Tested on DragonBoard 410c.

Reviewed by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13972
16:22:05 - r328131
(1 day 4 hours ago)
by pho
Affects:  /user/pho/stress2/misc/crossmp10.sh
Added a new test scenario.

Sponsored by: Dell EMC Isilon
16:20:09 - r328130
(1 day 4 hours ago)
by br
Affects:  /head/sys/arm64/arm64/machdep.c
Set the base address of translation table 0.

This fixes operation on Qualcomm Snapdragon and some other platforms.

During boot time on subsystems initialization we have some amount of
kernel threads created, then scheduler gives CPU time to each thread.
Eventually scheduler returns CPU execution back to thread 0. In this
case writing zero to ttbr0 in cpu_switch leads Qualcomm board to
reboot (asynchronously, CPU continues execution).

Similar to other kernel threads install a valid physical address
(kernel pmap) to user page table base register ttbr0.

Reviewed by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13536
15:28:49 - r328129
(1 day 5 hours ago)
by manu
Affects:  /head/sys/fs/nfsserver/nfs_nfsdstate.c
nfs: Do not printf each time a lock structure is freed during module unload

There can be a lot of those structures and printing a line each time we free
one on module unload.

MFC after: 3 days
15:15:35 - r328128
(1 day 5 hours ago)
by kib
Affects:  /head/sys/amd64/amd64/machdep.c
/head/sys/amd64/include/cpu.h
/head/sys/amd64/include/md_var.h
Move the kernphys declaration to machine/md_var.h.

Apparently machinde/cpu.h is supposed to contain MD implementations of
MI interfaces. Also, remove kernphys declaration from machdep.c,
since it is already provided by md_var.h.

Requested and reviewed by: bde
MFC after: 13 days
13:43:09 - r328127
(1 day 7 hours ago)
by ed
Affects: 
(5 files)
/stable/11/sys/compat/cloudabi/*
/stable/11/sys/compat/cloudabi32/cloudabi32_poll.c
/stable/11/sys/compat/cloudabi64/cloudabi64_poll.c
MFC r327560:

  Allow timed waits with relative timeouts on locks and condvars.

  Even though pthreads doesn't support this, there are various alternative
  APIs that use this. For example, uv_cond_timedwait() accepts a relative
  timeout. So does Rust's std::sync::Condvar::wait_timeout().

  Though I personally think that relative timeouts are bad (due to
  imprecision for repeated operations), it does seem that people want
  this. Extend the existing futex functions to keep track of whether an
  absolute timeout is used in a boolean flag.
12:59:04 - r328126
(1 day 8 hours ago)
by avg
Affects:  /head/sys/kern/vfs_bio.c
correct read-ahead calculations in vfs_bio_getpages

Previously the calculations were done as if the requested region
ended at the start of the last requested page, not its end.
The problem as actually quite minor as it affected only stats and
page prefaulting, not the actual page data, and only with specific
parameters.

Reviewed by: kib (previous version)
MFC after: 2 weeks
12:14:24 - r328125
(1 day 8 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/boot/common/reloc_elf.c
MFC r327822:
Skip IRELATIVE relocations when loader processes ELF files.
12:08:52 - r328124
(1 day 8 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/amd64/amd64/exception.S
MFC r327819:
Do not redundantly clear %RFLAGS.DF on fast syscall entry.
12:07:37 - r328123
(1 day 8 hours ago)
by kib
Affects: 
(4 files)
/stable/11/sys/amd64/amd64/machdep.c
/stable/11/sys/amd64/amd64/mp_machdep.c
/stable/11/sys/amd64/include/md_var.h
MFC r327818:
Move the hardware setup for fast syscalls into a common function.
12:06:01 - r328122
(1 day 8 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/vm/vm_swapout.c
MFC r327555:
Restructure swapout tests after vm map locking was removed.
12:04:45 - r328121
(1 day 9 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/vm/vm_swapout.c
MFC r327450 (by alc):
Eliminate "minslptime".
11:21:03 - r328120
(1 day 9 hours ago)
by kib
Affects:  /head/sys/amd64/amd64/pmap.c
/head/sys/amd64/include/cpu.h
Fix compilation with gcc.

etext is already declared in machine/cpu.h, move kernphys declaration
there too.

Based on the patch by: bde
MFC after: 13 days
11:19:58 - r328119
(1 day 9 hours ago)
by kib
Affects:  /head/sys/amd64/include/asmacros.h
Fix compilation with gas.

Submitted by: bde
MFC after: 13 days
11:07:40 - r328118
(1 day 9 hours ago)
by pho
Affects:  /user/pho/stress2/tools/setup.sh
Initial version of a simple setup script.

Sponsored by: Dell EMC Isilon
11:05:51 - r328117
(1 day 9 hours ago)
by pho
Affects:  /user/pho/stress2/testcases/link/link.c
Remove redundant test and added style fixes while here.

Sponsored by: Dell EMC Isilon
11:01:41 - r328116
(1 day 10 hours ago)
by kib
Affects:  /head/sys/amd64/amd64/pmap.c
Remove the 'last' argument from the pmap_pti_free_page().

It is in fact unused.

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 13 days
10:52:31 - r328115
(1 day 10 hours ago)
by andrew
Affects:  /head/sys/arm64/arm64/pmap.c
Add a pmap invalidate that doesn't call sched_pin.

When demoting DMAP pages curthread may be pointing to data within the
page we are demoting. Create a new invalidate that doesn't pin and use
it in the demote case.

As the demote has both interrupts disabled, and is within a critical section
this is safe from having the scheduler from switching to another CPU.

Reported by: loos
Reviewed by: loos
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13955
09:17:06 - r328114
(1 day 11 hours ago)
by jeff
Affects:  /user/jeff/numa/sys/vm/vm_page.c
This call to lock should've been unlock.

Reported by: pho
08:34:20 - r328113
(1 day 12 hours ago)
by wma
Affects:  /head/sys/powerpc/powerpc/mp_machdep.c
Call platform_smp_ap_init before decr_ap_init

  In platform_smp_ap_init we are doing some crucial code (eg. set LPCR
register)
  which have influence over further execution.

  Practiculary in PowerNV platform we have experienced Data Storage Interrupt
  before we set apropriate LPCR. It caused code execution from location which
was
  legal in bootloader (petitboot based on linux) but illegal in FreeBSD
07:42:51 - r328112
(1 day 13 hours ago)
by wma
Affects:  /head/sys/powerpc/powerpc/swtch64.S
/head/sys/powerpc/powerpc/vm_machdep.c
PPC64: fix TOC behavior on process initialization

Set stack pointer to correct value after thread's stack pointer restore

Restoring new thread's stack pointer caused stack corruption because
restored stack pointer didn't point to callee (cpu_switch) stack frame but
caller stack frame.

As a result we had mysterious errors in caller function (sched_switch).

Solution: simply set stack pointer to correct value

Also, initialize TOC to a valid pointer once the thread is being
created.

Created by: Patryk Duda <pdk@semihalf.com>
Submitted by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Reviewed by: nwhitehorn
Differential revision: https://reviews.freebsd.org/D13947
Sponsored by: QCM Technologies
07:41:04 - r328111
(1 day 13 hours ago)
by wma
Affects:  /head/sys/powerpc/powerpc/machdep.c
PPC: machdep, zero BSS always but BookE

Zero BSS always. The only case when this operation is
ommitted is when booting on BookE.

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Reviewed by: imp, nwhitehorn
Differential revision: https://reviews.freebsd.org/D13948
Sponsored by: QCM Technologies
07:38:54 - r328110
(1 day 13 hours ago)
by wma
Affects:  /head/sys/kern/subr_kdb.c
KDB: restart only CPUs stopped by KDB

There is a case when not all CPUs went online. In that situation,
restart only APs which were operational before entering KDB.

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Reviewed by: nwhitehorn
Differential revision: https://reviews.freebsd.org/D13949
Sponsored by: QCM Technologies
06:28:21 - r328109
(1 day 14 hours ago)
by wma
Affects:  /head/sys/powerpc/conf/GENERIC64
PPC64: add AHCI back to GENERIC64

> Description of fields to fill in above: 76 columns --|
> PR: If a GNATS PR is affected by the change.
> Submitted by: If someone else sent in the change.
> Reviewed by: If someone else reviewed your modification.
> Approved by: If you needed approval for this commit.
> Obtained from: If the change is from a third party.
> MFC after: N [day[s]|week[s]|month[s]]. Request a reminder
email.
> MFH: Ports tree branch name. Request approval for merge.
> Relnotes: Set to 'yes' for mention in release notes.
> Security: Vulnerability reference (one per line) or
description.
> Sponsored by: If the change was sponsored by an organization.
> Differential Revision: https://reviews.freebsd.org/D### (*full* phabric
URL needed).
> Empty fields above will be automatically removed.

M sys/powerpc/conf/GENERIC64
05:57:10 - r328108
(1 day 15 hours ago)
by asomers
Affects: 
(5 files)
/head/sbin/geom/class/nop/*
/head/sys/geom/nop/*
/head/tests/sys/geom/class/nop/nop_test.sh
gnop(8): add the ability to set a nop provider's physical path

While I'm here, expand the existing tests a bit.

MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D13579
04:58:54 - r328107
(1 day 16 hours ago)
by kevans
Affects: 
(5 files)
/head/etc/mtree/BSD.root.dist
/head/share/man/man7/hier.7
/head/stand/*
stand: Add /boot/overlays to allow separation of overlays from base FDT

This matches directory structure used commonly in Linux-land, and it's
cleaner than mixing overlays into the existing module paths. Overlays are
still mixed in by specifying fdt_overlays in loader.conf(5).

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13922
04:39:09 - r328106
(1 day 16 hours ago)
by kevans
Affects: 
(18 files)
/head/stand/fdt/*
/head/sys/contrib/libfdt/*
libfdt: Update to 1.4.6, switch to using libfdt for overlay support

libfdt highlights since 1.4.3:

- fdt_property_placeholder added to create a property without specifying its
value at creation time
- stringlist helper functions added to libfdt
- Improved overlay support
- Various internal cleanup

Also switch stand/fdt over to using libfdt for overlay support with this
update. Our current overlay implementation works only for limited use cases
with overlays generated only by some specific versions of our dtc(1). Swap
it out for the libfdt implementation, which supports any properly generated
overlay being applied to a properly generated base.

This will be followed up fairly soon with an update to dtc(1) in tree to
properly generate overlays.

MFC note: the <stdlib.h> include this update introduces in libfdt_env.h is
apparently not necessary in the context we use this in. It's not immediately
clear to me the motivation for it being introduced, but it came in with
overlay support. I've left it in for the sake of accuracy and because it's
not harmful here on HEAD, but MFC'ing this to stable/11 will require
wrapping the #include in an `#ifndef _STANDALONE` block or else it will
cause build failures.

Tested on: Banana Pi-M3 (ARMv7)
Tested on: Pine64 (aarch64)
Tested on: PowerPC [nwhitehorn]
Reviewed by: manu, nwhitehorn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13893
03:38:09 - r328105
(1 day 17 hours ago)
by kevans
Affects:  /stable/11
Record-only merges of recent loader fixes

Loader fixes were recently effectively MFC'd in r327942, r327944, r327945,
and r327957. These were all direct commits to stable/11 due to restructuring
in -HEAD where libstand and sys/boot are concerned, but achieve the same
effect as this range of commits.

Catch up on svn:mergeinfo following these, as this was missed in the
original commits to stable/11.
00:24:05 - r328104
(1 day 20 hours ago)
by jhb
Affects:  /head/usr.sbin/kldxref/ef_powerpc.c
Adjust format string to fix build.
00:23:11 - r328103
(1 day 20 hours ago)
by jhb
Affects:  /head/usr.sbin/kldxref/ef_powerpc.c
Tidy some whitespace.
2018 - 01 - 17   (2 days ago)
23:11:25 - r328102
(1 day 21 hours ago)
by jhb
Affects: 
(7 files)
/head/sys/amd64/include/vmm.h
/head/sys/amd64/vmm/*
/head/usr.sbin/bhyvectl/bhyvectl.c
Save and restore guest debug registers.

Currently most of the debug registers are not saved and restored
during VM transitions allowing guest and host debug register values to
leak into the opposite context. One result is that hardware
watchpoints do not work reliably within a guest under VT-x.

Due to differences in SVM and VT-x, slightly different approaches are
used.

For VT-x:

- Enable debug register save/restore for VM entry/exit in the VMCS for
  DR7 and MSR_DEBUGCTL.
- Explicitly save DR0-3,6 of the guest.
- Explicitly save DR0-3,6-7, MSR_DEBUGCTL, and the trap flag from
  %rflags for the host. Note that because DR6 is "software" managed
  and not stored in the VMCS a kernel debugger which single steps
  through VM entry could corrupt the guest DR6 (since a single step
  trap taken after loading the guest DR6 could alter the DR6
  register). To avoid this, explicitly disable single-stepping via
  the trace flag before loading the guest DR6. A determined debugger
  could still defeat this by setting a breakpoint after the guest DR6
  was loaded and then single-stepping.

For SVM:
- Enable debug register caching in the VMCB for DR6/DR7.
- Explicitly save DR0-3 of the guest.
- Explicitly save DR0-3,6-7, and MSR_DEBUGCTL for the host. Since SVM
  saves the guest DR6 in the VMCB, the race with single-stepping
  described for VT-x does not exist.

For both platforms, expose all of the guest DRx values via --get-drX
and --set-drX flags to bhyvectl.

Discussed with: avg, grehan
Tested by: avg (SVM), myself (VT-x)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D13229
22:51:59 - r328101
(1 day 22 hours ago)
by jhb
Affects:  /head/stand/common/load_elf_obj.c
/head/sys/kern/link_elf_obj.c
Require the SHF_ALLOC flag for program sections from kernel object modules.

ELF object files can contain program sections which are not supposed
to be loaded into memory (e.g. .comment). Normally the static linker
uses these flags to decide which sections are allocated to loadable
program segments in ELF binaries and shared objects (including kernels
on all architectures and kernel modules on architectures other than
amd64).

Mapping ELF object files (such as amd64 kernel modules) into memory
directly is a bit of a grey area. ELF object files are intended to be
used as inputs to the static linker. As a result, there is not a
standardized definition for what the memory layout of an ELF object
should be (none of the section headers have valid virtual memory
addresses for example).

The kernel and loader were not checking the SHF_ALLOC flag but loading
any program sections with certain types such as SHT_PROGBITS. As a
result, the kernel and loader would load into RAM some sections that
weren't marked with SHF_ALLOC such as .comment that are not loaded
into RAM for kernel modules on other architectures (which are
implemented as ELF shared objects). Aside from possibly requiring
slightly more RAM to hold a kernel module this does not affect runtime
correctness as the kernel relocates symbols based on the layout it
uses.

Debuggers such as gdb and lldb do not extract symbol tables from a
running process or kernel. Instead, they replicate the memory layout
of ELF executables and shared objects and use that to construct their
own symbol tables. For executables and shared objects this works
fine. For ELF objects the current logic in kgdb (and probably lldb
based on a simple reading) assumes that only sections with SHF_ALLOC
are memory resident when constructing a memory layout. If the
debugger constructs a different memory layout than the kernel, then it
will compute different addresses for symbols causing symbols in the
debugger to appear to have the wrong values (though the kernel itself
is working fine). The current port of mdb does not check SHF_ALLOC as
it replicates the kernel's logic in its existing kernel support.

The bfd linker sorts the sections in ELF object files such that all of
the allocated sections (sections with SHF_ALLOCATED) are placed first
followed by unallocated sections. As a result, when kgdb composed a
memory layout using only the allocated sections, this layout happened
to match the layout used by the kernel and loader. The lld linker
does not sort the sections in ELF object files and mixed allocated and
unallocated sections. This resulted in kgdb composing a different
memory layout than the kernel and loader.

We could either patch kgdb (and possibly in the future lldb) to use
custom handling when generating memory layouts for kernel modules that
are ELF objects, or we could change the kernel and loader to check
SHF_ALLOCATED. I chose the latter as I feel we shouldn't be loading
things into RAM that the module won't use. This should mostly be a
NOP when linking with bfd but will allow the existing kgdb to work
with amd64 kernel modules linked with lld.

Note that we only require SHF_ALLOC for "program" sections for types
like SHT_PROGBITS and SHT_NOBITS. Other section types such as symbol
tables, string tables, and relocations must also be loaded and are not
marked with SHF_ALLOC.

Reported by: np
Reviewed by: kib, emaste
MFC after: 1 month
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13926
22:47:34 - r328100
(1 day 22 hours ago)
by cem
Affects: 
(8 files)
/head/bin/ls/*
Convert ls(1) to not use libxo(3)

libxo imposes a large burden on system utilities. In the case of ls, that
burden is difficult to justify -- any language that can interact with json
output can use readdir(3) and stat(2).

Logically, this reverts r291607, r285857, r285803, r285734, r285425,
r284494, r284489, r284252, and r284198.

Kyua tests continue to pass (libxo integration was entirely untested).

Reported by: many
Reviewed by: imp
Discussed with: manu, bdrewery
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13959
22:36:58 - r328099
(1 day 22 hours ago)
by jhb
Affects: 
(11 files)
/head/sys/*
Use long for the last argument to VOP_PATHCONF rather than a register_t.

pathconf(2) and fpathconf(2) both return a long. The kern_[f]pathconf()
functions now accept a pointer to a long value rather than modifying
td_retval directly. Instead, the system calls explicitly store the
returned long value in td_retval[0].

Requested by: bde
Reviewed by: kib
Sponsored by: Chelsio Communications
22:33:19 - r328098
(1 day 22 hours ago)
by landonf
Affects:  /head/sys/dev/bwn/if_bwn.c
/head/sys/dev/bwn/if_bwn_pci.c
bwn(4): Enable, by default, the opt-in support for bhnd(4) introduced in
r326454.

bwn(4)/bhnd(4) has been tested with most chipsets currently supported by
bwn(4), and this change should be transparent to existing bwn(4) users;
please report any regressions that you do encounter.

To revert to using siba_bwn(4) instead of bhnd(4), place the following
lines in loader.conf(5):

  hw.bwn_pci.preferred="0"

Once we're satisfied that the switch to bhnd(4) has seen sufficient broader
testing, bwn(4) will be migrated to use the native bhnd(9) interface
directly, and support for siba_bwn(4) will be dropped (see D13518).

Sponsored by: The FreeBSD Foundation
22:10:58 - r328097
(1 day 22 hours ago)
by jeff
Affects: 
(9 files)
/user/jeff/numa/sys/*
Fix a reservation locking bug spotted by markj.
Make the reservation object lock an array of locks.
Fix the paging and laundry targets.
Make laundry per-domain.
Fix a compile error on powerpc and arm.
21:52:12 - r328096
(1 day 23 hours ago)
by markj
Affects:  /head/sys/amd64/amd64/exception.S
/head/sys/amd64/amd64/machdep.c
Annotate a couple of changes from r328083.

Reviewed by: kib
X-MFC with: r328083
20:43:30 - r328095
(2 days ago)
by emaste
Affects:  /head/usr.sbin/kldxref/ef.c
kldxref: additional sytle(9) cleanup

Reported by: kib (via comments in D13957)
Sponsored by: The FreeBSD Foundation
19:59:43 - r328094
(2 days 1 hour ago)
by emaste
Affects: 
(5 files)
/head/usr.sbin/kldxref/*
kldxref: improve style(9)

Address style issues including some previously raised in D13923.

- Use designated initializers for structs
- Always use bracketed return style
- No initialization in declarations
- Align function prototype names
- Remove old commented code/unused includes

Submitted by: Mitchell Horne <mhorne063@gmail.com>
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13943
18:18:33 - r328093
(2 days 2 hours ago)
by pfg
Affects:  /head/sys/ufs/ffs/ffs_snapshot.c
/head/sys/ufs/ffs/ffs_softdep.c
/head/sys/ufs/ufs/ufs_vnops.c
ufs: use mallocarray(9).

Basic use of mallocarray to prevent overflows: static analyzers are also
likely to perform additional checks.

Since mallocarray expects unsigned parameters, unsign some
related variables to minimize sign conversions.

Reviewed by: mckusick
17:58:24 - r328092
(2 days 3 hours ago)
by mckusick
Affects: 
(7 files)
/head/lib/libufs/*
/head/sbin/fsck_ffs/*
Correct fsck journal-recovery code to update a cylinder-group
check-hash after making changes to the cylinder group. The problem
was that the journal-recovery code was calling the libufs bwrite()
function instead of the cgput() function. The cgput() function updates
the cylinder-group check-hash before writing the cylinder group.

This change required the additions of the cgget() and cgput() functions
to the libufs API to avoid a gratuitous bcopy of every cylinder group
to be read or written. These new functions have been added to the
libufs manual pages. This was the first opportunity that I have had
to use and document the use of the EDOOFUS error code.

Reviewed by: kib
Reported by: emaste and others
17:14:19 - r328091
(2 days 3 hours ago)
by dim
Affects: 
(2 files)
/head/sys/crypto/via/padlock_cipher.c
Revert r327340, as the workaround for rep prefixes followed by .byte
directives is no longer needed after r328090.
17:11:55 - r328090
(2 days 3 hours ago)
by dim
Affects:  /head/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
/head/lib/clang/freebsd_cc_version.h
Pull in r322623 from upstream llvm trunk (by Andrew V. Tischenko):

  Allow usage of X86-prefixes as separate instrs.
  Differential Revision: https://reviews.llvm.org/D42102

This should fix parse errors when x86 prefixes (such as 'lock' and
'rep') are followed by various non-mnemonic tokens, e.g. comments, .byte
directives and labels.

PR: 224669,225054
17:08:26 - r328089
(2 days 3 hours ago)
by imp
Affects:  /head/sys/dev/nvme/nvme_sim.c
Move setting of CAM_SIM_QUEUED to before we actually submit it to the
hardware. Setting it after is racy, and we can lose the race on a
heavily loaded system.

Reviewed by: scottl@, gallatin@
Sponsored by: Netflix
16:55:35 - r328088
(2 days 4 hours ago)
by fabient
Affects:  /head/usr.sbin/pmcstat/pmcstat.c
Only call flush in pipe mode.
It fixes a crash with a socket in top mode.

Ex:
# pmcstat -R 127.0.0.1:8080 -T -w1
then
# pmcstat -n1 -Sclock.prof -Slock.failed -O 127.0.0.1:8080

MFC after: 1 week
Sponsored by: Stormshield
16:41:22 - r328087
(2 days 4 hours ago)
by fabient
Affects:  /head/lib/libpmc/pmclog.c
/head/sys/dev/hwpmc/hwpmc_logging.c
/head/sys/dev/hwpmc/hwpmc_mod.c
Fix pmcstat exit from kernel introduced by r325275.
pmcstat request for close will generate a close event.
This event will be in turn received by pmcstat to close the file.

Reviewed by: kib
Tested by: pho
MFC after: 1 week
Sponsored by: Stormshield
15:12:52 - r328086
(2 days 5 hours ago)
by markj
Affects: 
(2 files)
/stable/11/sys/geom/mirror/g_mirror.h
MFC r327768:
Clarify the use of the gmirror flag mask constants.
13:25:41 - r328085
(2 days 7 hours ago)
by bapt
Affects:  /head/share/misc/pci_vendors
Update pciids to 2018.01.14

MFC after: 3 days
13:19:37 - r328084
(2 days 7 hours ago)
by dim
Affects:  /head/sbin/fsdb/fsdb.c
Fix buildworld after r328075, by also renaming cgget to cglookup in
fsdb.

Reported by: ohartmann@walstatt.org,david@catwhisker.org
Pointy hat to: mckusick
11:44:21 - r328083
(2 days 9 hours ago)
by kib
Affects: 
(31 files)
/head/sys/*
PTI for amd64.

The implementation of the Kernel Page Table Isolation (KPTI) for
amd64, first version. It provides a workaround for the 'meltdown'
vulnerability. PTI is turned off by default for now, enable with the
loader tunable vm.pmap.pti=1.

The pmap page table is split into kernel-mode table and user-mode
table. Kernel-mode table is identical to the non-PTI table, while
usermode table is obtained from kernel table by leaving userspace
mappings intact, but only leaving the following parts of the kernel
mapped:

  kernel text (but not modules text)
  PCPU
  GDT/IDT/user LDT/task structures
  IST stacks for NMI and doublefault handlers.

Kernel switches to user page table before returning to usermode, and
restores full kernel page table on the entry. Initial kernel-mode
stack for PTI trampoline is allocated in PCPU, it is only 16
qwords. Kernel entry trampoline switches page tables. then the
hardware trap frame is copied to the normal kstack, and execution
continues.

IST stacks are kept mapped and no trampoline is needed for
NMI/doublefault, but of course page table switch is performed.

On return to usermode, the trampoline is used again, iret frame is
copied to the trampoline stack, page tables are switched and iretq is
executed. The case of iretq faulting due to the invalid usermode
context is tricky, since the frame for fault is appended to the
trampoline frame. Besides copying the fault frame and original
(corrupted) frame to kstack, the fault frame must be patched to make
it look as if the fault occured on the kstack, see the comment in
doret_iret detection code in trap().

Currently kernel pages which are mapped during trampoline operation
are identical for all pmaps. They are registered using
pmap_pti_add_kva(). Besides initial registrations done during boot,
LDT and non-common TSS segments are registered if user requested their
use. In principle, they can be installed into kernel page table per
pmap with some work. Similarly, PCPU can be hidden from userspace
mapping using trampoline PCPU page, but again I do not see much
benefits besides complexity.

PDPE pages for the kernel half of the user page tables are
pre-allocated during boot because we need to know pml4 entries which
are copied to the top-level paging structure page, in advance on a new
pmap creation. I enforce this to avoid iterating over the all
existing pmaps if a new PDPE page is needed for PTI kernel mappings.
The iteration is a known problematic operation on i386.

The need to flush hidden kernel translations on the switch to user
mode make global tables (PG_G) meaningless and even harming, so PG_G
use is disabled for PTI case. Our existing use of PCID is
incompatible with PTI and is automatically disabled if PTI is
enabled. PCID can be forced on only for developer's benefit.

MCE is known to be broken, it requires IST stack to operate completely
correctly even for non-PTI case, and absolutely needs dedicated IST
stack because MCE delivery while trampoline did not switched from PTI
stack is fatal. The fix is pending.

Reviewed by: markj (partially)
Tested by: pho (previous version)
Discussed with: jeff, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
11:21:04 - r328082
(2 days 9 hours ago)
by kib
Affects:  /head/sys/amd64/amd64/sys_machdep.c
/head/sys/amd64/include/proc.h
Amd64 user_ldt_deref() is not used outside sys_machdep.c. Mark it as
static.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
10:30:49 - r328081
(2 days 10 hours ago)
by tuexen
Affects:  /head/usr.bin/truss/syscalls.c
Add missing assignment to make sure non-first cmsgs are handled as such.
09:45:18 - r328080
(2 days 11 hours ago)
by wma
Affects:  /head/sys/powerpc/powerpc/bus_machdep.c
PPC64: implement missing busdma ops

Add missing little-endian 64-bit read and write. Since there
is no direct ASM opcode for this, perform byte swap if
necessary.

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: QCM Technologies
09:36:48 - r328079
(2 days 11 hours ago)
by wma
Affects:  /head/sys/powerpc/powerpc/copyinout.c
PPC64: fix copyinout ranges

Use current userspace address for segment mapping. Previously,
there was a bug which made the funciton constantly using the userspace
base address which could cause data integrity issues.

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: QCM Technologies
09:33:16 - r328078
(2 days 11 hours ago)
by wma
Affects:  /head/sys/powerpc/conf/GENERIC64
PPC64: add CXGBE and remove AHCI from GENERIC64

Add CXGBE driver which is required for PowerNV system.
Also, remove AHCI which does not work in BigEndian.

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: QCM Technologies
08:01:51 - r328077
(2 days 13 hours ago)
by wma
Affects:  /head/sys/powerpc/powernv/opal_console.c
PowerNV: workaround console on OPAL 5.4

FreeBSD prints text char-by-char, which is not what OPAL
is designed to. Poll events more frequently to avoid buffer
overflow and loosing data.

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: QCM Technologies
07:39:11 - r328076
(2 days 13 hours ago)
by wma
Affects:  /head/sys/powerpc/powernv/opal.h
/head/sys/powerpc/powernv/opal_pci.c
PowerNV: make PowerNV PCIe working on a real hardware

Fixes:
- map all devices to PE0
- use 1:1 TCE mapping
- provide the same TCE mapping for all PEs (not only PE0)
- add TCE reset and alignment (required by OPAL)

Created by: Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by: QCM Technologies
06:31:21 - r328075
(2 days 14 hours ago)
by mckusick
Affects: 
(5 files)
/head/sbin/fsck_ffs/*
Rename cgget => cglookup to clear name space for new libufs function cgget.
No functional change.
06:22:10 - r328074
(2 days 14 hours ago)
by jeff
Affects: 
(30 files)
/user/jeff/numa/sys/*
WIP per-domain page queue free locking and pageout targets.
05:09:15 - r328073
(2 days 15 hours ago)
by kevans
Affects:  /vendor-sys/libfdt/1.4.6
Tag libfdt 1.4.6 following initial import
05:08:01 - r328072
(2 days 15 hours ago)
by kevans
Affects: 
(2 files)
/vendor-sys/libfdt/dist
Create vendor-sys/libfdt from libfdt in vendor/dtc

There are no plans at the moment to continue updating GPL dtc in the tree as
BSDL dtc is slowly replacing it.

We use libfdt in the kernel and loaders, so fork off the libfdt bits from
vendor/dtc into vendor-sys/libfdt rather than continuing to update
vendor/dtc when we have no intention of updating anything in userland as a
result of these imports.

This also leaves us with a vendor branch whose content has a consistent
license- the entirety of libfdt is dual license, GPL/BSD, although that was
not a primary concern.
03:34:26 - r328071
(2 days 17 hours ago)
by landonf
Affects:  /head/sys/dev/bhnd/bhndb/bhndb_pci.c
/head/sys/dev/bhnd/bhndb/bhndb_pcivar.h
/head/sys/dev/bhnd/cores/pci/bhnd_pcireg.h
bhndb_pci(4): fix incorrect BHND_PCI_SRSH_PI workaround

On a SPROM-less device, the PCI(e) bridge core will be initialized with its
power-on-reset defaults; this can leave the SPROM-derived BHND_PCI_SRSH_PI
value pointing to the wrong backplane address. This value is used by the
PCI core when performing address translation between the static register
windows in BAR0 that map the PCI core's register block, and backplane
address space.

Previously, bhndb_pci(4) incorrectly used the potentially invalid static
BAR0 PCI register windows when attempting to correct the BHND_PCI_SRSH_PI
value in the PCI core's SPROM shadow.

Instead, we now read/update BHND_PCI_SRSH_PI by fetching the PCI core's
backplane address from the core enumeration table, and then using a dynamic
register window to explicitly map the PCI core's register block into BAR0.

Sponsored by: The FreeBSD Foundation
2018 - 01 - 16   (3 days ago)
23:19:57 - r328070
(2 days 21 hours ago)
by pfg
Affects: 
(17 files)
/head/sys/cam/*
SPDX: finish tagging sys/cam.
23:18:52 - r328069
(2 days 21 hours ago)
by ian
Affects:  /head/sys/x86/isa/atrtc.c
Remove redundant critical_enter/exit() calls. The block of code delimited
by these calls is now protected by a spin mutex (obscured within the
RTC_LOCK/RTC_UNLOCK macros).

Reported by: bde@
23:14:12 - r328068
(2 days 21 hours ago)
by ian
Affects:  /head/sys/x86/isa/atrtc.c
Move some code around and rename a couple variables; no functional changes.

The static atrtc_set() function was called only from clock_settime(), so
just move its contents entirely into clock_settime() and delete atrtc_set().

Rename the struct bcd_clocktime variables from 'ct' to 'bct'. I had
originally wanted to emphasize how identical the clocktime and bcd_clocktime
structs were, but things evolved to the point where the structs are not at
all identical anymore, so now emphasizing the difference seems better.
23:08:25 - r328067
(2 days 21 hours ago)
by pfg
Affects:  /head/sys/cam/scsi/scsi_ch.c
scsi_ch.c: Small cleanups to the comments.

Move the the NetBSD tag near to the related licence. Update it to reflect
better the point where we started diverging.

Use grouping parenthesis for the SPDX tag.

No functional change.
21:58:38 - r328066
(2 days 23 hours ago)
by tuexen
Affects:  /head/sys/netinet/sctp_indata.c
Fix a bug related to fast retransmissions.

When processing a SACK advancing the cumtsn-ack in fast recovery,
increment the miss-indications for all TSN's reported as missing.

Thanks to Fabian Ising for finding the bug and to Timo Voelker
for provinding a fix.

This fix moves also CMT related initialisation of some variables
to a more appropriate place.

MFC after: 1 week
21:43:57 - r328065
(2 days 23 hours ago)
by arichardson
Affects:  /head/sys/conf/kern.post.mk
/head/sys/conf/kmod.mk
Use ln -n instead of -h to allow building the kernel on Linux

Both flags do the same thing but -n is more widely supported.

Reviewed By: jhb, emaste
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13936
21:43:46 - r328064
(2 days 23 hours ago)
by arichardson
Affects: 
(4 files)
/head/usr.bin/xinstall/*
/head/usr.sbin/makefs/*
Allow xinstall and makefs to be crossbuilt on Linux and Mac

I need these tools in order to install the crossbuilt FreeBSD and create a
disk image. Linux does not have a st_flags in struct stat so unfortunately
I need a bunch of ugly ifdefs. The resulting binaries allow me to
sucessfully install a MIPS64 world and create a disk-image that boots.

Reviewed By: brooks, bdrewery, emaste
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13307
21:43:36 - r328063
(2 days 23 hours ago)
by arichardson
Affects:  /head/Makefile.inc1
Don't build share/syscons in build-tools stage if MK_SYSCONS == "no"

Reviewed By: emaste, jhb
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D12926
21:43:21 - r328062
(2 days 23 hours ago)
by arichardson
Affects:  /head/lib/libnetbsd/util.h
libnetbsd: Make the function declaration of efopen() match the definition

In order to crossbuild FreeBSD on Mac/Linux I also need to build libnetbsd
and FILE* is not equal to struct __sFILE on those platforms.

Reviewed By: brooks, emaste
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13305
20:35:54 - r328061
(3 days ago)
by tsoome
Affects:  /head/stand/efi/libefi/efichar.c
utf8_to_ucs2() should check for malloc failure

utf8_to_ucs2() is calling malloc() without checking the result.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13933
20:14:31 - r328060
(3 days ago)
by kevans
Affects:  /head/usr.sbin/service/service.sh
service(8): Reset OPTIND properly now that we're parsing args twice

r328032 introduced a second round of argument parsing to proxy the request
through to a jail as needed, but failed to reset OPTIND before getting to
the second round of parsing to allow other flags to be set.

Reported by: Oleg Ginzburg <olevole olevole ru>
20:02:07 - r328059
(3 days 1 hour ago)
by tuexen
Affects:  /head/usr.bin/truss/syscalls.c
Improve the printing of cmgs when the length is 0. Fix error handling.
19:57:30 - r328058
(3 days 1 hour ago)
by tuexen
Affects:  /head/usr.bin/truss/syscalls.c
Using %p already prints "0x", so don't do it explicitly.
19:41:18 - r328057
(3 days 1 hour ago)
by jhb
Affects:  /head/sys/opencrypto/cryptodev.h
Split crp_buf into a union.

This adds explicit crp_mbuf and crp_uio pointers of the right type to
replace casts of crp_buf. This does not sweep through changing existing
code, but new code should use the correct fields instead of casts.

Reviewed by: kib
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D13927
19:29:32 - r328056
(3 days 1 hour ago)
by pfg
Affects:  /head/sys/fs/ext2fs/ext2_lookup.c
/head/sys/fs/ext2fs/ext2_vfsops.c
ext2fs: use mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). These
are not likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.
18:36:25 - r328055
(3 days 2 hours ago)
by philip
Affects: 
(17 files)
/head/contrib/tzdata/*
Import tzdata 2018a

Changes: https://github.com/eggert/tz/blob/2018a/NEWS

MFC after: 3 days
18:27:26 - r328054
(3 days 2 hours ago)
by philip
Affects:  /vendor/tzdata/tzdata2018a
Tag import of tzdata 2018a
18:26:11 - r328053
(3 days 2 hours ago)
by philip
Affects: 
(16 files)
/vendor/tzdata/dist/*
Import tzdata 2018a
18:20:12 - r328052
(3 days 2 hours ago)
by emaste
Affects: 
(4 files)
/head/usr.sbin/kldxref/*
kldxref: handle modules with md_cval at the end of allocated sections

Attempting to retrieve an md_cval string from a kernel module with
kldxref would throw a offset error for modules created using lld, since
this value would be placed at the end of all allocated sections.

Add an ef_read_seg_string method to the ef interface, to allow reading
strings of varying size without attempting to read beyond the segment's
bounds.

PR: 224875
Submitted by: Mitchell Horne <mhorne063@gmail.com>
Reviewed by: cem, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13923
11:25:08 - r328051
(3 days 9 hours ago)
by avg
Affects: 
(2 files)
/stable/10/sys/dev/usb/usbdevs
MFC r327724: usbdevs: add ASMedia vendor ID
11:23:21 - r328050
(3 days 9 hours ago)
by avg
Affects: 
(2 files)
/stable/11/sys/dev/usb/usbdevs
MFC r327724: usbdevs: add ASMedia vendor ID
11:22:08 - r328049
(3 days 9 hours ago)
by avg
Affects: 
(2 files)
/stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
MFC r327725: zfs_mount: restore a bit of ifdef-out illumos code
11:22:07 - r328048
(3 days 9 hours ago)
by avg
Affects: 
(2 files)
/stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
MFC r327725: zfs_mount: restore a bit of ifdef-out illumos code
10:58:31 - r328047
(3 days 10 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/ufs/ffs/ffs_softdep.c
MFC r327723, r327821:
Generalize the fix from r322757 and apply it to several more places.
10:56:35 - r328046
(3 days 10 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/ufs/ffs/ffs_softdep.c
MFC r327722:
When handling write completion, take SU lock around calls to
handle_written_XXX() in case of processing the buffer with an error.
10:54:32 - r328045
(3 days 10 hours ago)
by kib
Affects: 
(2 files)
/stable/11/sys/ufs/ffs/ffs_vfsops.c
MFC r327721:
Postpone the disassotiation of the background write buffer with devvp
so that buf_complete() sees fully constructed buffer.
09:31:01 - r328044
(3 days 11 hours ago)
by br
Affects:  /head/lib/libpmcstat/libpmcstat_logging.c
Fix bug: increment the value of pmcstat_npmcs instead of moving pointer
to the next int position.

Bug was introduced in r324959 ("Extract a set of pmcstat functions and
interfaces to the new internal library -- libpmcstat.")

This fixes pmcstat top mode (-T) operation.
Example: pmcstat -n1 -S clock.hard -T

Reported by: Peter Holm <peter@holm.cc>
Sponsored by: DARPA, AFRL
08:00:08 - r328043
(3 days 13 hours ago)
by dim
Affects: 
(4 files)
/stable/11/contrib/llvm/tools/clang/include/clang/AST/Expr.h
/stable/11/contrib/llvm/tools/clang/lib/AST/Expr.cpp
/stable/11/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
MFC r327930:

Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):

  [Sema] Suppress warnings for C's zero initializer

  Patch by S. Gilles!

  Differential Revision: https://reviews.llvm.org/D28148

Pull in r314838 from upstream clang trunk (by Richard Smith):

  Suppress -Wmissing-braces warning when aggregate-initializing a
  struct with a single field that is itself an aggregate.

  In C++, such initialization of std::array<T, N> types is guaranteed
  to work by the standard, is completely idiomatic, and the "suggested"
  alternative from Clang was technically invalid.

Together, these suppress unneeded "suggest braces around initialization
of subobject" warnings for C++11 initializer lists.
06:24:19 - r328042
(3 days 14 hours ago)
by wma
Affects: 
(4 files)
/head/sys/conf/options.powerpc
/head/sys/powerpc/*
PowerNV: XICS support for PowerNV/OPAL

Make XICS to be OPAL-aware.

Created by: Nathan Whitehorn <nwhitehorn@freebsd.org>
Submitted by: Wojciech Macek <wma@semihalf.com>
Sponsored by: FreeBSD Foundation
06:04:39 - r328041
(3 days 15 hours ago)
by pfg
Affects:  /head/sys/mips/mips/busdma_machdep.c
Fix build after r328020.

Should have noticed earlier but the build was already broken by another
change.

Reported by: Ravi Pokala
04:50:23 - r328040
(3 days 16 hours ago)
by jhibbits
Affects:  /head/sys/powerpc/mpc85xx/fsl_sata.c
Make fsl_sata driver work on P1022

P1022 SATA controller may set the wrong CCR bit for a command completion.
This would previously cause an interrupt storm. Solve this by marking all
commands complete, and letting the end_transaction deal with the successes.
Causes no problems on P5020.

While here, fix a minor bug in collision detection. The Freescale SATA
controller only has 16 slots, not 32.
03:02:41 - r328039
(3 days 18 hours ago)
by ian
Affects:  /head/sys/x86/isa/atrtc.c
Add static inline rtcin_locked() and rtcout_locked() functions for doing a
related series of operations without doing a lock/unlock for each byte.
Use them when reading and writing the entire set of time registers.

The original rtcin() and writertc() functions which do lock/unlock on each
byte still exist, because they are public and called by outside code.
02:56:27 - r328038
(3 days 18 hours ago)
by cem
Affects:  /head/sys/dev/random/random_harvestq.c
/head/sys/sys/random.h
random(4): Add CCP random source definitions

The implementation will follow (D12723). For now, get the changes to
commit-protected files out of the way.

Approved by: secteam (gordon)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13925
01:21:07 - r328037
(3 days 19 hours ago)
by jhb
Affects:  /head/usr.bin/truss/syscalls.c
Rename 'recv' to 'receive' to appease shadow warnings from GCC.
01:05:04 - r328036
(3 days 20 hours ago)
by jhb
Affects:  /head/Makefile.libcompat
Check for GCC first rather than clang in the MIPS lib32 rules.

This works around a bug with X_COMPILER_TYPE and permits mips64 to build
again with in-tree gcc as well as clang and external gcc.

Sponsored by: DARPA / AFRL
00:47:53 - r328035
(3 days 20 hours ago)
by jhb
Affects:  /head/usr.sbin/newsyslog/newsyslog.conf.5
Sort the list of flags in newsyslog.conf entries.

Move the 'X' and 'Y' entries into their sorted location in the list
of flags just above 'Z'.

Reviewed by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13904
2018 - 01 - 15   (4 days ago)
23:17:12 - r328034
(3 days 21 hours ago)
by tuexen
Affects:  /head/usr.bin/truss/syscalls.c
Keep list sorted. Thanks to jhb@ to pointing out that I put it at the
wrong place in r327919.
23:12:54 - r328033
(3 days 21 hours ago)
by tuexen
Affects:  /head/lib/libsysdecode/sysdecode_mask.3
Bump date, which I missed in r328014. Thanks to jhb@ for reporting.
22:24:11 - r328032
(3 days 22 hours ago)
by kevans
Affects:  /head/usr.sbin/service/service.8
/head/usr.sbin/service/service.sh
service(8): Add support for interfacing with services in jails

Provide a -j option that can take a jail name or id. If -j is specified,
check that the jail exists and proxy the service request through to
service(8) in the jail.

This allows for cleaner workflows when updating services in a jail, turning
the following:

pkg -j dns upgrade
jexec dns service named restart

into:

pkg -j dns upgrade
service -j dns named restart

PR: 223325
Submitted by: David O'Rourke (with slight changes)
MFC after: 2 weeks
22:17:39 - r328031
(3 days 22 hours ago)
by imp
Affects:  /head/stand/efi/boot1/boot1.c
Need to free uv after we're done using it.

Reported by: andrew@
Sponsored by: Netflix
22:17:35 - r328030
(3 days 22 hours ago)
by imp
Affects:  /head/stand/efi/boot1/boot1.c
Check the return value from utf8_to_ucs2 instead of whether or not uv
is NULL. That's more correct and doesn't depend on the error behavior
of utf8_to_ucs2. In practice, we'll never see this though since we
pass utf8_to_ucs2 a well formed string.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13918
22:17:15 - r328029
(3 days 22 hours ago)
by imp
Affects:  /head/stand/efi/libefi/efichar.c
When returning an error and freeing allocated memory from ucs2_to_utf8
and utf8_to_ucs2, be sure to NULL out the return pointer too, rather
than return a pointer to free memory.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13917
21:59:20 - r328028
(3 days 23 hours ago)
by tuexen
Affects:  /head/sys/netinet/sctputil.c
Don't provide a (meaningless) cmsg when proving a notification
in a recvmsg() call.

MFC after: 1 week
21:53:33 - r328027
(3 days 23 hours ago)
by kevans
Affects:  /head/share/man/man4/wsp.4
wsp(4): Update to reflect new sysctl from r314467

r314467 introduced hw.usb.wsp.enable_single_tap_clicks to enable/disable
single-tap left click behavior. Update the man page to reflect the new
sysctl.

PR: 196624
MFC after: 3 days
X-MFC-With: r314467
21:23:16 - r328026
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/geom/uzip/g_uzip_zlib.c
/head/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_core.c
misc geom and gnu: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

Differential revision: https://reviews.freebsd.org/D13837
21:21:51 - r328025
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/net/if_vlan.c
/head/sys/net/iflib.c
/head/sys/netinet6/in6_jail.c
net*: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:19:21 - r328024
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/netgraph/ng_bridge.c
/head/sys/netgraph/ng_deflate.c
/head/sys/netgraph/ng_parse.c
netgraph: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:18:04 - r328023
(3 days 23 hours ago)
by pfg
Affects: 
(7 files)
/head/sys/kern/*
kern: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:15:25 - r328022
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/cam/cam_queue.c
/head/sys/cam/ctl/ctl_frontend.c
cam: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:14:56 - r328021
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/fs/nfsclient/nfs_clvnops.c
nfsclient: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:13:30 - r328020
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/mips/mips/busdma_machdep.c
/head/sys/mips/nlm/dev/sec/nlmrsa.c
mips: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:11:38 - r328019
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/compat/ndis/subr_ndis.c
ndis: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:10:40 - r328018
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/powerpc/pseries/phyp_vscsi.c
powerpc: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:09:58 - r328017
(3 days 23 hours ago)
by pfg
Affects:  /head/sys/arm/xscale/ixp425/if_npe.c
/head/sys/arm64/arm64/busdma_bounce.c
arm: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
21:08:22 - r328016
(3 days 23 hours ago)
by pfg
Affects: 
(4 files)
/head/sys/amd64/amd64/bpf_jit_machdep.c
/head/sys/i386/i386/*
/head/sys/x86/cpufreq/est.c
x86: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these ire likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.

X-Differential revision: https://reviews.freebsd.org/D13837
20:39:42 - r328015
(4 days ago)
by tuexen
Affects:  /head/usr.bin/truss/syscall.h
/head/usr.bin/truss/syscalls.c
Decode msghdr argument of sendmsg() and recvmsg().

Sponsored by: Netflix, Inc.
20:37:11 - r328014
(4 days ago)
by tuexen
Affects: 
(4 files)
/head/lib/libsysdecode/*
Add support for decoding the nxt_flags, rcv_flags, and snd_flags of
SCTP level cmsgs.
19:25:11 - r328013
(4 days 1 hour ago)
by dab
Affects:  /head/sbin/fsck_ffs/fsck.h
/head/sbin/fsck_ffs/fsck_ffs.8
/head/sbin/fsck_ffs/main.c
Exit fsck_ffs with non-zero status when file system is not repaired.

When the fsck_ffs program cannot fully repair a file system, it will
output the message PLEASE RERUN FSCK. However, it does not exit with a
non-zero status in this case (contradicting the man page claim that it
"exits with 0 on success, and >0 if an error occurs." The fsck
rc-script (when running "fsck -y") tests the status from fsck (which
passes along the exit status from fsck_ffs) and issues a "stop_boot"
if the status fails. However, this is not effective since fsck_ffs can
return zero even on (some) errors. Effectively, it is left to a later
step in the boot process when the file systems are mounted to detect
the still-unclean file system and stop the boot.

This change modifies fsck_ffs so that when it cannot fully repair the
file system and issues the PLEASE RERUN FSCK message it also exits
with a non-zero status.

While here, the fsck_ffs man page has also been updated to document
the failing exit status codes used by fsck_ffs. Previously, only exit
status 7 was documented. Some of these exit statuses are tested for in
the fsck rc-script, so they are clearly depended upon and deserve
documentation.

Reviewed by: mckusick, vangyzen, jilles (manpages)
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D13862
19:02:15 - r328012
(4 days 2 hours ago)
by jeff
Affects: 
(6 files)
/user/jeff/numa/sys/vm/*
First cut at finer locking for reservations.
18:37:03 - r328011
(4 days 2 hours ago)
by tychon
Affects:  /head/sys/amd64/vmm/amd/svm_support.S
/head/sys/amd64/vmm/intel/vmx_support.S
Provide some mitigation against CVE-2017-5715 by clearing registers
upon returning from the guest which aren't immediately clobbered by
the host. This eradicates any remaining guest contents limiting their
usefulness in an exploit gadget.

This was inspired by this linux commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5b6c02f38315b720c593c6079364855d276886aa

Reviewed by: grehan, rgrimes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13573
18:20:15 - r328010
(4 days 2 hours ago)
by dim
Affects:  /head/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Pull in r322473 from upstream llvm trunk (by Andrei Elovikov):

  [LV] Don't call recordVectorLoopValueForInductionCast for
  newly-created IV from a trunc.

  Summary:
  This method is supposed to be called for IVs that have casts in their
  use-def chains that are completely ignored after vectorization under
  PSE. However, for truncates of such IVs the same InductionDescriptor
  is used during creation/widening of both original IV based on PHINode
  and new IV based on TruncInst.

  This leads to unintended second call to
  recordVectorLoopValueForInductionCast with a VectorLoopVal set to the
  newly created IV for a trunc and causes an assert due to attempt to
  store new information for already existing entry in the map. This is
  wrong and should not be done.

  Fixes PR35773.

  Reviewers: dorit, Ayal, mssimpso

  Reviewed By: dorit

  Subscribers: RKSimon, dim, dcaballe, hsaito, llvm-commits, hiraditya

  Differential Revision: https://reviews.llvm.org/D41913

This should fix "Vector value already set for part" assertions when
building the net/iodine and sysutils/daa2iso ports.

Reported by: jbeich
PR: 224867,224868
18:08:01 - r328009
(4 days 2 hours ago)
by kevans
Affects:  /head/stand/fdt/fdt_loader_cmd.c
stand/fdt: Don't leak next_fdtp if we fail to open overlay

MFC after: 1 week
X-MFC-With: r327991
17:27:43 - r328008
(4 days 3 hours ago)
by eadler
Affects:  /head/usr.bin/units/units.c
units(1): units(1) free savescr in error condition too

CID: 978392
Reviewed by: des
MFC After: 1 week
16:58:07 - r328007
(4 days 4 hours ago)
by andrew
Affects:  /head/stand/efi/boot1/boot1.c
Fix booting on some arm64 systems after r327879 by fixing the call to
utf8_to_ucs2 in boot1.efi. We need to initialise the ucs2 output string
so it will allocate space, and use the return value to determine if the
call was successful.

Reviewed by: imp
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D13915
16:51:04 - r328006
(4 days 4 hours ago)
by eadler
Affects: 
(2 files)
/stable/11/lib/libc/stdio/fopen.3
MFC r327099:

fopen.1: document truncation

This documentation truncation similar to POSIX and glibc.

PR: 202545
16:40:43 - r328005
(4 days 4 hours ago)
by ian
Affects:  /head/sys/x86/isa/atrtc.c
Convert the x86 RTC driver to use new validated BCD<->timespec conversions.

New common routines were added to kern/subr_clock.c for converting between
calendrical time expressed in BCD and struct timespec. The new functions
return EINVAL on error, as expected when the clock hardware does not provide
valid time.

PR: 224813
Differential Revision: https://reviews.freebsd.org/D13731 (no reviewers)
16:08:34 - r328004
(4 days 4 hours ago)
by nwhitehorn
Affects:  /head/sys/powerpc/aim/aim_machdep.c
/head/sys/powerpc/aim/mmu_oea64.c
Install the SLB miss trap-handling code in the SLB-based MMU driver set up,
to which it is specific, rather than in the generic AIM startup code. This
will be required to support the radix-table-based MMU introduced with POWER9.
14:56:47 - r328003
(4 days 6 hours ago)
by markj
Affects:  /user/markj/netdump/sys/dev/virtio/network/if_vtnet.c
Remove changes left over from debugging.

Reported by: bryanv
12:17:26 - r328002
(4 days 8 hours ago)
by avg
Affects: 
(2 files)
/stable/10/sys/amd64/vmm/amd/vmcb.h
MFC r327593: Fix a couple of comments in AMD Virtual Machine Control Block
structure
12:16:49 - r328001
(4 days 8 hours ago)
by avg
Affects: 
(2 files)
/stable/11/sys/amd64/vmm/amd/vmcb.h
MFC r327593: Fix a couple of comments in AMD Virtual Machine Control Block
structure
12:15:04 - r328000
(4 days 8 hours ago)
by avg
Affects: 
(2 files)
/stable/10/sys/ddb/db_sym.c
MFC r326567: ddb: fix validation of cpu id in 'set db_cpu=x'
12:14:28 - r327999
(4 days 8 hours ago)
by avg
Affects: 
(2 files)
/stable/11/sys/ddb/db_sym.c
MFC r326567: ddb: fix validation of cpu id in 'set db_cpu=x'
12:00:35 - r327998
(4 days 9 hours ago)
by avg
Affects: 
(2 files)
/stable/10/share/examples/bhyve/vmrun.sh
MFC r326140: vmrun.sh: add -A option for AHCI emulation of disk devices
11:55:19 - r327997
(4 days 9 hours ago)
by avg
Affects: 
(2 files)
/stable/11/share/examples/bhyve/vmrun.sh
MFC r326140: vmrun.sh: add -A option for AHCI emulation of disk devices
11:20:00 - r327996
(4 days 9 hours ago)
by avg
Affects:  /head/sys/cam/scsi/scsi_da.c
/head/sys/geom/geom_disk.c
/head/sys/geom/geom_disk.h
geom_disk / scsi_da: deny opening write-protected disks for writing

Ths change consists of two parts.

geom_disk: deny opening a disk for writing if it's marked as
write-protected. A new disk(9) flag is added to mark write protected
disks. A possible alternative could be to add another parameter to d_open,
so that the open mode could be passed to it and the disk drivers could
make the decision internally, but the flag required less churn.

scsi_da: add a new phase of disk probing to query the all pages mode
sense page. We can determine if the disk is write protected using bit 7
of the device specific field in the mode parameter header returned by
MODE SENSE.

PR: 224037
Reviewed by: mav
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D13360
10:59:04 - r327995
(4 days 10 hours ago)
by tuexen
Affects: 
(6 files)
/head/lib/libsysdecode/*
Add support for decoding the type of a cmsg.
08:32:49 - r327994
(4 days 12 hours ago)
by tuexen
Affects:  /head/lib/libsysdecode/mktables
Simplify table generation.
08:04:55 - r327993
(4 days 13 hours ago)
by dim
Affects: 
(2 files)
/stable/11/contrib/llvm/lib/Support/Unix/Memory.inc
MFC r327845:

Pull in r316581 from upstream llvm trunk (by John Baldwin):

  Don't try to use a non-existent header on FreeBSD/mips.

  Reviewers: dim

  Differential Revision: https://reviews.llvm.org/D38807

Requested by: jhb
06:46:33 - r327992
(4 days 14 hours ago)
by nwhitehorn
Affects: 
(7 files)
/head/sys/powerpc/*
Move the pmap-specific code in copyinout.c that gets pointers to userland
buffers into a new pmap-module function pmap_map_user_ptr() that can
be implemented by the respective modules. This is required to implement
non-segment-based AIM-ish MMU systems such as the radix-tree page tables
introduced by POWER ISA 3.0 and present on POWER9.

Reviewed by: jhibbits
05:00:26 - r327991
(4 days 16 hours ago)
by kevans
Affects:  /head/stand/fdt/fdt_loader_cmd.c
stand/fdt: don't send clobbered FDT to the kernel

If fdt_overlay_apply fails at some stage to apply the overlay to the base,
both the base and overlay may be in an inconsistent state (some fixups
applied, some phandles adjusted, some symbols merged). These can be bad for
a number of reasons, to include user frustration if some fixups applied and
not others. Fail a little safer by making a clean copy of the base FDT for
every overlay that we can simply discard if things go awry.

This also allows us the luxury of simply discarding overlays if we hit some
kind of memory limit or if they're malformed and extremely large for some
reason. We'll now leave a nice error message indicating that some overlays
could not be applied due to size restrictions and we apply what we can.

I note that our overlay implementation has some flaws that might still leave
your system in an unbootable state even if an overlay applies correctly;
please exercise caution in using overlays until we can swap it out for
libfdt's implementation.

Tested on: BananaPi-M3 (armv7)
Tested on: Pine64 (aarch64)
Differential Revision: https://reviews.freebsd.org/D13709
04:52:12 - r327990
(4 days 16 hours ago)
by grehan
Affects:  /head/share/man/man4/Makefile
The vmm(4) man page is conditional on MK_BHYVE.

Submitted by: kevlo
01:19:11 - r327989
(4 days 19 hours ago)
by jeff
Affects: 
(4360 files)
/user/jeff/numa/*
Merge from head
01:09:10 - r327988
(4 days 19 hours ago)
by markj
Affects: 
(3 files)
/stable/11/sys/geom/mirror/g_mirror.c
/stable/11/sys/geom/mirror/g_mirror_ctl.c
MFC r327700:
Sort and remove unneeded includes.
01:06:53 - r327987
(4 days 19 hours ago)
by markj
Affects:  /user/markj/netdump/sys/net/iflib.c
Add netdump support to iflib.

Tested with bhyve's e1000 emulation (em) and a I210 adapter (igb).
00:57:55 - r327986
(4 days 20 hours ago)
by markj
Affects:  /user/markj/netdump/sys/dev/virtio/network/if_vtnet.c
Add netdump support to vtnet(4).

Tested with bhyve.
00:57:09 - r327985
(4 days 20 hours ago)
by markj
Affects:  /user/markj/netdump/sys/dev/re/if_re.c
Add netdump support to re(4).

Tested with a RealTek 8101E adapter.
00:55:34 - r327984
(4 days 20 hours ago)
by markj
Affects:  /user/markj/netdump/sys/dev/alc/if_alc.c
Add netdump support to alc(4).

Tested with an AR8162 adapter.
00:53:40 - r327983
(4 days 20 hours ago)
by markj
Affects:  /user/markj/netdump/sbin/dumpon/dumpon.c
Add dumpon(8) support for netdump client configuration.

In general we need four configuration parameters: client/server/gateway
addresses, and the name of the interface to be used. dumpon is modified
to accept (and in some cases, infer) these parameters and uses ioctls
on /dev/netdump to pass them to the client code.

This commit is lacking corresponding man page updates.
00:50:08 - r327982
(4 days 20 hours ago)
by markj
Affects: 
(13 files)
/user/markj/netdump/etc/mtree/BSD.include.dist
/user/markj/netdump/include/Makefile
/user/markj/netdump/sys/*
Add netdump client code and mbuf allocator hooks.
00:47:33 - r327981
(4 days 20 hours ago)
by markj
Affects:  /user/markj/netdump/sys/vm/uma.h
/user/markj/netdump/sys/vm/uma_core.c
Add a flag to disable per-CPU item caching in a given zone.
00:29:17 - r327980
(4 days 20 hours ago)
by markj
Affects:  /user/markj/netdump
Create a branch for integrating changes needed for netdump.

netdump is a facility that allows the kernel to transmit a kernel dump
over UDP to a remote server, instead of saving it to local media. This
is useful for diskless systems and for centralized collection of kernel
dumps in a lab environment.

This implementation will provide a kernel netdump client, including
hooks for some NIC drivers, and support for configuration with
dumpon(8). Some extensions to the mbuf allocator make it possible to
allocate mbufs/clusters after a panic using a pre-allocated pool;
this is done without imposing any runtime overhead in the regular
allocator and without having to modify driver tx/rx code. The netdump
server component is available in the ports tree as ftp/netdumpd.
2018 - 01 - 14   (5 days ago)
22:05:29 - r327979
(4 days 23 hours ago)
by manu
Affects:  /head/sys/arm/allwinner/aw_mmc.c
/head/sys/arm/allwinner/aw_mmc.h
allwinner: mmc: Multiple improvement

  - Add a per compatible configuration struct
  - Not all SoC uses the same size for DMA transfert, add this into the
  configuration data
  - Use new timing mode for some SoC (A64 mmc)
  - Auto calibrate clock for A64 mmc/emmc
  - A64 mmc controller need masking of data0
  - Add support for vmmc/vqmmc regulator
  - Add more capabilities, r/w speed is better for eMMC
  - MMC_CAP_SIGNALING_180 gives weird result so do not enable it for now.
  - Add new register documented in H3/A64 user manual

Tested-On: Pine64-LTS (A64), eMMC still doesn't work
Tested-On: A64-Olinuxino (A64), sd and eMMC are working
Tested-On: NanoPi Neo Plus2 (H5), sd and eMMC are working
Tested-On: OrangePi PC2 (H5), sd only (no eMMC)
Tested-On: OrangePi One (H3), sd only (no eMMC)
Tested-On: BananaPi M2 (A31s), sd only (no eMMC)
21:21:10 - r327978
(4 days 23 hours ago)
by pfg
Affects:  /svnadmin/conf/mentors
Free Fedor Uporov from mentorship.

He can now create his own bugs autonomously.
20:46:39 - r327977
(5 days ago)
by fsu
Affects: 
(15 files)
/head/sys/fs/ext2fs/*
Add metadata_csum feature support.

Reviewed by: pfg (mentor)
Approved by: pfg (mentor)
MFC after: 6 months

Differential Revision: https://reviews.freebsd.org/D13810
20:36:21 - r327976
(5 days ago)
by phk
Affects: 
(4 files)
/head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c
/head/sys/dts/arm/bcm2836.dtsi
/head/sys/modules/rpi_pwm/Makefile
Add a rudimentary PWM driver for the RaspberryPi.

Control is through sysctl, only GPIO12 supported.

bootverbose creates sysctls for direct mangling of relevant registers.

Only tested on RPI2
20:30:58 - r327975
(5 days ago)
by eadler
Affects:  /head/share/man/man4/Makefile
vmm(4): add to Makefile

r326281 added the vmm man page, but it needs to be installed.

PR: 205705
20:23:44 - r327974
(5 days ago)
by eadler
Affects: 
(2 files)
/stable/11/share/man/man4/vmm.4
MFC r326281:

Add vmm(4) man page

PR: 205705
17:56:19 - r327973
(5 days 3 hours ago)
by markj
Affects:  /head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
Remove tst.zonename.d from the list of expected failures.

X-MFC with: r327888
17:55:40 - r327972
(5 days 3 hours ago)
by markj
Affects:  /head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Use the thread's ucred struct when fetching jid or jailname.

Reported by: mjg
X-MFC with: r327888
17:01:37 - r327971
(5 days 4 hours ago)
by ian
Affects:  /head/sys/kern/subr_clock.c
/head/sys/sys/clock.h
Add RTC clock conversions for BCD values, with non-panic validation.

RTC clock hardware frequently uses BCD numbers. Currently the low-level
bcd2bin() and bin2bcd() functions will KASSERT if given out-of-range BCD
values. Every RTC driver must implement its own code for validating the
unreliable data coming from the hardware to avoid a potential kernel panic.

This change introduces two new functions, clock_bcd_to_ts() and
clock_ts_to_bcd(). The former validates its inputs and returns EINVAL if any
values are out of range. The latter guarantees the returned data will be
valid BCD in a known format (4-digit years, etc).

A new bcd_clocktime structure is used with the new functions. It is similar
to the original clocktime structure, but defines the fields holding BCD
values as uint8_t (uint16_t for year), and adds a PM flag for handling hours
using AM/PM mode.

PR: 224813
Differential Revision: https://reviews.freebsd.org/D13730 (no reviewers)
16:55:14 - r327970
(5 days 4 hours ago)
by imp
Affects:  /head/sbin/fsck_ffs/pass5.c
Report CG checksum mismatches. These errors are non-fatal. The
previous behavior is preserved (the CG checksum is fixed). We're just
noisy about it now.

Reviewed by: kirk@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13884
16:04:51 - r327969
(5 days 5 hours ago)
by emaste
Affects:  /head/sys/i386/conf/GENERIC
Enable VIMAGE in i386 GENERIC (revert r327840)

We've switched back to ld.bfd on i386 for now.

PR: 225077
Sponsored by: The FreeBSD Foundation
15:01:25 - r327968
(5 days 6 hours ago)
by bz
Affects:  /head/sys/kern/kern_fork.c
Remove trailing whitespace.
No functional change.
14:33:22 - r327967
(5 days 6 hours ago)
by tuexen
Affects:  /head/usr.bin/truss/syscall.h
/head/usr.bin/truss/syscalls.c
Improve support for sctp_generic_recvmsg() and sctp_generic_sendmsg()
and add support for sctp_generic_sendmsg_iov().

Handle the struct iovec argument and the struct sctp_sndrcvinfo
arguments.
14:27:42 - r327966
(5 days 6 hours ago)
by tuexen
Affects: 
(6 files)
/head/lib/libsysdecode/*
Add a function is decode the sinfo_flags of struct sctp_sndrcvinfo.
12:39:50 - r327965
(5 days 8 hours ago)
by kib
Affects:  /head/sys/amd64/include/cpufunc.h
Add STAC and CLAC instructions wrappers.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13838
12:36:23 - r327964
(5 days 8 hours ago)
by kib
Affects:  /head/sys/x86/include/specialreg.h
/head/sys/x86/include/x86_var.h
/head/sys/x86/x86/identcpu.c
Enumerate and print Intel CPU features for Speculative Execution Side
Channel Mitigations.

The definitions are taken from the document 336996-001.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
12:33:05 - r327963
(5 days 8 hours ago)
by kib
Affects:  /head/sys/dev/cpuctl/cpuctl.c
When re-evaluating cpu_features, also re-print CPU identification.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
12:08:41 - r327962
(5 days 8 hours ago)
by tuexen
Affects: 
(5 files)
/head/lib/libsysdecode/*
Add suppor for the supported PR-SCTP policies.
09:51:25 - r327961
(5 days 11 hours ago)
by tuexen
Affects:  /head/usr.bin/truss/syscalls.c
Mark the iovec parameters of writev() and readv() as IN and OUT.
This makes truss work on readv() as expected.
09:33:44 - r327960
(5 days 11 hours ago)
by kib
Affects: 
(3 files)
/stable/11/sys/amd64/amd64/cpu_switch.S
/stable/11/sys/amd64/amd64/genassym.c
MFC r327817:
Rename COMMON_TSS_RSP0 to TSS_RSP0.
09:29:06 - r327959
(5 days 11 hours ago)
by kib
Affects: 
(3 files)
/stable/11/sys/amd64/amd64/support.S
/stable/11/sys/i386/i386/support.s
MFC r327816, r327834:
Update comment explaining the check, to reality.
06:03:40 - r327958
(5 days 15 hours ago)
by bryanv
Affects:  /head/sys/dev/virtio/virtio.c
/head/sys/dev/virtio/virtio_ids.h
Sync VirtIO IDs with Linux
05:10:02 - r327957
(5 days 15 hours ago)
by kevans
Affects:  /stable/11/lib/libstand/Makefile
MFC (conceptually) r327377: Pull in strnlen for sys/boot environment

This is a direct commit to stable/11 due to restructuring of lib/libstand =>
stand/libsa in -HEAD. The diff remains the same and it is simply applied to
the previous location.

MFC r327377: Pull in strnlen from libc

strnlen is not used at the moment, but it will be when libfdt gets updated.
Prepare for the not-so-distant future by pulling in strnlen.
05:07:15 - r327956
(5 days 15 hours ago)
by bryanv
Affects: 
(2 files)
/stable/11/share/man/man4/vxlan.4
MFC r327448:

Add rc.conf vxlan example
05:05:06 - r327955
(5 days 16 hours ago)
by bryanv
Affects: 
(2 files)
/stable/11/etc/services
MFC r327438:

Add VXLAN (RFC 7348) port
03:36:03 - r327954
(5 days 17 hours ago)
by jeff
Affects: 
(11 files)
/head/sys/*
Move VM_NUMA_ALLOC and DEVICE_NUMA under the single global config option NUMA.

Sponsored by: Netflix, Dell/EMC Isilon
Discussed with: jhb
00:31:34 - r327953
(5 days 20 hours ago)
by pfg
Affects:  /head/sys/dev/mxge/if_mxge.c
Fix build after r327949.

Reported by: Cy Schubert
00:08:34 - r327952
(5 days 20 hours ago)
by dim
Affects: 
(4223 files)
/head/*
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r321788). Upstream has branched for the
6.0.0 release, which should be in about 6 weeks. Please report bugs and
regressions, so we can get them into the release.

Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11
support to build; see UPDATING for more information.

MFC after: 3 months
2018 - 01 - 13   (6 days ago)
23:31:21 - r327951
(5 days 21 hours ago)
by n_hibma
Affects:  /head/sys/dev/usb/serial/u3g.c
/head/sys/dev/usb/usbdevs
Add support for Quectel EC25.

Submitted by: Samuel Crookes
MFC after: 3 days
23:14:53 - r327950
(5 days 21 hours ago)
by nwhitehorn
Affects: 
(5 files)
/head/sys/powerpc/*
Document places we assume that physical memory is direct-mapped at zero by
using a new macro PHYS_TO_DMAP, which deliberately has the same name as the
equivalent macro on amd64. This also sets the stage for moving the direct
map to another base address.
22:30:30 - r327949
(5 days 22 hours ago)
by pfg
Affects: 
(43 files)
/head/sys/dev/*
dev: make some use of mallocarray(9).

Focus on code where we are doing multiplications within malloc(9). None of
these is likely to overflow, however the change is still useful as some
static checkers can benefit from the allocation attributes we use for
mallocarray.

This initial sweep only covers malloc(9) calls with M_NOWAIT. No good
reason but I started doing the changes before r327796 and at that time it
was convenient to make sure the sorrounding code could handle NULL values.
21:39:46 - r327948
(5 days 23 hours ago)
by bryanv
Affects:  /head/sys/dev/virtio/console/virtio_console.c
Fix possible panic when creating VirtIO console dev aliases

Since we have no control over the name, the MAKEDEV_CHECKNAME flag must be
used to return an error on an invalid (to devfs) name instead of panicing.

r305900 that originally added this feature also introduced a few other bugs:
  - Proper locking not performed
  - Theoretically broke the expectation that the control event buffer would
  not span more than one pages, but did not update the CTASSERT that was
  in place to prevent this. However, since the struct virtio_console_control
  and the bulk buffer together were quite small, this could not have happened.

Also workaround an QEMU VirtIO spec violation in that it includes the NUL
terminator in the buffer length when the spec says it is not included.

PR: 223531
MFC after: 1 week
21:37:14 - r327947
(5 days 23 hours ago)
by eadler
Affects:  /head/usr.bin/limits/limits.1
limits(1): also bump .Dd...

PR: 225147
MFC After: 1 week
21:36:39 - r327946
(5 days 23 hours ago)
by eadler
Affects:  /head/usr.bin/limits/limits.1
limits(1): fix grammar

Submitted by: yuri
PR: 225147
MFC After: 1 week
21:27:36 - r327945
(5 days 23 hours ago)
by kevans
Affects:  /stable/11/sys/boot/fdt/fdt_loader_cmd.c
/stable/11/sys/boot/fdt/fdt_overlay.c
/stable/11/sys/boot/fdt/fdt_overlay.h
MFC (conceptually) r327376, r327416: Improve libfdt compatibility

This is a direct commit to stable/11 due to restructuring of sys/boot =>
stand in -HEAD. The diff remains the same and it is simply applied to the
previous location.

MFC r327376: stand/fdt: Swap libfdt include order

libfdt.h should be included before fdt.h, as hinted at by all of libfdt/;
standard include order being libfdt.h, libfdt_env.h, fdt.h.

The current include order also causes problems when libfdt gets updated, as
fdt.h requires some definitions from libfdt.h.

MFC r327416: stand/fdt: Make fdt_overlay_apply signature-compatible with
  libfdt

libfdt will assume a writable fdt overlay blob has been passed in, so make
ours compatible to allow easier review when we try to drop libfdt into
place. overlay from the calling context is writable, making it safe to
simply rip out everything related to copying the overlay blob in
fdt_overlay_apply.

I note here that we still have problems: fdt_overlay_apply, both our version
and libfdt's, may fail and have already clobbered the base fdt to some
extent. Future work will make sure we don't apply a potentially bogus fdt,
instead discarding the base fdt if we had an error.
21:19:55 - r327944
(5 days 23 hours ago)
by kevans
Affects:  /stable/11/sys/boot/efi/fdt/efi_fdt.c
/stable/11/sys/boot/uboot/fdt/uboot_fdt.c
MFC (conceptually) r327350: Consistently apply fdt_overlays

This is a direct commit to stable/11 due to restructuring of sys/boot =>
stand in -HEAD. The diff remains the same and it is simply applied to the
previous location.

MFC r327350: stand/fdt: Consistently apply fdt_overlays

Overlays were previously not applied when U-Boot provides FDT or EFI
provides FDT, only when we load FDT from /boot/dtb given name from U-Boot.

Make all three paths lead to loading fdt_overlays and applying them, so that
fdt_overlays can be expected to Just Work.
21:10:42 - r327943
(5 days 23 hours ago)
by jhibbits
Affects:  /head/sys/powerpc/mpc85xx/mpc85xx_cache.c
Include only the headers needed

The extra headers came through evolution of the file.
21:08:38 - r327942
(5 days 23 hours ago)
by kevans
Affects:  /stable/11/sys/boot/fdt/fdt_loader_cmd.c
/stable/11/sys/boot/fdt/fdt_overlay.c
MFC (conceptually) r327298, r327299: Fix overlay application behavior

This is a direct commit to stable/11 due to restructuring of sys/boot =>
stand in -HEAD. The diff remains the same and it simply applied to the
previous location.

MFC r327298: stand/fdt: Fix loading of multiple fdt_overlays

fdt_load_dtb_overlays was written to unload previous overlay when a new
valid one is come across. fdt_apply_overlays further down is written to
iterate over all .dtbo's currently loaded and apply them one-by-one. Correct
fdt_load_dtb_overlays to stop dropping valid overlays that were previously
loaded and match expectations.

MFC r327299: stand/fdt: Avoid bailout when dtbo has no fixups

In the case of a simple dtbo where fragment uses target-path and the overlay
contains no references, /__fixups__ will not be included by either our dtc
or dtc from ports, but the file still has valid fragments to be applied.

Additional testing found that /__symbols__ might also be omitted if it's
empty, which is not necessarily an error.
20:35:32 - r327941
(6 days ago)
by eadler
Affects:  /head/usr.sbin/timed/timed/extern.h
/head/usr.sbin/timed/timed/slave.c
timed: slave is an infinite loop, mark it as such
19:02:51 - r327940
(6 days 2 hours ago)
by pfg
Affects:  /head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
zstd: Use mallocarray(9) for calloc macro.

This is in contrib code but since we only have mallocarray(9) in current
we will not upstream this.

This effectively brings back r327934, which was reverted to correct the
log message.
19:02:08 - r327939
(6 days 2 hours ago)
by kevans
Affects:  /head/sys/arm/allwinner/aw_syscon.c
Add SPDX tag to aw_syscon(4)
19:00:41 - r327938
(6 days 2 hours ago)
by kevans
Affects: 
(4 files)
/head/sys/dev/extres/syscon/*
Add SPDX tags to syscon bits, correct inconsistency in Copyright line.
18:56:42 - r327937
(6 days 2 hours ago)
by pfg
Affects:  /head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
Revert r327934 to fix the log message.
18:46:31 - r327936
(6 days 2 hours ago)
by kevans
Affects: 
(6 files)
/head/share/man/man4/*
/head/sys/arm/allwinner/*
/head/sys/dev/extres/syscon/*
Introduce aw_syscon(4) for earlier attachment

Attaching syscon_generic earlier than BUS_PASS_DEFAULT makes it more
difficult for specific syscon drivers to attach to the syscon node and to
get ordering right. Further discussion yielded the following set of
decisions:

- Move syscon_generic to BUS_PASS_DEFAULT
- If a platform needs a syscon with different attach order or probe
behavior, it should subclass syscon_generic and match on the SoC specific
compat string
- When we come across a need for a syscon that attaches earlier but only
specifies compatible = "syscon", we should create a syscon_exclusive driver
that provides generic access but probes earlier and only matches if "syscon"
is the only compatible. Such fdt nodes do exist in the wild right now, but
we don't really use them at the moment.

Additionally:

- Any syscon provider that has needs any more complex than a spinlock solely
for syscon access and a single memory resource should subclass syscon
directly rather than attempting to subclass syscon_generic or add complexity
to it. syscon_generic's attach/detach methods may be made public should the
need arise to subclass it with additional attach/detach behavior.

We introduce aw_syscon(4) that just subclasses syscon_generic but probes
earlier to meet our requirements for if_awg and implements #2 above for this
specific situation. It currently only matches a64/a83t/h3 since these are
the only platforms that really need it at the time being.

Discussed with: ian
Reviewed by: manu, andrew, bcr (manpages, content unchanged since review)
Differential Revision: https://reviews.freebsd.org/D13793
18:28:30 - r327935
(6 days 2 hours ago)
by pfg
Affects:  /head/share/examples/etc/bsd-style-copyright
Add SPDX identifier for the example license.

For project files we should use the -FreeBSD prefix but for this example
assume it is going to be used for some general purpose.

Submitted by: kevlo
18:09:09 - r327934
(6 days 2 hours ago)
by pfg
Affects:  /head/sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h
zstd: Use memalloc(9) for calloc macro.

This is in contrib code but since we only have memalloc(9) in current we
will not upstream this.
17:56:46 - r327933
(6 days 3 hours ago)
by dim
Affects:  /projects/clang600-import/contrib/llvm/tools/clang
And another whack with the cluestick for Subversion.
17:55:22 - r327932
(6 days 3 hours ago)
by cem
Affects:  /head/sys/x86/include/bus.h
amd64: Add a 48-bit MAXADDR constant

Some devices (e.g., ccp(4) -- to be committed) can only access the low 48
bits of physical memory.

Reviewed by: markj
Sponsored by: Dell EMC Isilon
17:52:55 - r327931
(6 days 3 hours ago)
by dim
Affects: 
(123 files)
/projects/clang600-import/*
Merge ^/head r327886 through r327930.
17:47:34 - r327930
(6 days 3 hours ago)
by dim
Affects:  /head/contrib/llvm/tools/clang/include/clang/AST/Expr.h
/head/contrib/llvm/tools/clang/lib/AST/Expr.cpp
/head/contrib/llvm/tools/clang/lib/Sema/SemaInit.cpp
Pull in r314499 from upstream clang trunk (by Daniel Marjamäki):

  [Sema] Suppress warnings for C's zero initializer

  Patch by S. Gilles!

  Differential Revision: https://reviews.llvm.org/D28148

Pull in r314838 from upstream clang trunk (by Richard Smith):

  Suppress -Wmissing-braces warning when aggregate-initializing a
  struct with a single field that is itself an aggregate.

  In C++, such initialization of std::array<T, N> types is guaranteed
  to work by the standard, is completely idiomatic, and the "suggested"
  alternative from Clang was technically invalid.

Together, these suppress unneeded "suggest braces around initialization
of subobject" warnings for C++11 initializer lists.

MFC after: 3 days
17:36:11 - r327929
(6 days 3 hours ago)
by marius
Affects:  /head/sys/dev/mmc/mmc.c
Use the correct revision specifier (EXT_CSD revision rather than
system specification version) for deciding whether the EXT_CSD
register includes the EXT_CSD_GEN_CMD6_TIME field.

Submitted by: Masanobu SAITOH
17:25:48 - r327928
(6 days 3 hours ago)
by jhibbits
Affects:  /head/sys/powerpc/mpc85xx/mpc85xx_cache.c
Add SPDX identifier to header

Reported by: pfg
17:21:45 - r327927
(6 days 3 hours ago)
by bryanv
Affects: 
(4 files)
/stable/11/sbin/ifconfig/ifvxlan.c
/stable/11/sys/net/if_vxlan.c
/stable/11/sys/net/if_vxlan.h
MFC r327375, r327385, r327386:

Add support for IPv6 scoped addresses to vxlan

Advertise IFCAP_LINKSTAT after r326480 added link status support

Add macro for vxlan list mutex lock and unlock
16:32:09 - r327926
(6 days 4 hours ago)
by marius
Affects:  /head/sys/dev/mmc/mmcsd.c
Fix a bug introduced in r327355; in mmcsd_ioctl_cmd() when ensuring
that userland doesn't switch partitions on its own, compare against
the partition mmcsd_ioctl_cmd() is going to switch to (based on the
device node used) rather than the currently selected partition.
16:31:07 - r327925
(6 days 4 hours ago)
by mav
Affects:  /head/sys/dev/wbwd/wbwd.c
Add IDs for Nuvoton NCT6793/NCT6795.

MFC after: 2 weeks
16:21:13 - r327924
(6 days 4 hours ago)
by marius
Affects:  /head/sys/dev/sdhci/sdhci.c
Fix a bug introduced in r327339; at the point in time re-tuning is
executed, the interrupt aggregation code might have disabled the
SDHCI_INT_DMA_END and/or SDHCI_INT_RESPONSE bits in slot->intmask
and the SDHCI_SIGNAL_ENABLE register respectively. So when restoring
the interrupt masks based on the previous contents of slot->intmask
in sdhci_exec_tuning(), ensure that the SDHCI_INT_ENABLE register
doesn't lose these two bits.
While at it and in the spirit of r327339, let sdhci_tuning_intmask()
set the tuning error and re-tuning interrupt bits based on the
SDHCI_TUNING_ENABLED rather than the SDHCI_TUNING_SUPPORTED flag
being set, i. e. only when (re-)tuning is actually used. Currently,
this changes makes no net difference, though.
14:14:50 - r327923
(6 days 6 hours ago)
by karels
Affects:  /stable/11/UPDATING
Add info about SW_WATCHDOG change to be dynamic in the common case.
14:10:45 - r327922
(6 days 6 hours ago)
by manu
Affects:  /head/sys/dev/mmc/host/dwmmc_hisi.c
dwmmc_hisi: Fix build when option MMCCAM is defined
14:10:45 - r327921
(6 days 6 hours ago)
by tuexen
Affects:  /head/usr.bin/truss/syscalls.c
Fix a typo introduced in r327919.
14:10:05 - r327920
(6 days 6 hours ago)
by karels
Affects: 
(6 files)
/stable/11/share/man/man4/watchdog.4
/stable/11/sys/*
MFC r327505:

make SW_WATCHDOG dynamic

Enable the hardclock-based watchdog previously conditional on the
SW_WATCHDOG option whenever hardware watchdogs are not found, and
watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
still causes the sofware watchdog to be enabled even if there is a
hardware watchdog. This does not change the other software-based
watchdog enabled by the --softtimeout option to watchdogd.

Note that the code to reprime the watchdog during kernel core dumps is
no longer conditional on SW_WATCHDOG. I think this was previously a bug.

Reviewed by: imp alfred bjk
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D13713
13:59:35 - r327919
(6 days 7 hours ago)
by tuexen
Affects:  /head/usr.bin/truss/syscall.h
/head/usr.bin/truss/syscalls.c
Add support for readv() and writev() to truss.

Sponsored by: Netflix, Inc.
13:53:05 - r327918
(6 days 7 hours ago)
by dim
Affects:  /projects/clang600-import/lib/clang/liblldb/Makefile
/projects/clang600-import/usr.bin/clang/llvm-extract/Makefile
Build llvm-extract with -lz, and add a few objects to liblldb, both of
which turn out to be needed when you don't use -ffunction-sections.

Reported by: Shawn Webb <shawn.webb@hardenedbsd.org>
11:59:49 - r327917
(6 days 9 hours ago)
by kib
Affects:  /head/sys/kern/subr_kdb.c
Add sysctl debug.kdb.stack_overflow to conveniently test kernel
handling of the kstack overflow.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week
09:30:34 - r327916
(6 days 11 hours ago)
by eadler
Affects: 
(2 files)
/stable/11/sys/kern/kern_fork.c
MFC r323390:

If the user tries to set kern.randompid to 1 (which is meaningless), set
it to a random value between 100 and 1123, rather than 0 as before.
09:28:43 - r327915
(6 days 11 hours ago)
by eadler
Affects: 
(2 files)
/stable/11/usr.sbin/bsdinstall/scripts/hardening
MFC r324206:

bsdinstall(8) hardening menu: Utilize new kern.randompid=1 behaviour

Enabling the PID randomization option in bsdinstall(8)'s hardening menu
now randomizes the effective value of kern.randompid on each boot.

Previous behaviour:
When kern.randompid was enabled via the the bsdinstall(8) hardening menu,
a random value was generated and placed in the systems /etc/sysctl.conf as
kern.randompid=value
This makes the value of kern.randompid static across reboots.

New behaviour:
When kern.randompid is enabled via the bsdinstall(8) hardening menu, the
line kern.randompid=1 is placed in the systems /etc/sysctl.conf.
This takes advantage of a new kernel feature and makes the value of
kern.randompid be randomized by the kernel on each reboot.
09:26:24 - r327914
(6 days 11 hours ago)
by mjg
Affects:  /head/sys/kern/kern_sx.c
sx: retry hard shared unlock just like in r327905 for rwlocks
08:28:46 - r327913
(6 days 12 hours ago)
by cy
Affects:  /head/sys/contrib/ipfilter/netinet/radix_ipf.c
Remove redundant variable.

MFC after: 1 week
08:16:10 - r327912
(6 days 12 hours ago)
by cy
Affects:  /head/sys/contrib/ipfilter/netinet/ip_ftp_pxy.c
Though this block of code is not used by FreeBSD, correct a call to
sprintf() with a macro call to SNPRINTF similar to other calls to
SNPRINTF within this same block.

MFC after: 1 week
04:53:04 - r327911
(6 days 16 hours ago)
by jhibbits
Affects:  /head/lib/libpmc/libpmc.c
Replace the PMC class struct copy with an explicit memcpy()

This should be effectively a nop for all archs, but for some reason the codegen
difference on the PowerPC 970 is such that the struct assignment doesn't work
(unless a printf() using one of the elements in the copied struct follows it),
while the memcpy() succeeds. On all archs the memcpy() should be expanded to an
inline copy, since the copy is bounded to ~16 bytes.

MFC after: 3 weeks
04:00:55 - r327910
(6 days 17 hours ago)
by emaste
Affects:  /head/share/man/man5/src.conf.5
/head/share/mk/src.opts.mk
Revert r327823, Enable ld.lld as bootstrap linker by default on i386

There's a report of some regression in ports. Revert for now for an
exp run for this change in isolation (previous lld exp run also included
switching the linker used for ports to lld).

Also revert the src.conf.5 regeneration in r327824.

Reported by: antoine
Sponsored by: The FreeBSD Foundation
03:12:21 - r327909
(6 days 17 hours ago)
by ian
Affects:  /stable/11/tools/build/options/WITHOUT_LINT
/stable/11/tools/build/options/WITH_LINT
Fix fallout from applying a patch twice.

Reported by: jhb@
Pointy hat: ian@
03:09:05 - r327908
(6 days 17 hours ago)
by nwhitehorn
Affects:  /head/sys/powerpc/ofw/ofw_machdep.c
Chase removal of FDT fixup code on PowerPC in r327907.
02:56:09 - r327907
(6 days 18 hours ago)
by jhibbits
Affects:  /head/sys/conf/files.powerpc
/head/sys/dev/fdt/fdt_powerpc.c
/head/sys/dev/ofw/ofw_fdt.c
Remove fdt fixups for powerpc, they are no longer needed.

If a fixup really is needed, it should be fixed in u-boot, not in FreeBSD.

Suggested by: nwhitehorn
01:36:37 - r327906
(6 days 19 hours ago)
by jhibbits
Affects:  /head/sys/conf/files.powerpc
/head/sys/powerpc/mpc85xx/mpc85xx_cache.c
Enable L2 cache on supported PowerQUICC and QorIQ platforms

Some PowerQUICC and QorIQ platforms have a L2 cache managed via the
memory-mapped configuration registers, and appear as a node in the device
tree. This adds basic support to enable the cache.
00:05:31 - r327905
(6 days 21 hours ago)
by mjg
Affects:  /head/sys/kern/kern_rwlock.c
rwlock: try regular read unlock even in the hard path

Saves on turnstile trips if the lock got more readers.
00:04:11 - r327904
(6 days 21 hours ago)
by np
Affects:  /head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
cxgbe/iw_cxgbe: Remove duplicates to fix compilation with recent gcc.

 


Powered by Python FreeBSD support by secnetix GmbH & Co. KG

Page generated in 28 ms, 268 revisions printed. Current time is 2018-01-19 21:05:35. All times are in UTC/GMT.