]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoRemove the obsolete pcpu_zone_ptr zone.
Mateusz Guzik [Sat, 24 Aug 2019 00:01:19 +0000 (00:01 +0000)]
Remove the obsolete pcpu_zone_ptr zone.

It was only used by flowtable (removed in r321618).

Sponsored by: The FreeBSD Foundation

4 years agoIt turns out the duplication is only mostly harmless.
Warner Losh [Fri, 23 Aug 2019 22:52:58 +0000 (22:52 +0000)]
It turns out the duplication is only mostly harmless.

While it worked with the kenrel, it wasn't working with the loader.
It failed to handle dependencies correctly. The reason for that is
that we never created a nvme module with the DRIVER_MODULE, but
instead a nvme_pci and nvme_ahci module. Create a real nvme module
that nvd can be dependent on so it can import the nvme symbols it
needs from there.

Arguably, nvd should just be a simple child of nvme, but transitioning
to that (and winning that argument given why it was done this way) is
beyond the scope of this change.

Reviewed by: jhb@
Differential Revision: https://reviews.freebsd.org/D21382

4 years agocxgbe/t4_tom: Any invalid scaling factor in the hardware's wsf field
Navdeep Parhar [Fri, 23 Aug 2019 22:41:16 +0000 (22:41 +0000)]
cxgbe/t4_tom: Any invalid scaling factor in the hardware's wsf field
implies that window scaling is not in use.

MFC after: 3 days
Sponsored by: Chelsio Communications

4 years agowhitespace nit.
Navdeep Parhar [Fri, 23 Aug 2019 22:34:14 +0000 (22:34 +0000)]
whitespace nit.

4 years agocxgbe(4): Use the same buffer size for TOE rx queues as the NIC rx queues.
Navdeep Parhar [Fri, 23 Aug 2019 22:22:34 +0000 (22:22 +0000)]
cxgbe(4): Use the same buffer size for TOE rx queues as the NIC rx queues.

This is a minor simplification.

MFC after: 1 week
Sponsored by: Chelsio Communications

4 years agoping: Fix alignment errors
Alan Somers [Fri, 23 Aug 2019 22:04:26 +0000 (22:04 +0000)]
ping: Fix alignment errors

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

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

4 years agovfs: assert the lock held in MNT_REF/MNT_REL
Mateusz Guzik [Fri, 23 Aug 2019 21:05:37 +0000 (21:05 +0000)]
vfs: assert the lock held in MNT_REF/MNT_REL

Sponsored by: The FreeBSD Foundation

4 years agoStop clearing page flags in vm_page_pqbatch_submit().
Mark Johnston [Fri, 23 Aug 2019 19:53:11 +0000 (19:53 +0000)]
Stop clearing page flags in vm_page_pqbatch_submit().

All existing callers guarantee that the page does not have a
pre-existing dequeue pending.  Thus, if the page is dequeued before
pqbatch_submit() acquires the page queue lock, we do not need to do
anything since vm_page_dequeue_complete() takes care of clearing all
page queue state flags for us.

With this change, vm_page_pqbatch_submit() has the nice property that it
does not directly modify any fields in the page structure.

Reviewed by: alc, kib
Tested by: pho (part of a larger change)
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21372

4 years agoMake vm_pqbatch_submit_page() externally visible.
Mark Johnston [Fri, 23 Aug 2019 19:49:29 +0000 (19:49 +0000)]
Make vm_pqbatch_submit_page() externally visible.

It will become useful for the page daemon to be able to directly create
a batch queue entry for a page, and without modifying the page
structure.  Rename vm_pqbatch_submit_page() to vm_page_pqbatch_submit()
to keep the namespace consistent.  No functional change intended.

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

4 years agoDe-commision the MNTK_NOINSMNTQ kernel mount flag.
Konstantin Belousov [Fri, 23 Aug 2019 19:40:10 +0000 (19:40 +0000)]
De-commision the MNTK_NOINSMNTQ kernel mount flag.

After all the changes, its dynamic scope is same as for MNTK_UNMOUNT,
but to allow the syncer vnode to be re-installed on unmount failure.
But the case of syncer was already handled by using the VV_FORCEINSMQ
flag for quite some time.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix universe to include arm LINT kernel configs.
John Baldwin [Fri, 23 Aug 2019 18:26:34 +0000 (18:26 +0000)]
Fix universe to include arm LINT kernel configs.

Strip comments from the NOTES.armv[57] files as is done for other
NOTES files when building the corresponding LINT configs.  Without
this, the LINT configs contained the NO_UNIVERSE comment from the
NOTES.armv[57] files.

Reviewed by: imp
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21264

4 years agoTurn off -Werror for gcc 4.2.1 for userland
Warner Losh [Fri, 23 Aug 2019 16:42:39 +0000 (16:42 +0000)]
Turn off -Werror for gcc 4.2.1 for userland

As discussed on arch@, gcc 4.2.1 is on its way out. Turn off Werror on gcc
versions < 5.0 permantly. This will allow older platforms to continue to compile
w/o new errors once we take them out of universe by default. This will also free
developers from chasing down obsolete warnings that produce no beneficial
changes to the source.

Discussed on: arch@
Reviewed by: jhb@, emaste@, pfg@
Differential Revision: https://reviews.freebsd.org/D21378

4 years agoTurn off -Werror for gcc 4.2.1
Warner Losh [Fri, 23 Aug 2019 16:42:04 +0000 (16:42 +0000)]
Turn off -Werror for gcc 4.2.1

As part of marching gcc 4.2.1 out of the tree, turn off -Werror on gcc 4.2.1
compiles by default. It generates too many false positives and breaks CI
for no benefit.

Discussed on: arch@
Reviewed by: jhb@, emaste@, pfg@
Differential Revision: https://reviews.freebsd.org/D21378

4 years agovtfontcvt: simplify rshift_row
Ed Maste [Fri, 23 Aug 2019 16:03:23 +0000 (16:03 +0000)]
vtfontcvt: simplify rshift_row

We don't need to specify the buffer size in both bytes and bits.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoping: fix include guard symbol name to reflect the header file name
Alan Somers [Fri, 23 Aug 2019 15:24:18 +0000 (15:24 +0000)]
ping: fix include guard symbol name to reflect the header file name

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

4 years agoping6: Rename options for better consistency with ping
Alan Somers [Fri, 23 Aug 2019 15:22:20 +0000 (15:22 +0000)]
ping6: Rename options for better consistency with ping

Now equivalent options have the same flags, and nonequivalent options have
different flags.  This is a prelude to merging the two commands.

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

4 years agoReport Clock Power Management support and status.
Alexander Motin [Fri, 23 Aug 2019 15:17:04 +0000 (15:17 +0000)]
Report Clock Power Management support and status.

Since we already report ASPM, why not to go further.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agonetpfil tests: Add forward test for the three firewalls
Kristof Provost [Fri, 23 Aug 2019 12:11:46 +0000 (12:11 +0000)]
netpfil tests: Add forward test for the three firewalls

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21321

4 years agoConvert ng_deflate to use new zlib.
Xin LI [Fri, 23 Aug 2019 07:24:36 +0000 (07:24 +0000)]
Convert ng_deflate to use new zlib.

This removes the last consumer of the modified zlib originally
bundled with Paul's PPP implementation, which will be removed
in a follow up commit.

PR: 229763
Differential Revision: https://reviews.freebsd.org/D21186

4 years agoINVARIANTS: treat LA_LOCKED as the same of LA_XLOCKED in mtx_assert.
Xin LI [Fri, 23 Aug 2019 06:39:40 +0000 (06:39 +0000)]
INVARIANTS: treat LA_LOCKED as the same of LA_XLOCKED in mtx_assert.

The Linux lockdep API assumes LA_LOCKED semantic in lockdep_assert_held(),
meaning that either a shared lock or write lock is Ok.  On the other hand,
the timeout code uses lc_assert() with LA_XLOCKED, and we need both to
work.

For mutexes, because they can not be shared (this is unique among all lock
classes, and it is unlikely that we would add new lock class anytime soon),
it is easier to simply extend mtx_assert to handle LA_LOCKED there, despite
the change itself can be viewed as a slight abstraction violation.

Reviewed by: mjg, cem, jhb
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D21362

4 years agolib.libc.gen.getmntinfo_test.getmntinfo_test is unstable since 8/20, skip it
Li-Wen Hsu [Fri, 23 Aug 2019 05:25:21 +0000 (05:25 +0000)]
lib.libc.gen.getmntinfo_test.getmntinfo_test is unstable since 8/20, skip it
in CI env temporarily for more offline diagnosis

PR: 240049
Sponsored by: The FreeBSD Foundation

4 years agoProperly update FSInfo block after generation.
Xin LI [Fri, 23 Aug 2019 05:23:45 +0000 (05:23 +0000)]
Properly update FSInfo block after generation.

After populating the filesystem, write a FSInfo block with
proper information.

Reviewed by: emaste, cem
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21363

4 years agolast(1): unbreak for 8-bit locales
Eugene Grosbein [Fri, 23 Aug 2019 01:25:38 +0000 (01:25 +0000)]
last(1): unbreak for 8-bit locales

Ouput format of last(1) is broken for non UTF-8 locales
since it got libxo(3) support. It uses strftime(3) that produces
non UTF-8 strings passed to xo_emit(3) with wrong %s format -
it should be %hs in this case, so xo_emit(3) produces empty output.

This change is basically no-op when locale is of UTF-8 type,
f.e. en_GB.UTF-8 or ru_RU.UTF-8 or sr_RS.UTF-8@latin.
It fixes output for other locales.

MFC after: 2 weeks

4 years agostand: boot2: fix amd64-xtoolchain-gcc build
Kyle Evans [Fri, 23 Aug 2019 01:16:12 +0000 (01:16 +0000)]
stand: boot2: fix amd64-xtoolchain-gcc build

-Wno-missing-declarations is the GCC equivalent of
-Wno-missing-prototypes... this was overlooked in r351135.

MFC after: 3 days
X-MFC-With: r351135

4 years agoWhen we have errors resetting the device before we allocate the
Warner Losh [Thu, 22 Aug 2019 21:56:11 +0000 (21:56 +0000)]
When we have errors resetting the device before we allocate the
queues, don't try to tear them down in the ctrlr_destroy
path. Otherwise, we dereference queue structures that are NULL and we
trap.

This fix is incomplete: we leak IRQ and MSI resources when this
happens. That's preferable to a crash but still should be fixed.

4 years agolibsa: mips: fix typo that had slipped into the diff on local machine
Kyle Evans [Thu, 22 Aug 2019 21:49:13 +0000 (21:49 +0000)]
libsa: mips: fix typo that had slipped into the diff on local machine

MFC after: 1 week
X-MFC-With: r351408

4 years agomips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM
Kyle Evans [Thu, 22 Aug 2019 21:43:21 +0000 (21:43 +0000)]
mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUM

machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via
machine/reg.h. Many of the regnum definitions are too short and too generic
to be exposing to any userland application including one of these two
headers. Moreover, these actively cause build failures in googletest
(template <typename T1 ...> expanding to template <typename 9 ...>).

Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of
the userland consumers to define as needed.

Discussed with: imp, jhb
Reviewed by: imp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21330

4 years agolibsa: mips: use _JB_* from machine/asm.h, remove regnum dep
Kyle Evans [Thu, 22 Aug 2019 21:42:11 +0000 (21:42 +0000)]
libsa: mips: use _JB_* from machine/asm.h, remove regnum dep

This brings the libsa/mips _setjmp implementation closer to parity with the
libc version.

Reviewed by: imp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21330

4 years agolibc: mips: remove unused longjmp.c
Kyle Evans [Thu, 22 Aug 2019 21:40:56 +0000 (21:40 +0000)]
libc: mips: remove unused longjmp.c

Reviewed by: imp, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21330

4 years agoWe need to define version 1 of nvme, not nvme_foo. Otherwise nvd won't
Warner Losh [Thu, 22 Aug 2019 21:12:51 +0000 (21:12 +0000)]
We need to define version 1 of nvme, not nvme_foo. Otherwise nvd won't
load and people who pull in nvme/nvd from modules can't load nvd.ko
since it depends on nvme, not nvme_foo. The duplicate doesn't matter
since kldxref properly handles that case.

4 years agoMove releasing of resources to later
Warner Losh [Thu, 22 Aug 2019 20:09:32 +0000 (20:09 +0000)]
Move releasing of resources to later

Turn off bus master after we detach the device (to match the prior
order).  Release MSI after we're done detaching and have turned off
all the interrupts. Otherwise this may cause problems as other threads
race nvme_detach. This more closely matches the old order.

Reviewed by: mav@

4 years agoFix the build with WITHOUT_GOOGLETEST
Kyle Evans [Thu, 22 Aug 2019 19:10:31 +0000 (19:10 +0000)]
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).

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D21367

4 years agoping: By default, don't reverse lookup IP addresses
Alan Somers [Thu, 22 Aug 2019 18:57:24 +0000 (18:57 +0000)]
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 after: 2 weeks
MFC-With: 351330
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21364

4 years agoMFV r346563:
Cy Schubert [Thu, 22 Aug 2019 18:52:30 +0000 (18:52 +0000)]
MFV r346563:

Update wpa 2.8 --> 2.9

hostapd:
* SAE changes
  - disable use of groups using Brainpool curves
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* EAP-pwd changes
  - disable use of groups using Brainpool curves
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* fixed FT-EAP initial mobility domain association using PMKSA caching
* added configuration of airtime policy
* fixed FILS to and RSNE into (Re)Association Response frames
* fixed DPP bootstrapping URI parser of channel list
* added support for regulatory WMM limitation (for ETSI)
* added support for MACsec Key Agreement using IEEE 802.1X/PSK
* added experimental support for EAP-TEAP server (RFC 7170)
* added experimental support for EAP-TLS server with TLS v1.3
* added support for two server certificates/keys (RSA/ECC)
* added AKMSuiteSelector into "STA <addr>" control interface data to
  determine with AKM was used for an association
* added eap_sim_id parameter to allow EAP-SIM/AKA server pseudonym and
  fast reauthentication use to be disabled
* fixed an ECDH operation corner case with OpenSSL

wpa_supplicant:
* SAE changes
  - disable use of groups using Brainpool curves
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* EAP-pwd changes
  - disable use of groups using Brainpool curves
  - allow the set of groups to be configured (eap_pwd_groups)
  - improved protection against side channel attacks
  [https://w1.fi/security/2019-6/]
* fixed FT-EAP initial mobility domain association using PMKSA caching
  (disabled by default for backwards compatibility; can be enabled
  with ft_eap_pmksa_caching=1)
* fixed a regression in OpenSSL 1.1+ engine loading
* added validation of RSNE in (Re)Association Response frames
* fixed DPP bootstrapping URI parser of channel list
* extended EAP-SIM/AKA fast re-authentication to allow use with FILS
* extended ca_cert_blob to support PEM format
* improved robustness of P2P Action frame scheduling
* added support for EAP-SIM/AKA using anonymous@realm identity
* fixed Hotspot 2.0 credential selection based on roaming consortium
  to ignore credentials without a specific EAP method
* added experimental support for EAP-TEAP peer (RFC 7170)
* added experimental support for EAP-TLS peer with TLS v1.3
* fixed a regression in WMM parameter configuration for a TDLS peer
* fixed a regression in operation with drivers that offload 802.1X
  4-way handshake
* fixed an ECDH operation corner case with OpenSSL

MFC after: 1 week
Security: https://w1.fi/security/2019-6/\
sae-eap-pwd-side-channel-attack-update.txt

4 years agomakefs: diff reduction to sys/fs/msdosfs
Ed Maste [Thu, 22 Aug 2019 17:49:34 +0000 (17:49 +0000)]
makefs: diff reduction to sys/fs/msdosfs

No functional change.

4 years agomsdosfs_fat: reduce diffs with NetBSD and makefs
Ed Maste [Thu, 22 Aug 2019 16:06:52 +0000 (16:06 +0000)]
msdosfs_fat: reduce diffs with NetBSD and makefs

Use pointer arithmetic (as now done in makefs, and in NetBSD) instead of
taking the address of array element.  No functional change, but this
makes it easier to compare different versions of this file.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21365

4 years agoping6: add a basic functional test
Alan Somers [Thu, 22 Aug 2019 15:08:04 +0000 (15:08 +0000)]
ping6: add a basic functional test

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

4 years agoping: add a basic functional test
Alan Somers [Thu, 22 Aug 2019 15:00:36 +0000 (15:00 +0000)]
ping: add a basic functional test

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

4 years agoFix path issues after r351212
Li-Wen Hsu [Thu, 22 Aug 2019 12:08:35 +0000 (12:08 +0000)]
Fix path issues after r351212

This fixes sys.netpfil.pf.forward.v4 and sys.netpfil.pf.icmp.cve_2019_5598
failures in CI system.

Sponsored by: The FreeBSD Foundation

4 years agoReorganise conditionals to reduce duplication.
Brooks Davis [Thu, 22 Aug 2019 10:21:07 +0000 (10:21 +0000)]
Reorganise conditionals to reduce duplication.

No functional change.

Obtained from: CheriBSD
MFC after: 3 days
Sponsored by: DARPA, AFRL

4 years agousb: fix usb_fdt_support.c when altq enabled (usb_ehernet.h changes)
Bjoern A. Zeeb [Thu, 22 Aug 2019 09:24:43 +0000 (09:24 +0000)]
usb: fix usb_fdt_support.c when altq enabled (usb_ehernet.h changes)

After r351243 when ALTQ was enabled in the kernel, the inline functions
in ifq.h would not have full type information as if_var.h was not
included.

Given usb_ethernet.h already includes all the various headers (which)
is the cause of the problem here, add if_var.h to it.  This fixes the
builds again.

Reported by: CI system, e.g. FreeBSD-head-aarch64-LINT

4 years agow: initialize save_p to silence 'may be used uninitilized'
Bjoern A. Zeeb [Thu, 22 Aug 2019 07:52:06 +0000 (07:52 +0000)]
w: initialize save_p to silence 'may be used uninitilized'

After r351379 save_p may be used uninitialized.  Set it to NULL before
first assignment so that a later NULL check will work correctly.

Reported by: CI system for gcc platforms
MFC after: 1 week
X-MFC with: 351379 (karels)

4 years agoWhen creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for
Xin LI [Thu, 22 Aug 2019 06:14:06 +0000 (06:14 +0000)]
When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for
FSI_Nxt_Free instead of providing a wrong value.

With this change, fsck_msdosfs would no longer complain about invalid
FSInfo information.

MFC after: 2 weeks

4 years agoFix i386 build after r351368
Conrad Meyer [Thu, 22 Aug 2019 04:31:07 +0000 (04:31 +0000)]
Fix i386 build after r351368

Reported by: cy
Submitted by: cy

4 years agoSpecifying array sizes for fully initialized tables at compile time is
Cy Schubert [Thu, 22 Aug 2019 03:33:10 +0000 (03:33 +0000)]
Specifying array sizes for fully initialized tables at compile time is
redundant.

MFC after: 1 week

4 years agoChange w(1) to compute FROM (host) field size dynamically
Mike Karels [Thu, 22 Aug 2019 03:28:31 +0000 (03:28 +0000)]
Change w(1) to compute FROM (host) field size dynamically

It's nice to be able to display a full IPv6 host address if
needed, but it's also nice to display more than 3 characters of a command
line. Compute the needed size for the FROM column in an earlier pass,
and determine the maximum, then print what fits for the command.

Reviewed by: marcel@ (markm@ previous revision)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21211

4 years agoImport wpa_supplicant/hostapd 2.9
Cy Schubert [Thu, 22 Aug 2019 02:58:49 +0000 (02:58 +0000)]
Import wpa_supplicant/hostapd 2.9

4 years agoRemove stray line that was duplicated.
Warner Losh [Thu, 22 Aug 2019 02:53:51 +0000 (02:53 +0000)]
Remove stray line that was duplicated.

Noticed by: rpokala@

4 years agoDocument Intel RST support just added
Warner Losh [Thu, 22 Aug 2019 02:53:46 +0000 (02:53 +0000)]
Document Intel RST support just added

4 years agoAdd a couple of lines noting that r351372 maps ENOTTY->EINVAL for other cases.
Rick Macklem [Thu, 22 Aug 2019 01:29:59 +0000 (01:29 +0000)]
Add a couple of lines noting that r351372 maps ENOTTY->EINVAL for other cases.

4 years agoDocument r351361.
Mark Johnston [Thu, 22 Aug 2019 01:18:36 +0000 (01:18 +0000)]
Document r351361.

4 years agoMap ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE).
Rick Macklem [Thu, 22 Aug 2019 01:15:06 +0000 (01:15 +0000)]
Map ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE).

Without this patch, when an application performed lseek(SEEK_DATA/SEEK_HOLE)
on a file in a file system that does not have its own VOP_IOCTL(), the
lseek(2) fails with errno ENOTTY. This didn't seem appropriate, since
ENOTTY is not listed as an error return by either the lseek(2) man page
nor the POSIX draft for lseek(2).
This was discussed on freebsd-current@ here:
http://docs.FreeBSD.org/cgi/mid.cgi?CAOtMX2iiQdv1+15e1N_r7V6aCx_VqAJCTP1AW+qs3Yg7sPg9wA

This trivial patch maps ENOTTY to EINVAL for lseek(SEEK_DATA/SEEK_HOLE).

Reviewed by: markj
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D21300

4 years agogdb(4): Style
Conrad Meyer [Thu, 22 Aug 2019 00:36:16 +0000 (00:36 +0000)]
gdb(4): Style

No functional change.

I was surprised to find that no sys/ header already defines the -1 EOF
convention anywhere, so defined one locally.

4 years agogdb(4):amd64: Bump MI GDB_BUFSZ for more efficient transfers
Conrad Meyer [Thu, 22 Aug 2019 00:35:17 +0000 (00:35 +0000)]
gdb(4):amd64: Bump MI GDB_BUFSZ for more efficient transfers

A bigger buffer reduces the RTTs to transfer long messages and is otherwise
relatively harmless, especially on systems with plenty of memory.

4 years agogdb(4): Implement qXfer:threads:read
Conrad Meyer [Thu, 22 Aug 2019 00:34:11 +0000 (00:34 +0000)]
gdb(4): Implement qXfer:threads:read

This streams out an XML document over several GDB packets describing all
threads in the system; their ids, name, and any loosely defined "extra info"
we feel like including.  For now, I have included a string version of the run
state, similar to some of the DDB logic to stringify thread state.

The benefit of supporting this in addition to the qfThreadInfo/qsThreadInfo
packing is that in this mode, the host gdb does not ask for every thread's
"qThreadExtraInfo," saving per-thread round-trips on "info threads."

To use this feature, (k)gdb needs to be built with the --with-expat option.
I would encourage enabling this option by default in our GDB port, if it is
not already.

Finally, there is another optional attribute you can specify per-thread
called a "handle."  Handles are arbitrarily long sequences of bytes,
represented in the XML as hexadecimal.  It is unclear to me how or if GDB
actually uses handles for anything.  So I have left them out.

4 years agogdb(4): Add basic 'qSupported' support
Conrad Meyer [Thu, 22 Aug 2019 00:19:41 +0000 (00:19 +0000)]
gdb(4): Add basic 'qSupported' support

This is where the host GDB tells us what features it supports, and we
respond with the list we support.  For now, just report PacketSize.

4 years agogdb(4): Include thread in Target Halt Reason
Conrad Meyer [Thu, 22 Aug 2019 00:19:14 +0000 (00:19 +0000)]
gdb(4): Include thread in Target Halt Reason

This saves a round trip of the gdb remote inferior attempting to find
the thread id of the halted thread.

Sponsored by: Dell EMC Isilon

4 years agoUse 'const' for keys and IVs passed to software encryption algorithms.
John Baldwin [Thu, 22 Aug 2019 00:02:08 +0000 (00:02 +0000)]
Use 'const' for keys and IVs passed to software encryption algorithms.

Specifically, use 'const' for the key passed to the 'setkey' method
and 'const' for the 'iv' passed to the 'reinit' method.

Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D21347

4 years agoAdd hold events for lockmgr probes, missed in r351361.
Mark Johnston [Wed, 21 Aug 2019 23:47:01 +0000 (23:47 +0000)]
Add hold events for lockmgr probes, missed in r351361.

MFC with: r351361

4 years agoAdd lockmgr(9) probes to the lockstat DTrace provider.
Mark Johnston [Wed, 21 Aug 2019 23:43:58 +0000 (23:43 +0000)]
Add lockmgr(9) probes to the lockstat DTrace provider.

They follow the conventions set by rw and sx lock probes.  There is
an additional lockstat:::lockmgr-disown probe.

Update lockstat(1) to report on contention and hold events for
lockmgr locks.  Document the new probes in dtrace_lockstat.4, and
deduplicate some of the existing probe descriptions.

Reviewed by: mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21355

4 years agonullfs: lock the vnode with LK_SHARED in null_vptocnp
Mateusz Guzik [Wed, 21 Aug 2019 23:24:40 +0000 (23:24 +0000)]
nullfs: lock the vnode with LK_SHARED in null_vptocnp

null_nodeget which follows almost always finds the target vnode in the hash,
avoiding insmntque1 altogether. Should it be needed, it already checks if the
lock needs to be upgraded.

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

4 years agoFix inverted predicates for sx lock hold events in lockstat(1).
Mark Johnston [Wed, 21 Aug 2019 23:13:00 +0000 (23:13 +0000)]
Fix inverted predicates for sx lock hold events in lockstat(1).

This caused shared sx holds to be reported as exclusive, and vice
versa.

Reviewed by: mjg
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoDocument RST support in nvme(4) and ahci(4).
Warner Losh [Wed, 21 Aug 2019 22:18:07 +0000 (22:18 +0000)]
Document RST support in nvme(4) and ahci(4).

4 years agoCreate a AHCI attachment for nvme.
Warner Losh [Wed, 21 Aug 2019 22:18:01 +0000 (22:18 +0000)]
Create a AHCI attachment for nvme.

Intel has created RST and many laptops from vendors like Lenovo and Asus. It's a
mechanism for creating multiple boot devices under windows. It effectively hides
the nvme drive inside of the ahci controller. The details are supposed to be a
trade secret. However, there's a reverse engineered Linux driver, and this
implements similar operations to allow nvme drives to attach. The ahci driver
attaches nvme children that proxy the remapped resources to the child. nvme_ahci
is just like nvme_pci, except it doesn't do the PCI specific things. That's
moved into ahci where appropriate.

When the nvme drive is remapped, MSI-x interrupts aren't forwarded (the linux
driver doesn't know how to use this either). INTx interrupts are used
instead. This is suboptimal, but usually sufficient for the laptops these parts
are in.

This is based loosely on https://www.spinics.net/lists/linux-ide/msg53364.html
submitted, but not accepted by, Linux. It was written by Dan Williams. These
changes were written from scratch by Olivier Houchard.

Submitted by: cognet@ (Olivier Houchard)

4 years agoSeparate the pci attachment from the rest of nvme
Warner Losh [Wed, 21 Aug 2019 22:17:55 +0000 (22:17 +0000)]
Separate the pci attachment from the rest of nvme

Nvme drives can be attached in a number of different ways. Separate out the PCI
attachment so that we can have other attachment types, like ahci and various
types of NVMeoF.

Submitted by: cognet@

4 years agoping: add -H option for enabling reverse DNS lookup
Alan Somers [Wed, 21 Aug 2019 21:05:15 +0000 (21:05 +0000)]
ping: add -H option for enabling reverse DNS lookup

This is the reverse of the -n flag.

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

4 years agoImprove NVMe hot unplug handling.
Alexander Motin [Wed, 21 Aug 2019 20:17:30 +0000 (20:17 +0000)]
Improve NVMe hot unplug handling.

If device is unplugged from the system (CSTS register reads return
0xffffffff), it makes no sense to send any more recovery requests or
expect any responses back.  If there is a detach call in such state,
just stop all activity and free resources.  If there is no detach
call (hot-plug is not supported), rely on normal timeout handling,
but when it trigger controller reset, do not wait for impossible and
quickly report failure.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoRemove manual wire_count adjustments from the unmapped mbuf code.
Mark Johnston [Wed, 21 Aug 2019 20:01:52 +0000 (20:01 +0000)]
Remove manual wire_count adjustments from the unmapped mbuf code.

The original code came from a desire to minimize the number of updates
to v_wire_count, which prior to r329187 was updated using atomics.
However, there is no significant benefit to batching today, so simply
allocate pages using VM_ALLOC_WIRED and rely on system accounting.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D21323

4 years agoFix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.
Konstantin Belousov [Wed, 21 Aug 2019 19:53:50 +0000 (19:53 +0000)]
Fix _pthread_cancel_enter() and _pthread_cancel_leave() jmptable entries.

PR: 240022
Reported by: Andrew Gierth <andrew@tao11.riddles.org.uk>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agoModify pipe_poll() to properly check for pending direct writes.
Mark Johnston [Wed, 21 Aug 2019 19:35:04 +0000 (19:35 +0000)]
Modify pipe_poll() to properly check for pending direct writes.

With r349546, it is a responsibility of the writer to clear PIPE_DIRECTW
after pinned data has been read.  In particular, once a reader has
drained this data, there is a small window where the pipe is empty but
PIPE_DIRECTW is set.  pipe_poll() was using the presence of PIPE_DIRECTW
to determine whether to return POLLIN, so in this window it would
claim that data was available to read when this was not the case.

Fix this by modifying several checks for PIPE_DIRECTW to instead look
at the number of residual bytes in data pinned by a direct writer.  In
some cases we really do want to check for PIPE_DIRECTW, since the
presence of this flag indicates that any attempt to write to the pipe
will block on the existing direct writer.

Bisected and test case provided by: mav
Tested by: pho
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21333

4 years agomakefs: Verify that the BPB media descriptor and FAT ID match
Ed Maste [Wed, 21 Aug 2019 19:09:40 +0000 (19:09 +0000)]
makefs: Verify that the BPB media descriptor and FAT ID match

From r322982 in sys/fs/msdosfs.

4 years agomakefs: share denode.h between kernel msdosfs and makefs
Ed Maste [Wed, 21 Aug 2019 19:07:13 +0000 (19:07 +0000)]
makefs: share denode.h between kernel msdosfs and makefs

There is no need to duplicate this file when it can be trivially
shared (just exposing sections previously under #ifdef _KERNEL).

MFC with: r351273
Differential Revision: The FreeBSD Foundation

4 years agoSimplify vm_page_dequeue() and fix an assertion.
Mark Johnston [Wed, 21 Aug 2019 16:11:12 +0000 (16:11 +0000)]
Simplify vm_page_dequeue() and fix an assertion.

- Add a vm_pagequeue_remove() function to physically remove a page
  from its queue and update the queue length.
- Remove vm_page_pagequeue_lockptr() and let vm_page_pagequeue()
  return NULL for dequeued pages.
- Avoid unnecessarily reloading the queue index if vm_page_dequeue()
  loses a race with a concurrent queue operation.
- Correct an always-true assertion: vm_page_dequeue() may be called
  from the page allocator with the page unlocked.  The assertion
  m->order == VM_NFREEORDER simply tests whether the page has been
  removed from the vm_phys free lists; instead, check whether the
  page belongs to an object.

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

4 years agoUnconditionally enable debug.vm_lowmem.
Mark Johnston [Wed, 21 Aug 2019 16:01:17 +0000 (16:01 +0000)]
Unconditionally enable debug.vm_lowmem.

It is useful for testing purposes to be able to drain UMA caches, so
do not limit the sysctl to DIAGNOSTIC kernels.

MFC after: 1 week
Sponsored by: Netflix

4 years agoDon't requeue active pages in vm_swapout_object_deactivate_pages().
Mark Johnston [Wed, 21 Aug 2019 15:52:10 +0000 (15:52 +0000)]
Don't requeue active pages in vm_swapout_object_deactivate_pages().

As of r332974 the page daemon does not requeue pages during a scan
of the active queue, so there is not much value in doing so here
either.

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

4 years agoping: do reverse DNS lookup of the target address
Alan Somers [Wed, 21 Aug 2019 14:52:12 +0000 (14:52 +0000)]
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>
MFC after: 2 weeks
Sponsored by: Google LLC (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21351

4 years agogprof: disable building of a.out components
Bjoern A. Zeeb [Wed, 21 Aug 2019 10:54:52 +0000 (10:54 +0000)]
gprof: disable building of a.out components

On arm64, riscv, and s390x disable building of aout components.
This allows gprof to build on these architectures which never supported
the legacy a.out binary format.

Obtained from: s390x branch
MFC after: 3 months

4 years agoFix an issue when TSO and Rack play together. Basically
Randall Stewart [Wed, 21 Aug 2019 10:45:28 +0000 (10:45 +0000)]
Fix an issue when TSO and Rack play together. Basically
an retransmission of the initial SYN (with data) would
cause us to strip the SYN and decrement/increase offset/len
which then caused us a -1 offset and a panic.

Reported by: Larry Rosenman
(Michael Tuexen helped me debug this at the IETF)

4 years agoathhal: disable unused function (big endian only)
Bjoern A. Zeeb [Wed, 21 Aug 2019 10:42:31 +0000 (10:42 +0000)]
athhal: disable unused function (big endian only)

Disable ar9300_swap_tx_desc() for the moment.  It is an unused
function only tried to compile on big endian systems.

Found by: s390x buildkernel
MFC after: 3 months

4 years agoUse MTX_NEW instead of bzero().
Xin LI [Wed, 21 Aug 2019 08:15:30 +0000 (08:15 +0000)]
Use MTX_NEW instead of bzero().

Submitted by: cem

4 years agoFix sound on headset jack for ThinkPad T51.
Xin LI [Wed, 21 Aug 2019 08:01:43 +0000 (08:01 +0000)]
Fix sound on headset jack for ThinkPad T51.

4 years agoFix a panic in ubt_do_hci_request.
Xin LI [Wed, 21 Aug 2019 07:45:39 +0000 (07:45 +0000)]
Fix a panic in ubt_do_hci_request.

The 'mtx' is on stack and can contain garbages that would cause mtx_init
(and in turn lock_init) to think that the mutex was already initialized.

4 years agoseqc: predict false for _in_modify and type fixes for _consistent_*
Mateusz Guzik [Wed, 21 Aug 2019 04:54:48 +0000 (04:54 +0000)]
seqc: predict false for _in_modify and type fixes for _consistent_*

seqc_consistent_* return bool, not seqc. [0]

While here annotate the rarely true condition - it is expected to run
into it on vare occasion (compared to the other case).

Reported by: oshogbo [0]
Sponsored by: The FreeBSD Foundation

4 years agodpaa: Fix warnings in dtsec(4) found by clang
Justin Hibbits [Wed, 21 Aug 2019 02:26:22 +0000 (02:26 +0000)]
dpaa: Fix warnings in dtsec(4) found by clang

These are all trivial warnings that have no real functional change.

4 years agomakefs: share fat.h between kernel msdosfs and makefs
Ed Maste [Wed, 21 Aug 2019 02:21:40 +0000 (02:21 +0000)]
makefs: share fat.h between kernel msdosfs and makefs

There is no reason to duplicate this file when it can be trivially
shared (just exposing one section previously under #ifdef _KERNEL).

Reviewed by: imp, cem
MFC with: r351273
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21346

4 years agoFormalize NVMe controller consumer life cycle.
Alexander Motin [Wed, 21 Aug 2019 02:17:39 +0000 (02:17 +0000)]
Formalize NVMe controller consumer life cycle.

This fixes possible double call of fail_fn, for example on hot removal.
It also allows ctrlr_fn to safely return NULL cookie in case of failure
and not get useless ns_fn or fail_fn call with NULL cookie later.

MFC after: 2 weeks

4 years agomakefs: use `char *` not `void *` for buf b_data, drop casts in msdos
Ed Maste [Wed, 21 Aug 2019 01:45:29 +0000 (01:45 +0000)]
makefs: use `char *` not `void *` for buf b_data, drop casts in msdos

(The kernel uses caddr_t.)

Suggested by: cem
Reviewed by: cem
MFC with: r351273
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21348

4 years agoping: Add tests of the Internet checksum function
Alan Somers [Tue, 20 Aug 2019 21:59:48 +0000 (21:59 +0000)]
ping: Add tests of the Internet checksum function

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

4 years agomakefs.8: update history
Ed Maste [Tue, 20 Aug 2019 21:14:44 +0000 (21:14 +0000)]
makefs.8: update history

- ported to FreeBSD and first appeared in 8.0
- Christos Zoulas added the FAT support that I imported

4 years agomakefs: avoid "dereferencing 'void *' pointer" warnings
Ed Maste [Tue, 20 Aug 2019 20:04:16 +0000 (20:04 +0000)]
makefs: avoid "dereferencing 'void *' pointer" warnings

On GCC 4.2.1 archs

MFC with: r351273
Sponsored by: The FreeBSD Foundation

4 years agoloader.efi: efipart should be more careful about constructing block device lists
Toomas Soome [Tue, 20 Aug 2019 19:31:11 +0000 (19:31 +0000)]
loader.efi: efipart should be more careful about constructing block device lists

The cd handles should be collected as list of partitions. Some systems also
provide base name for block device (like PciRoot(0x0)/Pci(0x5,0x0)), we need
to be careful about those.

To make out life a bit easier, we prepare not just an array of handles, but we
allocate pdinfo struct for each handle and devicepath, then we can simplify
our work to sort the devices.

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

4 years agomakefs: add msdosfs (FAT) support
Ed Maste [Tue, 20 Aug 2019 18:20:45 +0000 (18:20 +0000)]
makefs: add msdosfs (FAT) support

Add FAT support to makefs by copying some files from sys/fs/msdosfs/ and
updating others with changes from NetBSD.

The six files copied from sys/fs/msdosfs at r348251 and modified are:
denode.h direntry.h fat.h msdosfs_fat.c msdosfs_lookup.c msdosfsmount.h

I would prefer to avoid the duplication, but reluctance to doing so was
expressed in a previous review (D11197); for now copy the files and
revisit in the future.

Submitted by: Siva Mahadevan
Discussed with: cem, imp
MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16438

4 years agoUse a sleepable lock for midistat functions.
Mark Johnston [Tue, 20 Aug 2019 17:52:12 +0000 (17:52 +0000)]
Use a sleepable lock for midistat functions.

Otherwise the mutex needs to be dropped when copying out the midistat
sbuf, leading to a race which allows one to read kernel memory beyond
the end of the sbuf buffer.

Reported and tested by: pho
Security: CVE-2019-5612

4 years agomqueuefs: fix compat32 struct file leak
Ed Maste [Tue, 20 Aug 2019 17:44:03 +0000 (17:44 +0000)]
mqueuefs: fix compat32 struct file leak

In a compat32 error case we previously leaked a struct file.

Submitted by: Karsten König, Secfault Security
Security: CVE-2019-5603

4 years agoPull in r368867 from upstream libc++ trunk (by Marshall Clow):
Dimitry Andric [Tue, 20 Aug 2019 17:39:32 +0000 (17:39 +0000)]
Pull in r368867 from upstream libc++ trunk (by Marshall Clow):

  Rework recursive_timed_mutex so that it uses __thread_id instead of
  using the lower-level __libcpp_thread_id. This is prep for fixing
  PR42918. Reviewed as https://reviews.llvm.org/D65895

Pull in r368916 from upstream libc++ trunk (by Marshall Clow):

  Fix thread comparison by making sure we never pass our special 'not a
  thread' value to the underlying implementation. Fixes PR#42918.

This should fix std::thread::id::operator==() attempting to call
pthread_equal(3) with zero values.

Reported by: andrew@tao11.riddles.org.uk
PR: 239038, 239550
MFC after: 3 days

4 years agoRemove some compatability with Seventh Edition UNIX realloc().
Brooks Davis [Tue, 20 Aug 2019 16:07:17 +0000 (16:07 +0000)]
Remove some compatability with Seventh Edition UNIX realloc().

In Seventh Edition UNIX, the last pointer passed to free() was
guaranteed to not actually have been freed allowing memory to be
"compacted" via the following pattern:

free(foo);
foo = realloc(foo, newsize);

Further, Andrew Koenig reports in "C Traps and Pitfalls" that the
original realloc() implementation required this pattern.

The C standard is clear that this is Undefined Behavior. Modern
allocators don't support it and no portable code could rely on it so
remove this support.

Note: the removed implementation contains an off-by-one error and if
an item isn't found on the freelist, then twice as much memory as the
largest possible allocation will be copied.

Reviewed by: kib, imp
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21296

4 years agoUnbreak USB ethernet module builds
Justin Hibbits [Tue, 20 Aug 2019 15:14:32 +0000 (15:14 +0000)]
Unbreak USB ethernet module builds

Sponsored by: Juniper Networks, Inc.

4 years agonetpfil tests: Add too many fragments test for pf, ipfw and ipf
Kristof Provost [Tue, 20 Aug 2019 14:46:12 +0000 (14:46 +0000)]
netpfil tests: Add too many fragments test for pf, ipfw and ipf

Add test for checking that the packets are dropped if it is fragmented into
more than the defined value.

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21307

4 years agonetpfil tests: Add the set ToS test for ipfw and pf
Kristof Provost [Tue, 20 Aug 2019 14:31:22 +0000 (14:31 +0000)]
netpfil tests: Add the set ToS test for ipfw and pf

This test tests the following:

 - The firewall is able to set the tos bits
 - The firewall is able to set the DSCP bits when EN bits is already set and
   the EN bits remains unchanged.
 - The firewall is able to drop the packets based on ToS value

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21305

4 years agopowerpc: Link Book-E kernels at the same address as AIM kernels
Justin Hibbits [Tue, 20 Aug 2019 01:26:02 +0000 (01:26 +0000)]
powerpc: Link Book-E kernels at the same address as AIM kernels

Summary:
Reduce the diff between AIM and Book-E even more.  This also cleans up
vmparam.h significantly.

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