]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoIn FreeBSD 11 localedef(1) has replaced the mklocale(1) and colldef(1)
bapt [Tue, 10 Sep 2019 07:47:52 +0000 (07:47 +0000)]
In FreeBSD 11 localedef(1) has replaced the mklocale(1) and colldef(1)
tools to generate the locales data. state it in the libc manpages.

MFC after: 3 days

4 years agoRemove reference to mklocale regarding the nls directory
bapt [Tue, 10 Sep 2019 07:40:45 +0000 (07:40 +0000)]
Remove reference to mklocale regarding the nls directory

mklocale never had anything to do with the content of this directory

MFC after: 3 days

4 years agoStop linking to libl by specifying we do not need yywrap
bapt [Tue, 10 Sep 2019 07:28:27 +0000 (07:28 +0000)]
Stop linking to libl by specifying we do not need yywrap

MFC after: 3 days

4 years agoStop linking to libl by specifying we do not need yywrap
bapt [Tue, 10 Sep 2019 07:26:38 +0000 (07:26 +0000)]
Stop linking to libl by specifying we do not need yywrap

MFC after: 3 days

4 years agoStop linking to libl by specifying we do not need yywrap
bapt [Tue, 10 Sep 2019 07:25:37 +0000 (07:25 +0000)]
Stop linking to libl by specifying we do not need yywrap

MFC after: 3 days

4 years agoStop linking to libl by specifying we do not need yywrap
bapt [Tue, 10 Sep 2019 07:23:01 +0000 (07:23 +0000)]
Stop linking to libl by specifying we do not need yywrap

MFC after: 3 days

4 years agoby specifyng we do not use yywrap we can avoid linking to libl and liby
bapt [Tue, 10 Sep 2019 07:20:32 +0000 (07:20 +0000)]
by specifyng we do not use yywrap we can avoid linking to libl and liby

MFC after: 3 days

4 years agoconfig: do not link against libl, it is not needed
bapt [Tue, 10 Sep 2019 07:14:39 +0000 (07:14 +0000)]
config: do not link against libl, it is not needed

MFC after: 3 days

4 years agoFix 'calendar -a' in several ways.
glebius [Tue, 10 Sep 2019 04:21:48 +0000 (04:21 +0000)]
Fix 'calendar -a' in several ways.

o Do not run any iconv() processing in -a. The locale of root user is not
  what is desired by most of the users who receive their calendar mail.
  Just assume that users store their calendars in a format that is readable
  to them. This fixes regression from r344340.
o fork() and setusercontext(LOGIN_SETALL) for every user. This makes LANG
  set inside a calendar file mostly excessive, as we will pick up user's
  login class LANG.
o This also executes complex function cal() that parses user owned files
  with appropriate user privileges.
  Previously it was run with privileges dropped only temporary for execution
  of cal(), and fully dropped only before invoking sendmail (see r22473).

Reviewed by: bapt (older version of patch)

4 years agoRemove pointless playing with LC_TIME, which should have been done in r205821.
glebius [Tue, 10 Sep 2019 04:01:41 +0000 (04:01 +0000)]
Remove pointless playing with LC_TIME, which should have been done in r205821.

4 years agoAppease Clang false-positive Werrors in r352112
cem [Tue, 10 Sep 2019 01:56:47 +0000 (01:56 +0000)]
Appease Clang false-positive Werrors in r352112

Reported by: bcran

4 years agoddb(4): Add 'show route <dest>' and 'show routetable [<af>]'
cem [Mon, 9 Sep 2019 22:54:27 +0000 (22:54 +0000)]
ddb(4): Add 'show route <dest>' and 'show routetable [<af>]'

These commands show the route resolved for a specified destination, or
print out the entire routing table for a given address family (or all
families, if none is explicitly provided).

Discussed with: emaste
Differential Revision: https://reviews.freebsd.org/D21510

4 years agoInitialize page/subpage in case of `modepage -d`.
mav [Mon, 9 Sep 2019 22:08:22 +0000 (22:08 +0000)]
Initialize page/subpage in case of `modepage -d`.

Previously without -m parameter it worked mostly by concodence.

While there, make page/subpage values validation more strict.

MFC after: 5 days
Sponsored by: iXsystems, Inc.

4 years agoChange synchonization rules for vm_page reference counting.
markj [Mon, 9 Sep 2019 21:32:42 +0000 (21:32 +0000)]
Change synchonization rules for vm_page reference counting.

There are several mechanisms by which a vm_page reference is held,
preventing the page from being freed back to the page allocator.  In
particular, holding the page's object lock is sufficient to prevent the
page from being freed; holding the busy lock or a wiring is sufficent as
well.  These references are protected by the page lock, which must
therefore be acquired for many per-page operations.  This results in
false sharing since the page locks are external to the vm_page
structures themselves and each lock protects multiple structures.

Transition to using an atomically updated per-page reference counter.
The object's reference is counted using a flag bit in the counter.  A
second flag bit is used to atomically block new references via
pmap_extract_and_hold() while removing managed mappings of a page.
Thus, the reference count of a page is guaranteed not to increase if the
page is unbusied, unmapped, and the object's write lock is held.  As
a consequence of this, the page lock no longer protects a page's
identity; operations which move pages between objects are now
synchronized solely by the objects' locks.

The vm_page_wire() and vm_page_unwire() KPIs are changed.  The former
requires that either the object lock or the busy lock is held.  The
latter no longer has a return value and may free the page if it releases
the last reference to that page.  vm_page_unwire_noq() behaves the same
as before; the caller is responsible for checking its return value and
freeing or enqueuing the page as appropriate.  vm_page_wire_mapped() is
introduced for use in pmap_extract_and_hold().  It fails if the page is
concurrently being unmapped, typically triggering a fallback to the
fault handler.  vm_page_wire() no longer requires the page lock and
vm_page_unwire() now internally acquires the page lock when releasing
the last wiring of a page (since the page lock still protects a page's
queue state).  In particular, synchronization details are no longer
leaked into the caller.

The change excises the page lock from several frequently executed code
paths.  In particular, vm_object_terminate() no longer bounces between
page locks as it releases an object's pages, and direct I/O and
sendfile(SF_NOCACHE) completions no longer require the page lock.  In
these latter cases we now get linear scalability in the common scenario
where different threads are operating on different files.

__FreeBSD_version is bumped.  The DRM ports have been updated to
accomodate the KPI changes.

Reviewed by: jeff (earlier version)
Tested by: gallatin (earlier version), pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20486

4 years agoReverse the referenced tables.
crees [Mon, 9 Sep 2019 20:48:12 +0000 (20:48 +0000)]
Reverse the referenced tables.

If ipv4_prefer is specified, Section 10.3 is relevant.
If ipv6_prefer is specified, Section  2.1 is relevant.

This change makes the corresponding options/sections 'respective'

PR: docs/234249
Submitted by: David Fiander <david@fiander.info>

4 years agoAdd one more error message to r352082.
mav [Mon, 9 Sep 2019 19:00:37 +0000 (19:00 +0000)]
Add one more error message to r352082.

MFC after: 5 days
Sponsored by: iXsystems, Inc.

4 years agoRemove obsolete WITHOUT names that are no longer in the system.
imp [Mon, 9 Sep 2019 18:46:28 +0000 (18:46 +0000)]
Remove obsolete WITHOUT names that are no longer in the system.

Noticed by: swills@

4 years agoThese should have been removed when we removed atmel port before 12.
imp [Mon, 9 Sep 2019 18:45:52 +0000 (18:45 +0000)]
These should have been removed when we removed atmel port before 12.

4 years agomsdosfsmount.h: fix ifdef comment
emaste [Mon, 9 Sep 2019 18:35:17 +0000 (18:35 +0000)]
msdosfsmount.h: fix ifdef comment

4 years agocompiler-rt: use 64-bit time_t for all FreeBSD archs except i386
emaste [Mon, 9 Sep 2019 18:33:15 +0000 (18:33 +0000)]
compiler-rt: use 64-bit time_t for all FreeBSD archs except i386

Obtained from: LLVM r370756

4 years agocompiler-rt: use more __sanitizer_time_t on FreeBSD
emaste [Mon, 9 Sep 2019 18:32:29 +0000 (18:32 +0000)]
compiler-rt: use more __sanitizer_time_t on FreeBSD

A few structs were using long for time_t members.

Obtained from: LLVM r370755

4 years agobectl(8): initialize reverse earlier
kevans [Mon, 9 Sep 2019 18:17:30 +0000 (18:17 +0000)]
bectl(8): initialize reverse earlier

This turns into a warning in GCC 4.2 that 'reverse' may be used
uninitialized in this function. While I don't immediately see where it's
deciding this from (there's only two paths that make column != NULL, and
they both set reverse), initializing reverse earlier is good for clarity.

MFC after: 3 days

4 years agoFix number of problems found while testing on SAT devices.
mav [Mon, 9 Sep 2019 17:36:29 +0000 (17:36 +0000)]
Fix number of problems found while testing on SAT devices.

 - Remove incomplete and dangerous ata_res decoding from ata_do_cmd().
Instead switch all functions that need the result to use get_ata_status(),
doing the same, but more careful, also reducing code duplication.
 - Made get_ata_status() to also decode fixed format sense.  In many cases
it is still not enough to make it useful, since it can only report results
of 28-bit command, but it is slightly better then nothing.
 - Organize error reporting in ata_do_cmd(), so that if caller specified
AP_FLAG_CHK_COND, it is responsible for command errors (non-ioctl ones).
 - Make HPA/AMA errors not fatal for `identify` subcommand.
 - Fix reprobe() not being called on HPA/AMA when in quiet mode.
 - Remove not very useful messages from `format` and `sanitize` commands
with -y flag.  Once they started, they often can't be stopped any way.

MFC after: 5 days
Sponsored by: iXsystems, Inc.

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