]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoddb(4): Add some support for lexing IPv6 addresses
cem [Mon, 9 Sep 2019 16:32:23 +0000 (16:32 +0000)]
ddb(4): Add some support for lexing IPv6 addresses

Allow commands to specify that (hex) numbers may start with A-F, by adding
the DRT_HEX flag for db_read_token_flags().  As before, numbers containing
invalid digits for the current radix are rejected.

Also, lex ':' and '::' tokens as tCOLON and tCOLONCOLON respectively.

There is a mild conflict here with lexed "identifiers" (tIDENT): ddb
identifiers may contain arbitrary colons, and the ddb lexer is greedy.  So
the identifier lex will swallow any colons it finds inside identifiers, and
consumers are still unable to expect the token sequence 'tIDENT tCOLON'.
That limitation does not matter for IPv6 addresses, because the lexer always
attempts to lex numbers before identifiers.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D21509

4 years agoddb(4): Enhance lexer functionality for specialized commands
cem [Mon, 9 Sep 2019 16:31:14 +0000 (16:31 +0000)]
ddb(4): Enhance lexer functionality for specialized commands

Add a db_read_token_flags() variant of db_read_token() with configurable
parameters.

Allow specifying an explicit radix for tNUMBER lexing.  It overrides the
default inference and db_radix setting.

Also provide the option of yielding any lexed whitespace (tWSPACE) (instead
of ignoring it).  This is useful for whitespace-sensitive CS_OWN commands.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D21459

4 years agocsu: Add the riscv .init call sequence
kp [Mon, 9 Sep 2019 16:25:09 +0000 (16:25 +0000)]
csu: Add the riscv .init call sequence

Reviewed by: br
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D21537

4 years agoOnly update SACK/DSACK lists when a non-empty segment was received.
tuexen [Mon, 9 Sep 2019 16:07:47 +0000 (16:07 +0000)]
Only update SACK/DSACK lists when a non-empty segment was received.
This fixes hitting a KASSERT with a valid packet exchange.

Reviewed by: rrs@, Richard Scheffenegger
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21567

4 years agoriscv: Ensure that BSS is 8-byte aligned
kp [Mon, 9 Sep 2019 15:57:24 +0000 (15:57 +0000)]
riscv: Ensure that BSS is 8-byte aligned

This makes clearing it (from locore.S) work without misaligned accesses
(which can trap to machine mode, and be slow).

Reviewed by: br
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D21538

4 years agom4: import from OpenBSD
bapt [Mon, 9 Sep 2019 15:37:40 +0000 (15:37 +0000)]
m4: import from OpenBSD

By deraadt@

mkstemp() returns -1 on failure

Obtained from: OpenBSD

4 years agom4: import from OpenBSD
bapt [Mon, 9 Sep 2019 15:35:34 +0000 (15:35 +0000)]
m4: import from OpenBSD

patch by espie@

replace sloppy parsing of numeric values with strtonum (incr, decr, divert)

still use integers, so use the natural bounds for these.

POSIX says m4 should error when these use non numeric values, and now they
do.

okay millert@

Obtained from: OpenBSD

4 years agom4: import patch from OpenBSD
bapt [Mon, 9 Sep 2019 15:28:22 +0000 (15:28 +0000)]
m4: import patch from OpenBSD

by espie@
ifelse is special, fix argv parsing to avoid segfault

problem noticed by Matthew Green (netbsd), slightly different fix
so that argc counting makes more sense.

we might want to warn on wrong number of parameters later, but this is
somewhat inconsistent depending on the builtin right now.

okay millert@

Obtained from: OpenBSD

4 years agom4: import patch from OpenBSD
bapt [Mon, 9 Sep 2019 15:24:48 +0000 (15:24 +0000)]
m4: import patch from OpenBSD

Use waitpid()/EINTR idiom for the specific pid, rather than generic wait()

Patch by: deraadt@

Obtained from: OpenBSD

4 years agoImport from OpenBSD a patch which eliminates the link with -ly or -ly
bapt [Mon, 9 Sep 2019 15:20:19 +0000 (15:20 +0000)]
Import from OpenBSD a patch which eliminates the link with -ly or -ly

patch by ibara@

Obtained from: OpenBSD

4 years agoImport from OpenBSD: -E flag
bapt [Mon, 9 Sep 2019 15:18:04 +0000 (15:18 +0000)]
Import from OpenBSD: -E flag

Add -E flag (make warnings fatal), following the behavior of GNU m4 1.4.9+

Help and direction millert@ espie@ anton@ deraadt@

ok espie@

Obtained from: OpenBSD

4 years agoci-qemu-test: if firmware is not available, hint at pkg to install
emaste [Mon, 9 Sep 2019 14:51:25 +0000 (14:51 +0000)]
ci-qemu-test: if firmware is not available, hint at pkg to install

uefi-edk2-qemu-x86_64 provides the firmware ci-qemu-test.sh expects to
use.

Sponsored by: The FreeBSD Foundation

4 years agoInitialize timehands linkage much earlier.
kib [Mon, 9 Sep 2019 12:42:48 +0000 (12:42 +0000)]
Initialize timehands linkage much earlier.

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

4 years agoMake timehands count selectable at boottime.
kib [Mon, 9 Sep 2019 11:29:58 +0000 (11:29 +0000)]
Make timehands count selectable at boottime.

Tested by: O'Connor, Daniel <darius@dons.net.au>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21563

4 years agoRemove some unneeded vfs_busy() calls in SU code.
kib [Mon, 9 Sep 2019 11:22:38 +0000 (11:22 +0000)]
Remove some unneeded vfs_busy() calls in SU code.

When softdep_fsync() is running, a caller must already started write
for the mount point.  Since unmount or remount to ro suspends mount
point, it cannot run in parallel with softdep_fsync(), which makes
vfs_busy() call there not needed.

Doing blocking vfs_busy() there effectively causes lock order reversal
between vn_start_write() and setting MNTK_UNMOUNT, because
vfs_busy(mp, 0) sleeps waiting for MNTK_UNMOUNT becoming clear, while
unmount sets the flag and starts the suspension.

Note that all other uses of vfs_busy() in SU code are non-blocking.

Reported by: chs by mckusick
Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoMake snprintf(3) and vscanf(3) definitions available under appropriate
kib [Mon, 9 Sep 2019 11:15:14 +0000 (11:15 +0000)]
Make snprintf(3) and vscanf(3) definitions available under appropriate
POSIX visibility.

Reported by: jbeich
Reviewed by: jilles
PR: 207287
MFC after: 1 week

4 years agoral(4): Use unsigned to avoid undefined behavior.
pfg [Mon, 9 Sep 2019 03:31:46 +0000 (03:31 +0000)]
ral(4): Use unsigned to avoid undefined behavior.

Found by NetBSD's kUBSan

Obtained from: NetBSD (github 5b153f1)

4 years agoddb(4): Move an extern variable declaration to a header
cem [Mon, 9 Sep 2019 01:33:45 +0000 (01:33 +0000)]
ddb(4): Move an extern variable declaration to a header

Trivial cleanup, no functional change.

4 years agogdb(4): Root a sysctl tree at 'debug.gdb.'
cem [Sun, 8 Sep 2019 22:52:47 +0000 (22:52 +0000)]
gdb(4): Root a sysctl tree at 'debug.gdb.'

Like debug.ddb and debug.kdb.  Rename 'debug.gdbcons' to 'debug.gdb.cons,'
but leave the old name as a compatibility alias.

4 years agoFix cpuwhich_t column width
mhorne [Sun, 8 Sep 2019 21:37:52 +0000 (21:37 +0000)]
Fix cpuwhich_t column width

Not bumping .Dd since this is purely a format change.

Approved by: markj (mentor)

4 years agoremove leftover zfsloader directory
tsoome [Sun, 8 Sep 2019 19:54:28 +0000 (19:54 +0000)]
remove leftover zfsloader directory

It really is empty.

4 years agoFix compilation of locore.S with clang
mhorne [Sun, 8 Sep 2019 19:53:11 +0000 (19:53 +0000)]
Fix compilation of locore.S with clang

The branch from _start to mpentry has to cross a large section of data;
an offset larger than can be specified with a 12-bit branch immediate.
Fix this by converting the branch to an unconditional jump. The gcc
assembler does this conversion silently but it is not done automatically
by clang.

Reported by: Jeremy Bennett <jeremy.bennett@embecosm.com>
Reviewed by: markj
Approved by: markj (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21437

4 years agoRemove a duplicate KTR entry
mhorne [Sun, 8 Sep 2019 19:46:34 +0000 (19:46 +0000)]
Remove a duplicate KTR entry

Reviewed by: markj
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D21438

4 years agoRISC-V: fix kernel CFLAGS with clang
mhorne [Sun, 8 Sep 2019 19:44:21 +0000 (19:44 +0000)]
RISC-V: fix kernel CFLAGS with clang

Use the -march and -mabi flags for both gcc and clang as they are
compatible. Specify the "medium" code model separately as it goes by the
name "medany" under gcc, although they are equivalent.

Reviewed by: markj
Approved by: markj (mentor)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21436

4 years agoAllow for compiler versions >= 10
mhorne [Sun, 8 Sep 2019 19:40:52 +0000 (19:40 +0000)]
Allow for compiler versions >= 10

Both clang and gcc development branches have reached version 10. Since we
only parse for a single digit in the major version number, this causes
COMPILER_VERSION to be set to its default of 0.0.0, meaning version checks
fail with these newer compilers.

Reviewed by: emaste
Approved by: markj (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21413

4 years agoloader: --gc-sections needs sections to work with
tsoome [Sun, 8 Sep 2019 19:39:45 +0000 (19:39 +0000)]
loader: --gc-sections needs sections to work with

--gc-sections is not really useful unless we generate sections with
-ffunction-sections -fdata-sections

While there, i386/loader would win from --gc-sections too.

4 years ago[rpi] Inherit framebuffer BPP value from the VideoCore firmware
gonzo [Sun, 8 Sep 2019 09:47:21 +0000 (09:47 +0000)]
[rpi] Inherit framebuffer BPP value from the VideoCore firmware

Instead of using hardcoded bpp of 24, obtain current/configured value
from VideoCore. This solves certain problems with Xorg/Qt apps that
require bpp of 32 to work properly. The mode can be forced by setting
framebuffer_depth value in config.txt

PR: 235363
Submitted by: Steve Peurifoy <ssw01@mathistry.net>

4 years agomount_fusefs: fix a segfault on memory allocation failure
asomers [Sat, 7 Sep 2019 21:49:01 +0000 (21:49 +0000)]
mount_fusefs: fix a segfault on memory allocation failure

Reported by: Coverity
Coverity CID: 1354188
MFC after: 4 days
Sponsored by: The FreeBSD Foundation

4 years agofusefs: suppress some Coverity resource leak CIDs in the tests
asomers [Sat, 7 Sep 2019 19:25:45 +0000 (19:25 +0000)]
fusefs: suppress some Coverity resource leak CIDs in the tests

The fusefs tests deliberately leak file descriptors.  To do otherwise would
add extra complications to the tests' mock FUSE server.  This annotation
should hopefully convince Coverity to shut up about the leaks.

Reviewed by: uqs
MFC after: 4 days
Sponsored by: The FreeBSD Foundation

4 years agoUnify cam_send_ccb() error reporting.
mav [Sat, 7 Sep 2019 16:52:40 +0000 (16:52 +0000)]
Unify cam_send_ccb() error reporting.

Error there mean that command was not even executed, and all information
we have about it is errno, and cam_error_print() call is not very useful.
Plus it is most likely a programmatic error, that shoud not happen.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agoIn do_execve(), use shared text vnode lock consistently.
kib [Sat, 7 Sep 2019 16:10:57 +0000 (16:10 +0000)]
In do_execve(), use shared text vnode lock consistently.

Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21560

4 years agoIn do_execve(), clear imgp->textset when restarting for interpreter.
kib [Sat, 7 Sep 2019 16:05:17 +0000 (16:05 +0000)]
In do_execve(), clear imgp->textset when restarting for interpreter.

Otherwise, we might left the boolean set, which would affect cleanup
after an error on interpreter activation.

Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21560

4 years agoWhen loading ELF interpreter, initialize whole nested image_params with zero.
kib [Sat, 7 Sep 2019 16:03:26 +0000 (16:03 +0000)]
When loading ELF interpreter, initialize whole nested image_params with zero.

Otherwise we could mishandle imgp->textset.

Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21560

4 years agovm_object_deallocate(): Remove no longer needed code.
kib [Sat, 7 Sep 2019 16:01:45 +0000 (16:01 +0000)]
vm_object_deallocate(): Remove no longer needed code.

We track text mappings explicitly, there is no removal of the text
refs on the object deallocate any more, so tmpfs objects should not be
treated specially. Doing so causes excess deref.

Reported and tested by: gallatin
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21560

4 years agovm_object_coalesce(): avoid extending any nosplit objects, not only
kib [Sat, 7 Sep 2019 15:58:48 +0000 (15:58 +0000)]
vm_object_coalesce(): avoid extending any nosplit objects, not only
that which back tmpfs nodes.

Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21560

4 years agoProperly check for writers when fetching quotas for writeable vnodes
kib [Sat, 7 Sep 2019 15:57:23 +0000 (15:57 +0000)]
Properly check for writers when fetching quotas for writeable vnodes
in UFS quotaon().

Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21560

4 years agoSupply SAT layer with valid transfer sizes.
mav [Sat, 7 Sep 2019 15:56:00 +0000 (15:56 +0000)]
Supply SAT layer with valid transfer sizes.

This is a rework of r344701, that noticed that number of bytes passes to
8 bit sector count field gets truncated.  First decision was to not pass
anything, since ATA specs define the field as N/A.  But it appeared to be a
problem for some SAT devices, that require information about data transfer
to operate properly.  Some additional investigation shown that it is quite
a common practice to set unused fields of ATA commands (fortunately ATA
specs formally allow it) to supply the information to SAT layer.  I have
found SAS-SATA interposer that does not allow pass-through without it.

As side effect, reduce code duplication by removing ata_do_28bit_cmd()
function, replacing it with more universal ata_do_cmd().

MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agoriscv: restore default HZ=1000, keep QEMU at HZ=100
philip [Sat, 7 Sep 2019 05:13:31 +0000 (05:13 +0000)]
riscv: restore default HZ=1000, keep QEMU at HZ=100

This reverts r351918 and r351919.

Discussed with: br, ian, imp

4 years agoSome newer HID devices have descriptors that are larger than 1k. Bump
imp [Sat, 7 Sep 2019 03:51:26 +0000 (03:51 +0000)]
Some newer HID devices have descriptors that are larger than 1k. Bump
this to 2k to prevent them from being truncated and ignored. It
appears to be a sanity check only, but bumping it to 2k allows both of
my iic hid devices to be parsed and the second one to work...

4 years agofusefs: coverity cleanup in the tests
asomers [Fri, 6 Sep 2019 19:50:45 +0000 (19:50 +0000)]
fusefs: coverity cleanup in the tests

Address the following defects reported by Coverity:

* Structurally dead code (CID 1404366): set m_quit before FAIL, not after

* Unchecked return value of sysctlbyname (CID 1404321)

* Unchecked return value of stat(2) (CID 1404471)

* Unchecked return value of open(2) (CID 14044021404529)

* Unchecked return value of dup(2) (CID 1404478)

* Buffer overflows. These are all false positives caused by the fact that
  Coverity thinks I'm using a buffer to store strings, when in fact I'm
  really just using it to store a byte array that happens to be initialized
  with a string. I'm changing the type from char to uint8_t in the hopes
  that it will placate Coverity. (CID 1404338140435014043671404376,
  14043791404381140438814044031404425140443314044341404474,
  1404480140448414045031404505)

* False positive file descriptor leak. I'm going to try to fix this with
  Coverity modeling, but I'll also change an EXPECT to ASSERT so we don't
  perform meaningless assertions after the failure. (CID 14043201404324,
  14044401404445).

* Unannotated file descriptor leak. This will be followed up by a Coverity
  modeling change. (CID 14043261404334140433614043571404361,
  14043721404391140439514044091404430140444814044511404455,
  140445714044581404460)

* Uninitialized variables in C++ constructors (CID 14043271404346). In the
  case of m_maxphys, this actually led to part of the FUSE_INIT's response
  being set to stack garbage during the WriteCluster::clustering test.

* Uninitialized sun_len field in struct sockaddr_un (CID 14043301404371,
  1404429).

Reported by: Coverity
Reviewed by: emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21457

4 years agoCoverity fixes in fusefs(5)
asomers [Fri, 6 Sep 2019 19:40:11 +0000 (19:40 +0000)]
Coverity fixes in fusefs(5)

CID 1404532 fixes a signed vs unsigned comparison error in fuse_vnop_bmap.
It could potentially have resulted in VOP_BMAP reporting too many
consecutive blocks.

CID 1404364 is much worse. It was an array access by an untrusted,
user-provided variable. It could potentially have resulted in a malicious
file system crashing the kernel or worse.

Reported by: Coverity
Reviewed by: emaste
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21466

4 years agoloader.efi: UEFI text mode background colors are only using 3 bits
tsoome [Fri, 6 Sep 2019 19:30:23 +0000 (19:30 +0000)]
loader.efi: UEFI text mode background colors are only using 3 bits

Need to mask background colors to pass allowed value.

4 years agoUse file destdir for stage_as sets
sjg [Fri, 6 Sep 2019 19:05:01 +0000 (19:05 +0000)]
Use file destdir for stage_as sets

We cannot use file (without :T) to name targets
but we can use the destination directory (with / replaced by _)
This has the benefit of minimizing the targets created.

Reviewed by: bdrewery
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org//D21283

4 years agorc.8: Update documentation regarding old-style rc scripts
0mp [Fri, 6 Sep 2019 18:51:41 +0000 (18:51 +0000)]
rc.8: Update documentation regarding old-style rc scripts

The EXAMPLES section does not contain any examples of output formats for
the old-style scripts. Remove the misleading bits stating otherwise.

Reviewed by: bcr, imp
Approved by: src (imp)
Differential Revision: https://reviews.freebsd.org/D21552

4 years agoFix build after r351934
cem [Fri, 6 Sep 2019 18:33:39 +0000 (18:33 +0000)]
Fix build after r351934

tcp_queue_pkts() is only used if TCPHPTS is defined (and it is not by
default).

Reported by: gcc

4 years agoThis adds in the missing counter initialization which
rrs [Fri, 6 Sep 2019 18:29:48 +0000 (18:29 +0000)]
This adds in the missing counter initialization which
I had forgotten to bring over.. opps.

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

4 years agoInitialize if_hw_tsomaxsegsize to 0 to appease gcc's flow analysis as a
imp [Fri, 6 Sep 2019 18:25:42 +0000 (18:25 +0000)]
Initialize if_hw_tsomaxsegsize to 0 to appease gcc's flow analysis as a
fail-safe.

4 years agoAdd myself as a mentor for Scott Phillip (scottph)
scottl [Fri, 6 Sep 2019 17:06:48 +0000 (17:06 +0000)]
Add myself as a mentor for Scott Phillip (scottph)

4 years agoPull in r371111 from upstream llvm trunk (by Eli Friedman):
dim [Fri, 6 Sep 2019 16:06:37 +0000 (16:06 +0000)]
Pull in r371111 from upstream llvm trunk (by Eli Friedman):

  [IfConversion] Fix diamond conversion with unanalyzable branches.

  The code was incorrectly counting the number of identical
  instructions, and therefore tried to predicate an instruction which
  should not have been predicated.  This could have various effects: a
  compiler crash, an assembler failure, a miscompile, or just
  generating an extra, unnecessary instruction.

  Instead of depending on TargetInstrInfo::removeBranch, which only
  works on analyzable branches, just remove all branch instructions.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
  https://bugs.llvm.org/show_bug.cgi?id=41121 .

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

This should fix "Unable to predicate BX killed renamable $r0" errors
when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
armv7 and armv6.

PR: 236567
MFC after: 3 days

4 years agoLinuxKPI: Improve sysfs support.
johalun [Fri, 6 Sep 2019 15:43:53 +0000 (15:43 +0000)]
LinuxKPI: Improve sysfs support.

- Add functions for creating and merging sysfs groups.
- Add sysfs_streq function to compare strings ignoring newline from the
  sysctl userland call.
- Add a call to sysfs_create_groups in device_add.
- Remove duplicate header include.
- Bump __FreeBSD_version.

Reviewed by: hselasky
Approved by: imp (mentor), hselasky
MFC after: 4 days
Differential Revision: D21542

4 years agoFix typo not -> nor and add 'the' because we are talking about specific flags
imp [Fri, 6 Sep 2019 15:01:47 +0000 (15:01 +0000)]
Fix typo not -> nor and add 'the' because we are talking about specific flags
and make the punctuation parallel between the three cases.

Submitted by: Yoshihiro Ota-san
Differential Revision: https://reviews.freebsd.org/D21530

4 years agoFix broken window replay check that will allow old packet to be accepted.
fabient [Fri, 6 Sep 2019 14:30:23 +0000 (14:30 +0000)]
Fix broken window replay check that will allow old packet to be accepted.
This was introduced in r309144.

Submitted by: Jean-Francois HREN <jean-francois.hren@stormshield.eu>
Approved by: ae@
MFC after: 3 days

4 years agoThis adds the final tweaks to LRO that will now allow me
rrs [Fri, 6 Sep 2019 14:25:41 +0000 (14:25 +0000)]
This adds the final tweaks to LRO that will now allow me
to add BBR. These changes make it so you can get an
array of timestamps instead of a compressed ack/data segment.
BBR uses this to aid with its delivery estimates. We also
now (via Drew's suggestions) will not go to the expense of
the tcb lookup if no stack registers to want this feature. If
HPTS is not present the feature is not present either and you
just get the compressed behavior.

Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D21127

4 years agopkgbase: r351861 didn't solve everything, we need to default to the utilities package too
manu [Fri, 6 Sep 2019 12:26:45 +0000 (12:26 +0000)]
pkgbase: r351861 didn't solve everything, we need to default to the utilities package too

4 years agoAdd embedded Managed Object Format blob access to acpi_wmi(4).
takawata [Fri, 6 Sep 2019 10:12:05 +0000 (10:12 +0000)]
Add embedded Managed Object Format blob access to acpi_wmi(4).
This blob is can be converted to human readable form by bmfdec.
(http://github.com/pali/bmfdec)

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

4 years agoufs: Remove redundant brelse() after r294954
cem [Fri, 6 Sep 2019 08:08:33 +0000 (08:08 +0000)]
ufs: Remove redundant brelse() after r294954

Same automation.

No functional change.

4 years agomsdosfs: Remove redundant brelse() after r294954
cem [Fri, 6 Sep 2019 08:08:10 +0000 (08:08 +0000)]
msdosfs: Remove redundant brelse() after r294954

Same automation.

No functional change.

4 years agocd9660: Remove redundant brelse() after r294954
cem [Fri, 6 Sep 2019 08:07:36 +0000 (08:07 +0000)]
cd9660: Remove redundant brelse() after r294954

Same automation.

No functional change.

4 years agoext2fs: Remove redundant brelse() after r294954
cem [Fri, 6 Sep 2019 08:07:12 +0000 (08:07 +0000)]
ext2fs: Remove redundant brelse() after r294954

Coccinelle:

@ rule1 @
 identifier __error;
@@
 ...
 int __error;
 ...

@ rule2 depends on rule1 @
 identifier rule1.__error;
 identifier __bp;
@@

 __error =
(
 bread
|
 bread_gb
|
 breadn
|
 breadn_flags
)
 (..., &__bp);
 if (
(
 __error
|
 __error != 0
)
 ) {
 ...
- brelse(__bp);
 ...
 }

No functional change.

4 years agopowerpc64/pmap: Fix a WITNESS error in alloc_pvo_entry()
jhibbits [Fri, 6 Sep 2019 03:02:12 +0000 (03:02 +0000)]
powerpc64/pmap: Fix a WITNESS error in alloc_pvo_entry()

We only call alloc_pvo_entry() with M_WAITOK from one location.  However,
this can be called while holding nonsleepable locks.  Rather than passing
M_WAITOK down, use vm_wait() and loop.

4 years agopowerpc64/pmap: Simplify the code path for moea64_pte_replace_native()
jhibbits [Fri, 6 Sep 2019 02:45:46 +0000 (02:45 +0000)]
powerpc64/pmap: Simplify the code path for moea64_pte_replace_native()

Summary:
MOEA64_PTE_REPLACE() is called often with the pmap lock held, and
sometimes with the page pv lock held.  The less work done while holding
a lock, the better.  Since we are intending to replace the same PTE
(same hash index), we don't need to recalculate anything, just flat
replace the PTE.  This cuts more than 200 instructions off the
invalidating code path.  In addition, we don't need to replace a PTE
that's not occupied by this PVO.

Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D21515

4 years agoLoader: Add load offset to powerpc kernel entry point
jhibbits [Fri, 6 Sep 2019 02:28:03 +0000 (02:28 +0000)]
Loader: Add load offset to powerpc kernel entry point

Summary:
There is logic in ELF loadimage() to relocate kernels, but currently
only type ET_EXEC.  PowerPC kernels are ET_DYN, and can be relocated anywhere.
Add the load offset to kernel entry points on this platform.

Reviewed by: imp, ian
Differential Revision: https://reviews.freebsd.org/D21286

4 years agoQEMU: use default HZ
philip [Fri, 6 Sep 2019 01:22:16 +0000 (01:22 +0000)]
QEMU: use default HZ

HZ=100 by default on riscv since r351918.

4 years agoriscv: default to HZ=100
philip [Fri, 6 Sep 2019 01:19:31 +0000 (01:19 +0000)]
riscv: default to HZ=100

Most current RISC-V development platforms are not fast enough to benefit
from the increased granularity provided by HZ=1000.

Sponsored by: Axiado

4 years agoDelete the unused "nd" argument for nfsrv_proxyds().
rmacklem [Thu, 5 Sep 2019 22:25:19 +0000 (22:25 +0000)]
Delete the unused "nd" argument for nfsrv_proxyds().

The "nd" argument for nfsrv_proxyds() is no longer used by the function.
This patch deletes it. This allows a subsequent patch to delete the "nd"
argument from nfsvno_getattr(), since it's only use of "nd" was to pass it
to nfsrv_proxyds().
Getting rid of the "nd" argument from nfsvno_getattr() avoids confusion
over why it might need "nd".

This patch is trivial and does not have any semantic effect.

4 years agoloader: use teken teminal emulator for x86 and uefi
tsoome [Thu, 5 Sep 2019 22:15:50 +0000 (22:15 +0000)]
loader: use teken teminal emulator for x86 and uefi

Replace mini cons25 emulator with teken, this does enable us proper console
terminal for loader and will make it possible to implement different
back end callbacks to draw to screen.

At this time we still only "draw" in text mode.

4 years agoRemove long-dead BUF_ASSERT_{,UN}HELD assertions
cem [Thu, 5 Sep 2019 21:43:33 +0000 (21:43 +0000)]
Remove long-dead BUF_ASSERT_{,UN}HELD assertions

These were fully neutered in r177676 (2008), but not removed at the time for
unclear reasons.  They're totally dead code, so go ahead and yank them now.

No functional change.

4 years agomsdosfs: Drop an unneeded brelse in bread error condition
cem [Thu, 5 Sep 2019 21:30:52 +0000 (21:30 +0000)]
msdosfs: Drop an unneeded brelse in bread error condition

After r294954, it is an invariant that bread returns non-NULL bp if and only
if the routine succeeded.  On error, it handles any buffer cleanup
internally.  So the brelse(NULL) here was just redundant.

No functional change.

Discussed with: kib (extracted from a larger differential)

4 years agonvdimm(4): Add description of NVDIMM Namespace support
scottph [Thu, 5 Sep 2019 20:51:41 +0000 (20:51 +0000)]
nvdimm(4): Add description of NVDIMM Namespace support

Reviewed by: kib, bcr
Approved by: emaste (mentor)
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21536

4 years agoBounds check again after advancing cp, otherwise we have a possible
cy [Thu, 5 Sep 2019 19:35:30 +0000 (19:35 +0000)]
Bounds check again after advancing cp, otherwise we have a possible
heap buffer overflow. This was discovered by a Google fuzzer test.
This can lead to remote denial of service. User interaction and
execution privileges are not a prerequisite for exploitation.

Reported by: enh at Google, to FreeBSD by maya@NetBSD.org
Obtained from: enh at Google
See also: NetBSD ns_name.c r1.12
Reviewed by: delphij, ume
MFC after: 3 days
https://android-review.googlesource.com/c/platform/bionic/+/1093130
Differential Revision: https://reviews.freebsd.org/D21523

4 years agoUse a single write of 3 bytes instead of iicdev_writeto() in ads111x.
ian [Thu, 5 Sep 2019 19:17:53 +0000 (19:17 +0000)]
Use a single write of 3 bytes instead of iicdev_writeto() in ads111x.

The iicdev_writeto() function basically does scatter-gather IO by filling
in a pair of iic_msg structs to write the register address then the data
from different locations but with a single bus START/xfer/STOP sequence.
It turns out several low-level i2c controller drivers do not honor the
IIC_NOSTART flag, so the second piece of the write gets a new START on
the bus, and that confuses the ads111x chips which expect a continuous
write of 3 bytes to set a register.

A proper fix for this is to track down all the misbehaving controllers
drivers and fix them.  For now this change makes this driver work again.

4 years agopkgbase: Add the pkg trusted keys to the FreeBSD-utilities package
manu [Thu, 5 Sep 2019 19:17:17 +0000 (19:17 +0000)]
pkgbase: Add the pkg trusted keys to the FreeBSD-utilities package

4 years agoEnsure a measurement is complete before reading the result in ads111x.
ian [Thu, 5 Sep 2019 19:07:48 +0000 (19:07 +0000)]
Ensure a measurement is complete before reading the result in ads111x.
Also, disable the comparator by default; it's not used for anything.

The previous logic would start a measurement, and then pause_sbt() for the
averaging time currently configured in the chip.  After waiting that long,
the code would blindly read the measurement register and return its value.
The problem is that the chip's idea of averaging time is based on its
internal free-running 1MHz oscillator, which may be running at a wildly
different rate than the kernel clock.  If the chip's internal timer was
running slower than the kernel clock, we'd end up grabbing a stale result
from an old measurement.

The driver now still uses pause_sbt() to yield the cpu while waiting for
the measurement to complete, but after sleeping it checks the chip's status
register to ensure the measurement engine is idle.  If it's not, the driver
uses a retry loop to wait a bit (5% of the original wait time) then check
again for completion.

4 years agoSet required program for all acl tests
kp [Thu, 5 Sep 2019 18:54:46 +0000 (18:54 +0000)]
Set required program for all acl tests

r339782 re-enabled acl test 00 and 02, which were disabled in r336617
due to PR 229930.
When the tests were disabled the code to set their required programs was
disabled as well, but this was not reinstated when r339782 re-enabled
them.
Do so now.

Sponsored by: Axiado

4 years agovfs: temporarily revert r351825
mjg [Thu, 5 Sep 2019 18:19:51 +0000 (18:19 +0000)]
vfs: temporarily revert r351825

There are 2 problems:
- it introduces a funny bug where it can end up trylocking the same vnode [1]
- it exposes a pre-existing softdep deadlock [2]

Both are easier to run into that the bug which got fixed, so revert until
a complete solution is worked out.

Reported by: cy [1], pho [2]
Sponsored by: The FreeBSD Foundation

4 years agoAdjust teken to allow build as part of loader
tsoome [Thu, 5 Sep 2019 18:07:40 +0000 (18:07 +0000)]
Adjust teken to allow build as part of loader

Building for loader needs specific headers.

4 years agoAdd dwgpio to NOTES so it gets built in LINT kernels.
br [Thu, 5 Sep 2019 17:54:57 +0000 (17:54 +0000)]
Add dwgpio to NOTES so it gets built in LINT kernels.

Sponsored by: DARPA, AFRL

4 years agoBump up the low range of cpuset numbers to account for the kernel cpuset.
stevek [Thu, 5 Sep 2019 17:48:39 +0000 (17:48 +0000)]
Bump up the low range of cpuset numbers to account for the kernel cpuset.

Reviewed by: jeff
Obtained from: Juniper Networks, Inc.

4 years ago[lib80211] add initial VHT (11ac) channel ranges for FCC.
adrian [Thu, 5 Sep 2019 15:55:24 +0000 (15:55 +0000)]
[lib80211] add initial VHT (11ac) channel ranges for FCC.

This is a simple set of VHT channels and flags for the FCC (US) regulatory
domain.  This needs to be researched and done for the rest of the
regulatory domains, but this should at least unblock some more ath10k
testing.

4 years agopcie: return an error if a matching resource is not found
emaste [Thu, 5 Sep 2019 15:45:21 +0000 (15:45 +0000)]
pcie: return an error if a matching resource is not found

Submitted by: markj
Reviewed by: manu
Event: vBSDCon FreeBSD hackathon
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20884

4 years agopatch(1): fix the file removal test, strengthen it a bit
kevans [Thu, 5 Sep 2019 15:35:57 +0000 (15:35 +0000)]
patch(1): fix the file removal test, strengthen it a bit

To remain compatible with GNU patch, we should ensure that once we're
removing empty files after a reversed /dev/null patch we don't remove files
that have been modified. GNU patch leaves these intact and just reverses the
hunk that created the file, effectively implying --remove-empty-files for
reversed /dev/null patches.

4 years agoficl: add xemit word
tsoome [Thu, 5 Sep 2019 15:06:30 +0000 (15:06 +0000)]
ficl: add xemit word

While emit will output one byte on screen, the xemit will output xchar.

See: http://forth-standard.org/standard/xchar/XEMIT

4 years agorc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)
0mp [Thu, 5 Sep 2019 14:52:22 +0000 (14:52 +0000)]
rc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)

A user may set ${name}_env variable in rc.conf(5) in order to set additional
environment variables for a service command.  Unfortunately, at the moment
this variable is only honored when the command is specified via the command
variable. Those additional environment variables coming from ${name}_env
are never set if the service is started via the ${rc_arg}_cmd variable (for
example start_cmd).

PR: 239692
Reviewed by: bcr, jilles
Approved by: src (jilles)
Differential Revision: https://reviews.freebsd.org/D21228

4 years agopkgbase: pfctl: tests: Put tests files in the FreeBSD-tests package
manu [Thu, 5 Sep 2019 14:19:06 +0000 (14:19 +0000)]
pkgbase: pfctl: tests: Put tests files in the FreeBSD-tests package

Reviewed by: kp, gjb
Differential Revision: https://reviews.freebsd.org/D21521

4 years agopkgbase: Handle FILES when no FILESGROUP isn't used
manu [Thu, 5 Sep 2019 14:18:13 +0000 (14:18 +0000)]
pkgbase: Handle FILES when no FILESGROUP isn't used

bsd.files.mk only add the TAG when groups are used, fix this.

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D21520

4 years agopkgbase: Add tag for LIBSYMLINK case
manu [Thu, 5 Sep 2019 14:17:28 +0000 (14:17 +0000)]
pkgbase: Add tag for LIBSYMLINK case

Otherwised the files aren't packaged.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21508

4 years agopkgbase: Add tags for includes in bsd.incs.mk
manu [Thu, 5 Sep 2019 14:16:39 +0000 (14:16 +0000)]
pkgbase: Add tags for includes in bsd.incs.mk

Otherwise the files aren't packaged.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21507

4 years agopkgbase: Create a FreeBSD-utilities package and make it the default one
manu [Thu, 5 Sep 2019 14:15:47 +0000 (14:15 +0000)]
pkgbase: Create a FreeBSD-utilities package and make it the default one

The default package use to be FreeBSD-runtime but it should only contain
binaries and libs enough to boot to single user and repair the system, it
is also very handy to have a package that can be tranform to a small mfsroot.
So create a new package named FreeBSD-utilities and make it the default one.
Also move a few binaries and lib into this package when it make sense.
Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21506

4 years agopkgbase: Add TAG for evdev and veriexec headers
manu [Thu, 5 Sep 2019 14:14:47 +0000 (14:14 +0000)]
pkgbase: Add TAG for evdev and veriexec headers

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D21505

4 years agopkgbase: Put the sys/common test into the tests package
manu [Thu, 5 Sep 2019 14:14:07 +0000 (14:14 +0000)]
pkgbase: Put the sys/common test into the tests package

Every other test is there so do the same for those.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21504

4 years agopkgbase: Put a lot of binaries and lib in FreeBSD-runtime
manu [Thu, 5 Sep 2019 14:13:08 +0000 (14:13 +0000)]
pkgbase: Put a lot of binaries and lib in FreeBSD-runtime

All of them are needed to be able to boot to single user and be able
to repair a existing FreeBSD installation so put them directly into
FreeBSD-runtime.

Reviewed by:    bapt, gjb
Differential Revision:  https://reviews.freebsd.org/D21503

4 years agopkgbase: Put libbluetooth in the bluetooth package
manu [Thu, 5 Sep 2019 14:11:16 +0000 (14:11 +0000)]
pkgbase: Put libbluetooth in the bluetooth package

It make sense to have everything bluetooth related in the same package.
Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21502

4 years agopkgbase: Move libcap_ to FreeBSD-runtime
manu [Thu, 5 Sep 2019 14:10:26 +0000 (14:10 +0000)]
pkgbase: Move libcap_ to FreeBSD-runtime

A lot of binaries present in FreeBSD-runtime depend on it so move
the libs there.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21501

4 years agopkgbase: Tag passwd related file to be in FreeBSD-runtime package.
manu [Thu, 5 Sep 2019 14:09:33 +0000 (14:09 +0000)]
pkgbase: Tag passwd related file to be in FreeBSD-runtime package.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21500

4 years agopkgbase: Move rc scripts and related files to their own packages
manu [Thu, 5 Sep 2019 14:08:45 +0000 (14:08 +0000)]
pkgbase: Move rc scripts and related files to their own packages

It doesn't need to be in runtime and might help people who want to
experiment with other rc system or don't use one (like in small
embedded mfsroot).

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21499

4 years agopkgbase: Force zfs(8) and zpool(8) to be in the runtime package
manu [Thu, 5 Sep 2019 14:07:49 +0000 (14:07 +0000)]
pkgbase: Force zfs(8) and zpool(8) to be in the runtime package

Those commands are needed to repair a FreeBSD installation so add them
to the runtime package

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21498

4 years agopkgbase: lib80211 is needed by ifconfig(8) so put it in FreeBSD-runtime
manu [Thu, 5 Sep 2019 14:06:48 +0000 (14:06 +0000)]
pkgbase: lib80211 is needed by ifconfig(8) so put it in FreeBSD-runtime

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21497

4 years agopkgbase: Move the bootloader related files to a new FreeBSD-bootloader package
manu [Thu, 5 Sep 2019 14:06:01 +0000 (14:06 +0000)]
pkgbase: Move the bootloader related files to a new FreeBSD-bootloader package

Bootloader file isn't needed for jails so don't include it in FreeBSD-runtime.

Reviewed by: bapt, delphij, gjb
Differential Revision: https://reviews.freebsd.org/D21496

4 years agoDecrease the default audio playback latency to a maximum of 21.3ms.
hselasky [Thu, 5 Sep 2019 10:49:12 +0000 (10:49 +0000)]
Decrease the default audio playback latency to a maximum of 21.3ms.
This significantly improves the audio playback response time.

Discussed with: mav@
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoficl: add uIsGreater word
tsoome [Thu, 5 Sep 2019 09:04:48 +0000 (09:04 +0000)]
ficl: add uIsGreater word

For some reason we have u< but not u>, fix it.