]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agobsdgrep(1): various fixes of empty pattern/exit code/-c behavior
Kyle Evans [Wed, 25 Sep 2019 17:14:43 +0000 (17:14 +0000)]
bsdgrep(1): various fixes of empty pattern/exit code/-c behavior

When an empty pattern is encountered in the pattern list, I had previously
broken bsdgrep to count that as a "match all" and ignore any other patterns
in the list. This commit rectifies that mistake, among others:

- The -v flag semantics were not quite right; lines matched should have been
  counted differently based on whether the -v flag was set or not. procline
  now definitively returns whether it's matched or not, and interpreting
  that result has been kicked up a level.
- Empty patterns with the -x flag was broken similarly to empty patterns
  with the -w flag. The former is a whole-line match and should be more
  strict, only matching blank lines. No -x and no -w will will match the
  empty string at the beginning of each line.
- The exit code with -L was broken, w.r.t. modern grep. Modern grap will
  exit(0) if any file that didn't match was output, so our interpretation
  was simply backwards. The new interpretation makes sense to me.

Tests updated and added to try and catch some of this.

This misbehavior was found by autoconf while fixing ports found in PR 229925
expecting either a more sane or a more GNU-like sed.

MFC after: 1 week

4 years agoAdd some counters for per-VM page events.
Mark Johnston [Wed, 25 Sep 2019 17:08:35 +0000 (17:08 +0000)]
Add some counters for per-VM page events.

For now, just count batched page queue state operations.
vm.stats.page.queue_ops counts the number of batch entries that
successfully completed, while queue_nops counts entries that had no
effect, which occurs when the queue operation had been completed before
the batch entry was processed.

Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: Intel, Netflix
Differential Revision: https://reviews.freebsd.org/D21782

4 years agoremove obsolete i386 MD memchr implementation
Ed Maste [Wed, 25 Sep 2019 16:49:22 +0000 (16:49 +0000)]
remove obsolete i386 MD memchr implementation

bde reports (in a reply to r351700 commit mail):
    This uses scasb, which was last optimal on the 8086, or perhaps the
    original i386.  On freefall, it is several times slower than the
    naive translation of the naive C code.

Reported by: bde
Reviewed by: kib, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21785

4 years agoComplete the removal of the "wire_count" field from struct vm_page.
Mark Johnston [Wed, 25 Sep 2019 16:11:35 +0000 (16:11 +0000)]
Complete the removal of the "wire_count" field from struct vm_page.

Convert all remaining references to that field to "ref_count" and update
comments accordingly.  No functional change intended.

Reviewed by: alc, kib
Sponsored by: Intel, Netflix
Differential Revision: https://reviews.freebsd.org/D21768

4 years agox86: Fall back to leaf 0x16 if TSC frequency is obtained by CPUID and
Konstantin Belousov [Wed, 25 Sep 2019 13:36:56 +0000 (13:36 +0000)]
x86: Fall back to leaf 0x16 if TSC frequency is obtained by CPUID and
leaf 0x15 is not functional.

This should improve automatic TSC frequency determination on
Skylake/Kabylake/... families, where 0x15 exists but does not provide
all necessary information.  SDM contains relatively strong wording
against such uses of 0x16, but Intel does not give us any other way to
obtain the frequency. Linux did the same in the commit
604dc9170f2435d27da5039a3efd757dceadc684.

Based on submission by: Neel Chauhan <neel@neelc.org>
PR: 240475
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21777

4 years agovt: use colors from terminal emulator
Toomas Soome [Wed, 25 Sep 2019 13:24:31 +0000 (13:24 +0000)]
vt: use colors from terminal emulator

Instead of hardcoded colors, use terminal state. This also means,
we need to record the pointer to terminal state with vtbuf.

4 years agokernel: terminal_init() should check for teken colors from kenv
Toomas Soome [Wed, 25 Sep 2019 13:21:07 +0000 (13:21 +0000)]
kernel: terminal_init() should check for teken colors from kenv

Check for teken.fg_color and teken.bg_color and prepare the color
attributes accordingly.

When white background is used, make it light to improve visibility.
When black background is used, make kernel messages light.

4 years agoRELNOTES: Document r352668 (crontab -n and -q options)
Kyle Evans [Wed, 25 Sep 2019 13:04:34 +0000 (13:04 +0000)]
RELNOTES: Document r352668 (crontab -n and -q options)

Suggested by: bapt

4 years agoFix wrong assertion in r352658.
Alexander Motin [Wed, 25 Sep 2019 11:58:54 +0000 (11:58 +0000)]
Fix wrong assertion in r352658.

MFC after: 1 month

4 years agoSize is unsigned, so remove the test entirely.
Warner Losh [Wed, 25 Sep 2019 07:51:30 +0000 (07:51 +0000)]
Size is unsigned, so remove the test entirely.

The kernel won't crash if you have a bad value and I'd rather not have
nvmecontrol know the internal details about how the nvme driver limits
the transfer size.

4 years agoloader: fix indentation in efi_console and vidconsole
Toomas Soome [Wed, 25 Sep 2019 07:36:35 +0000 (07:36 +0000)]
loader: fix indentation in efi_console and vidconsole

Remove extra tab.

Reported by: yuripv

4 years agoloader: add teken.fg_color and teken.bg_color variables
Toomas Soome [Wed, 25 Sep 2019 07:09:25 +0000 (07:09 +0000)]
loader: add teken.fg_color and teken.bg_color variables

Add settable variables to control teken default color attributes.
The supported colors are 0-7 or basic color names:
black, red, green, brown, blue, magenta, cyan, white.

The current implementation does add some duplication which will be addressed
later.

4 years agocron: add log suppression and mail suppression for successful runs
Kyle Evans [Wed, 25 Sep 2019 02:37:40 +0000 (02:37 +0000)]
cron: add log suppression and mail suppression for successful runs

This commit adds two new extensions to crontab, ported from OpenBSD:
- -n: suppress mail on succesful run
- -q: suppress logging of command execution

The -q option appears decades old, but -n is relatively new. The
original proposal by Job Snijder can be found here [1], and gives very
convincing reasons for inclusion in base.

This patch is a nearly identical port of OpenBSD cron for -q and -n
features. It is written to follow existing conventions and style of the
existing codebase.

Example usage:

# should only send email, but won't show up in log
* * * * * -q date

# should not send email
* * * * * -n date

# should not send email or log
* * * * * -n -q date

# should send email because of ping failure
* * * * * -n -q ping -c 1 5.5.5.5

[1]: https://marc.info/?l=openbsd-tech&m=152874866117948&w=2

PR: 237538
Submitted by: Naveen Nathan <freebsd_t.lastninja.net>
Reviewed by: bcr (manpages)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D20046

4 years agopowerpc/atomic: Follow recommendations on atomic primitive comparisons
Justin Hibbits [Wed, 25 Sep 2019 01:39:58 +0000 (01:39 +0000)]
powerpc/atomic: Follow recommendations on atomic primitive comparisons

Both IBM and Freescale programming examples presume the cmpset operands will
favor equal, and pessimize the non-equal case instead.  Do the same for
atomic_cmpset_* and atomic_fcmpset_*.  This slightly pessimizes the failure
case, in favor of the success case.

MFC after: 3 weeks

4 years agopowerpc: Allocate DPCPU block from domain-local memory
Justin Hibbits [Wed, 25 Sep 2019 01:23:08 +0000 (01:23 +0000)]
powerpc: Allocate DPCPU block from domain-local memory

This should improve NUMA scalability a little, by binding to the CPU's NUMA
domain.  This matches what's done on amd64.

4 years agoAfter my comnd changes, the number of threads and size weren't set. In
Warner Losh [Wed, 25 Sep 2019 00:24:57 +0000 (00:24 +0000)]
After my comnd changes, the number of threads and size weren't set. In
addition, the flags are optional, but were made to be mandatory. Set
these things, as well as santiy check the specified size.

Submitted by: Stefan Rink
PR: 240798

4 years agoReplace all mtx_lock()/mtx_unlock() on the iod lock with macros.
Rick Macklem [Tue, 24 Sep 2019 23:38:10 +0000 (23:38 +0000)]
Replace all mtx_lock()/mtx_unlock() on the iod lock with macros.

Since the NFS node mutex needs to change to an sx lock so it can be held when
vnode_pager_setsize() is called and the iod lock is held when the NFS node lock
is acquired, the iod mutex will need to be changed to an sx lock as well.
To simply the future commit that changes both the NFS node lock and iod lock
to sx locks, this commit replaces all mtx_lock()/mtx_unlock() calls on the
iod lock with macros.
There is no semantic change as a result of this commit.

I don't know when the future commit will happen and be MFC'd, so I have
set the MFC on this commit to one week so that it can be MFC'd at the same
time.

Suggested by: kib
MFC after: 1 week

4 years agoFix white spaces.
Jung-uk Kim [Tue, 24 Sep 2019 21:41:19 +0000 (21:41 +0000)]
Fix white spaces.

4 years agofreebsd-update: Add `updatesready' and `showconfig' commands
Michael Gmelin [Tue, 24 Sep 2019 20:49:33 +0000 (20:49 +0000)]
freebsd-update: Add `updatesready' and `showconfig' commands

`freebsd-update updatesready' can be used to check if there are any pending
fetched updates that can be installed.

`freebsd-update showconfig' writes freebsd-update's configuration to
stdout.

This also changes the exit code of `freebsd-update install' to 2 in case
there are no updates pending to be installed and there wasn't a fetch phase
in the same invocation. This allows scripts to tell apart these error
conditions without breaking existing jail managers.

See freebsd-update(8) for details.

PR: 240757, 240177, 229346
Reviewed by: manpages (bcr), sectam (emaste), yuripv
Differential Revision: https://reviews.freebsd.org/D21473

4 years agolets put (void) in a couple of functions to keep older platforms that
Randall Stewart [Tue, 24 Sep 2019 20:36:43 +0000 (20:36 +0000)]
lets put (void) in a couple of functions to keep older platforms that
are stuck with gcc happy (ppc). The changes are needed in both bbr and
rack.

Obtained from: Michael Tuexen (mtuexen@)

4 years agodon't call in_ratelmit detach when RATELIMIT is not
Randall Stewart [Tue, 24 Sep 2019 20:11:55 +0000 (20:11 +0000)]
don't call in_ratelmit detach when RATELIMIT is not
compiled in the kernel.

4 years agoFix the ifdefs in tcp_ratelimit.h. They were reversed so
Randall Stewart [Tue, 24 Sep 2019 20:04:31 +0000 (20:04 +0000)]
Fix the ifdefs in tcp_ratelimit.h. They were reversed so
that instead of functions only being inside the _KERNEL and
the absence of RATELIMIT causing us to have NULL/error returning
interfaces we ended up with non-kernel getting the error path.
opps..

4 years agoFix/improve interrupt threads scheduling.
Alexander Motin [Tue, 24 Sep 2019 20:01:20 +0000 (20:01 +0000)]
Fix/improve interrupt threads scheduling.

Doing some tests with very high interrupt rates I've noticed that one of
conditions I added in r232207 to make interrupt threads in most cases
run on local CPU never worked as expected (worked only if previous time
it was executed on some other CPU, that is quite opposite).  It caused
additional CPU usage to run full CPU search and could schedule interrupt
threads to some other CPU.

This patch removes that code and instead reuses existing non-interrupt
code path with some tweaks for interrupt case:
 - On SMT systems, if current thread is idle, don't look on other threads.
Even if they are busy, it may take more time to do fill search and bounce
the interrupt thread to other core then execute it locally, even sharing
CPU resources.  It is other threads should migrate, not bound interrupts.
 - Try hard to keep interrupt threads within LLC of their original CPU.
This improves scheduling cost and supposedly cache and memory locality.

On a test system with 72 threads doing 2.2M IOPS to NVMe this saves few
percents of CPU time while adding few percents to IOPS.

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

4 years agoThis commit adds BBR (Bottleneck Bandwidth and RTT) congestion control. This
Randall Stewart [Tue, 24 Sep 2019 18:18:11 +0000 (18:18 +0000)]
This commit adds BBR (Bottleneck Bandwidth and RTT) congestion control. This
is a completely separate TCP stack (tcp_bbr.ko) that will be built only if
you add the make options WITH_EXTRA_TCP_STACKS=1 and also include the option
TCPHPTS. You can also include the RATELIMIT option if you have a NIC interface that
supports hardware pacing, BBR understands how to use such a feature.

Note that this commit also adds in a general purpose time-filter which
allows you to have a min-filter or max-filter. A filter allows you to
have a low (or high) value for some period of time and degrade slowly
to another value has time passes. You can find out the details of
BBR by looking at the original paper at:

https://queue.acm.org/detail.cfm?id=3022184

or consult many other web resources you can find on the web
referenced by "BBR congestion control". It should be noted that
BBRv1 (which this is) does tend to unfairness in cases of small
buffered paths, and it will usually get less bandwidth in the case
of large BDP paths(when competing with new-reno or cubic flows). BBR
is still an active research area and we do plan on  implementing V2
of BBR to see if it is an improvement over V1.

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

4 years agoix, ixv: Read msix_bar from device configuration
Eric Joyner [Tue, 24 Sep 2019 17:06:32 +0000 (17:06 +0000)]
ix, ixv: Read msix_bar from device configuration

Instead of predicting the MSI-X bar index based on the device's MAC
type, read it from the device's PCI configuration instead.

PR: 239704
Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21547

4 years agoiflib: Remove redundant VLAN events deregistration
Eric Joyner [Tue, 24 Sep 2019 17:03:31 +0000 (17:03 +0000)]
iflib: Remove redundant VLAN events deregistration

From Piotr:
r351152 introduced iflib_deregister() function calling
EVENTHANDLER_DEREGISTER() to unregister VLAN events. This patch removes
duplicate of EVENTHANDLER_DEREGISTER() calls placed in
iflib_device_deregister() as this function is now calling
iflib_deregister(). This is to avoid deregistering same event twice.

This patch also adds check in iflib_vlan_register() to prevent
registering VLAN while being in detach.

Patch co-authored by Krzysztof Galazka <krzysztof.galazka@intel.com>,
erj <erj@FreeBSD.org> and Jacob Keller <jacob.e.keller@intel.com>.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: gallatin@, erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21711

4 years agoFix a minor typo
Olivier Cochard [Tue, 24 Sep 2019 16:49:42 +0000 (16:49 +0000)]
Fix a minor typo

Approved by: lwhsu
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D19970

4 years agoFix coredump_phnum_test in case of kern.compress_user_cores=1
Olivier Cochard [Tue, 24 Sep 2019 16:45:34 +0000 (16:45 +0000)]
Fix coredump_phnum_test in case of kern.compress_user_cores=1

PR: 240783
Approved by: ngie, lwhsu
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21776

4 years agoPlumb a memory leak.
Michael Tuexen [Tue, 24 Sep 2019 13:15:24 +0000 (13:15 +0000)]
Plumb a memory leak.
Thnanks to Felix Weinrank for finding this issue using fuzz testing
and reporting it for the userland stack:
https://github.com/sctplab/usrsctp/issues/378

MFC after: 3 days

4 years agolib/libc/regex: fix build with REDEBUG defined
Yuri Pankov [Tue, 24 Sep 2019 12:21:01 +0000 (12:21 +0000)]
lib/libc/regex: fix build with REDEBUG defined

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D21760

4 years agoReplace all mtx_lock()/mtx_unlock() on n_mtx with the macros.
Rick Macklem [Tue, 24 Sep 2019 01:58:54 +0000 (01:58 +0000)]
Replace all mtx_lock()/mtx_unlock() on n_mtx with the macros.

For a long time, some places in the NFS code have locked/unlocked the
NFS node lock with the macros NFSLOCKNODE()/NFSUNLOCKNODE() whereas
others have simply used mtx_lock()/mtx_unlock().
Since the NFS node mutex needs to change to an sx lock so it can be held when
vnode_pager_setsize() is called, replace all occurrences of mtx_lock/mtx_unlock
with the macros to simply making the change to an sx lock in future commit.
There is no semantic change as a result of this commit.

I am not sure if the change to an sx lock will be MFC'd soon, so I put
an MFC of 1 week on this commit so that it could be MFC'd with that commit.

Suggested by: kib
MFC after: 1 week

4 years agoClean LINT* kernel configurations for arm*
Li-Wen Hsu [Tue, 24 Sep 2019 01:56:27 +0000 (01:56 +0000)]
Clean LINT* kernel configurations for arm*

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoping6: Use caph_rights_limit(3) for STDIN_FILENO
Mark Johnston [Mon, 23 Sep 2019 22:20:11 +0000 (22:20 +0000)]
ping6: Use caph_rights_limit(3) for STDIN_FILENO

Update some error messages while here.

Reported by: olivier
MFC after: 3 days

4 years agocache: tidy up handling of negative entries
Mateusz Guzik [Mon, 23 Sep 2019 20:50:04 +0000 (20:50 +0000)]
cache: tidy up handling of negative entries

- track the total count of hot entries
- pre-read the lock when shrinking since it is typically already taken
- place the lock in its own cacheline
- shorten the hold time of hot lock list when zapping

Sponsored by: The FreeBSD Foundation

4 years agoMake nvme(4) driver some more NUMA aware.
Alexander Motin [Mon, 23 Sep 2019 17:53:47 +0000 (17:53 +0000)]
Make nvme(4) driver some more NUMA aware.

 - For each queue pair precalculate CPU and domain it is bound to.
If queue pairs are not per-CPU, then use the domain of the device.
 - Allocate most of queue pair memory from the domain it is bound to.
 - Bind callouts to the same CPUs as queue pair to avoid migrations.
 - Do not assign queue pairs to each SMT thread.  It just wasted
resources and increased lock congestions.
 - Remove fixed multiplier of CPUs per queue pair, spread them even.
This allows to use more queue pairs in some hardware configurations.
 - If queue pair serves multiple CPUs, bind different NVMe devices to
different CPUs.

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

4 years agoImplement x86 dtrace_invop_(un)init() in C.
Mark Johnston [Mon, 23 Sep 2019 15:08:17 +0000 (15:08 +0000)]
Implement x86 dtrace_invop_(un)init() in C.

There is no reason for these routines to be written in assembly.  In
the ports of DTrace to other platforms, they are already written in C.
No functional change intended.

MFC after: 1 week
Sponsored by: Netflix

4 years agoFix a harmless typo.
Mark Johnston [Mon, 23 Sep 2019 14:34:23 +0000 (14:34 +0000)]
Fix a harmless typo.

MFC after: 1 week

4 years agoRevert r316820.
Mark Johnston [Mon, 23 Sep 2019 14:29:05 +0000 (14:29 +0000)]
Revert r316820.

Despite appearing correct, r316820 breaks packet rx/tx for jme(4)
interfaces.  With 12.1 approaching, let's just revert the commit for now.

PR: 233952
Tested by: Armin Gruner <ag-freebsd@muc.de>
MFC after: 3 days

4 years agoSet NX on some non-leaf direct map page table entries.
Mark Johnston [Mon, 23 Sep 2019 14:19:41 +0000 (14:19 +0000)]
Set NX on some non-leaf direct map page table entries.

The direct map is never used for execution of code, so we might as well
set NX in the direct map's PML4Es.  Also clarify the intent of the code
in create_pagetables() that restricts access protections on the region
of the direct map mapping the kernel text.

Reviewed by: alc, kib (previous version)
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21759

4 years agoUse elf_relocaddr() when handling R_X86_64_RELATIVE relocations.
Mark Johnston [Mon, 23 Sep 2019 14:14:43 +0000 (14:14 +0000)]
Use elf_relocaddr() when handling R_X86_64_RELATIVE relocations.

This is required for DPCPU and VNET data variable definitions to work when
KLDs are linked as DSOs.  R_X86_64_RELATIVE relocations should not appear
in object files, so assert this in elf_relocaddr().

Reviewed by: kib
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21755

4 years agoSet NX in mappings created by pmap_kenter() and pmap_kenter_attr().
Mark Johnston [Mon, 23 Sep 2019 14:11:59 +0000 (14:11 +0000)]
Set NX in mappings created by pmap_kenter() and pmap_kenter_attr().

There does not appear to be any existing need for such mappings to be
executable.

Reviewed by: alc, kib
MFC after: 1 month
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21754

4 years agoFix destruction of the robust mutexes.
Konstantin Belousov [Mon, 23 Sep 2019 13:24:31 +0000 (13:24 +0000)]
Fix destruction of the robust mutexes.

If robust mutex' owner terminated, causing kernel-assisted state
recovery, and then pthread_mutex_destroy() is executed as the next
action, assert is triggered about mutex still being on the list.
Ignore the mutex linkage in pthread_mutex_destroy() for shared robust
mutexes with dead owner, same as for enqueue_mutex().

Reported by: avg
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agomips: fix XLPN32 after r352434
Kyle Evans [Mon, 23 Sep 2019 12:43:08 +0000 (12:43 +0000)]
mips: fix XLPN32 after r352434

SYSINIT usage was added, but the <sys/kernel.h> dependency was not added.
This worked by coincidence, as most of the mips configs have DDB enabled and
pmap.c gets <sys/kernel.h> via ddb.h pollution.

Reported by: dim

4 years agoCreate a "drm" subdirectory for drm devices in linsysfs. Recent versions of
Tijl Coosemans [Mon, 23 Sep 2019 12:27:55 +0000 (12:27 +0000)]
Create a "drm" subdirectory for drm devices in linsysfs.  Recent versions of
linux libdrm check for the existence of this directory:

https://cgit.freedesktop.org/mesa/drm/commit/?id=f8392583418aef5e27bfed9989aeb601e20cc96d

MFC after: 2 weeks

4 years agocache: count evictions of negatve entries
Mateusz Guzik [Mon, 23 Sep 2019 08:53:14 +0000 (08:53 +0000)]
cache: count evictions of negatve entries

Sponsored by: The FreeBSD Foundation

4 years agoAdd two options to allow mount to avoid covering up existing mount points.
Sean Eric Fagan [Mon, 23 Sep 2019 04:28:07 +0000 (04:28 +0000)]
Add two options to allow mount to avoid covering up existing mount points.
The two options are

* nocover/cover:  Prevent/allow mounting over an existing root mountpoint.
E.g., "mount -t ufs -o nocover /dev/sd1a /usr/local" will fail if /usr/local
is already a mountpoint.
* emptydir/noemptydir:  Prevent/allow mounting on a non-empty directory.
E.g., "mount -t ufs -o emptydir /dev/sd1a /usr" will fail.

Neither of these options is intended to be a default, for historical and
compatibility reasons.

Reviewed by: allanjude, kib
Differential Revision: https://reviews.freebsd.org/D21458

4 years agocache: try to avoid vhold if locks held
Mateusz Guzik [Sun, 22 Sep 2019 20:50:24 +0000 (20:50 +0000)]
cache: try to avoid vhold if locks held

Sponsored by: The FreeBSD Foundation

4 years agocache: jump in negative success instead of positive
Mateusz Guzik [Sun, 22 Sep 2019 20:49:17 +0000 (20:49 +0000)]
cache: jump in negative success instead of positive

Sponsored by: The FreeBSD Foundation

4 years agolockprof: move per-cpu data to dpcpu
Mateusz Guzik [Sun, 22 Sep 2019 20:44:24 +0000 (20:44 +0000)]
lockprof: move per-cpu data to dpcpu

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21747

4 years agoi386: reduce differences in source between PAE and non-PAE pmaps ...
Konstantin Belousov [Sun, 22 Sep 2019 19:59:10 +0000 (19:59 +0000)]
i386: reduce differences in source between PAE and non-PAE pmaps ...

by defining pg_nx as zero for non-PAE and correspondingly simplifying
some expressions.

Suggested and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21757

4 years agoi386: implement sysctl vm.pmap.kernel_maps.
Konstantin Belousov [Sun, 22 Sep 2019 19:23:00 +0000 (19:23 +0000)]
i386: implement sysctl vm.pmap.kernel_maps.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21739

4 years agoamd64: minor tweaks to pat decoding in sysctl vm.pmap.kernel_maps.
Konstantin Belousov [Sun, 22 Sep 2019 19:20:37 +0000 (19:20 +0000)]
amd64: minor tweaks to pat decoding in sysctl vm.pmap.kernel_maps.

Decode PAT_UNCACHED.
When unknown pat mode is encountered, print the pte bits combination
instead of the index, which is always 8.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21738

4 years agoocteon-sdk: suppress another set of warnings under clang
Kyle Evans [Sun, 22 Sep 2019 18:32:05 +0000 (18:32 +0000)]
octeon-sdk: suppress another set of warnings under clang

Clang sees this construct and warns that adding an int to a string like this
does not concatenate the two. Fortunately, this is not what octeon-sdk
actually intended to do, so we take the path towards remediation that clang
offers: use array indexing instead.

4 years agoocteon1: suppress a couple of warnings under clang
Kyle Evans [Sun, 22 Sep 2019 18:30:19 +0000 (18:30 +0000)]
octeon1: suppress a couple of warnings under clang

These appear in octeon-sdk -- there are new releases, but they don't seem to
address the running issues in octeon-sdk. GCC4.2 is more than happy, but
clang is much less-so and most of them are fairly innocuous and perhaps a
by-product of their style guide, which may make some of the changes harder
to upstream (if this is even possible anymore).

4 years agoHonor CWARNFLAGS.clang/gcc in the kernel build
Kyle Evans [Sun, 22 Sep 2019 18:27:57 +0000 (18:27 +0000)]
Honor CWARNFLAGS.clang/gcc in the kernel build

Some kernel builds or users may want to disable warnings on a per-compiler
basis, so do this now.

4 years agoloader_lua: lua color changes should end with reset
Toomas Soome [Sun, 22 Sep 2019 17:39:20 +0000 (17:39 +0000)]
loader_lua: lua color changes should end with reset

The color change should have reset sequence, not switch to white.

4 years agoloader_4th: menu items need to reset color attribute, not switch to white
Toomas Soome [Sun, 22 Sep 2019 16:10:25 +0000 (16:10 +0000)]
loader_4th: menu items need to reset color attribute, not switch to white

Forth menu kernel and BE entries, instead of resetting the color attribute,
are switching to white color.

4 years agoAdd support for ps -H on corefiles in libkvm
Mike Karels [Sun, 22 Sep 2019 13:56:27 +0000 (13:56 +0000)]
Add support for ps -H on corefiles in libkvm

Add support for kernel threads in kvm_getprocs() and the underlying
kvm_proclist() in libkvm when fetching from a kernel core file. This
has been missing/needed for several releases, when kernel threads became
normal threads.  The loop over the processes now contains a sub-loop for
threads, which iterates beyond the first thread only when threads are
requested.  Also set some fields such as tid that were previously
uninitialized.

Reviewed by: vangyzen jhb(earlier revision)
MFC after: 4 days
Sponsored by: Forcepoint LLC
Differential Revision: https://reviews.freebsd.org/D21461

4 years agoDon't hold the info lock when calling sctp_select_a_tag().
Michael Tuexen [Sun, 22 Sep 2019 11:11:01 +0000 (11:11 +0000)]
Don't hold the info lock when calling sctp_select_a_tag().

This avoids a double lock bug in the NAT colliding state processing
of SCTP. Thanks to Felix Weinrank for finding and reporting this issue in
https://github.com/sctplab/usrsctp/issues/374
He found this bug using fuzz testing.

MFC after: 3 days

4 years agoCleanup the RTO calculation and perform some consistency checks
Michael Tuexen [Sun, 22 Sep 2019 10:40:15 +0000 (10:40 +0000)]
Cleanup the RTO calculation and perform some consistency checks
before computing the RTO.
This should fix an overflow issue reported by Felix Weinrank in
https://github.com/sctplab/usrsctp/issues/375
for the userland stack and found by running a fuzz tester.

MFC after: 3 days

4 years agoMFZoL: Retire send space estimation via ZFS_IOC_SEND
Andriy Gapon [Sun, 22 Sep 2019 08:44:41 +0000 (08:44 +0000)]
MFZoL: Retire send space estimation via ZFS_IOC_SEND

Add a small wrapper around libzfs_core's lzc_send_space() to libzfs so
that every legacy ZFS_IOC_SEND consumer, along with their userland
counterpart estimate_ioctl(), can leverage ZFS_IOC_SEND_SPACE to
request send space estimation.

The legacy functionality in zfs_ioc_send() is left untouched for
compatibility purposes.

Obtained from: ZoL
Obtained from: zfsonlinux/zfs@cf7684bc8d57
Author: loli10K <ezomori.nozomu@gmail.com>
MFC after: 2 weeks

4 years agoprint summary line for space estimate of zfs send from bookmark
Andriy Gapon [Sun, 22 Sep 2019 08:34:23 +0000 (08:34 +0000)]
print summary line for space estimate of zfs send from bookmark

Although there is always a single stream and the total size in the
summary is always equal to the size reported for the stream, it's nice
to follow the usual output format.

MFC after: 3 days

4 years agokern.elf{32,64}.pie_base sysctl: enforce page alignment.
Konstantin Belousov [Sat, 21 Sep 2019 20:03:17 +0000 (20:03 +0000)]
kern.elf{32,64}.pie_base sysctl: enforce page alignment.

Requested by: rstone
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoIn case a translation fault on the kernel address space occurs from
Alan Cox [Sat, 21 Sep 2019 19:51:57 +0000 (19:51 +0000)]
In case a translation fault on the kernel address space occurs from
within a critical section, we must perform a lock-free check on the
faulting address.

Reported by: andrew
Reviewed by: andrew, markj
X-MFC with: r350579
Differential Revision: https://reviews.freebsd.org/D21685

4 years agolockprof: use CPUFOREACH and drop always false lp_cpu NULL checks
Mateusz Guzik [Sat, 21 Sep 2019 19:05:38 +0000 (19:05 +0000)]
lockprof: use CPUFOREACH and drop always false lp_cpu NULL checks

Sponsored by: The FreeBSD Foundation

4 years agoMake non-ASLR pie base tunable.
Konstantin Belousov [Sat, 21 Sep 2019 18:00:23 +0000 (18:00 +0000)]
Make non-ASLR pie base tunable.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoamd64 pmap: Fix formats for 64bit addresses in ddb and sysctl output.
Konstantin Belousov [Sat, 21 Sep 2019 17:59:15 +0000 (17:59 +0000)]
amd64 pmap: Fix formats for 64bit addresses in ddb and sysctl output.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21737

4 years agoFix a regression introduced in r344601, and work properly with the
Sean Eric Fagan [Sat, 21 Sep 2019 17:54:42 +0000 (17:54 +0000)]
Fix a regression introduced in r344601, and work properly with the
-v and -n options.

PR: 240640
Reported by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: avg
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21709

4 years agoAllocate callout wheel from the respective memory domain.
Alexander Motin [Sat, 21 Sep 2019 15:38:08 +0000 (15:38 +0000)]
Allocate callout wheel from the respective memory domain.

MFC after: 1 week

4 years agojot.1: Explain default argument values more precisely
Mateusz Piotrowski [Sat, 21 Sep 2019 15:01:11 +0000 (15:01 +0000)]
jot.1: Explain default argument values more precisely

The way jot(1) defaults missing arguments doesn't match the behaviour
described in the manpage, which states that with fewer than 3 arguments
missing values are supplied from left to right.

In fact, with one or two arguments, the last (s which is step size or seed)
defaults to 1 (or -1 if begin and end specify a descending range), and then
omitted arguments are set to default starting with the leftmost until three
arguments are available.

This is why `jot 2 1000` prints 1000 and 1001 instead of 1000 and 100.

PR: 135475
Submitted by: Jonathan McKeown <j.mckeown@ru.ac.za>
Approved by: doc (bcr)
Differential Revision: https://reviews.freebsd.org/D21736
Event: EuroBSDcon 2019

4 years agoascii(7): Add STANDARDS section and update HISTORY section
Mateusz Piotrowski [Sat, 21 Sep 2019 14:16:37 +0000 (14:16 +0000)]
ascii(7): Add STANDARDS section and update HISTORY section

PR: 240727
Submitted by: Gordon Bergling <gbergling@gmail.com>
Approved by: src (imp)
Event: EuroBSDcon 2019

4 years ago- Revert WARNS to 2 because of mismatch between (xdrproc_t) and xdr_void().
Hiroki Sato [Sat, 21 Sep 2019 13:34:06 +0000 (13:34 +0000)]
- Revert WARNS to 2 because of mismatch between (xdrproc_t) and xdr_void().
- Add prototype of from_addr().

4 years agoFix warnings and set WARNS=6.
Hiroki Sato [Sat, 21 Sep 2019 12:33:41 +0000 (12:33 +0000)]
Fix warnings and set WARNS=6.

4 years agoFix build errors of test.c, which had been broken for a long time.
Hiroki Sato [Sat, 21 Sep 2019 01:29:59 +0000 (01:29 +0000)]
Fix build errors of test.c, which had been broken for a long time.
This is a temporary fix and should be converted to a complete
test scenarios by using this tool.

4 years agoImpove wording and move descriptions about
Hiroki Sato [Sat, 21 Sep 2019 00:44:37 +0000 (00:44 +0000)]
Impove wording and move descriptions about
locale to LC_CTYPE in the ENVIRONMENT section.

4 years agoAdd a workaround for servers which respond RPC_PROGNOTREGISTERED
Hiroki Sato [Sat, 21 Sep 2019 00:17:40 +0000 (00:17 +0000)]
Add a workaround for servers which respond RPC_PROGNOTREGISTERED
to a clnt_create() call even when it is actually a program
version mismatch.

Normally the server is supposed to return RPC_PROGVERSMISMATCH
when it supports the specified program but not support
the specified version.  Some filers return RPC_PROGNOTREGISTERED
to RQUOTA v2 calls and FreeBSD does not retry with the old
v1 calls.  This change fixes this failure scenario.

Submitted by: Jian-Bo Liao
PR: 236179

4 years agomsdosfs: do not deget unlinked denodes
Kyle Evans [Fri, 20 Sep 2019 20:47:10 +0000 (20:47 +0000)]
msdosfs: do not deget unlinked denodes

When a file is unlinked, the denode is not reclaimed until the last
reference is dropped, but the directory entry is immediately up for reuse.
This is a problem later when createde goes to grab a denode for the newly
created entry -- we search the hash and find a dead denode, then return that
without even bumping the reference count and the data later gets truncated
when the the last reference to the unlinked file is dropped.

This manifested itself as a broken in-place strip(1) on msdosfs. elfcopy
will do a sequence incredibly roughly like this:

open("/mnt/foo", ...) => fd 3
mmap()
unlink("/mnt/foo")
open("/mnt/foo", ...) => fd 4
write(4, ...)
close(4)
close(3)

and the resulting file would be truncated, but the write succeeded, as long
as a reference to the unlinked file had not been closed.

Some archaeology indicates that this bug has likely existed since msdosfs
was converted to use vfs_hash instead of a home rolled hash implementation
in r143570. Prior to that point, the hashget implementation would do a
refcnt check while searching and explicitly only return a denode with
de_refcnt != 0. vfs_hash did not yet have the callback that it does today,
so this slipped away and did not come back when it later grew that
functionality.

The comment indicating that we want to skip these denodes has been updated
to reflect where this is actually done. My repo-diving session seems to
indicate that the refcnt check was likely never actually below the comment,
to be pedantic, but instead a detail wrapped up in the hashget
implementation since the beginning of its inclusion into FreeBSD.

This bug was the cause behind the issue addressed in r352557.

Reported by: jhibbits
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21731

4 years agoloader: Respect loader_color=YES for serial consoles
Kyle Evans [Fri, 20 Sep 2019 19:43:40 +0000 (19:43 +0000)]
loader: Respect loader_color=YES for serial consoles

It's not uncommon these days for the terminals attached to serial consoles
to support ANSI escape sequences. However, we assume escape sequences may
break some serial consoles and default to not using them when boot_serial or
boot_multicons (or if console contains "comconsole" in the forth loader) for
broader compatibility. We also have loader_color which can be explicitly set
to "NO" to disable the use of ANSI escape sequences.

The problem is that loader_color=YES gets ignored when boot_serial=YES or
boot_multicons=YES (or when console contains "comconsole" in the forth
loader).

To fix, the existing default behavior remains unchanged when loader_color is
unset, loader_color=NO explicitly disables the use of ANSI escape sequences
still, and the change is that loader_color=YES can now be used to explicitly
allow ANSI escapes when a serial console is enabled.

Submitted by: Ryan Moeller <ryan@ixsystems.com>
Reviewed by: tsoome (forth), kevans (lua)
MFC after: 1 week
Sponsored by: iXsystems, Inc. (Ryan)
Differential Revision: https://reviews.freebsd.org/D21732

4 years agotop(1): support multibyte characters in command names (ARGV array)
Daichi GOTO [Fri, 20 Sep 2019 17:37:23 +0000 (17:37 +0000)]
top(1): support multibyte characters in command names (ARGV array)
depending on locale.

 - add setlocale()
 - remove printable() function
 - add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display
   non-printable characters that do not use C-style backslash sequences
   in three digit octal sequence, or remove it

This change allows multibyte characters to be displayed according to
locale. If it is recognized as a non-display character according to the
locale, it is displayed in three digit octal sequence.

Reference:
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165751.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165766.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165833.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165846.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165891.html

Submitted by: hrs
Differential Revision: https://reviews.freebsd.org/D16204

4 years agopowerpc/loader: Install ubldr without stripping
Justin Hibbits [Fri, 20 Sep 2019 13:35:28 +0000 (13:35 +0000)]
powerpc/loader: Install ubldr without stripping

Summary:
Install's strip capability, by way of strip(1), doesn't seem to work
correctly on msdosfs, and instead ends up truncating the resulting
binary to 0-length.  As a workaround, don't strip ubldr(8).  This
fixes installworld on Book-E ubldr-based platforms, which prior to this
would need to manually install ubldr separately after installworld, in
order to have a functional ubldr.

The same thing could be done on PowerNV platforms that use msdosfs /boot
volumes, since loader and loader.kboot, etc, all get truncated to 0 on
install.  However, PowerNV does not use loader, instead loading from
petitboot, so it's not really necessary at this time.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D21725

4 years agoAdd quirk for XHCI(4) controllers to support USB control transfers
Hans Petter Selasky [Fri, 20 Sep 2019 11:28:45 +0000 (11:28 +0000)]
Add quirk for XHCI(4) controllers to support USB control transfers
above 1Kbyte.  It might look like some XHCI(4) controllers do not
support when the USB control transfer is split using a link TRB. The
next NORMAL TRB after the link TRB is simply failing with XHCI error
code 4. The quirk ensures we allocate a 64Kbyte buffer so that the
data stage TRB is not broken with a link TRB.

Found at: EuroBSDcon 2019
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoIncrease the maximum user-space buffer size from 256kBytes to 32MBytes for
Hans Petter Selasky [Fri, 20 Sep 2019 11:00:02 +0000 (11:00 +0000)]
Increase the maximum user-space buffer size from 256kBytes to 32MBytes for
libusb. This is useful for speeding up large data transfers while reducing
the interrupt rate.

Found at: EuroBSDcon 2019
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoThe maximum TD size is 31 and not 15.
Hans Petter Selasky [Fri, 20 Sep 2019 10:56:13 +0000 (10:56 +0000)]
The maximum TD size is 31 and not 15.

Found at: EuroBSDcon 2019
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoEnsure libthr is always built before libprivatezstd when building the
Baptiste Daroussin [Fri, 20 Sep 2019 09:45:38 +0000 (09:45 +0000)]
Ensure libthr is always built before libprivatezstd when building the
startup libs

Reported by: "Galazka, Krzysztof" <krzysztof.galazka@intel.com>

4 years agoremove redundant "ktls" in KTLS thr name
Andrew Gallatin [Fri, 20 Sep 2019 09:36:07 +0000 (09:36 +0000)]
remove redundant "ktls" in  KTLS thr name

This reducesthe string width of the ktls thread name
and improves "ps" output.

Glanced at by: jhb
Event: EuroBSDCon hackathon
Sponsored by: Netflix

4 years agoelf_common: add ELF note names
Ed Maste [Fri, 20 Sep 2019 09:04:52 +0000 (09:04 +0000)]
elf_common: add ELF note names

r348628 added a definition of NT_GNU_BUILD_ID.  Some software (Valgrind)
also expects a #define for the note name (ELF_NOTE_GNU) in the case that
NT_GNU_BUILD_ID is defined.

PR: 239669
Reported by: Yuichiro NAITO
Sponsored by: The FreeBSD Foundation
Event: EuroBSDCon FreeBSD DevSummit 2019

4 years agoFix the handling of invalid parameters in ASCONF chunks.
Michael Tuexen [Fri, 20 Sep 2019 08:20:20 +0000 (08:20 +0000)]
Fix the handling of invalid parameters in ASCONF chunks.
Thanks to Mark Wodrich from Google for reproting the issue in
https://github.com/sctplab/usrsctp/issues/376
for the userland stack.

MFC after: 3 days

4 years agoloader: fix typo in zalloc.
Toomas Soome [Fri, 20 Sep 2019 05:22:34 +0000 (05:22 +0000)]
loader: fix typo in zalloc.

4 years agoImprove ioat(4) NUMA-awareness.
Alexander Motin [Thu, 19 Sep 2019 22:15:57 +0000 (22:15 +0000)]
Improve ioat(4) NUMA-awareness.

Allocate ioat->ring memory from the device domain.
Schedule ioat->poll_timer to the first CPU of the device domain.

According to pcm-numa tool from intel-pcm port, this reduces number of
remote DRAM accesses while copying data by 75%.  And unless it is a noise,
I've noticed some speed improvement when copying data to other domain.

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

4 years agovfs: group fields used for per-cpu ops in one cacheline
Mateusz Guzik [Thu, 19 Sep 2019 21:23:14 +0000 (21:23 +0000)]
vfs: group fields used for per-cpu ops in one cacheline

Sponsored by: The FreeBSD Foundation

4 years agoFix src component detection
Michael Gmelin [Thu, 19 Sep 2019 21:13:51 +0000 (21:13 +0000)]
Fix src component detection

Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21579

4 years agoFollow up on r352304 which disabled default mlockall() at startup.
Cy Schubert [Thu, 19 Sep 2019 20:16:51 +0000 (20:16 +0000)]
Follow up on r352304 which disabled default mlockall() at startup.
Unfortunately though the original tarball supports this in ./configure
(for Linux), to fully support disabling of mlockall() by default requires
a little extra help otherwise the following is logged in syslog:

Cannot set RLIMIT_MEMLOCK: Operation not permitted

MFC after: 2 weeks
X-MFC with: r352304

4 years agoApply r346792 (cperciva) from stable/12 to head. The original commit
Glen Barber [Thu, 19 Sep 2019 16:43:12 +0000 (16:43 +0000)]
Apply r346792 (cperciva) from stable/12 to head.  The original commit
message:

 On non-x86 systems, use "quarterly" packages.

 x86 architectures have "latest" package builds on stable/*, so keep using
 those (they'll get switched over to "quarterly" during releases).

The original commit was a direct commit to stable/12, as at the time it
was presumed it would not be necessary for head.  However, when it is time
to create a releng branch or switch from PRERELEASE/STABLE to BETA/RC, the
pkg(7) Makefile needs further adjusting.  This commit includes those
further adjustments, evaluating the BRANCH variable from release/Makefile
to determine the pkg(7) repository to use.

MFC after: immediate (if possible)
Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoReduce calls to close(2) at startup through the use of closefrom(2).
Cy Schubert [Thu, 19 Sep 2019 14:45:04 +0000 (14:45 +0000)]
Reduce calls to close(2) at startup through the use of closefrom(2).

Submitted by: pawel.biernacki@gmail.com
Reviewed by: mjg, cy
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21715

4 years agoWhitespace cleanup, no functional change
Li-Wen Hsu [Thu, 19 Sep 2019 13:25:19 +0000 (13:25 +0000)]
Whitespace cleanup, no functional change

Sponsored by: The FreeBSD Foundation

4 years agoTemporarily add test_write_filter_zstd BROKEN_TESTS as it always fails in CI
Li-Wen Hsu [Thu, 19 Sep 2019 13:23:25 +0000 (13:23 +0000)]
Temporarily add test_write_filter_zstd BROKEN_TESTS as it always fails in CI

There is no trivial way to mark single libarchive test skip currently so just
add it to BROKEN_TESTS for now.

PR: 240683
Sponsored by: The FreeBSD Foundation

4 years agofreebsd-update: make usage output consistent
Ed Maste [Thu, 19 Sep 2019 11:46:43 +0000 (11:46 +0000)]
freebsd-update: make usage output consistent

Drop trailing . which appeared only on description of IDS.

Submitted by: grembo
Event: EuroBSDCon Norway FreeBSD DevSummit

4 years agofreebsd-update.8: appease igor
Ed Maste [Thu, 19 Sep 2019 11:34:35 +0000 (11:34 +0000)]
freebsd-update.8: appease igor

igor follows American style guides in the belief that abbreviations i.e.
and e.g. are always followed by a comma.  Make that change now so that
future updates to freebsd-update.8 do not complain about this.

Submitted by: grembo
Event: EuroBSDCon Norway FreeBSD DevSummit

4 years agoWhen the RACK stack computes the space for user data in a TCP segment,
Michael Tuexen [Thu, 19 Sep 2019 10:27:47 +0000 (10:27 +0000)]
When the RACK stack computes the space for user data in a TCP segment,
it wasn't taking the IP level options into account. This patch fixes this.
In addition, it also corrects a KASSERT and adds protection code to assure
that the IP header chain and the TCP head fit in the first fragment as
required by RFC 7112.

Reviewed by: rrs@
MFC after: 3 days
Sponsored by: Nertflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21666

4 years agoWhen processing an incoming IPv6 packet over the loopback interface which
Michael Tuexen [Thu, 19 Sep 2019 10:22:29 +0000 (10:22 +0000)]
When processing an incoming IPv6 packet over the loopback interface which
contains Hop-by-Hop options, the mbuf chain is potentially changed in
ip6_hopopts_input(), called by ip6_input_hbh().
This can happen, because of the the use of IP6_EXTHDR_CHECK, which might
call m_pullup().
So provide the updated pointer back to the called of ip6_input_hbh() to
avoid using a freed mbuf chain in`ip6_input()`.

Reviewed by: markj@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21664