]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoUpdate and replace old rc daemons for GCE images.
Glen Barber [Thu, 9 Aug 2018 23:31:18 +0000 (23:31 +0000)]
Update and replace old rc daemons for GCE images.

PR: 229000
Submitted by: helen.koike@collabora.com
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agocam(4): Add an xpt-neutral flag indicating a valid panic CCB
Conrad Meyer [Thu, 9 Aug 2018 21:53:32 +0000 (21:53 +0000)]
cam(4): Add an xpt-neutral flag indicating a valid panic CCB

No functional change.

Note that this change is careful to set the CCB header xflags after
foo_fill_bar() routines, which generally zero existing flags.  An earlier
version of this patch mistakenly set the flag before the fill routines.

Submitted by: Scott Ferris <sferris AT isilon.com>, jhibbits@
Reviewed by: bdrewery@, markj@, and non-committer FreeBSD contributor Anton Rang
Sponsored by: Dell EMC Isilon

5 years agocxgbe(4): Add a sysctl to control the tx credit reclaim mechanism for
Navdeep Parhar [Thu, 9 Aug 2018 21:52:51 +0000 (21:52 +0000)]
cxgbe(4): Add a sysctl to control the tx credit reclaim mechanism for
netmap tx queues.  There is no change in default behavior.

Sponsored by: Chelsio Communications

5 years agoAdd optional LLVM BPF target support
Dimitry Andric [Thu, 9 Aug 2018 21:28:31 +0000 (21:28 +0000)]
Add optional LLVM BPF target support

BPF (eBPF) is an independent instruction set architecture which is
introduced in Linux a few years ago. Originally, eBPF execute
environment was only inside Linux kernel. However, recent years there
are some user space implementation (https://github.com/iovisor/ubpf,
https://doc.dpdk.org/guides/prog_guide/bpf_lib.html) and kernel space
implementation for FreeBSD is going on
(https://github.com/YutaroHayakawa/generic-ebpf).

The BPF target support can be enabled using WITH_LLVM_TARGET_BPF, as it
is not built by default.

Submitted by: Yutaro Hayakawa <yhayakawa3720@gmail.com>
Reviewed by: dim, bdrewery
Differential Revision: https://reviews.freebsd.org/D16033

5 years agocam_ccb.h: Remove redundant declarations of static inline functions
Conrad Meyer [Thu, 9 Aug 2018 21:20:07 +0000 (21:20 +0000)]
cam_ccb.h: Remove redundant declarations of static inline functions

No functional change.

They're unnecessarily confusing for tools like grep or ctags.

Sponsored by: Dell EMC Isilon

5 years agocxgbe(4): Set fl_pktshift to 0 by default.
Navdeep Parhar [Thu, 9 Aug 2018 21:07:32 +0000 (21:07 +0000)]
cxgbe(4): Set fl_pktshift to 0 by default.

Sponsored by: Chelsio Communications

5 years agolibnv: Remove -I${SRCTOP}/sys
Kyle Evans [Thu, 9 Aug 2018 20:29:44 +0000 (20:29 +0000)]
libnv: Remove -I${SRCTOP}/sys

This should have been done as part of r336019 -- including ${SRCTOP}/sys is
not a good business model for something that's build in legacy/bootstrap
stages.

Beyond that, libnv seems to build quite alright as legacy, part of
buildworld, and standalone without. Axe it.

Reported by: truckman (head building stable/11)
Tested by: Shawn Webb (HardenedBSD)
MFC after: 3 days

5 years agosubr_prf: style(9) the sizeof
Kyle Evans [Thu, 9 Aug 2018 19:09:06 +0000 (19:09 +0000)]
subr_prf: style(9) the sizeof

Reported by: jkim, ian

5 years agoAccount for the lowmem handlers in the inactive queue scan target.
Mark Johnston [Thu, 9 Aug 2018 18:25:49 +0000 (18:25 +0000)]
Account for the lowmem handlers in the inactive queue scan target.

Before r329882 the target would be computed after lowmem handlers run
and free pages.  On some systems a significant amount of page
reclamation happens this way.  However, with r329882 the target is
computed first, which can lead to unnecessary reclamation from the
page cache, and this in turn may result in excessive swapping.

Instead, adjust the target after running lowmem handlers.  Don't
invoke the lowmem handlers before the PID controller, though, since
that would hide the true rate of page allocation.

Reviewed by: alc, kib (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16606

5 years agosubr_prf: Use "sizeof current_boot_tag" instead
Kyle Evans [Thu, 9 Aug 2018 17:53:18 +0000 (17:53 +0000)]
subr_prf: Use "sizeof current_boot_tag" instead

5 years agoBOOT_TAG: Make a config(5) option, expose as sysctl and loader tunable
Kyle Evans [Thu, 9 Aug 2018 17:47:47 +0000 (17:47 +0000)]
BOOT_TAG: Make a config(5) option, expose as sysctl and loader tunable

BOOT_TAG lived shortly in sys/msgbuf.h, but this wasn't necessarily great
for changing it or removing it. Move it into subr_prf.c and add options for
it to opt_printf.h.

One can specify both the BOOT_TAG and BOOT_TAG_SZ (really, size of the
buffer that holds the BOOT_TAG). We expose it as kern.boot_tag and also add
a loader tunable by the same name that we'll fetch upon initialization of
the msgbuf.

This allows for flexibility and also ensures that there's a consistent way
to figure out the boot tag of the running kernel, rather than relying on
headers to be in-sync.

Prodded super-super-lightly by: imp

5 years agomsgbuf: Light detailing (const'ify and bool'itize)
Kyle Evans [Thu, 9 Aug 2018 17:42:27 +0000 (17:42 +0000)]
msgbuf: Light detailing (const'ify and bool'itize)

5 years agoCorrect default path of kernel modules.
John Baldwin [Thu, 9 Aug 2018 16:42:13 +0000 (16:42 +0000)]
Correct default path of kernel modules.

5 years agocxgbe(4): Display pkt-size and burst-size in traffic class parameters.
Navdeep Parhar [Thu, 9 Aug 2018 14:36:44 +0000 (14:36 +0000)]
cxgbe(4): Display pkt-size and burst-size in traffic class parameters.

5 years agocxgbetool(8): Userspace part of support for high priority filters on T6+.
Navdeep Parhar [Thu, 9 Aug 2018 14:21:27 +0000 (14:21 +0000)]
cxgbetool(8): Userspace part of support for high priority filters on T6+.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agocxgbe(4): Add support for high priority filters on T6+. They have their
Navdeep Parhar [Thu, 9 Aug 2018 14:19:47 +0000 (14:19 +0000)]
cxgbe(4): Add support for high priority filters on T6+.  They have their
own region in the TCAM starting with T6, unlike previous chips where
they were in the same region as normal filters.

These filters "hit" before anything else in the LE's lookup.  The exact
order is:
a) High priority filters
b) TOE's active region (TCAM and/or hash)
c) Servers (TOE hw listeners)
d) Normal filters

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years ago[ppc] Fix kernel panic when using BOOTP_NFSROOT
Leandro Lupori [Thu, 9 Aug 2018 14:04:51 +0000 (14:04 +0000)]
[ppc] Fix kernel panic when using BOOTP_NFSROOT

On PowerPC (and possibly other architectures), that doesn't use
EARLY_AP_STARTUP, the config task queue may be used initialized.
This was observed while trying to mount the root fs from NFS, as
reported here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230168.

This patch has 2 main changes:
1- Perform a basic initialization of qgroup_config, similar to
what is done in taskqgroup_adjust, but simpler.
This makes qgroup_config ready to be used during NFS root mount.

2- When EARLY_AP_STARTUP is not used, call inm_init() and
in6m_init() right before SI_SUB_ROOT_CONF, because bootp needs
to send multicast packages to request an IP.

PR: Bug 230168
Reported by: sbruno
Reviewed by: jhibbits, mmacy, sbruno
Approved by: jhibbits
Differential Revision: D16633

5 years agoIf -q flag is specified, do not complain when we are trying to delete
Andrey V. Elsukov [Thu, 9 Aug 2018 12:46:30 +0000 (12:46 +0000)]
If -q flag is specified, do not complain when we are trying to delete
nonexistent NAT instance or nonexistent rule.

This allows execute batched `delete` commands and do not fail when
found nonexistent rule.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC

5 years agoUse NULLs instead of casted zeroes, for consistency.
Edward Tomasz Napierala [Thu, 9 Aug 2018 12:17:03 +0000 (12:17 +0000)]
Use NULLs instead of casted zeroes, for consistency.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRefactor common code into execute_script().
Edward Tomasz Napierala [Thu, 9 Aug 2018 12:13:08 +0000 (12:13 +0000)]
Refactor common code into execute_script().

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16627

5 years agoImport CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
Olivier Houchard [Thu, 9 Aug 2018 12:11:49 +0000 (12:11 +0000)]
Import CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
to avoid using lwsync on ppc32.

5 years agoImport CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
Olivier Houchard [Thu, 9 Aug 2018 12:07:37 +0000 (12:07 +0000)]
Import CK as of commit 08813496570879fbcc2adcdd9ddc0a054361bfde, mostly
to avoid using lwsync on ppc32.

5 years agoMake ldconfig(8) atomic, by removing an unneccessary call to unlink(2)
Edward Tomasz Napierala [Thu, 9 Aug 2018 11:46:12 +0000 (11:46 +0000)]
Make ldconfig(8) atomic, by removing an unneccessary call to unlink(2)
before rename(2).

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16641

5 years agoImplement missing atomic_fcmpset_XXX() support for i386.
Hans Petter Selasky [Thu, 9 Aug 2018 11:30:13 +0000 (11:30 +0000)]
Implement missing atomic_fcmpset_XXX() support for i386.

This also fixes i386 build after r337527.

MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoadd an option for ddb ps command to print process arguments
Andriy Gapon [Thu, 9 Aug 2018 11:21:31 +0000 (11:21 +0000)]
add an option for ddb ps command to print process arguments

We use ps to collect the information of all processes in textdump. But
it doesn't contain process arguments which however sometimes are very
useful for debugging.  The new 'a' modifier adds that capability.

While here, remove 'm' modifier from ddb.4.  It was in the manual page
from its very first revision, but I could not find any evidence of the
code ever supporting it.

Submitted by: Terry Hu <thu@panzura.com>
Reviewed by: kib
MFC after: 1 week
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D16603

5 years agoUse atomic_fcmpset_XXX() instead of atomic_cmpset_XXX() when possible
Hans Petter Selasky [Thu, 9 Aug 2018 09:39:32 +0000 (09:39 +0000)]
Use atomic_fcmpset_XXX() instead of atomic_cmpset_XXX() when possible
in the LinuxKPI.

Suggested by: mjg @
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoFollow up to r333195, add us Macbook/Macbook Pro keyboard support.
Kevin Lo [Thu, 9 Aug 2018 09:06:30 +0000 (09:06 +0000)]
Follow up to r333195, add us Macbook/Macbook Pro keyboard support.
Tested by: rcyu

5 years agoepoch_block_wait: don't check TD_RUNNING
Matt Macy [Thu, 9 Aug 2018 05:18:27 +0000 (05:18 +0000)]
epoch_block_wait: don't check TD_RUNNING

struct epoch_thread is not type safe (stack allocated) and thus cannot be dereferenced from another CPU

Reported by: novel@

5 years agolibi386: Fix typo in pxe.h
Kyle Evans [Thu, 9 Aug 2018 03:45:47 +0000 (03:45 +0000)]
libi386: Fix typo in pxe.h

PR: 207337
Submitted by: Tony Narlock <tony@git-pull.com>
MFC after: 1 week

5 years agolibsa: exit on EOF in ngets
Kyle Evans [Thu, 9 Aug 2018 02:55:48 +0000 (02:55 +0000)]
libsa: exit on EOF in ngets

It was possible in some rare circumstances for ngets to behave terribly with
bhyveload and some form of redirecting user input over a pipe.

PR: 198706
Submitted by: Ivan Krivonos <int0dster@gmail.com>
MFC after: 1 week

5 years agoIn read_zones(), check if the file name actually fit in the buffer
Xin LI [Thu, 9 Aug 2018 02:47:22 +0000 (02:47 +0000)]
In read_zones(), check if the file name actually fit in the buffer
and make sure it would terminate with nul with strlcpy().

Reviewed by: imp (earlier revision)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16595

5 years agoisoboot, gptboot: Fix WITHOUT_LOADER_GELI (gptboot) and isoboot in general
Kyle Evans [Thu, 9 Aug 2018 02:06:25 +0000 (02:06 +0000)]
isoboot, gptboot: Fix WITHOUT_LOADER_GELI (gptboot) and isoboot in general

gptboot was broken when r316078 added the LOADER_GELI_SUPPORT #ifdef to
not pass geliargs via __exec.  KARGS_FLAGS_EXTARG must not be used if we're
not going to pass an additional argument to __exec.

PR: 228151
Submitted by: guyyur@gmail.com
MFC after: 1 week

5 years agokern: Add a BOOT_TAG marker at the beginning of boot dmesg
Kyle Evans [Thu, 9 Aug 2018 01:32:09 +0000 (01:32 +0000)]
kern: Add a BOOT_TAG marker at the beginning of boot dmesg

From the "newly licensed to drive" PR department, add a BOOT_TAG marker (by
default, --<<BOOT>>--, to the beginning of each boot's dmesg. This makes it
easier to do textproc magic to locate the start of each boot and, of
particular interest to some, the dmesg of the current boot.

The PR has a dmesg(8) component as well that I've opted not to include for
the moment- it was the more contentious part of this PR.

bde@ also made the statement that this boot tag should be written with an
ordinary printf, which I've- for the moment- declined to change about this
patch to keep it more transparent to observer of the boot process.

PR: 43434
Submitted by: dak <aurelien.nephtali@wanadoo.fr> (basically rewritten)
MFC after: maybe never

5 years agoFix a typo plus add a couple of sentences to pnfsserver.4.
Rick Macklem [Thu, 9 Aug 2018 00:15:28 +0000 (00:15 +0000)]
Fix a typo plus add a couple of sentences to pnfsserver.4.

This is a content change.

5 years agoTerminate filter_create_ext() args with NULL, not 0.
Brooks Davis [Wed, 8 Aug 2018 22:45:30 +0000 (22:45 +0000)]
Terminate filter_create_ext() args with NULL, not 0.

filter_create_ext() is documented to take a NULL terminated set of
arguments.  0 is promoted to an int so this would fail on 64-bit
systems if the value was not passed in a register.  On all currently
supported 64-bit architectures it is.

Obtained from: CheriBSD
Sponsored by: DARPA, AFRL

5 years agols(1): Enable colors with COLORTERM is set in the environment
Kyle Evans [Wed, 8 Aug 2018 21:51:19 +0000 (21:51 +0000)]
ls(1): Enable colors with COLORTERM is set in the environment

COLORTERM is the de facto standard, while CLICOLOR is generally specific to
FreeBSD and ls(1).

PR: 230101
Submitted by: D Green <dfrg@xsmail.com> (with manpage additions by myself)
Reviewed by: cem ("LGTM" in PR; pre-manpage changes)
MFC after: 1 week

5 years agodd: add status=progress support
Kyle Evans [Wed, 8 Aug 2018 21:37:02 +0000 (21:37 +0000)]
dd: add status=progress support

This reports the current status on a single line every second, mirroring
similar functionality in GNU dd, and carefully interacts with SIGINFO.

PR: 229615
Submitted by: Thomas Hurst <tom@hur.st> (modified for style(9) nits by me)
MFC after: 1 week

5 years agoapply(1): Fix magic number substitution with magic character ' '
Kyle Evans [Wed, 8 Aug 2018 21:21:28 +0000 (21:21 +0000)]
apply(1): Fix magic number substitution with magic character ' '

Using a space as the magic character would result in problems if the command
started with a number:

- For a 'valid' number n, n < size of argv, it would erroneously get
  replaced with that argument; e.g. `apply -a ' ' -d 1rm x => `execxrm x`

- For an 'invalid' number n, n >= size of argv, it would segfault.
  e.g. `apply -a ' ' 2to3 test.py` would try to access argv[2]

This problem occurred because apply(1) would prepend "exec " to the command
string before doing the actual magic number replacements, so it would come
across "exec 2to3 1" and assume that the " 2" is also a magic number to be
replaced.

Re-work this to instead just append "exec " to the command sbuf and
workaround the ugliness. This also simplifies stuff in the process.

PR: 226948
Submitted by: Tobias Stoeckmann <tobias@stoeckmann.org>
MFC after: 1 week

5 years agopowerpc64/powernv: re-read RTC after polling
Breno Leitao [Wed, 8 Aug 2018 21:19:07 +0000 (21:19 +0000)]
powerpc64/powernv: re-read RTC after polling

If OPAL_RTC_READ is busy and does not return the information on the first run,
as returning OPAL_BUSY_EVENT, the system will crash since ymd and hmsm variable
will contain junk values.

This is happening because we were not calling OPAL_RTC_READ again after
OPAL_POLL_EVENTS' return, which would finally replace the old/junk hmsm and ymd
values.

The code was also mixing OPAL_RTC_READ and OPAL_POLL_EVENTS return values.

This patch fix this logic and guarantee that we call OPAL_RTC_READ after
OPAL_POLL_EVENTS return, and guarantee the code will only proceed if
OPAL_RTC_READ returns OPAL_SUCCESS.

Reviewed by: jhibbits
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D16617

5 years agoFix the err() arguments for a nfssvc(8) failure.
Rick Macklem [Wed, 8 Aug 2018 20:30:12 +0000 (20:30 +0000)]
Fix the err() arguments for a nfssvc(8) failure.

argv has been incremented during argument handling, so elements of the
array are no longer valid. Change the err() arguments so only the
first string pointer in argv is used.
Found during code inspection.

5 years agoAssorted fixes to handling of LayoutRecall callbacks, mostly error handling.
Rick Macklem [Wed, 8 Aug 2018 20:21:45 +0000 (20:21 +0000)]
Assorted fixes to handling of LayoutRecall callbacks, mostly error handling.

After a re-read of the appropriate section of RFC5661, I decided that a
few things should be changed related to LayoutRecall callback handling.
Here are the things fixed by this patch.
- For two of the three cases that LayoutRecall is done, I now think
  setting the clora_changed argument false is correct.
- All errors other than NFSERR_DELAY returned by LayoutRecall appear
  permanent, so don't retry for any of them. (NFSERR_DELAY is retried by
  newnfs_request(), so it is not affected by this patch.)
- Instead of waiting "forever" (actually until the process is SIGTERM'd)
  for Layouts to be returned during a mirror copy, fail and return
  ENXIO after about 1minute.
  Waiting for a <ctrl>C made sense when pnfsdscopymr() was done by itself,
  but did not make sense when done via find(1).
This patch only affects the pNFS server.

5 years agoUse the right variable when updating interface routes.
Mark Johnston [Wed, 8 Aug 2018 20:15:40 +0000 (20:15 +0000)]
Use the right variable when updating interface routes.

PR: 229807
Submitted by: John Hay <jhay@meraka.org.za>
MFC after: 2 weeks

5 years agoSwitch the default pager for most commands to less
Alan Somers [Wed, 8 Aug 2018 19:24:20 +0000 (19:24 +0000)]
Switch the default pager for most commands to less

Finally, a pager for the nineties.

MFC after: Never
Relnotes: Yes
Differential Revision: https://reviews.freebsd.org/D13465
Poll: https://reviews.freebsd.org/V7

5 years agoDIRS: Fix duplicate target warnings.
Bryan Drewery [Wed, 8 Aug 2018 19:15:48 +0000 (19:15 +0000)]
DIRS: Fix duplicate target warnings.

5 years agoDIRS: Ensure existing directory still has permissions set.
Bryan Drewery [Wed, 8 Aug 2018 19:15:45 +0000 (19:15 +0000)]
DIRS: Ensure existing directory still has permissions set.

5 years agoBring VOP_LOOKUP(9) up to date
Alan Somers [Wed, 8 Aug 2018 18:50:42 +0000 (18:50 +0000)]
Bring VOP_LOOKUP(9) up to date

* Remove the cn_hash field (removed by r51906)
* Add the cn_lkflags field (added by r144285)
* Remove duplicate definition of cnp.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16629

5 years agoUse host byte order when comparing mss values.
Andrey V. Elsukov [Wed, 8 Aug 2018 17:32:02 +0000 (17:32 +0000)]
Use host byte order when comparing mss values.

This fixes tcp-setmss action on little endian machines.

PR: 225536
Submitted by: John Zielinski

5 years agoSimplify compression code.
Mark Johnston [Wed, 8 Aug 2018 17:26:51 +0000 (17:26 +0000)]
Simplify compression code.

- Remove the compression suffix macros and move them directly into the
  compress_type array.
- Remove the hardcoded sizes on the suffix and compression args arrays.
- Simplify the compression args arrays at the expense of a __DECONST
  when calling execv().
- Rewrite do_zipwork.  The COMPRESS_* macros can directly index the
  compress_types array, so the outer loop is not needed. Convert
  fixed-length strings into asprintf or sbuf calls.

Submitted by: Dan Nelson <dnelson_1901@yahoo.com>
Reviewed by: gad
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16518

5 years agoAdd support for pmap_enter(..., psind=1) to the armv6 pmap. In other words,
Alan Cox [Wed, 8 Aug 2018 16:55:01 +0000 (16:55 +0000)]
Add support for pmap_enter(..., psind=1) to the armv6 pmap.  In other words,
add support for explicitly requesting that pmap_enter() create a 1 MB page
mapping.  (Essentially, this feature allows the machine-independent layer
to create superpage mappings preemptively, and not wait for automatic
promotion to occur.)

Export pmap_ps_enabled() to the machine-independent layer.

Add a flag to pmap_pv_insert_pte1() that specifies whether it should fail
or reclaim a PV entry when one is not available.

Refactor pmap_enter_pte1() into two functions, one by the same name, that
is a general-purpose function for creating pte1 mappings, and another,
pmap_enter_1mpage(), that is used to prefault 1 MB read- and/or execute-
only mappings for execve(2), mmap(2), and shmat(2).

In addition, as an optimization to pmap_enter(..., psind=0), eliminate the
use of pte2_is_managed() from pmap_enter().  Unlike the x86 pmap
implementations, armv6 does not have a managed bit defined within the PTE.
So, pte2_is_managed() is actually a call to PHYS_TO_VM_PAGE(), which is O(n)
in the number of vm_phys_segs[].  All but one call to PHYS_TO_VM_PAGE() in
pmap_enter() can be avoided.

Reviewed by: kib, markj, mmel
Tested by: mmel
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D16555

5 years agoImplement uma_small_alloc(), uma_small_free().
Ruslan Bukin [Wed, 8 Aug 2018 16:08:38 +0000 (16:08 +0000)]
Implement uma_small_alloc(), uma_small_free().

Reviewed by: markj
Obtained from: arm64
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16628

5 years agoFix printf(1) ignores width and precision in %b format.
Pedro F. Giffuni [Wed, 8 Aug 2018 15:25:01 +0000 (15:25 +0000)]
Fix printf(1) ignores width and precision in %b format.

The precision with the conversion specifier b is specified by POSIX: see
point 7 in the reference documentation.

This corrects previous wrong log in r337440.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

PR: 229641
Reported by: Rudolf Cejka
Submitted by: Garrett D'Amore (illumos)
MFC after: 1 week

5 years agoRevert r337440: the log message is wrong.
Pedro F. Giffuni [Wed, 8 Aug 2018 15:12:32 +0000 (15:12 +0000)]
Revert r337440: the log message is wrong.

5 years agomsdosfs: fixes for Undefined Behavior.
Pedro F. Giffuni [Wed, 8 Aug 2018 15:08:22 +0000 (15:08 +0000)]
msdosfs: fixes for Undefined Behavior.

These were found by the Undefined Behaviour GsoC project at NetBSD:

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'

Detected with micro-UBSan in the user mode.

Hinted from: NetBSD (CVS 1.33)
MFC after: 2 weeks
Differenctial Revision: https://reviews.freebsd.org/D16615

5 years agoFix a small bug in rack where it will
Randall Stewart [Wed, 8 Aug 2018 13:36:49 +0000 (13:36 +0000)]
Fix a small bug in rack where it will
end up sending the FIN twice.
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D16604

5 years agoSplit the dir_index and dir_nlink features.
Fedor Uporov [Wed, 8 Aug 2018 12:08:46 +0000 (12:08 +0000)]
Split the dir_index and dir_nlink features.

Do not allow to create more that EXT4_LINK_MAX links to directory in case
if the dir_nlink is not set, like it is done in the fresh e2fsprogs updates.

MFC after:      3 months

5 years agoFix directory blocks checksum updating logic.
Fedor Uporov [Wed, 8 Aug 2018 12:07:45 +0000 (12:07 +0000)]
Fix directory blocks checksum updating logic.

The checksum updating functions were not called in case of dir index inode splitting
and in case of dir entry removing, when the entry was first in the block.
Fix and move the dir entry adding logic when i_count == 0 to new function.

MFC after:      3 months

5 years agobuild: skip the database check for the distributeworld target
Roger Pau Monné [Wed, 8 Aug 2018 07:58:29 +0000 (07:58 +0000)]
build: skip the database check for the distributeworld target

distributeworld is used to generate install media, so it makes no
sense to check the host database since the install media can be
generated from any box, regardless of the version of FreeBSD it's
running.

Sponsored by: Citrix Systems R&D
Reviewed by: ian, gjb
Differential revision: https://reviews.freebsd.org/D16507

5 years agotop(1): hide THR column in separate-thread mode.
Eitan Adler [Wed, 8 Aug 2018 06:31:46 +0000 (06:31 +0000)]
top(1): hide THR column in separate-thread mode.

It does not make sense to show a "thread count" column when displaying
threads separately. In fact we don't, but do show the header for this
column. Fix this.

5 years agoFUSE: Remove some set-but-not-used variables
Conrad Meyer [Wed, 8 Aug 2018 04:46:03 +0000 (04:46 +0000)]
FUSE: Remove some set-but-not-used variables

No functional change.

5 years agoDefer and aggregate swap_pager_meta_build frees.
Alan Cox [Wed, 8 Aug 2018 02:30:34 +0000 (02:30 +0000)]
Defer and aggregate swap_pager_meta_build frees.

Before swp_pager_meta_build replaces an old swapblk with an new one,
it frees the old one.  To allow such freeing of blocks to be
aggregated, have swp_pager_meta_build return the old swap block, and
make the caller responsible for freeing it.

Define a pair of short static functions, swp_pager_init_freerange and
swp_pager_update_freerange, to do the initialization and updating of
blk addresses and counters used in aggregating blocks to be freed.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: kib, markj (an earlier version)
Tested by: pho
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13707

5 years agofile: update to 5.34
Eitan Adler [Wed, 8 Aug 2018 01:33:36 +0000 (01:33 +0000)]
file: update to 5.34

PR: 230141
exp-run by: antoine

5 years ago- Fix hash calculation by MAC address
Kevin Lo [Wed, 8 Aug 2018 01:20:02 +0000 (01:20 +0000)]
- Fix hash calculation by MAC address
- Since rx_cmd_c is an uint16_t, use le16toh() instead of le32toh()

Reviewed by: emaste

5 years agoFix printf(1) ignores width and precision in %b format.
Pedro F. Giffuni [Tue, 7 Aug 2018 23:03:50 +0000 (23:03 +0000)]
Fix printf(1) ignores width and precision in %b format.

The precision with behavior is "unspecified" by POSIX (as of 2018), but
most implementations seem to have taken it to be treated the same as for
"s"; applied after the unescaping.
Adopt the same treatment on our printf.

PR: 229641
Submitted by: Garrett D'Amore (illumos)

5 years agocxgbe(4): Allow the driver to specify a burst size when configuring a
Navdeep Parhar [Tue, 7 Aug 2018 22:13:03 +0000 (22:13 +0000)]
cxgbe(4): Allow the driver to specify a burst size when configuring a
traffic class for rate limiting.

Add experimental knobs that allow the user to specify a default pktsize
and burstsize for traffic classes associated with a port:

dev.<ifname>.<instance>.tc.pktsize
dev.<ifname>.<instance>.tc.burstsize

Sponsored by: Chelsio Communications

5 years agoAllow newnfs_request() to retry all callback RPCs with an NFSERR_DELAY reply.
Rick Macklem [Tue, 7 Aug 2018 21:29:14 +0000 (21:29 +0000)]
Allow newnfs_request() to retry all callback RPCs with an NFSERR_DELAY reply.

The code in newnfs_request() retries RPCs that get a reply of NFSERR_DELAY,
but exempts certain NFSv4 operations. However, for callback RPCs, there
should not be any exemptions at this time. The code would have erroneously
exempted the CBRECALL callback, since it has the same operation number as
the CLOSE operation.
This patch fixes this by checking for a callback RPC (indicated by clp != NULL)
and not checking for exempt operations for callbacks.
This would have only affected the NFSv4 server when delegations are enabled
(they are not enabled by default) and the client replies to CBRECALL with
NFSERR_DELAY. This may never actually happen.
Spotted during code inspection.

MFC after: 2 weeks

5 years agoWhen getting mount information for all filesystems, mount uses the
Kirk McKusick [Tue, 7 Aug 2018 21:17:45 +0000 (21:17 +0000)]
When getting mount information for all filesystems, mount uses the
getfsstat(2) system call using the MNT_NOWAIT flag to indicate that
it wants to use the statfs information cached in the mount structure.
When the -v (verbose) flag is specified, we need to use the MNT_WAIT
flag to getfsstat(2) so that kernel will call VFS_STATFS to get the
current statfs statistics from each filesystem.

Sponsored by: Netflix

5 years agoFollowup to r337430: only call elf_reloc_ifunc on x86.
Konstantin Belousov [Tue, 7 Aug 2018 20:43:50 +0000 (20:43 +0000)]
Followup to r337430: only call elf_reloc_ifunc on x86.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoMove description of init_shell, init_script, and init_chroot kenv
Edward Tomasz Napierala [Tue, 7 Aug 2018 19:23:03 +0000 (19:23 +0000)]
Move description of init_shell, init_script, and init_chroot kenv
tunables from loader(8) to init(8), since it's init that actually
uses them.  Add .Xrs at their old place.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUpdate the list of architectures having atomic_fcmpset_{8,16,64}(9) and
Marius Strobl [Tue, 7 Aug 2018 18:59:02 +0000 (18:59 +0000)]
Update the list of architectures having atomic_fcmpset_{8,16,64}(9) and
atomic_swap_{64,int}(9) respectively as of r337433.

5 years agoImplement atomic_swap_{int,long,ptr}(9).
Marius Strobl [Tue, 7 Aug 2018 18:56:51 +0000 (18:56 +0000)]
Implement atomic_swap_{int,long,ptr}(9).

5 years agoImplement atomic_swap_64(9).
Marius Strobl [Tue, 7 Aug 2018 18:56:01 +0000 (18:56 +0000)]
Implement atomic_swap_64(9).

5 years agoFutex support functions in linux.ko and linux32.ko on amd64 should be
Konstantin Belousov [Tue, 7 Aug 2018 18:29:10 +0000 (18:29 +0000)]
Futex support functions in linux.ko and linux32.ko on amd64 should be
aware of SMAP.

Reported and tested by: Johannes Lundberg <johalun0@gmail.com>, wulf
Sponsored by: The FreeBSD Foundation

5 years agoAdd missed handling of local relocs against ifunc target in the obj modules.
Konstantin Belousov [Tue, 7 Aug 2018 18:26:46 +0000 (18:26 +0000)]
Add missed handling of local relocs against ifunc target in the obj modules.

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

5 years agoifconfig: Fix use of _Noreturn.
Mark Johnston [Tue, 7 Aug 2018 17:25:38 +0000 (17:25 +0000)]
ifconfig: Fix use of _Noreturn.

The _Noreturn is a function-specifier (like inline) which must preceed
the declarator.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

5 years agoRecognize ICS1893C PHYs.
Mark Johnston [Tue, 7 Aug 2018 17:13:42 +0000 (17:13 +0000)]
Recognize ICS1893C PHYs.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

5 years agoUpdate PR 131876 regression tests after r337423.
Mark Johnston [Tue, 7 Aug 2018 16:39:07 +0000 (16:39 +0000)]
Update PR 131876 regression tests after r337423.

- Add some more cases to the truncation test.
- Remove the "expect fail" annotations.

PR: 131876
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16562

5 years agoImprove handling of control message truncation.
Mark Johnston [Tue, 7 Aug 2018 16:36:48 +0000 (16:36 +0000)]
Improve handling of control message truncation.

If a recvmsg(2) or recvmmsg(2) caller doesn't provide sufficient space
for all control messages, the kernel sets MSG_CTRUNC in the message
flags to indicate truncation of the control messages.  In the case
of SCM_RIGHTS messages, however, we were failing to dispose of the
rights that had already been externalized into the recipient's file
descriptor table.  Add a new function and mbuf type to handle this
cleanup task, and use it any time we fail to copy control messages
out to the recipient.  To simplify cleanup, control message truncation
is now only performed at control message boundaries.

The change also fixes a few related bugs:
- Rights could be leaked to the recipient process if an error occurred
  while copying out a message's contents.
- We failed to set MSG_CTRUNC if the truncation occurred on a control
  message boundary, e.g., if the caller received two control messages
  and provided only the exact amount of buffer space needed for the
  first.

PR: 131876
Reviewed by: ed (previous version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16561

5 years agolibc: fix cases of undefined behavior.
Pedro F. Giffuni [Tue, 7 Aug 2018 15:24:19 +0000 (15:24 +0000)]
libc: fix cases of undefined behavior.

These were found by the Undefined Behavious  GsoC project at NetBSD:

Avoid undefined behavior in ftok(3)

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

ftok.c:56:10, left shift of 123456789 by 24 places cannot be represented
in type 'int'
ftok.c:56:10, left shift of 4160 by 24 places cannot be represented in
type 'int'

Avoid undefined behavior in an inet_addr.c

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

inet_addr.c:218:20, left shift of 131 by 24 places cannot be represented
in type 'int'

Detected with micro-UBSan in the user mode.

Obtained from: NetBSD
MFC after: 2 weeks

5 years agosed(1): partial fix for the case of the regex delimited with '['.
Pedro F. Giffuni [Tue, 7 Aug 2018 14:47:39 +0000 (14:47 +0000)]
sed(1): partial fix for the case of the regex delimited with '['.

We don't generally support the weird case of regular expresions delimited
by an opening square bracket ('[') but POSIX says that inside
bracket expressions, escaping is not possible and both '[' and '\'
represent themselves.

PR: 230198 (exp-run)
Obtained from: OpenBSD

5 years agodhclient: Enter capability mode before dropping privileges.
Mark Johnston [Tue, 7 Aug 2018 13:50:21 +0000 (13:50 +0000)]
dhclient: Enter capability mode before dropping privileges.

This is needed to be able to chroot in the fallback case where
Capsicum is not available.

Reported by: Daniel Braniss <danny@cs.huji.ac.il>
X-MFC with: r337382
Sponsored by: The FreeBSD Foundation

5 years agolibsa: gzipfs.c converts pointers to integer types with different sign
Toomas Soome [Tue, 7 Aug 2018 10:53:51 +0000 (10:53 +0000)]
libsa: gzipfs.c converts pointers to integer types with different sign

Signed versus unsigned char.

5 years agolibsa: dos_checksum() should take unsigned chars
Toomas Soome [Tue, 7 Aug 2018 10:48:36 +0000 (10:48 +0000)]
libsa: dos_checksum() should take unsigned chars

Fix pointers to integers with different sign issue.

5 years agoReplace a pair of 8-bit writes to VGA memory with a single 16-bit write.
Colin Percival [Tue, 7 Aug 2018 08:33:40 +0000 (08:33 +0000)]
Replace a pair of 8-bit writes to VGA memory with a single 16-bit write.

The VGA "text mode" buffer has a pair of bytes for each character: One
byte for the character symbol, and an "attribute" byte encoding the
foreground and background colours.  When updating the screen, we were
writing these two bytes separately.

On some virtualized systems, every write results in a glyph being redrawn
into a (graphical) virtual screen; writing these two bytes separately
results in twice as much work being done to draw characters, whereas if
we perform a single 16-bit write instead, the character only needs to be
redrawn once.

On an EC2 c5.4xlarge instance, this change cuts 1.30s from the kernel boot,
speeding it up from 8.90s to 7.60s.

MFC after: 1 week

5 years agoRemove redundant and incorrect default definition of AF_INET6. AF_INET6
Cy Schubert [Tue, 7 Aug 2018 07:12:59 +0000 (07:12 +0000)]
Remove redundant and incorrect default definition of AF_INET6. AF_INET6
is defined in sys/socket.h where it's defined as 28.

A bit of trivia: On NetBSD AF_INET6 is defined as 24. On Solaris it is
defined as 26. This is probably why Darren defaulted to 26, because
ipfilter was originally written for SunOS 4 and Solaris many moons ago.

MFC after: 2 weeks

5 years agoFix copy-and-paste error in previous commit.
Colin Percival [Tue, 7 Aug 2018 00:51:49 +0000 (00:51 +0000)]
Fix copy-and-paste error in previous commit.

5 years agoRemove spurious ABI tags from kdump output.
John Baldwin [Tue, 7 Aug 2018 00:10:58 +0000 (00:10 +0000)]
Remove spurious ABI tags from kdump output.

The abidump routine output an ABI tag when -A was specified for records
that were not displayed due to type or pid filtering.  To fix, split
the code to lookup the ABI from the code to display the ABI, move the
code to display the ABI into dumpheader(), and move dumpheader() later
in the main loop as a simplification.  Previously dumpheader() was
called under a condition that repeated conditions made later in the
main loop.

Reviewed by: kib
MFC after: 1 month
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D16608

5 years agoMake the system C11 atomics headers fully compatible with external GCC.
John Baldwin [Mon, 6 Aug 2018 23:51:08 +0000 (23:51 +0000)]
Make the system C11 atomics headers fully compatible with external GCC.

The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure.  This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile.  Fix this by not hiding atomic variables
in a structure for modern versions of GCC.  The headers already avoid
using a wrapper structure on clang.

Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.

Reported by: Mark Millard
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16585

5 years agocxgbe(4): Allow user-configured and driver-configured traffic classes to
Navdeep Parhar [Mon, 6 Aug 2018 23:21:13 +0000 (23:21 +0000)]
cxgbe(4): Allow user-configured and driver-configured traffic classes to
be used simultaneously.  Move sysctl_tc and sysctl_tc_params to
t4_sched.c while here.

MFC after: 3 weeks
Sponsored by: Chelsio Communications

5 years agocxgbe(4): Break up sysctl_bitfield into 8 bit and 16 bit variants. Have
Navdeep Parhar [Mon, 6 Aug 2018 21:54:51 +0000 (21:54 +0000)]
cxgbe(4): Break up sysctl_bitfield into 8 bit and 16 bit variants.  Have
them display the current value of the bitfield rather than the fixed
value that was provided when the sysctl node was created.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoPut in place the framework for consolodating contiguous blocks into
Kirk McKusick [Mon, 6 Aug 2018 21:09:11 +0000 (21:09 +0000)]
Put in place the framework for consolodating contiguous blocks into
a smaller number of larger TRIM requests. The hope had been to have
the full TRIM consolodation in place for 12.0, but the algorithms
are still under development and need further testing. With this
framework in place it will be possible to easily add TRIM consolodation
once the optimal strategy has been found.

The only functional change with this patch is the elimination of TRIM
requests for blocks that are freed before they have been likely to
have been written.

Reviewed by: kib
Discussed with: Warner Losh and Chuck Silvers
Sponsored by: Netflix

5 years agoAdd EC2PUBLICSNAP option to EC2 builds; this passes a (recently added)
Colin Percival [Mon, 6 Aug 2018 19:21:32 +0000 (19:21 +0000)]
Add EC2PUBLICSNAP option to EC2 builds; this passes a (recently added)
flag to bsdec2-image-upload instructing it to mark the snapshot of its
root disk as public (which is independent from marking the created AMIs
as public).

Requested by: Amazon

5 years agoFix typo in cxgbe/t4_tom.
Navdeep Parhar [Mon, 6 Aug 2018 19:09:55 +0000 (19:09 +0000)]
Fix typo in cxgbe/t4_tom.

5 years agoBump date after r337384.
Jonathan T. Looney [Mon, 6 Aug 2018 18:42:37 +0000 (18:42 +0000)]
Bump date after r337384.

Reported by: bz

5 years agoAddress concerns about CPU usage while doing TCP reassembly.
Jonathan T. Looney [Mon, 6 Aug 2018 17:36:57 +0000 (17:36 +0000)]
Address concerns about CPU usage while doing TCP reassembly.

Currently, the per-queue limit is a function of the receive buffer
size and the MSS.  In certain cases (such as connections with large
receive buffers), the per-queue segment limit can be quite large.
Because we process segments as a linked list, large queues may not
perform acceptably.

The better long-term solution is to make the queue more efficient.
But, in the short-term, we can provide a way for a system
administrator to set the maximum queue size.

We set the default queue limit to 100.  This is an effort to balance
performance with a sane resource limit.  Depending on their
environment, goals, etc., an administrator may choose to modify this
limit in either direction.

Reviewed by: jhb
Approved by: so
Security: FreeBSD-SA-18:08.tcp
Security: CVE-2018-6922

5 years agorelease: arm: Copy the dtb to the fat partition
Emmanuel Vadot [Mon, 6 Aug 2018 17:21:20 +0000 (17:21 +0000)]
release: arm: Copy the dtb to the fat partition

When booting via EFI on arm we have no way to know the dtb file to load
and we always use the one provided from the bootloader.
This works in most case but :

 U-Boot have some really old DTB for some boards, the sync from Linux isn't done automatically for all boards
 Some boards (like TI BeagleBone series) use one u-boot for all the model and it doesn't embed the DTBs
 Some boards (like IMX6 based ones), don't embed the DTB

We want u-boot to load and patch the DTB with the mac address or the display
node enabled or not.

Reviewed by: gjb, imp
Differential Revision: https://reviews.freebsd.org/D16596

5 years agodhclient: Don't chroot if we are in capability mode.
Mark Johnston [Mon, 6 Aug 2018 16:22:01 +0000 (16:22 +0000)]
dhclient: Don't chroot if we are in capability mode.

The main dhclient process is Capsicumized but also chroots to
restrict filesystem access.  With r322369, pidfile(3) maintains a
directory descriptor for the pidfile, which can cause the chroot
to fail in certain cases.  To minimize the problem, only chroot
if we fail to enter capability mode, and store dhclient pidfiles
in a subdirectory of /var/run, thus restricting access via
pidfile(3)'s directory descriptor.

PR: 223327
Reviewed by: cem, oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16584

5 years agoIncrease timeout for timedmutex_test:mutex2, timedmutex_test:mutex3
Ruslan Bukin [Mon, 6 Aug 2018 15:55:58 +0000 (15:55 +0000)]
Increase timeout for timedmutex_test:mutex2, timedmutex_test:mutex3
tests.

Default value is 300. It takes ~310s to complete each of these tests
in QEMU/RISC-V.

Sponsored by: DARPA, AFRL

5 years agoDefault to armv5te in LINT on arm. This should fix building LINT there.
Andrew Turner [Mon, 6 Aug 2018 14:40:45 +0000 (14:40 +0000)]
Default to armv5te in LINT on arm. This should fix building LINT there.

5 years agoFix "mandoc -Tlint" warnings.
Mateusz Piotrowski [Mon, 6 Aug 2018 11:45:28 +0000 (11:45 +0000)]
Fix "mandoc -Tlint" warnings.

Reviewed by: bcr
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D15580

5 years agoFix synopsis of the -t option.
Mateusz Piotrowski [Mon, 6 Aug 2018 11:38:55 +0000 (11:38 +0000)]
Fix synopsis of the -t option.

While here:

 - Remove deprecated ".Tn" macros.
 - Improve formatting and fix typos in the description of
   the -t option.

Reviewed by: bcr
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D16541