]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoFix the following -Werror warning from clang 10.0.0 in bsnmpd:
dim [Fri, 31 Jan 2020 18:09:27 +0000 (18:09 +0000)]
Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in bsnmpd:
dim [Wed, 29 Jan 2020 21:40:35 +0000 (21:40 +0000)]
Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                            begemotBridgeStpPortEnable_enabled ||
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Work around it by casting the enum values to the type of val->v.integer.

MFC after: 3 days

4 years agoMerge ^/head r357179 through r357269.
dim [Wed, 29 Jan 2020 21:09:36 +0000 (21:09 +0000)]
Merge ^/head r357179 through r357269.

4 years agoMerge r357267 from the clang1000-import branch:
dim [Wed, 29 Jan 2020 21:07:46 +0000 (21:07 +0000)]
Merge r357267 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in tip:

usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

MFC after: 3 days

4 years agoMerge r357260 from the clang1000-import branch:
dim [Wed, 29 Jan 2020 21:06:22 +0000 (21:06 +0000)]
Merge r357260 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in procstat:

usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in tip:
dim [Wed, 29 Jan 2020 20:56:31 +0000 (20:56 +0000)]
Fix the following -Werror warning from clang 10.0.0 in tip:

usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

MFC after: 3 days

4 years agomips: unbreak module builds after r357265
kevans [Wed, 29 Jan 2020 18:54:21 +0000 (18:54 +0000)]
mips: unbreak module builds after r357265

Touch opt_global.h to make sure it exists...

Pointy hat: kevans

4 years agokmod build: start generating opt_global.h, include it
kevans [Wed, 29 Jan 2020 18:50:55 +0000 (18:50 +0000)]
kmod build: start generating opt_global.h, include it

For untied module builds, we'll generate opt_foo headers if they're included
in SRCS. However, options that would normally be represented in opt_global.h
aren't properly represented.

Start generating opt_global.h with #define VIMAGE for !mips since it's
almost universally a project default and right now kmods must hack it in
themselves in order to be properly compiled for the default kernel. For
example, ^/sys/modules/pf/Makefile

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D23345

4 years agopkgbase: fix caroot packaging and add post-install script
kevans [Wed, 29 Jan 2020 18:47:08 +0000 (18:47 +0000)]
pkgbase: fix caroot packaging and add post-install script

The original intention for caroot was to be packaged separately, perhaps so
that users can have a more/less conservative upgrade policy for this
separated from the rest of base.

secure/caroot/Makefile doesn't have anything interesting to package, but its
subdirectories might. Move the PACKAGE= to Makefile.inc so both blacklisted
and trusted get packaged consistently into the correct one rather than the
default -utilities. Also tag the directories for package=caroot, as they
could also be empty; blacklisted is empty by default, but trusted is not.

Add a post-install script to do certctl rehash, along with a note should we
eventually come up with a way to detect that files have been added or
removed that requires a rehash.

-caroot gets a dependency on -utilities, as that's where we provide certctl
at the moment. We can perhaps reconsider this and put certctl into this
package in the future, but there are some bits within -utilities that
unconditionally invoke certctl so let's hold off for now.

Reviewed by: manu (earlier version, before -utilities dep added)
Differential Revision: https://reviews.freebsd.org/D23352

4 years agoPlug parent iface refcount leak on <ifname>.X vlan creation.
melifaro [Wed, 29 Jan 2020 18:41:35 +0000 (18:41 +0000)]
Plug parent iface refcount leak on <ifname>.X vlan creation.

PR: kern/242270
Submitted by: Andrew Boyer <aboyer at pensando.io>
MFC after: 2 weeks

4 years ago[PPC64] Fix NUMA on POWER8
luporl [Wed, 29 Jan 2020 18:13:44 +0000 (18:13 +0000)]
[PPC64] Fix NUMA on POWER8

On some POWER8 machines, 'ibm,associativity' property may have 6
cells, which would overflow the 5 cells buffer being used.
There was also an issue with the "check if node is root" part,
that have been fixed too.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D23414

4 years agoAdd myself (alfredo) to committers-src.dot and calendar.freebsd
alfredo [Wed, 29 Jan 2020 17:39:38 +0000 (17:39 +0000)]
Add myself (alfredo) to committers-src.dot and calendar.freebsd

Approved by: jhibbits (mentor)

4 years agoFix the following -Werror warning from clang 10.0.0 in procstat:
dim [Wed, 29 Jan 2020 17:01:02 +0000 (17:01 +0000)]
Fix the following -Werror warning from clang 10.0.0 in procstat:

usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

MFC after: 3 days

4 years agoRevert upstream lld r371957 (git commit 06bb7dfbd) by Fangrui Song:
dim [Wed, 29 Jan 2020 16:57:55 +0000 (16:57 +0000)]
Revert upstream lld r371957 (git commit 06bb7dfbd) by Fangrui Song:

  [ELF] Map the ELF header at imageBase

  If there is no readonly section, we map:

  * The ELF header at imageBase+maxPageSize
  * Program headers at imageBase+maxPageSize+sizeof(Ehdr)
  * The first section .text at imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)

  Due to the interaction between Writer<ELFT>::fixSectionAlignments and
  LinkerScript::allocateHeaders,
  `alignDown(p_vaddr(R PT_LOAD)) = alignDown(p_vaddr(RX PT_LOAD))`.
  The RX PT_LOAD will override the R PT_LOAD at runtime, which is not ideal:

  ```
  // PHDR at 0x401034, should be 0x400034
    PHDR           0x000034 0x00401034 0x00401034 0x000a0 0x000a0 R   0x4
  // R PT_LOAD contains just Ehdr and program headers.
  // At 0x401000, should be 0x400000
    LOAD           0x000000 0x00401000 0x00401000 0x000d4 0x000d4 R   0x1000
    LOAD           0x0000d4 0x004010d4 0x004010d4 0x00001 0x00001 R E 0x1000
  ```

  * createPhdrs allocates the headers to the R PT_LOAD.
  * fixSectionAlignments assigns `imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)` (formula: `alignTo(dot, maxPageSize) + dot % config->maxPageSize`) to addrExpr of .text
  * allocateHeaders computes the minimum address among SHF_ALLOC sections, i.e. addr(.text)
  * allocateHeaders sets address of ELF header to `addr(.text)-sizeof(Ehdr)-sizeof(program headers) = imageBase+maxPageSize`

  The main observation is that when the SECTIONS command is not used, we
  don't have to call allocateHeaders. This requires an assumption that
  the presence of PT_PHDR and addresses of headers can be decided
  regardless of address information.

  This may seem natural because dot is not manipulated by a linker script.
  The other thing is that we have to drop the special rule for -T<section>
  in `getInitialDot`. If -Ttext is smaller than the image base, the headers
  will not be allocated with the old behavior (allocateHeaders is called)
  but always allocated with the new behavior.

  The behavior change is not a problem. Whether and where headers are
  allocated can vary among linkers, or ld.bfd across different versions
  (--enable-separate-code or not). It is thus advised to use a linker
  script with the PHDRS command to have a consistent behavior across
  linkers. If PT_PHDR is needed, an explicit --image-base can be a simpler
  alternative.

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

  llvm-svn: 371957

This causes "ld: error: output file too large: 18446744073707016908
bytes" when linking our loader_4th and loader_lua.  Clearly, something
is wrong when using -Ttext 0x0: I will file an upstream bug report for
this.

4 years agoAdd driver for Xilinx XDMA PCIe Bridge found in the U.S. Government
br [Wed, 29 Jan 2020 16:52:12 +0000 (16:52 +0000)]
Add driver for Xilinx XDMA PCIe Bridge found in the U.S. Government
Furnished Equipment (GFE) riscv cores.

GFE cores are synthesized on the Xilinx Virtex UltraScale+ FPGA VCU118
Evaluation Kit.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23337

4 years agopkgbase: kill off clibs.ucl and docs.ucl
kevans [Wed, 29 Jan 2020 16:24:16 +0000 (16:24 +0000)]
pkgbase: kill off clibs.ucl and docs.ucl

These are just direct copies of the template. If they don't exist but are
attempted to be used, generate-ucl.sh will simply fallback to the template
anyways. Let it do so to reduce potential maintenance burden.

4 years agocgem: Add another compat string for the SiFive fu540
mhorne [Wed, 29 Jan 2020 15:58:19 +0000 (15:58 +0000)]
cgem: Add another compat string for the SiFive fu540

Newer device trees use "sifive,fu540-c000-gem" instead of "cdns,macb".

Reviewed by: br, kp
Differential Revision: https://reviews.freebsd.org/D23407

4 years agoFix definition of SSTATUS_SD
mhorne [Wed, 29 Jan 2020 15:50:48 +0000 (15:50 +0000)]
Fix definition of SSTATUS_SD

The SD bit is defined as the MSB of the sstatus register, meaning its
position will vary depending on the CSR's length. Previously, there were
two (unused) defines for this, for the 32 and 64-bit cases, but their
definitions were swapped.

Consolidate these into one define: SSTATUS_SD, and make the definition
dependent on the value of __riscv_xlen.

Reviewed by: br
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D23402

4 years agoAdd an overlay for RK3328 USB3 node.
ganbold [Wed, 29 Jan 2020 12:10:42 +0000 (12:10 +0000)]
Add an overlay for RK3328 USB3 node.
It doesn't exist in mainline dts due to the issues related
with detaching and reattaching USB3 devices as mentioned in
https://patchwork.kernel.org/patch/10853381/
In case of FreeBSD, as a temporary workaround "usbconfig reset"
command can fix the problem.

Reviewed by: manu

4 years agoRestore OOM logic on page fault after r357026.
kib [Wed, 29 Jan 2020 12:02:47 +0000 (12:02 +0000)]
Restore OOM logic on page fault after r357026.

Right now OOM is initiated unconditionally on the page allocation
failure, after the wait.

Reported by: Mark Millard <marklmi@yahoo.com>
Reviewed by: cy, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D23409

4 years agoEnable USB3 support for Rockchip RK3328 SoC.
ganbold [Wed, 29 Jan 2020 09:36:59 +0000 (09:36 +0000)]
Enable USB3 support for Rockchip RK3328 SoC.

Reviewed by: manu

4 years agoAdd USB3 related clock definitions for Rockchip RK3328 SoC.
ganbold [Wed, 29 Jan 2020 08:46:35 +0000 (08:46 +0000)]
Add USB3 related clock definitions for Rockchip RK3328 SoC.

Reviewed by: manu

4 years agoypldap(8): Fix absent va_end() in 'goto fail' path
cem [Wed, 29 Jan 2020 05:59:22 +0000 (05:59 +0000)]
ypldap(8): Fix absent va_end() in 'goto fail' path

In this path, we used va_start() without pairing it with va_end().  Add the
va_end().  (va_start() without paired va_end() is undefined behavior per the C
standard.)

"In many implementations, [va_end] is a do-nothing operation; but those
implementations that need it probably need it badly." - Rationale for the ANSI
C Programming Language, § 4.8.1.3.

Reported by: Coverity
CID: 1340539

4 years agobnxt(4): Eliminate wrong sizeof() expression in memset()
cem [Wed, 29 Jan 2020 05:42:24 +0000 (05:42 +0000)]
bnxt(4): Eliminate wrong sizeof() expression in memset()

While here, clean up magic numbers.

The memset(,0,) (and M_ZERO!) can just be removed; the bit_alloc() API already
zeros the allocation.

No functional change.

Reported by: Coverity
CID: 1378286

4 years agoixgbe(4): Eliminate bogus sizeof() expressions
cem [Wed, 29 Jan 2020 05:31:40 +0000 (05:31 +0000)]
ixgbe(4): Eliminate bogus sizeof() expressions

All of these uses of sizeof() were on the wrong type in relation to the pointer
passed to SYSCTL_ADD_PROC as arg1.  Fortunately, none of the handlers actually
use arg2.  So just don't pass a (non-zero) arg2.

Reported by: Coverity
CID: 1007701

4 years agoqmath(3) test: Replace overcomplicated abomination with arc4random(3)
cem [Wed, 29 Jan 2020 05:25:20 +0000 (05:25 +0000)]
qmath(3) test: Replace overcomplicated abomination with arc4random(3)

The horrific GENRAND construction bent over backwards to construct 64-bit
signed integers from the 31-bit output of random(3) for about 20 numbers per
test.  Reproducibility wasn't a goal: random(3) was seeded with
srandomdev(3).  Speed is not a factor for generating 20 integers with
arc4random(3).  Range is not a factor: all uses did not bound the range
beyond that of the full [INT64_MIN, INT64_MAX].  Just use arc4random(3).

Reported by: Coverity
CIDs: 1404809140481714048381404840 and about 6x other
identical reports of dubious code relating to the
construction

4 years agoqlxge(4): Ditto r357244
cem [Wed, 29 Jan 2020 04:42:46 +0000 (04:42 +0000)]
qlxge(4): Ditto r357244

Reported by: Coverity
CID: 1193716

4 years agoqlxgb(4): Use defined evaluation order
cem [Wed, 29 Jan 2020 04:41:26 +0000 (04:41 +0000)]
qlxgb(4): Use defined evaluation order

Reported by: Coverity
CID: 1193717

4 years agolibpmc: jevents: Go ahead and use snprintf(3)
cem [Wed, 29 Jan 2020 04:33:45 +0000 (04:33 +0000)]
libpmc: jevents: Go ahead and use snprintf(3)

Reported by: Coverity
CID: 1391362

4 years agopowerpc64/csu: Rename dummy asm file to force use of 'cc'
jhibbits [Wed, 29 Jan 2020 04:32:06 +0000 (04:32 +0000)]
powerpc64/csu: Rename dummy asm file to force use of 'cc'

Implicit make rules build .S asm files with the compiler, rather than the
assembler.  r356889 removed GNU as from the build for powerpc targets,
causing '.s' asm files to fail to build, due to a missing 'as'.  Rename the
one dummy asm file we have to a '.S' to force the implicit rules to build
with the compiler rather than the assembler.

Reported by: Francis Little

4 years agolibpmc: jevents: Partial style(9) pass
cem [Wed, 29 Jan 2020 04:31:26 +0000 (04:31 +0000)]
libpmc: jevents: Partial style(9) pass

Sort headers, move includes up to the top of the file, function return types on
their own line; no functional change.

4 years agohwpstate_intel(4): Silence/fix Coverity reports
cem [Wed, 29 Jan 2020 03:15:34 +0000 (03:15 +0000)]
hwpstate_intel(4): Silence/fix Coverity reports

These were all introduced in the initial import of hwpstate_intel(4).

Reported by: Coverity
CIDs: 1413161141316414131651413167
X-MFC-With: r357002

4 years agoamd64: sync up libc memcmp with the kernel version (r357208)
mjg [Wed, 29 Jan 2020 01:57:07 +0000 (01:57 +0000)]
amd64: sync up libc memcmp with the kernel version (r357208)

4 years agolibc: remove forward compat added in r356830 for F_ISUNIONSTACK
mjg [Wed, 29 Jan 2020 01:52:27 +0000 (01:52 +0000)]
libc: remove forward compat added in r356830 for F_ISUNIONSTACK

4 years agovfs: add VNPASS macro and augment VNASSERT to print more about the assert
mjg [Wed, 29 Jan 2020 01:51:21 +0000 (01:51 +0000)]
vfs: add VNPASS macro and augment VNASSERT to print more about the assert

Sample out put now instead of mere VNASSERT failed:
VNASSERT failed: vp->v_holdcnt == 1234 not true at /usr/src/sys/kern/vfs_subr.c:3148 (vputx)

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23396

4 years agoFix spelling of removable
imp [Wed, 29 Jan 2020 00:28:50 +0000 (00:28 +0000)]
Fix spelling of removable

4 years agoSpeed up "zpool import" in the presence of many zvols
asomers [Tue, 28 Jan 2020 23:07:31 +0000 (23:07 +0000)]
Speed up "zpool import" in the presence of many zvols

By default, zpools may not be backed by zvols (that can be changed with the
"vfs.zfs.vol.recursive" sysctl). When that sysctl is set to 0, the kernel
does not attempt to read zvols when looking for vdevs. But the zpool command
still does. This change brings the zpool command into line with the kernel's
behavior. It speeds "zpool import" when an already imported pool has many
zvols, or a zvol with many snapshots.

PR: 241083
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>
Reviewed by: mav, Ryan Moeller <ryan@freqlabs.com>
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22077

4 years agotests: Test for an epair panic
kp [Tue, 28 Jan 2020 22:46:51 +0000 (22:46 +0000)]
tests: Test for an epair panic

if_epair abused the ifr_data field to insert its second interface in
IFC_IFLIST. If userspace provides a value for ifr_data it would get
dereferenced by the kernel leading to a panic.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
MFC after: 3 days

4 years agoepair: Do not abuse params to register the second interface
kp [Tue, 28 Jan 2020 22:44:24 +0000 (22:44 +0000)]
epair: Do not abuse params to register the second interface

if_epair used the 'params' argument to pass a pointer to the b interface
through if_clone_create().
This pointer can be controlled by userspace, which means it could be abused to
trigger a panic. While this requires PRIV_NET_IFCREATE
privileges those are assigned to vnet jails, which means that vnet jails
could panic the system.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
MFC after: 3 days

4 years agoMerge r357231 from the clang1000-import branch:
dim [Tue, 28 Jan 2020 21:46:59 +0000 (21:46 +0000)]
Merge r357231 from the clang1000-import branch:

Work around assembler error from clang 10.0.0 in gptboot:

stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for field of 2 bytes.
  jmp MEM_JMP # Start BTX
  ^

Use the same construct as in stand/i386/boot2/boot1.S, which ensures the
jump distance does not become too large.

MFC after: 3 days

4 years agoWork around assembler error from clang 10.0.0 in gptboot:
dim [Tue, 28 Jan 2020 21:41:37 +0000 (21:41 +0000)]
Work around assembler error from clang 10.0.0 in gptboot:

stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for field of 2 bytes.
  jmp MEM_JMP # Start BTX
  ^

Use the same construct as in stand/i386/boot2/boot1.S, which ensures the
jump distance does not become too large.

MFC after: 3 days

4 years agoMerge r357225 from the clang1000-import branch:
dim [Tue, 28 Jan 2020 20:12:29 +0000 (20:12 +0000)]
Merge r357225 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in newfs_msdos:

sbin/newfs_msdos/newfs_msdos.c:181:2: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
        if (o.align) {
        ^
sbin/newfs_msdos/newfs_msdos.c:179:5: note: previous statement is here
    if (argc < 1 || argc > 2)
    ^

MFC after: 3 days

4 years agoMerge r357224 from the clang1000-import branch:
dim [Tue, 28 Jan 2020 20:11:27 +0000 (20:11 +0000)]
Merge r357224 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in binutils:

contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                if (efi)
                ^
contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
              if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
              ^
contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                if (!efi)
                ^
contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
              if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
              ^

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in newfs_msdos:
dim [Tue, 28 Jan 2020 20:10:26 +0000 (20:10 +0000)]
Fix the following -Werror warning from clang 10.0.0 in newfs_msdos:

sbin/newfs_msdos/newfs_msdos.c:181:2: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
        if (o.align) {
        ^
sbin/newfs_msdos/newfs_msdos.c:179:5: note: previous statement is here
    if (argc < 1 || argc > 2)
    ^

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in binutils:
dim [Tue, 28 Jan 2020 20:09:23 +0000 (20:09 +0000)]
Fix the following -Werror warning from clang 10.0.0 in binutils:

contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                if (efi)
                ^
contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
              if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
              ^
contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                if (!efi)
                ^
contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
              if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
              ^

MFC after: 3 days

4 years agoMerge r357222 from the clang1000-import branch:
dim [Tue, 28 Jan 2020 20:05:25 +0000 (20:05 +0000)]
Merge r357222 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in rbootd:

libexec/rbootd/rmpproto.c:335:49: error: multiple unsequenced modifications to 'filename' [-Werror,-Wunsequenced]
        filename = (filename = strrchr(filepath,'/'))? ++filename: filepath;
                 ~                                     ^

MFC after: 3 days

4 years agoFix the following -Werror warning from clang 10.0.0 in rbootd:
dim [Tue, 28 Jan 2020 19:19:55 +0000 (19:19 +0000)]
Fix the following -Werror warning from clang 10.0.0 in rbootd:

libexec/rbootd/rmpproto.c:335:49: error: multiple unsequenced modifications to 'filename' [-Werror,-Wunsequenced]
        filename = (filename = strrchr(filepath,'/'))? ++filename: filepath;
                 ~                                     ^

MFC after: 3 days

4 years agoAdd internal floating point environment builtins to libcompiler_rt and
dim [Tue, 28 Jan 2020 19:07:37 +0000 (19:07 +0000)]
Add internal floating point environment builtins to libcompiler_rt and
libgcc, as these are used in a few other builtin implementations.

4 years agoFix urldecode buffer overrun.
gordon [Tue, 28 Jan 2020 18:37:18 +0000 (18:37 +0000)]
Fix urldecode buffer overrun.

Reported by: Duncan Overbruck
Security: CVE-2020-7450

4 years agogeli: add a test case for attaching multiple providers with 1 command
asomers [Tue, 28 Jan 2020 18:32:19 +0000 (18:32 +0000)]
geli: add a test case for attaching multiple providers with 1 command

Reviewed by: cem
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D23400

4 years agoPrefer upstream RISC-V additions in libunwind instead of ours, as these
dim [Tue, 28 Jan 2020 18:04:17 +0000 (18:04 +0000)]
Prefer upstream RISC-V additions in libunwind instead of ours, as these
arrived via roundabout way upstream, and got updated in the mean time.

4 years agoamd64: revamp memcmp
mjg [Tue, 28 Jan 2020 17:48:17 +0000 (17:48 +0000)]
amd64: revamp memcmp

Borrow the trick from memset and memmove and use the scale/index/base addressing
to avoid branches.

If a mismatch is found, the routine has to calculate the difference. Make sure
there is always up to 8 bytes to inspect. This replaces the previous loop which
would operate over up to 16 bytes with an unrolled list of 8 tests.

Speed varies a lot, but this is a net win over the previous routine with probably
a lot more to gain.

Validated with glibc test suite.

4 years agoAdd some missing articles.
dwmalone [Tue, 28 Jan 2020 15:34:00 +0000 (15:34 +0000)]
Add some missing articles.
Use .Nm to format the utility name.
Get the name of the GEOM class right.

MFC after: 2 weeks

4 years agoAdd TCP_CORK support to linux(4). This fixes one of the things Nginx
trasz [Tue, 28 Jan 2020 13:57:24 +0000 (13:57 +0000)]
Add TCP_CORK support to linux(4).  This fixes one of the things Nginx
trips over.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23171

4 years agoAdd compat.linux.ignore_ip_recverr sysctl. This is a workaround
trasz [Tue, 28 Jan 2020 13:51:53 +0000 (13:51 +0000)]
Add compat.linux.ignore_ip_recverr sysctl.  This is a workaround
for missing IP_RECVERR setsockopt(2) support. Without it, DNS
resolution is broken for glibc >= 2.30 (glibc BZ #24047).

From the user point of view this fixes "yum update" on recent
CentOS 8.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23234

4 years agoMFV r357163:
cy [Tue, 28 Jan 2020 13:13:41 +0000 (13:13 +0000)]
MFV r357163:

Update sqlite3-3.30.1 (3300100) --> sqlite3-3.31.0 (3310000)

MFC after: 1 month

4 years agoSave lower root vnode in nullfs mnt data instead of upper.
kib [Tue, 28 Jan 2020 11:29:06 +0000 (11:29 +0000)]
Save lower root vnode in nullfs mnt data instead of upper.

Nullfs needs to know the root vnode of the lower fs during the
operation.  Currently it caches the upper vnode of it, which is also
the root of the nullfs mount.  On unmount, nullfs calls vflush() with
rootrefs == 1, and aborts non-forced unmount if there are any more
vnodes instantiated during vflush().  This means that the reference to
the root vnode after failed non-forced unmount could be lost and
nullm_rootvp points to the freed memory.

Fix it by storing the reference for lower vnode instead, which is kept
intact during vflush().  nullfs_root() now instantiates the upper
vnode of lower root.  Care about VV_ROOT flag in null_nodeget().

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoProvide support for fdevname(3) on linuxkpi-backed devices.
kib [Tue, 28 Jan 2020 11:22:20 +0000 (11:22 +0000)]
Provide support for fdevname(3) on linuxkpi-backed devices.

Reported and tested by: manu
Reviewed by: hselasky, manu
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23386

4 years agoFix build issues for the userland stack on 32-bit platforms.
tuexen [Tue, 28 Jan 2020 10:09:05 +0000 (10:09 +0000)]
Fix build issues for the userland stack on 32-bit platforms.

Reported by: Felix Weinrank
MFC after: 1 week

4 years agonetbsd-tests: libc: use correct modes in O_SEARCH tests
kevans [Tue, 28 Jan 2020 03:47:29 +0000 (03:47 +0000)]
netbsd-tests: libc: use correct modes in O_SEARCH tests

The current code clearly intended for these to be octal based on the values
used, but the octal prefix was forgotten. Add it now for correctness, but
note that we don't currently execute these tests.

This has been submitted upstream as misc/54902, so I've omitted the standard
FreeBSD markers that we tend to put into netbsd-tests for upstream-candidate
identification.

Reviewed by: ngie
MFC after: 3 days

4 years agoamdtemp(4): Remove dead code that snuck in with r357190
cem [Tue, 28 Jan 2020 03:27:06 +0000 (03:27 +0000)]
amdtemp(4): Remove dead code that snuck in with r357190

I intended to remove this before committing, but neglected to.

4 years agocaroot: blacklisted: automatically pick up *.pem in the tree
kevans [Tue, 28 Jan 2020 03:02:18 +0000 (03:02 +0000)]
caroot: blacklisted: automatically pick up *.pem in the tree

This kind of automagica got picked up in trusted/ prior to the initial
commit, but never got applied over in blacklisted. Ideally no one will be
using blacklisted/ to store arbitrary certs that they don't intend to
blacklist, so we should just install anything that's in here rather than
force consumer to first copy cert into place and then modify the file
listing in the Makefile.

Wise man once say: "it is better to restrict too much, than not enough.
sometimes."

4 years agoamdtemp(4): Add support for Family 17h CCD sensors
cem [Tue, 28 Jan 2020 01:39:50 +0000 (01:39 +0000)]
amdtemp(4): Add support for Family 17h CCD sensors

Probe Family 17h CPUs for up to 4 (Zen, Zen+) or 8 (Zen2) CCD temperature
sensors.  These were discovered by Ondrej Čerman
(https://github.com/ocerman) and collaborators experimentally, and are not
currently documented in any datasheet I have access to.

4 years agoamdtemp(4): Refactor shared temperature calculation logic
cem [Tue, 28 Jan 2020 01:38:51 +0000 (01:38 +0000)]
amdtemp(4): Refactor shared temperature calculation logic

No functional change intended.

4 years agox86: identcpu: Decode new Intel Structured Extended feature bits
cem [Tue, 28 Jan 2020 01:37:20 +0000 (01:37 +0000)]
x86: identcpu: Decode new Intel Structured Extended feature bits

4 years agox86: identcpu: Decode new Zen2 AMD Feature2 bit
cem [Tue, 28 Jan 2020 01:36:45 +0000 (01:36 +0000)]
x86: identcpu: Decode new Zen2 AMD Feature2 bit

4 years agoRemove old device list
imp [Tue, 28 Jan 2020 00:36:46 +0000 (00:36 +0000)]
Remove old device list

The device list hasn't aged well. All these devices are over a decade old. umass
supports thunb drives almost universally, and the list is too long to try to
list here.

Remove some obsolete advice as well. This isn't the place to talk about how to
create FAT filesystems, nor now to mount them. The only advice that's still
useful is the rescanning of a multi-slot flash adapater.

MFC After: 3 days

4 years agobsdinstall: Provide help text for partitioning options
woodsb02 [Mon, 27 Jan 2020 22:45:49 +0000 (22:45 +0000)]
bsdinstall: Provide help text for partitioning options

Includes commentary of when ZFS works well by default (>= 8GB RAM),
and where to go for information on ZFS tuning if required.

Also hoist the options text to the top of script as variables
(will help with future international translations).

Reviewed by: philip, dteske, karels, imp, emaste
Approved by: rgrimes
Differential Revision: https://reviews.freebsd.org/D23224

4 years agomulti-boot for openstack/qcow images
imp [Mon, 27 Jan 2020 22:40:03 +0000 (22:40 +0000)]
multi-boot for openstack/qcow images

Make stock FreeBSD more useful for people wishing to use them. The
QEMU folks suggested this change. It adds a serial console which
allows them to interact with FreeBSD from the earliest moments. This
allows them to configure FreeBSD via the serial port to set it up for
CI use.

Reviewed by: kevans@
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D22786

4 years agoMake mqueue objects work across a fork again.
imp [Mon, 27 Jan 2020 22:36:54 +0000 (22:36 +0000)]
Make mqueue objects work across a fork again.

In r110908 (2003) alfred added DFLAG_PASSABLE to tag those types of FD
that can be passed via unix pipes, but mqueuefs didn't exist
yet. Later, in r152825 (2005) davidxu neglected to include
DFLAG_PASSABLE since people don't normally pass these things via unix
sockets (it's a FreeBSD implementation detail that it's a file
descriptor, nobody noticed). Then r223866 (2011) by jonathan used the
new flag in fdcopy, which fork uses. Due to that, mqueuefs actually
broke mqueue objects being propagated by fork. No mention of mqueuefs
was made in r223866, so I think it was an unintended consequence.

Fix this by tagging mqueuefs as passable as well. They were prior to
alfred's change (and it's clear there's no intent in his change to
change this behavior), and POSIX requires this to be the case as well.

PR: 243103
Reviewed by: kib@, jiles@
Differential Revision: https://reviews.freebsd.org/D23038

4 years agoNo need to have an extra layer of indirection here. Call the sdhci_cam_requiest
imp [Mon, 27 Jan 2020 22:20:02 +0000 (22:20 +0000)]
No need to have an extra layer of indirection here. Call the sdhci_cam_requiest
routine directly when handling a MMIO request.

4 years agoCreate a convenince wrapper to fill in a CAM_PATH_INQ request for MMC sims. Pass
imp [Mon, 27 Jan 2020 22:19:55 +0000 (22:19 +0000)]
Create a convenince wrapper to fill in a CAM_PATH_INQ request for MMC sims. Pass
in the parameters needed for the different sims, but it's almost all identical.

4 years agoMerge ^/head r357119 through r357178.
dim [Mon, 27 Jan 2020 20:47:18 +0000 (20:47 +0000)]
Merge ^/head r357119 through r357178.

4 years agoUpdate build glue for libclang_rt.
dim [Mon, 27 Jan 2020 20:46:26 +0000 (20:46 +0000)]
Update build glue for libclang_rt.

4 years agoSort libcompiler_rt sources.
dim [Mon, 27 Jan 2020 20:12:03 +0000 (20:12 +0000)]
Sort libcompiler_rt sources.

4 years agoUpdate build glue for libc++.
dim [Mon, 27 Jan 2020 19:18:36 +0000 (19:18 +0000)]
Update build glue for libc++.

4 years agoUpdate build glue for libomp.
dim [Mon, 27 Jan 2020 18:04:28 +0000 (18:04 +0000)]
Update build glue for libomp.

4 years agoUpdate build glue for lldb (MK_LLDB=yes). Also update lldb's generated
dim [Mon, 27 Jan 2020 16:52:44 +0000 (16:52 +0000)]
Update build glue for lldb (MK_LLDB=yes).  Also update lldb's generated
Config.h, disable a few more parts in the code we don't use, and add a
pre-generated man page.

4 years agoCorrect the use of RB_AUGMENT in the RB_TREE macros so that is invoked
dougm [Mon, 27 Jan 2020 15:09:13 +0000 (15:09 +0000)]
Correct the use of RB_AUGMENT in the RB_TREE macros so that is invoked
at the root of every subtree that changes in an insert or delete, and
only once, and ordered from the bottom of the tree to the top.  For
intel_gas.c, the only user of RB_AUGMENT I can find, change the
augmenting routine so that it does not climb from entry to tree root
on every call, and remove a 'tree correcting' function that can be
supplanted by proper tree augmentation.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23189

4 years agoFix aggregating geoms for BIO_SPEEDUP.
kib [Mon, 27 Jan 2020 13:15:16 +0000 (13:15 +0000)]
Fix aggregating geoms for BIO_SPEEDUP.

If the bio was split into several bios going down, completion computes
bio_completed of the original bio as sum of the bio_completes of the
splits.  For BIO_SETUP, bio_length means something different than the
length. it is the requested speedup amount, and is duplicated into the
splits, which is in fact reasonable, since we cannot know how the
previous activity was distributed among subordinate geoms.  Obviously,
the sum of n bio_length is greater than bio_length for n > 1, which
triggers assert that bio_length >= bio_completed for e.g. geom_stripe
and geom_raid3.

Fix this by reassigning bio_completed from bio_length for completed
BIO_SPEEDED, I do not think it really mattters what we return in
bio_completed.

Reported and tested by: pho
Reviewed by: imp
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23380

4 years agoBuild hard-float lib32 for mips64hf/mips64elhf
arichardson [Mon, 27 Jan 2020 12:02:47 +0000 (12:02 +0000)]
Build hard-float lib32 for mips64hf/mips64elhf

This should fix linker errors when building with clang+lld.
After this change the lib32 compat libraries are now buildt with
-mhard-float instead of -msoft-float

Reviewed By: brooks, jhb
Differential Revision: https://reviews.freebsd.org/D23229

4 years agoAllow bootstrapping makefs on older FreeBSD hosts and Linux/macOS
arichardson [Mon, 27 Jan 2020 12:02:41 +0000 (12:02 +0000)]
Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOS

In order to do so we need to install the msdosfs headers to the bootstrap
sysroot and avoid includes of kernel headers that may not exist on every
host (e.g. sys/lockmgr.h). This change should allow bootstrapping of makefs
on FreeBSD 11+ as well as Linux and macOS.

We also have to avoid using the IO_SYNC macro since that may not be
available. In makefs it is only used to switch between calling
bwrite() and bdwrite() which both call the same function. Therefore we
can simply always call bwrite().

For our CheriBSD builds we always bootstrap makefs by setting
LOCAL_XTOOL_DIRS='lib/libnetbsd usr.sbin/makefs' and use the makefs binary
from the build tree to create a bootable disk image.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D23201

4 years agohwpstate(4): Log a debug line when throttled
cem [Mon, 27 Jan 2020 06:04:32 +0000 (06:04 +0000)]
hwpstate(4): Log a debug line when throttled

If we're going to throttle user requested P-states, we should at least produce
a debug log line indicating the surprising behavior.

PR: inspired by 234733

4 years agoEnter net epoch in msk_tick.
kan [Mon, 27 Jan 2020 00:14:51 +0000 (00:14 +0000)]
Enter net epoch in msk_tick.

One more instance of if_input being called outside of
interrupt, by means of msk_handle_events.

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

4 years agoUpdate build glue for lld (MK_LLD=yes). Also update invocation of
dim [Sun, 26 Jan 2020 21:55:17 +0000 (21:55 +0000)]
Update build glue for lld (MK_LLD=yes). Also update invocation of
elf::link() in lld.cpp.

4 years agonetmap_mem_unmap: fix NULL pointer dereference
vmaffione [Sun, 26 Jan 2020 21:34:46 +0000 (21:34 +0000)]
netmap_mem_unmap: fix NULL pointer dereference

MFC after: 3 days

4 years agoUpdate build glue for extra clang/llvm tools (MK_CLANG_EXTRAS=yes).
dim [Sun, 26 Jan 2020 20:57:29 +0000 (20:57 +0000)]
Update build glue for extra clang/llvm tools (MK_CLANG_EXTRAS=yes).

4 years agoUpdate build glue for a world stage, e.g. when not only clang, but also
dim [Sun, 26 Jan 2020 18:57:12 +0000 (18:57 +0000)]
Update build glue for a world stage, e.g. when not only clang, but also
llvm-ar, llvm-nm, llvm-objdump and llvm-symbolizer are built.

4 years agoFix a crash in the NFSv4 server.
rmacklem [Sun, 26 Jan 2020 17:59:05 +0000 (17:59 +0000)]
Fix a crash in the NFSv4 server.

The PR reported a crash that occurred when a file was removed while
client(s) were actively doing lock operations on it.
Since nfsvno_getvp() will return NULL when the file does not exist,
the bug was obvious and easy to fix via this patch. It is a little
surprising that this wasn't found sooner, but I guess the above
case rarely occurs.

Tested by: iron.udjin@gmail.com
PR: 242768
Reported by: iron.udjin@gmail.com
MFC after: 2 weeks

4 years agoUpdate build glue for a full build (MK_CLANG_FULL=yes) of the clang
dim [Sun, 26 Jan 2020 17:22:05 +0000 (17:22 +0000)]
Update build glue for a full build (MK_CLANG_FULL=yes) of the clang
executable.

4 years agoRevert accidental change from r357146.
jhb [Sun, 26 Jan 2020 14:23:27 +0000 (14:23 +0000)]
Revert accidental change from r357146.

4 years agoFix some misleading indentation warnings reported by recent clang.
jhb [Sun, 26 Jan 2020 14:20:57 +0000 (14:20 +0000)]
Fix some misleading indentation warnings reported by recent clang.

These should not be any functional change.  While the change in
emul10kx-pcm.c looks like a real bug fix (as opposed to inconsistent
whitespace), the extra statements were not harmful.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23363

4 years agoCompile hack.c with normal CFLAGS + -shared -nostdlib.
jhb [Sun, 26 Jan 2020 14:19:08 +0000 (14:19 +0000)]
Compile hack.c with normal CFLAGS + -shared -nostdlib.

Originally, hack.c was compiled into a shard object with just -shared
-nostdlib.  This assumed that ${CC} did not require any additional
flags for ABIs, cross-building, etc.

When kern.post.mk was created in r89509 by reducing duplication in
kernel Makefile.<arch> files, the -shared flag was moved into a
HACK_EXTRA_FLAGS variable so that sparc64 could override it with
-Wl,-shared.  The sparc64 hack was removed in r111650, but
HACK_EXTRA_FLAGS was left in place.  Over time, we have started
support toolchains that require flags to support alternate ABIs on
MIPS and PowerPC and started (ab)using HACK_EXTRA_FLAGS to set only
those flags.

I need to fix risc-v to pass -mno-relax to the hack.c build for lld in
llvm 10, and the patches to support cross-build from non-FreeBSD hosts
need to include -target for clang in CFLAGS for hack.c.  Rather than
adding more hacks into HACK_EXTRA_FLAGS, just use the full set of
CFLAGS with hack.c.

Reviewed by: kib, arichardson
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23362

4 years agoFix NOINET6 build after r357038.
melifaro [Sun, 26 Jan 2020 11:54:21 +0000 (11:54 +0000)]
Fix NOINET6 build after r357038.

Reported by: AN <andy at neu.net>

4 years agoStyle changes, mostly usage of braces around single line statements -
pjd [Sun, 26 Jan 2020 11:13:34 +0000 (11:13 +0000)]
Style changes, mostly usage of braces around single line statements -
it is safer and allowed for some time now by style(9).

Sponsored by: Fudo Security

4 years agoImplement tests for the newly added -o flag.
pjd [Sun, 26 Jan 2020 11:03:45 +0000 (11:03 +0000)]
Implement tests for the newly added -o flag.

Sponsored by: Fudo Security

4 years agoImplement -o flag which tells pwait(1) to exit if any of the given processes
pjd [Sun, 26 Jan 2020 11:02:51 +0000 (11:02 +0000)]
Implement -o flag which tells pwait(1) to exit if any of the given processes
has terminated.

Sponsored by: Fudo Security

4 years agoDon't setup a timeout if we are exiting.
pjd [Sun, 26 Jan 2020 10:54:16 +0000 (10:54 +0000)]
Don't setup a timeout if we are exiting.

Sponsored by: Fudo Security

4 years agoCheck for duplicated PID without using additional variable.
pjd [Sun, 26 Jan 2020 10:51:57 +0000 (10:51 +0000)]
Check for duplicated PID without using additional variable.

Sponsored by: Fudo Security

4 years ago- Be consistent with using sysexits(3) codes.
pjd [Sun, 26 Jan 2020 10:49:24 +0000 (10:49 +0000)]
- Be consistent with using sysexits(3) codes.
- Turn fprintf()+exit() into errx().

Sponsored by: Fudo Security