]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r351604:
Yuri Pankov [Mon, 16 Sep 2019 16:10:44 +0000 (16:10 +0000)]
MFC r351604:

ichsmb: defer smbus attach until interrupts are available

This fixes a "timed sleep before timers are working" panic seen
while attaching jedec_dimm(4) instances too early in the boot.

Submitted by: ian
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D21452

4 years agoMFC r351727:
Mark Johnston [Mon, 16 Sep 2019 15:21:37 +0000 (15:21 +0000)]
MFC r351727:
Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.

4 years agoMFC r342937:
Andrew Turner [Mon, 16 Sep 2019 15:00:11 +0000 (15:00 +0000)]
MFC r342937:

Fix the location of td->td_frame at the top of the kernel stack.

In cpu_thread_alloc we would allocate space for the trap frame at the top of
the kernel stack. This is just below the pcb, however due to a missing cast
the pointer arithmetic would use the pcb size, not the trapframe size. As
the pcb is larger than the trapframe this is safe, however later in cpu_fork
we include the case leading to the two disagreeing on the location.

Fix by using the same arithmetic in both locations.

Found by: An early KASAN patch
Sponsored by: DARPA, AFRL

4 years agoMFC r340008, r340013
Andrew Turner [Mon, 16 Sep 2019 14:51:24 +0000 (14:51 +0000)]
MFC r340008, r340013

r340008:
Add the ARMv8.3 HCR_EL2 register fields.

Sponsored by: DARPA, AFRL

r340013:
Add the ARMv8.3 SCTLR_EL1 fields.

While here tag which architecture release fields were added and remove a
field that only existed in very early releases of the ARMv8 spec.

Sponsored by: DARPA, AFRL

4 years agoMFC r339988:
Andrew Turner [Mon, 16 Sep 2019 14:45:20 +0000 (14:45 +0000)]
MFC r339988:

Use the correct offsets for the trap frame in fork_trampoline.

Sponsored by: DARPA, AFRL

4 years agoMFC r339594:
Andrew Turner [Mon, 16 Sep 2019 14:43:43 +0000 (14:43 +0000)]
MFC r339594:

Stop advertising ARMv8.3 Pointer Authentication

This needs firmware and kernel support before userspace can use it. Until
then don't advertise it's available.

4 years agoMFC r341489:
Andrew Turner [Mon, 16 Sep 2019 14:42:14 +0000 (14:42 +0000)]
MFC r341489:

Only gnu/lib/csu when MK_BSD_CRTBEGIN is off.

We were still building it from Makefile.inc1. Disable it there so we don't
try to build the GNU crtbegin/crtend when the BSD version was asked for.

PR: 233733
Reported by: lwhsu
Reviewed by: emaste
MFC with: r339738
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18428

4 years agoMFC r339948:
Andrew Turner [Mon, 16 Sep 2019 14:35:02 +0000 (14:35 +0000)]
MFC r339948:

Use pmap_invalidate_all rather than invalidating 512 level 2 entries in
the early pmap_mapbios/unmapbios code. It is even worse when there are
multiple L2 entries to handle as we would need to iterate over all pages.

Sponsored by: DARPA, AFRL

4 years agoMFC r339944:
Andrew Turner [Mon, 16 Sep 2019 14:34:10 +0000 (14:34 +0000)]
MFC r339944:

Fix some style(9) issues in the arm64 pmap_mapbios/unmapbios. Split lines
when they are too long.

4 years agoMFC r348323:
Andrew Turner [Mon, 16 Sep 2019 14:25:51 +0000 (14:25 +0000)]
MFC r348323:

The alignment is passed into contigmalloc_domainset in the 7th argument.

KUBSAN was complaining the pointer contigmalloc_domainset returned was
misaligned. Fix this by using the correct argument to find the alignment
in the function signature.

Reported by: KUBSAN
Sponsored by: DARPA, AFRL

4 years agoMFC r343876:
Andrew Turner [Mon, 16 Sep 2019 14:07:30 +0000 (14:07 +0000)]
MFC r343876:

Add missing data barriers after storeing a new valid pagetable entry.

When moving from an invalid to a valid entry we don't need to invalidate
the tlb, however we do need to ensure the store is ordered before later
memory accesses. This is because this later access may be to a virtual
address within the newly mapped region.

Add the needed barriers to places where we don't later invalidate the
tlb. When we do invalidate the tlb there will be a barrier to correctly
order this.

This fixes a panic on boot on ThunderX2 when INVARIANTS is turned off:
panic: vm_fault_hold: fault on nofault entry, addr: 0xffff000040c11000

Reported by: jchandra
Tested by: jchandra
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19097

4 years agoMFC r346996:
Andrew Turner [Mon, 16 Sep 2019 13:45:31 +0000 (13:45 +0000)]
MFC r346996:

Restore x18 in efi_arch_leave.

Some UEFI implementations trash this register and, as we use it as a
platform register, the kernel doesn't save it before calling into the UEFI
runtime services. As we have a copy in tpidr_el1 restore from there when
exiting the EFI environment.

PR: 237234, 237055
Reviewed by: manu
Tested On: Ampere eMAG
Sponsored by: DARPA, AFRL
Sponsored by: Ampere Computing (hardware)
Differential Revision: https://reviews.freebsd.org/D20127

4 years agoMFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, r339912...
Andrew Turner [Mon, 16 Sep 2019 13:41:24 +0000 (13:41 +0000)]
MFC r339738, r339744, r339770, r339773, r339864-r339866, r339907-r339908, r339912-r339913, r339916, r339954, r340213, r340395, r340840, r340910-r340911, r341424, r342773, r342974, r351027, r352073:

MFC the BSD crtbegin to stable/12 but keep it disabled.

r339738:
Implement a BSD licensed crtbegin/crtend

These are needed for .ctors/.dtors and .jcr handling. The former needs
all the function pointers to be called in the correct order from the
.init/.fini section. The latter just needs to call a gcj specific function
if it exists with a pointer to the start of the .jcr section.

This is currently disabled until __dso_handle support is added.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17587

r339744:
Add a missing include for src.opts.mk. Without it MK_TESTS isn't defined.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339770:
Drop the csu tests WARNS to 5 to fix the powerpc64 build.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339773:
Add __dso_handle to the BSD crtbegin. This is used to identify shared
objects.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339864:
Check __dso_handle is NULL in non-DSO objects. It should only be non-NULL
when accessed from a shared object.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339865:
Include the csu test directories in BSD.tests.dist

MFC with: r339738
Sponsored by: DARPA, AFRL

r339866:
Make the .ctors, .dtors, and .jcr markers as static. They shouldn't be
accessible from out of the files they are defined in.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339907:
The jcr argument to _Jv_RegisterClasses is used, stop marking it otherwise.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339908:
Run the csu tests on a DSO. This builds the tests into a shared library,
then runs these from the base test programs. With this we can check
crtbeginS.o and crtendS.o are working as expected.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339912:
Fix the location of the static keyword.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339913:
Disable the .preinit_array test in DSOs, ld.bfd fails to link objects with
the section.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339916:
Build the csu tests on all architectures.

The tests haven't been run them, but this is enough to build them so I can
get feedback on if the various crt.h headers are correct.

MFC with: r339738
Sponsored by: DARPA, AFRL

r339954:
Add __used to __CTOR_LIST__ and __DTOR_LIST__

Enabling BSD_CRTBEGIN on amd64 resulted in
error: unused variable '__CTOR_LIST__'.

__CTOR_LIST__ is indeed unused in crtbegin.c; it marks the beginning of
the .ctors array and is used in crtend.c.  Annotate __DTOR_LIST__ as
well for consistency.

Discussed with: andrew
MFC with: r339738
Sponsored by: The FreeBSD Foundation

r340213:
Add the (untested) mips and sparc64 .init call sequences.

The BSD crtbegin/crtend code now builds on all architectures, however
further work is needed to check if it works correctly.

MFC with: r339738
Sponsored by: DARPA, AFRL

r340395:
Run __cxa_finalize in shared objects in the destructor path.

When we have .dtors call them before .dtor handling, otherwise call from
a destructor.

PR: 233056
MFC with: r339738
Sponsored by: DARPA, AFRL

r340840:
Mark the function called by the MIPS .init/.fini sequence with .local.

As with r328939 we need to mark local symbols as such. Without this the
assembly parser treats the symbols as global and created relocations
against these private symbols.

MFC with: r339738
Sponsored by: DARPA, AFRL

r340910:
Add the missing 0 at the end of the .jcr section.

Without this the dynamic library test was failing as it was calling
_Jv_RegisterClasses multiple times.

r340911:
Re-enable the dynamiclib tests. These should be fixed by r340910.

r341424:
Disable the BSD CRT code on powerpc and sparc64, they need extra crt*.o
files that haven't been implemented.

Reported by: sbruno
MFC with: r339738
Sponsored by: DARPA, AFRL

r342773:
Add explicit csu test dependency

lib/csu/tests/dynamiclib requires libh_csu.so be built first.  I'm not
sure this is the most correct/best way to address this but it solves
the issue in my testing.

PR: 233734
Sponsored by: The FreeBSD Foundation

r342974:
Create crtsavres.o for powerpc builds

Summary:
GCC expects to link in a crtsavres.o on powerpc platforms.  On
powerpc64 this is an empty file, but on powerpc and powerpcspe this does contain
some save/restore functions, which may not actually be necessary for newer
modern GCC and clang.  This appeases the in-tree gcc, though, and is needed in
order to switch to the BSD CRTRBEGIN.

PR: 233751
Reviewed By: andrew
Differential Revision: https://reviews.freebsd.org/D18826

r351027:
Enable BSD_CRTBEGIN on powerpc

In r342974 jhibbits added support to build crtsavres.o. This was the
blocker for BSD_CRTBEGIN to be enabled there. As such enable this
option again.

Reviewed by: jhibbits
Sponsored by: DARPA, AFRL

r352073:
csu: Add the riscv .init call sequence

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

4 years agoMFC r350499: acpi_resource.c: mention ThunderX2 firmware revision with issue
Ed Maste [Mon, 16 Sep 2019 13:10:34 +0000 (13:10 +0000)]
MFC r350499: acpi_resource.c: mention ThunderX2 firmware revision with issue

[This has been fixed in a later version] and the workaround can
eventually be removed.  See r330113 and r346066 details.

4 years agoMFC r350303: enable ig4_acpi on aarch64
Ed Maste [Mon, 16 Sep 2019 12:54:44 +0000 (12:54 +0000)]
MFC r350303: enable ig4_acpi on aarch64

The already-listed APMC0D0F ID belongs to the Ampere eMAG aarch64
platform, but ACPI support was not even built on aarch64.

Submitted by: Greg V <greg_unrelenting.technology>

4 years agoMFC r346445: Enable ioremap for aarch64 in the LinuxKPI
Ed Maste [Mon, 16 Sep 2019 12:51:28 +0000 (12:51 +0000)]
MFC r346445: Enable ioremap for aarch64 in the LinuxKPI

Required for Mellanox drivers (e.g. on Ampere eMAG at Packet.com).

PR: 237055
Submitted by: Greg V <greg@unrelenting.technology>

4 years agoMFC r352059, r352060:
Konstantin Belousov [Mon, 16 Sep 2019 06:15:22 +0000 (06:15 +0000)]
MFC r352059, r352060:
Make timehands count selectable at boottime.

4 years agoMFC r352056:
Konstantin Belousov [Mon, 16 Sep 2019 06:13:29 +0000 (06:13 +0000)]
MFC r352056:
Make snprintf(3) and vscanf(3) definitions available under appropriate
POSIX visibility.

PR: 207287

4 years agoMFC r352058:
Konstantin Belousov [Mon, 16 Sep 2019 06:12:12 +0000 (06:12 +0000)]
MFC r352058:
Remove some unneeded vfs_busy() calls in SU code.

4 years agoMFC r352306:
Dimitry Andric [Mon, 16 Sep 2019 06:01:06 +0000 (06:01 +0000)]
MFC r352306:

Include <stdint.h> in unwind-arm.h, since it uses uint32_t and uint64_t
in various declarations.

Otherwise, depending on how unwind-arm.h is included from other source
files, the compiler may complain that uint32_t and uint64_t are unknown
types.

4 years agoMFC r351803: ZFS: Always refuse receving non-resume stream when resume state exists
Andriy Gapon [Mon, 16 Sep 2019 05:25:36 +0000 (05:25 +0000)]
MFC r351803: ZFS: Always refuse receving non-resume stream when resume state exists

4 years agoMFC r349323, r349442, r349866, r349975
Alan Cox [Mon, 16 Sep 2019 04:54:17 +0000 (04:54 +0000)]
MFC r349323, r349442, r349866, r349975
  pmap_enter_quick_locked() never replaces a valid mapping, so it need not
  perform a TLB invalidation.  A barrier suffices.  (See r343876.)

  Add a comment to pmap_enter_quick_locked() in order to highlight the fact
  that it does not replace valid mappings.

  Correct a typo in one of pmap_enter()'s comments.

  Introduce pmap_clear(), which zeroes a page table entry, and use it,
  instead of pmap_load_clear(), in places where we don't care about the page
  table entry's prior contents.

  Eliminate an unnecessary pmap_load() from pmap_remove_all().  Instead, use
  the value returned by the pmap_load_clear() on the very next line.

  A KASSERT() in pmap_enter(), which originated in the amd64 pmap, was meant
  to check the value returned by the pmap_load_clear() on the previous
  line.  However, we were ignoring the value returned by the
  pmap_load_clear(), and so the KASSERT() was not serving its intended
  purpose.  Use the value returned by the pmap_load_clear() in the
  KASSERT().

4 years agoMFC r349003, r349031, r349042, r349129, r349290, r349618, r349798
Alan Cox [Mon, 16 Sep 2019 02:31:58 +0000 (02:31 +0000)]
MFC r349003, r349031, r349042, r349129, r349290, r349618, r349798
  Change pmap_demote_l2_locked() so that it removes the superpage mapping on
  a demotion failure.  Otherwise, some callers to pmap_demote_l2_locked(),
  such as pmap_protect(), may leave an incorrect mapping in place on a
  demotion failure.

  Change pmap_demote_l2_locked() so that it handles addresses that are not
  superpage aligned.  Some callers to pmap_demote_l2_locked(), such as
  pmap_protect(), may not pass a superpage aligned address.

  Optimize TLB invalidation in pmap_remove_l2().

  Change the arm64 pmap so that updates to the global count of wired pages
  are not performed directly by the pmap.  Instead, they are performed by
  vm_page_free_pages_toq().

  Batch the TLB invalidations that are performed by pmap_protect() rather
  than performing them one at a time.

  Eliminate a redundant call to pmap_invalidate_page() from
  pmap_ts_referenced().

  Introduce pmap_remove_l3_range() and use it in two places: (1)
  pmap_remove(), where it eliminates redundant TLB invalidations by
  pmap_remove() and pmap_remove_l3(), and (2) pmap_enter_l2(), where it may
  optimize the TLB invalidations by batching them.

  Implement pmap_copy().

  Three changes to pmap_enter():

  1. Use _pmap_alloc_l3() instead of pmap_alloc_l3() in order to handle the
  possibility that a superpage mapping for "va" was created while we slept.

  2. Eliminate code for allocating kernel page table pages.  Kernel page
  table pages are preallocated by pmap_growkernel().

  3. Eliminate duplicated unlock operations when KERN_RESOURCE_SHORTAGE is
  returned.

4 years agoMFC r352231:
Alan Somers [Mon, 16 Sep 2019 00:59:10 +0000 (00:59 +0000)]
MFC r352231:

getsockopt.2: clarify that SO_TIMESTAMP is not 100% reliable

When SO_TIMESTAMP is set, the kernel will attempt to attach a timestamp as
ancillary data to each IP datagram that is received on the socket. However,
it may fail, for example due to insufficient memory. In that case the
packet will still be received but not timestamp will be attached.

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

4 years agoMFC r351318, r351330, r351393, r351398, r351440, r351461, r351548, r352226, r352229
Alan Somers [Mon, 16 Sep 2019 00:56:33 +0000 (00:56 +0000)]
MFC r351318, r351330, r351393, r351398, r351440, r351461, r351548, r352226, r352229

r351318:
ping: Add tests of the Internet checksum function

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21340

r351330:
ping: do reverse DNS lookup of the target address

When printing replies, ping will now attempt a reverse DNS lookup of the
target.  That can be suppressed by using the "-n" option.  Curiously, ping
has always done reverse lookups in certain error paths, but never in the
success path.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21351

r351393:
ping: add a basic functional test

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21289

r351398:
ping: By default, don't reverse lookup IP addresses

ping's default is now not to attempt reverse DNS lookups.  The -H flag will
enable them.  This change is not quite a reversion of r351330.  That change
made the happy path and error path do reverse lookups consistently; this
change changes the default for both paths.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Discussed with: cem
MFC-With: 351330
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21364

r351440:
ping: Fix alignment errors

This fixes -Wcast-align errors when compiled with WARNS=6.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21327

r351461:
ping: fix unaligned access to ancillary data

Use CMSG_FIRSTHDR rather than assume that an array is correctly aligned.
Fixes warnings on sparc64 and powerpcspe.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFH: 2 weeks
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21406

r351548:
ping: raise WARNS level to 6

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21405

r352226:
ping: fix a string in an error message

r352229:
ping: Verify whether a datagram timestamp was actually received.

ping(8) uses SO_TIMESTAMP, which attaches a timestamp to each IP datagram at
the time it's received by the kernel.  Except that occasionally it doesn't.
Add a check to see whether such a timestamp was actually set before trying
to read it.  This fixes segfaults that can happen when the kernel doesn't
attach a timestamp.

The bug has always existed, but prior to r351461 it manifested as an
implausible round-trip-time, not a segfault.

Reported by: pho
MFC-With: 351461

4 years agoMFC r349070
Alan Cox [Sun, 15 Sep 2019 21:32:19 +0000 (21:32 +0000)]
MFC r349070
  Previously, when pmap_remove_pages() destroyed a dirty superpage mapping,
  it only called vm_page_dirty() on the first of the superpage's constituent
  4KB pages.  This revision corrects that error, calling vm_page_dirty() on
  all of superpage's constituent 4KB pages.

4 years agoMFC r349905
Alan Cox [Sun, 15 Sep 2019 21:27:14 +0000 (21:27 +0000)]
MFC r349905
  According to Section D5.10.3 "Maintenance requirements on changing System
  register values" of the architecture manual, an isb instruction should be
  executed after updating ttbr0_el1 and before invalidating the TLB.

4 years agoMFC r348809, r349767
Doug Moore [Sun, 15 Sep 2019 21:13:13 +0000 (21:13 +0000)]
MFC r348809, r349767
Let swap_pager_swapoff_object and swp_pager_force_pagein operate on
multiple pages per I/O operation.

Reviewed by: alc
Approved by: markj (implicit, mentor)

4 years agoMFC 351064
Doug Moore [Sun, 15 Sep 2019 20:13:46 +0000 (20:13 +0000)]
MFC 351064
Don't let swapon trimming wipe the bsd label.

Reviewed by: alc
Approved by: markj (mentor, implicit)

4 years agoig4(4): Fix SDA HOLD time set too low on Skylake controllers
Vladimir Kondratyev [Sun, 15 Sep 2019 19:16:42 +0000 (19:16 +0000)]
ig4(4): Fix SDA HOLD time set too low on Skylake controllers

Execution of "Soft reset" command (IG4_REG_RESETS_SKL) at controller init
stage sets SDA_HOLD register value to 0x0001 which is often too low for
normal operation.

Set SDA_HOLD back to 28 after reset to restore controller functionality.

PR: 240339
Reported by: imp, GregV, et al.

4 years agoMFC r352258: Remove Tagged Command Queuing feature reporting.
Alexander Motin [Sun, 15 Sep 2019 17:58:39 +0000 (17:58 +0000)]
MFC r352258: Remove Tagged Command Queuing feature reporting.

I never saw those devices myself, FreeBSD never supported them, and it is
officially obsolete since ACS-2 specification.

4 years agoMFC r348828
Alan Cox [Sun, 15 Sep 2019 17:22:29 +0000 (17:22 +0000)]
MFC r348828
  Implement an alternative solution to the amd64 and i386 pmap problem that
  we previously addressed in r348246 (and MFCed in r348479).

  This pmap problem also exists on arm64 and riscv.  However, the original
  solution developed for amd64 and i386 cannot be used on arm64 and riscv.
  In particular, arm64 and riscv do not define a PG_PROMOTED flag in their
  level 2 PTEs.  (A PG_PROMOTED flag makes no sense on arm64, where unlike
  x86 or riscv we are required to break the old 4KB mappings before making
  the 2MB mapping; and on riscv there are no unused bits in the PTE to
  define a PG_PROMOTED flag.)

  This commit implements an alternative solution that can be used on all
  four architectures.  Moreover, this solution has two other advantages.
  First, on older AMD processors that required the Erratum 383 workaround,
  it is less costly.  Specifically, it avoids unnecessary calls to
  pmap_fill_ptp() on a superpage demotion.  Second, it enables the
  elimination of some calls to pagezero() in pmap_kernel_remove_{l2,pde}().

  In addition, remove a related stale comment from pmap_enter_{l2,pde}().

4 years agoMFC r350994, r350998, r351030, r351033, r351171, r351223, r351226, r351424
Alan Somers [Sun, 15 Sep 2019 16:53:02 +0000 (16:53 +0000)]
MFC r350994, r350998, r351030, r351033, r351171, r351223, r351226, r351424

r350994:
ping: fix data type of a variable for a packet sequence number

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21244

r350998:
ping: use the monotonic clock to measure durations

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21245

r351030:
ping: fix triptime calculation after r350998

That revision changed the internal clock to the monotonic, but neglected to
change the datagram's timestamp source.

Reported by: Oliver Hartmann, Michael Butler
Reviewed by: Ján Sučan <sucanjan@gmail.com>, allanjude
MFC-With: r350998
Differential Revision: https://reviews.freebsd.org/D21258

r351033:
ping: Make in_cksum() operate on u_char buffer

This fixes -Wcast-align errors for in_cksum() calls when compiled with
WARNS=6.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21261

r351171:
ping: Move in_cksum() to a separate source file

This is a preparation step for adding ATF tests of in_cksum(), which has been
modified to operate on unaligned data. ping.o cannot be linked to the test
executable because both of them contain 'main' symbol.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21288

r351223:
ping: fix -Wformat-truncating warning with GCC

Increase buffer size for the string representation of n_time

ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes
and seconds is always 2 characters wide. Max. number of hours is 4
characters wide. The buffer size should be at least:

4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21325

r351226:
Fix uninitialized variable warnings when MK_CASPER=no

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21322

r351424:
ping: fix include guard symbol name to reflect the header file name

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC-With: 351171
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21374

4 years agoMFC r351399: Fix the build with WITHOUT_GOOGLETEST
Kyle Evans [Sun, 15 Sep 2019 14:37:50 +0000 (14:37 +0000)]
MFC r351399: Fix the build with WITHOUT_GOOGLETEST

Attempting to build the fusefs tests WITHOUT_GOOGLETEST will result in an
error if the host system or sysroot doesn't already have googletest headers
in /usr/include/private (e.g. host built/installed WITHOUT_GOOGLETEST, clean
cross-buildworld WITHOUT_GOOGLETEST).

4 years agoMFC r351657
Vincenzo Maffione [Sun, 15 Sep 2019 14:26:19 +0000 (14:26 +0000)]
MFC r351657

netmap: import changes from upstream (SHA 137f537eae513)

 - Rework option processing.
 - Use larger integers for memory size values in the
   memory management code.

4 years agoMFC r352238: Import tzdata 2019c
Philip Paeps [Sun, 15 Sep 2019 10:54:18 +0000 (10:54 +0000)]
MFC r352238: Import tzdata 2019c

4 years agoMFC 346554,346556,346595,348060,348061,348494 udp locking fixes
Bjoern A. Zeeb [Sun, 15 Sep 2019 08:16:28 +0000 (08:16 +0000)]
MFC 346554,346556,346595,348060,348061,348494 udp locking fixes

  Fix multiple possible locking problems found by syzkaller and
  update comment (which was wrong already anyway due to previous
  changes).
  Improve KASSERTs for debugging lock related issues.
  Fold two RSS sections together.

4 years agoMFC the new fusefs driver
Alan Somers [Sun, 15 Sep 2019 04:14:31 +0000 (04:14 +0000)]
MFC the new fusefs driver

MFC r350665, r350990, r350992, r351039, r351042, r351061, r351066, r351113, r351560, r351961, r351963, r352021, r352025, r352230

r350665:
fusefs: merge from projects/fuse2

This commit imports the new fusefs driver. It raises the protocol level
from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and
adds many new features. New features include:

* Optional kernel-side permissions checks (-o default_permissions)
* Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK
* Allow interrupting FUSE operations
* Support named pipes and unix-domain sockets in fusefs file systems
* Forward UTIME_NOW during utimensat(2) to the daemon
* kqueue support for /dev/fuse
* Allow updating mounts with "mount -u"
* Allow exporting fusefs file systems over NFS
* Server-initiated invalidation of the name cache or data cache
* Respect RLIMIT_FSIZE
* Try to support servers as old as protocol 7.4

Performance enhancements include:

* Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags
* Cache file attributes
* Cache lookup entries, both positive and negative
* Server-selectable cache modes: writethrough, writeback, or uncached
* Write clustering
* Readahead
* Use counter(9) for statistical reporting

PR: 199934 216391 233783 234581 235773 235774 235775
PR: 236226 236231 236236 236291 236329 236381 236405
PR: 236327 236466 236472 236473 236474 236530 236557
PR: 236560 236844 237052 237181 237588 238565
Reviewed by: bcr (man pages)
Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit
review on project branch)
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Pull Request: https://reviews.freebsd.org/D21110

r350990:
fusefs: add SVN Keywords to the test files

Reported by: SVN pre-commit hooks
MFC-With: r350665
Sponsored by: The FreeBSD Foundation

r350992:
fusefs: skip some tests when unsafe aio is disabled

MFC-With:       r350665
Sponsored by:   The FreeBSD Foundation

r351039:
fusefs: fix intermittency in the default_permissions.Unlink.ok test

The test needs to expect a FUSE_FORGET operation. Most of the time the test
would pass anyway, because by chance FUSE_FORGET would arrive after the
unmount.

MFC-With: 350665
Sponsored by: The FreeBSD Foundation

r351042:
fusefs: Fix the size of fuse_getattr_in

In FUSE protocol 7.9, the size of the FUSE_GETATTR request has increased.
However, the fusefs driver is currently not sending the additional fields.
In our implementation, the additional fields are always zero, so I there
haven't been any test failures until now.  But fusefs-lkl requires the
request's length to be correct.

Fix this bug, and also enhance the test suite to catch similar bugs.

PR: 239830
MFC-With: 350665
Sponsored by: The FreeBSD Foundation

r351061:
fusefs: fix the 32-bit build after 351042

Reported by: jhb
MFC-With: 351042
Sponsored by: The FreeBSD Foundation

r351066:
fusefs: fix conditional from r351061

The entirety of r351061 was a copy/paste error.  I'm sorry I've been
comitting so hastily.

Reported by: rpokala
Reviewed by: rpokala
MFC-With: 351061
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21265

r351113:
fusefs: don't send the namespace during listextattr

The FUSE_LISTXATTR operation always returns the full list of a file's
extended attributes, in all namespaces. There's no way to filter the list
server-side. However, currently FreeBSD's fusefs driver sends a namespace
string with the FUSE_LISTXATTR request. That behavior was probably copied
from fuse_vnop_getextattr, which has an attribute name argument. It's
been there ever since extended attribute support was added in r324620. This
commit removes it.

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21280

r351560:
fusefs: Fix some bugs regarding the size of the LISTXATTR list

* A small error in r338152 let to the returned size always being exactly
  eight bytes too large.

* The FUSE_LISTXATTR operation works like Linux's listxattr(2): if the
  caller does not provide enough space, then the server should return ERANGE
  rather than return a truncated list.  That's true even though in FUSE's
  case the kernel doesn't provide space to the client at all; it simply
  requests a maximum size for the list.  We previously weren't handling the
  case where the server returns ERANGE even though the kernel requested as
  much size as the server had told us it needs; that can happen due to a
  race.

* We also need to ensure that a pathological server that always returns
  ERANGE no matter what size we request in FUSE_LISTXATTR won't cause an
  infinite loop in the kernel.  As of this commit, it will instead cause an
  infinite loop that exits and enters the kernel on each iteration, allowing
  signals to be processed.

Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21287

r351961:
Coverity fixes in fusefs(5)

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

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

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

r351963:
fusefs: coverity cleanup in the tests

Address the following defects reported by Coverity:

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

* Unchecked return value of sysctlbyname (CID 1404321)

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

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

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

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

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

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

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

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

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

r352021:
fusefs: suppress some Coverity resource leak CIDs in the tests

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

Reviewed by: uqs
Sponsored by: The FreeBSD Foundation

r352025:
mount_fusefs: fix a segfault on memory allocation failure

Reported by: Coverity
Coverity CID: 1354188
Sponsored by: The FreeBSD Foundation

r352230:
fusefs: Fix iosize for FUSE_WRITE in 7.8 compat mode

When communicating with a FUSE server that implements version 7.8 (or older)
of the FUSE protocol, the FUSE_WRITE request structure is 16 bytes shorter
than normal. The protocol version check wasn't applied universally, leading
to an extra 16 bytes being sent to such servers. The extra bytes were
allocated and bzero()d, so there was no information disclosure.

Reviewed by: emaste
MFC-With: r350665
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21557

4 years agoMFC r352194: lualoader: Revert to ASCII menu frame for serial console
Kyle Evans [Sun, 15 Sep 2019 02:48:15 +0000 (02:48 +0000)]
MFC r352194: lualoader: Revert to ASCII menu frame for serial console

The box drawing characters we use aren't necessarily safe with a serial
console; for instance, in the report by npn@, these were causing his xterm
to send back a sequence that lua picked up as input and halted the boot.
This is less than ideal.

Fallback to ASCII frames for console with 'comconsole' in it.  This is a
partial revert r338108 by imp@ -- instead of removing the menu entirely and
disabling color/cursor sequences, just reverting the default frame to ASCII
is enough to not break in this setup.

4 years agoMFC r352211: bectl(8): Add a "check" command
Kyle Evans [Sun, 15 Sep 2019 02:46:40 +0000 (02:46 +0000)]
MFC r352211: bectl(8): Add a "check" command

This command simply returns 0 at the moment and explicitly takes no
arguments. This should be used by utilities wanting to see if bectl can
operate on the system they're running, or with a specific root (`bectl -r`).
It may grow more checks than "will libbe successfully init" in the future,
but for now this is enough as that checks for the dataset mounted at "/" and
that it looks capable of being a BE root (e.g. it's not a top-level dataset)

bectl commands can now specify if they want to be silent, and this will turn
off libbe_print_on_error so they can control the output as needed. This is
already used in `bectl check`, and may be turned on in the future for some
other commands where libbe errors are better suppressed as the failure mode
may be obvious.

4 years agoMFC r351813, r352092: bectl(8) list sorting
Kyle Evans [Sun, 15 Sep 2019 02:36:50 +0000 (02:36 +0000)]
MFC r351813, r352092: bectl(8) list sorting

MFC r351813: bectl(8): implement sorting for 'bectl list' output

Allow 'bectl list' to sort output by a given property name. The property
name is passed in using a command-line flag, '-c' for ascending order and
'-C' for descending order. The properties allowed to sort by are:

- name (the default output, even if '-c' or '-C' are not used)
- creation
- origin
- used
- usedds
- usedsnap
- usedrefreserv

The default output for 'bectl list' is now ascending alphabetical order of
BE name.

To sort by creation time from earliest to latest, the command would be
'bectl list -c creation'

MFC r352092: bectl(8): initialize reverse earlier

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

4 years agoMFC r351885, r351887
Ian Lepore [Sat, 14 Sep 2019 20:26:50 +0000 (20:26 +0000)]
MFC r351885, r351887

r351885:
Ensure a measurement is complete before reading the result in ads111x.
Also, disable the comparator by default; it's not used for anything.

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

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

r351887:
Use a single write of 3 bytes instead of iicdev_writeto() in ads111x.

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

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

4 years agoMFC r352017:
Konstantin Belousov [Sat, 14 Sep 2019 13:33:36 +0000 (13:33 +0000)]
MFC r352017:
In do_execve(), use shared text vnode lock consistently.

4 years agoMFC r351693:
Hans Petter Selasky [Sat, 14 Sep 2019 13:32:54 +0000 (13:32 +0000)]
MFC r351693:
Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI.
This fixes system hangs on reading device registers on aarch64.

Tested with: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu
Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D20789
Sponsored by: Mellanox Technologies

4 years agoMFC r352016:
Konstantin Belousov [Sat, 14 Sep 2019 13:32:13 +0000 (13:32 +0000)]
MFC r352016:
In do_execve(), clear imgp->textset when restarting for interpreter.

4 years agoMFC r352015:
Konstantin Belousov [Sat, 14 Sep 2019 13:30:53 +0000 (13:30 +0000)]
MFC r352015:
When loading ELF interpreter, initialize whole nested image_params with zero.

4 years agoMFC r351847:
Hans Petter Selasky [Sat, 14 Sep 2019 13:30:22 +0000 (13:30 +0000)]
MFC r351847:
Decrease the default audio playback latency to a maximum of 21.3ms.
This significantly improves the audio playback response time.

Discussed with: mav@
Sponsored by: Mellanox Technologies

4 years agoMFC r352014:
Konstantin Belousov [Sat, 14 Sep 2019 13:29:41 +0000 (13:29 +0000)]
MFC r352014:
vm_object_deallocate(): Remove no longer needed code.

4 years agoMFC r352013:
Konstantin Belousov [Sat, 14 Sep 2019 13:27:07 +0000 (13:27 +0000)]
MFC r352013:
vm_object_coalesce(): avoid extending any nosplit objects, not only
that which back tmpfs nodes.

4 years agoMFC r352012:
Konstantin Belousov [Sat, 14 Sep 2019 13:25:54 +0000 (13:25 +0000)]
MFC r352012:
Properly check for writers when fetching quotas for writeable vnodes
in UFS quotaon().

4 years agoMFC r351218:
Emmanuel Vadot [Fri, 13 Sep 2019 21:28:08 +0000 (21:28 +0000)]
MFC r351218:

ti: sdhci: Correct voltage caps

ti,dual-volt property say that the eMMC support 1.8V and 3.3V not 3.0V
Use the correct caps for the mmc stack.
Note that the MMCHS_SD_CAPA register can only be written once after bootup
so if one is using a u-boot compiled with eMMC support (this is the default)
this code is a no-op but just in case someone have u-boot compiled without
eMMC support this make eMMC works when the kernel is booted.

4 years agoMFC r351184, r351189, r351217
Emmanuel Vadot [Fri, 13 Sep 2019 21:20:24 +0000 (21:20 +0000)]
MFC r351184, r351189, r351217

r351184:
Add method for getting of syscon handle from parent device.

If simple multifuction device also provides syscon interface, its
childern should be able to consume it. Due to this:
- declare coresponding method in syscon interface
- implement it in simple multifunction device driver

r351189:
Fix bug introduced by r351184.
We should check the returned handle, not the pointer to it.

Noticed by: ian
X-MFC with: r351184

r351217:
arm64: a37x0_gpio: Use syscon instead of MMIO region

The fdt node for this driver is a simple-mfd and syscon compatible one
meaning that simplemfd will be the driver attached for it. The gpio driver
is attached to the 'gpio' subnode so use syscon_get_handle_default to
obtain the handle of the syscon from the parent device and use this
to read/write to the memory region.

4 years agoMFC r352201: Fix assumptions of only one device per SES slot.
Alexander Motin [Fri, 13 Sep 2019 15:48:11 +0000 (15:48 +0000)]
MFC r352201: Fix assumptions of only one device per SES slot.

It is typical to have one, but no longer true for multi-actuator HDDs
with separate LUN for each actuator.

4 years agoMFC r352257: Report Trusted Computing feature set support.
Alexander Motin [Fri, 13 Sep 2019 15:21:18 +0000 (15:21 +0000)]
MFC r352257: Report Trusted Computing feature set support.

It practically means the device is SED.

4 years agoMFC r352200: Remove struct ata_res_pass16, unneeded after r352082.
Alexander Motin [Fri, 13 Sep 2019 15:19:50 +0000 (15:19 +0000)]
MFC r352200: Remove struct ata_res_pass16, unneeded after r352082.

4 years agoMFC r352111: Initialize page/subpage in case of `modepage -d`.
Alexander Motin [Fri, 13 Sep 2019 15:18:28 +0000 (15:18 +0000)]
MFC r352111: Initialize page/subpage in case of `modepage -d`.

Previously without -m parameter it worked mostly by concodence.

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

4 years agoMFC r352082, r352103: Fix number of problems found while testing on SAT devices.
Alexander Motin [Fri, 13 Sep 2019 15:15:58 +0000 (15:15 +0000)]
MFC r352082, r352103: Fix number of problems found while testing on SAT devices.

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

4 years agoMFC r352018: Unify cam_send_ccb() error reporting.
Alexander Motin [Fri, 13 Sep 2019 14:43:44 +0000 (14:43 +0000)]
MFC r352018: Unify cam_send_ccb() error reporting.

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

4 years agoMFC r352011: Supply SAT layer with valid transfer sizes.
Alexander Motin [Fri, 13 Sep 2019 14:42:37 +0000 (14:42 +0000)]
MFC r352011: Supply SAT layer with valid transfer sizes.

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

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

4 years agoMFC r352072:
Michael Tuexen [Fri, 13 Sep 2019 08:14:46 +0000 (08:14 +0000)]
MFC r352072:

Only update SACK/DSACK lists when a non-empty segment was received.
This fixes hitting a KASSERT with a valid packet exchange.

PR: 240471
Reviewed by: rrs@, Richard Scheffenegger
Sponsored by: Neflix, Inc.
Differential Revision: https://reviews.freebsd.org/D21567

4 years agoMFC r352127:
Baptiste Daroussin [Fri, 13 Sep 2019 07:18:32 +0000 (07:18 +0000)]
MFC r352127:

In FreeBSD 11 localedef(1) has replaced the mklocale(1) and colldef(1)
tools to generate the locales data. state it in the libc manpages.

4 years agoMFC r352126:
Baptiste Daroussin [Fri, 13 Sep 2019 07:15:48 +0000 (07:15 +0000)]
MFC r352126:

Remove reference to mklocale regarding the nls directory

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

4 years agoMFC r352065-r352070
Baptiste Daroussin [Fri, 13 Sep 2019 07:10:50 +0000 (07:10 +0000)]
MFC r352065-r352070

Sync with OpenBSD, in particular this adds support for -E flags
(GNU compatibility)

4 years agoMFC r352119-r352124, r352130
Baptiste Daroussin [Fri, 13 Sep 2019 07:08:43 +0000 (07:08 +0000)]
MFC r352119-r352124, r352130

Stop linking to libl by specifying we do not need yywrap

4 years agoUse file destdir for stage_as sets
Simon J. Gerraty [Fri, 13 Sep 2019 05:54:09 +0000 (05:54 +0000)]
Use file destdir for stage_as sets

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

MFC r351954

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org//D21283

4 years agoMFC r351445:
Navdeep Parhar [Fri, 13 Sep 2019 01:14:58 +0000 (01:14 +0000)]
MFC r351445:

whitespace nit.

4 years agoMFC r351540, r351590
Navdeep Parhar [Fri, 13 Sep 2019 01:12:17 +0000 (01:12 +0000)]
MFC r351540, r351590

r351540:
cxgbe/t4_tom: Initialize all TOE connection parameters in one place.
Remove now-redundant items from toepcb and synq_entry and the code to
support them.

Let the driver calculate tx_align, rx_coalesce, and sndbuf by default.

Reviewed by: jhb@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D21387

r351590:
cxgbe/t4_tom: Use the correct value of sndbuf in AIO Tx.

This should have been part of r351540.

Sponsored by: Chelsio Communications

4 years agoMFC r351524:
Navdeep Parhar [Fri, 13 Sep 2019 00:58:33 +0000 (00:58 +0000)]
MFC r351524:

cxgbe/t4_tom: Limit work requests with immediate payload to a single
descriptor.  The per-tid tx credits are in demand during active Tx and
it's best not to use too many just for payload.

Sponsored by: Chelsio Communications

4 years agoMFC r351446:
Navdeep Parhar [Fri, 13 Sep 2019 00:53:09 +0000 (00:53 +0000)]
MFC r351446:

cxgbe/t4_tom: Any invalid scaling factor in the hardware's wsf field
implies that window scaling is not in use.

Sponsored by: Chelsio Communications

4 years agoMFC r345103:
Johannes Lundberg [Thu, 12 Sep 2019 21:12:39 +0000 (21:12 +0000)]
MFC r345103:
Implement more PCI speed related functions and macros in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

4 years agoMFC r345100:
Johannes Lundberg [Thu, 12 Sep 2019 20:15:04 +0000 (20:15 +0000)]
MFC r345100:
Implement task_euid() and get_task_state() function macros in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

4 years agoMFC r351172:
Alan Somers [Thu, 12 Sep 2019 16:23:22 +0000 (16:23 +0000)]
MFC r351172:

ping6: Raise WARNS level to 6

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21260

4 years agoMFC r351865, r351837:
Toomas Soome [Thu, 12 Sep 2019 06:26:22 +0000 (06:26 +0000)]
MFC r351865, r351837:
ficl: add xemit word
ficl: add uIsGreater word (needed for xemit)

We need xemit to support userboot.so loading images from CURRENT.

4 years agoMFC r348268 (by sef), r348293 (by cem):
Alexander Motin [Wed, 11 Sep 2019 23:45:58 +0000 (23:45 +0000)]
MFC r348268 (by sef), r348293 (by cem):
Add an AESNI-optimized version of the CCM/CBC cryptographic and authentication
code.  The primary client of this is probably going to be ZFS encryption.

4 years agoMFC r342024 (by mmacy): Generalize AES iov optimization
Alexander Motin [Wed, 11 Sep 2019 23:41:09 +0000 (23:41 +0000)]
MFC r342024 (by mmacy): Generalize AES iov optimization

Right now, aesni_cipher_alloc does a bit of special-casing
for CRYPTO_F_IOV, to not do any allocation if the first uio
is large enough for the requested size. While working on ZFS
crypto port, I ran into horrible performance because the code
uses scatter-gather, and many of the times the data to encrypt
was in the second entry. This code looks through the list, and
tries to see if there is a single uio that can contain the
requested data, and, if so, uses that.

This has a slight impact on the current consumers, in that the
check is a little more complicated for the ones that use
CRYPTO_F_IOV -- but none of them meet the criteria for testing
more than one.

4 years agoMFC r350993, r350997, r351079-r351080, r351082, r351090, r351101-r351102
Alan Somers [Wed, 11 Sep 2019 20:13:38 +0000 (20:13 +0000)]
MFC r350993, r350997, r351079-r351080, r351082, r351090, r351101-r351102

r350993:
Consistently use the byteorder functions in the correct direction

Though ntohs and htons are functionally identical, they have different meanings.Using the correct one helps to document the code.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21219

r350997:
ping6: use the monotonic clock to measure durations

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21226

r351079:
ping6: quiet warning about unused copyright variable

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21270

r351080:
ping6: quiet an undefined variable warning

GCC 4.2 isn't smart enough to know that this variable is already defined by
the time it's used.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21269

r351082:
ping6: fix uninitialized variable warning for intvl

GCC isn't smart enough to realize that this variable was always initialized.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21271

r351090:
ping6: Fix data type of the buffer for ancillary data of a received message

The old code worked, but wasted some stack space.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21275

r351101:
ping6: fix uninitialized variable warnings when MK_CASPER=no

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21273

r351102:
ping6: Fix alignment errors

This fixes -Wcast-align errors when compiled with WARNS=6.

Submitted by: Ján Sučan <sucanjan@gmail.com>
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21217

4 years agoFix miss merge in r352179.
Mariusz Zaborski [Wed, 11 Sep 2019 16:06:05 +0000 (16:06 +0000)]
Fix miss merge in r352179.

4 years agoMFC r351830:
Konstantin Belousov [Wed, 11 Sep 2019 04:55:10 +0000 (04:55 +0000)]
MFC r351830:
madvise(MADV_FREE): Quick fix to time rewind.

PR: 240061

4 years agoMFC: r352197
Jung-uk Kim [Tue, 10 Sep 2019 22:26:31 +0000 (22:26 +0000)]
MFC: r352197

Remove unnecessary entries from the previous commit.

4 years agoMFC: r352191
Jung-uk Kim [Tue, 10 Sep 2019 21:13:37 +0000 (21:13 +0000)]
MFC: r352191

Merge OpenSSL 1.1.1d.

4 years agoMFCr350429:
Mariusz Zaborski [Tue, 10 Sep 2019 20:55:47 +0000 (20:55 +0000)]
MFCr350429:
  proc: make clear_orphan an public API

  This will be useful for other patches with process descriptors.
  Change its name as well.

  Reviewed by:  markj, kib

4 years agoMFCr340638:
Mariusz Zaborski [Tue, 10 Sep 2019 20:49:47 +0000 (20:49 +0000)]
MFCr340638:
 libcasper: provide compatibility with the old version of service

  Some external tools like tcpdump(1) have upstream the changes with old limits
  name. Because of that provide compatibility with the old names.

  Reported by:  emaste

4 years agoMFCr340363:
Mariusz Zaborski [Tue, 10 Sep 2019 20:45:51 +0000 (20:45 +0000)]
MFCr340363:
  libcasper: Change the name of limits in cap_dns so the intentions are obvious.

  Reported by:  pjd

4 years agoMFCr340141:
Mariusz Zaborski [Tue, 10 Sep 2019 20:41:42 +0000 (20:41 +0000)]
MFCr340141:
  libcasper: fix limitations in dns service

  The getaddrinfo(3) and gethostbyname(3) are used to return the address for a
  given hostname. The getnameinfo(3) and gethostbyaddr(3) are used to return
  hostname for a given address. Right now in casper, we have two limitations:
  - NAME which allows resolving DNS names.
  - ADDR which allows to do revert DNS lookups.

  Before this change the rights was mixed up:
  NAME - getnameinfo(3) and gethostbyname(3)
  ADDR - gethostbyaddr(3) and getaddrinfo(3)

  Which no matters on limitation allowed us to resolve DNS names and do DNS
  lookups basically by using a different set of functions.

  Now the NAME type allows getaddrinfo(3) and gethostbyname (3)functions,
  and the ADDR names allow to use gethostbyaddr(3) and getnameinfo(3) functions.

  Reviewed by:  pjd, bcr
  Discussed with:       hrs
  Differential Revision:        https://reviews.freebsd.org/D16930

4 years agoMFCr350617:
Mariusz Zaborski [Tue, 10 Sep 2019 20:21:47 +0000 (20:21 +0000)]
MFCr350617:
  procdesc: fix the function name

  I changed name of the function r350429 and forgot to update
  the r350612 patch.

  Reported by:  jenkins

4 years agoMFCr350616:
Mariusz Zaborski [Tue, 10 Sep 2019 20:20:45 +0000 (20:20 +0000)]
MFCr350616:
  process: style

  We don't need to check if the parent is already set.
  This is done already in the proc_reparent.

  No functional behaviour changes intended.

  MFC after:    1 month

4 years agoMFCr350614:
Mariusz Zaborski [Tue, 10 Sep 2019 20:19:02 +0000 (20:19 +0000)]
MFCr350614:
  exit1: fix style nits

4 years agoMFCr350612
Mariusz Zaborski [Tue, 10 Sep 2019 20:18:06 +0000 (20:18 +0000)]
MFCr350612
  procdesc: fix reparenting when the debugger is attached

  The process is reparented to the debugger while it is attached.
    B          B
   /   ---->   |
  A          A D

  Every time when the process is reparented, it is added to the orphan list
  of the previous parent:

  A->orphan = B
  D->orphan = NULL

  When the A process will close the process descriptor to the B process,
  the B process will be reparented to the init process.
    B            B - init
    |   ---->
  A D          A   D

  A->orphan = B
  D->orphan = B

  In this scenario, the B process is in the orphan list of A and D.

  When the last process descriptor is closed instead of reparenting
  it to the reaper let it stay with the debugger process and set
  our previews parent to the reaper.

  Add test case for this situation.
  Notice that without this patch the kernel will crash with this test case:
  panic: orphan 0xfffff8000e990530 of 0xfffff8000e990000 has unexpected oppid 1

  Reviewed by:  markj, kib
  Differential Revision:        https://reviews.freebsd.org/D20361

4 years agoMFCr350611:
Mariusz Zaborski [Tue, 10 Sep 2019 20:15:52 +0000 (20:15 +0000)]
MFCr350611:
  proc: introduce the proc_add_orphan function

  This API allows adding the process to its parent orphan list.

  Reviewed by:  kib, markj

4 years agoMFCr350610:
Mariusz Zaborski [Tue, 10 Sep 2019 20:14:52 +0000 (20:14 +0000)]
MFCr350610:
  exit1: postpone clearing P_TRACED flag until the proctree lock is acquired

  In case of the process being debugged. The P_TRACED is cleared very early,
  which would make procdesc_close() not calling proc_clear_orphan().
  That would result in the debugged process can not be able to collect
  status of the process with process descriptor.

  Reviewed by:  markj, kib
  Tested by:    pho

4 years agoMFC r351774:
Konstantin Belousov [Tue, 10 Sep 2019 06:47:40 +0000 (06:47 +0000)]
MFC r351774:
Add stackgap control mode to proccontrol(1).

PR: 239894

4 years agoMFC r351773:
Konstantin Belousov [Tue, 10 Sep 2019 06:45:44 +0000 (06:45 +0000)]
MFC r351773:
Add procctl(PROC_STACKGAP_CTL).

PR: 239894

4 years agoMFC r351937:
Johannes Lundberg [Tue, 10 Sep 2019 02:21:17 +0000 (02:21 +0000)]
MFC r351937:
LinuxKPI: Improve sysfs support.

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

Reviewed by: hselasky
Approved by: imp (mentor), hselasky

4 years agoMFC 351897: nvdimm(4): Add description of NVDIMM Namespace support
D Scott Phillips [Mon, 9 Sep 2019 21:03:08 +0000 (21:03 +0000)]
MFC 351897: nvdimm(4): Add description of NVDIMM Namespace support

Approved by: scottl (mentor)
Sponsored by: Intel Corporation

4 years agoMFC 348757,351225: acpi and nvdimm location_str updates
D Scott Phillips [Mon, 9 Sep 2019 20:49:37 +0000 (20:49 +0000)]
MFC 348757,351225: acpi and nvdimm location_str updates

348757:
nvdimm: Provide nvdimm location information

Provide the acpi handle path as the location string for the nvdimm
children of the nvdimm_root device.

351225:
Don't set the string "unknown" as a device's location_str

Return an empty string when the location is unknown instead of the
string "unknown". This ensures that all location entries are of
the form key=val.

Approved by: scottl (mentor)
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20644

4 years agoMFC r351663: ar: use more correct size_t type for loop index
Ed Maste [Mon, 9 Sep 2019 20:04:45 +0000 (20:04 +0000)]
MFC r351663: ar: use more correct size_t type for loop index

Submitted by: cem

4 years agoMFC r351197, r351199:
Vladimir Kondratyev [Mon, 9 Sep 2019 18:57:17 +0000 (18:57 +0000)]
MFC r351197, r351199:

iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices

Currently supported models are: 8260, 8265, 9560, 9260 and 22161.
Firmware files can be installed with comms/iwmbt-firmware port.

PR: 237083
Reviewed by: hps, emax
Differential Revision: https://reviews.freebsd.org/D21071

4 years agoMFC r351196, r351324, r351326:
Vladimir Kondratyev [Mon, 9 Sep 2019 18:50:38 +0000 (18:50 +0000)]
MFC r351196, r351324, r351326:

ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode.

Add helper function for synchronous execution of HCI commands at probe
stage and use this function to check firmware state of Intel Wireless
8260/8265 bluetooth devices found in many post 2016 year laptops.

Attempt to initialize FreeBSD bluetooth stack while such a device is in
bootloader mode locks the adapter hardly so it requires power on/off
cycle to restore.

This change blocks ng_ubt attachment unless operational firmware is
loaded thus preventing the lock up.

PR: 237083
Reviewed by: hps, emax
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21071

4 years agoMFC: r351429,351430,351485,351497,351498
Warner Losh [Mon, 9 Sep 2019 18:27:52 +0000 (18:27 +0000)]
MFC: r351429,351430,351485,351497,351498

Merge changes to turn off -Werror for gcc 4.2.1 by default as part of
the plan to deorbit gcc 4.2.1 from -head before 13.0.

Relnotes: Yes

4 years agoBack out r352087 for now
Kyle Evans [Mon, 9 Sep 2019 18:20:55 +0000 (18:20 +0000)]
Back out r352087 for now

The ancient-gcc -Wno-error series hasn't been MFC'd yet to this branch and
some GCC builds seem to have raised a false-positive that wasn't caught due
to -Wno-error on head. Back it out for now, will reapply when r352092
becomes eligible for MFC...