]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoif_mxge: update zlib version 1.0.4 to 1.2.11.
delphij [Sat, 3 Aug 2019 03:36:18 +0000 (03:36 +0000)]
if_mxge: update zlib version 1.0.4 to 1.2.11.

PR: 229763
Submitted by: Yoshihiro Ota <ota j email ne jp>
Differential Revision: https://reviews.freebsd.org/D20272

4 years agoAdd more random bits from NVMe 1.4.
mav [Sat, 3 Aug 2019 02:36:35 +0000 (02:36 +0000)]
Add more random bits from NVMe 1.4.

MFC after: 2 weeks

4 years agopowerpc/powernv: Fix OPAL cfgread/cfgwrite error handling
jhibbits [Sat, 3 Aug 2019 01:55:51 +0000 (01:55 +0000)]
powerpc/powernv: Fix OPAL cfgread/cfgwrite error handling

Freeze clearing needs to heppen any time OPAL reads return either an error
(except OPAL_HARDWARE), AND any time it returns 0xff for all bytes.

For cfgwrite, any error that's not OPAL_HARDWARE should be cleaned up.

4 years agoDon't reset memory attributes when mapping physical addresses for ACPI.
jhb [Sat, 3 Aug 2019 01:36:05 +0000 (01:36 +0000)]
Don't reset memory attributes when mapping physical addresses for ACPI.

Previously, AcpiOsMemory was using pmap_mapbios which would always map
the requested address Write-Back (WB).  For several AMD Ryzen laptops,
the BIOS uses AcpiOsMemory to directly access the PCI MCFG region in
order to access PCI config registers.  This has the side effect of
remapping the MCFG region in the direct map as WB instead of UC
hanging the laptops during boot.

On the one laptop I examined in detail, the _PIC global method used to
switch from 8259A PICs to I/O APICs uses a pair of PCI config space
registers at offset 0x84 in the device at 0:0:0 to as a pair of
address/data registers to access an indirect register in the chipset
and clear a single bit to switch modes.

To fix, alter the semantics of pmap_mapbios() such that it does not
modify the attributes of any existing mappings and instead uses the
existing attributes.  If a new mapping is created, this new mapping
uses WB (the default memory attribute).

Special thanks to the gentleman whose name I don't have who brought
two affected laptops to the hacker lounge at BSDCan.  Direct access to
the affected systems permitted finding the root cause within an hour
or so.

PR: 231760, 236899
Reviewed by: kib, alc
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20327

4 years agoFlip REPRODUCIBLE_BUILD back to off by default in head.
jhb [Sat, 3 Aug 2019 01:06:17 +0000 (01:06 +0000)]
Flip REPRODUCIBLE_BUILD back to off by default in head.

Having the full uname output can be useful on head even with
unmodified trees or trees that newvers.sh fails to recognize as
modified.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D20895

4 years agoSet ISOPEN in namei flags when opening executable interpreters.
jhb [Sat, 3 Aug 2019 01:02:52 +0000 (01:02 +0000)]
Set ISOPEN in namei flags when opening executable interpreters.

These vnodes are explicitly opened via VOP_OPEN via
exec_check_permissions identical to the main exectuable image.
Setting ISOPEN allows filesystems to perform suitable checks in
VOP_LOOKUP (e.g. close-to-open consistency in the NFS client).

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

4 years agoMFC after: 3 days
cy [Fri, 2 Aug 2019 22:58:45 +0000 (22:58 +0000)]
MFC after: 3 days

4 years agoFix !INET build.
delphij [Fri, 2 Aug 2019 22:43:09 +0000 (22:43 +0000)]
Fix !INET build.

4 years agoBecause of AArch64's weak memory consistency model, we need to include a
alc [Fri, 2 Aug 2019 22:36:42 +0000 (22:36 +0000)]
Because of AArch64's weak memory consistency model, we need to include a
memory barrier between the stores for initializing a page table page and
the store for adding that page to the page table.  Otherwise, a page table
walk by another processor's MMU could see the page table page before it
sees the initialized entries.

Simplify pmap_growkernel().  In particular, eliminate an unnecessary TLB
invalidation.

Reviewed by: andrew, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21126

4 years agoAdd bzip2recover.1.
markj [Fri, 2 Aug 2019 22:09:56 +0000 (22:09 +0000)]
Add bzip2recover.1.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoDecode few more NVMe log pages.
mav [Fri, 2 Aug 2019 20:16:21 +0000 (20:16 +0000)]
Decode few more NVMe log pages.

In particular: Changed Namespace List, Commands Supported and Effects,
Reservation Notification, Sanitize Status.

Add few new arguments to `nvmecontrol log` subcommand.

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

4 years agoOnly check the blessings table for known LORs.
markj [Fri, 2 Aug 2019 18:01:47 +0000 (18:01 +0000)]
Only check the blessings table for known LORs.

Previously we would check for blessings before marking a given lock
pair as reversed, so each "reversed" lock acquisition would require
a linear scan of the table.  Instead, check the table after marking
the pair as reversed but before generating a report.

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

4 years agoFix warnings about unused identifiers when compiling without RATELIMIT.
markj [Fri, 2 Aug 2019 15:19:11 +0000 (15:19 +0000)]
Fix warnings about unused identifiers when compiling without RATELIMIT.

4 years agoFix one more atomic for i86
rrs [Fri, 2 Aug 2019 11:17:07 +0000 (11:17 +0000)]
Fix one more atomic for i86
Obtained from: mtuexen@freebsd.org

4 years agofrag6.c: make compile with gcc
bz [Fri, 2 Aug 2019 11:05:00 +0000 (11:05 +0000)]
frag6.c: make compile with gcc

Removing the prototype from the header and making the function static
in r350533 makes architectures using gcc complain "function declaration
isn't a prototype".  Add the missing void given the function has no
arguments.

Reported by: the CI machinery
Pointyhat to: bz
MFC after: 3 months
X-MFC with: r350533
Sponsored by: Netflix

4 years agofrag6.c: rename malloc type
bz [Fri, 2 Aug 2019 10:54:57 +0000 (10:54 +0000)]
frag6.c: rename malloc type

Rename M_FTABLE to M_FRAG6 as the former sounds very much like the former
"flowtable" rather than anything to do with fragments and reassembly.

While here, let malloc( , .. | M_ZERO) do the zeroing rather than calling
bzero() ourselves.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: remove dead code
bz [Fri, 2 Aug 2019 10:41:51 +0000 (10:41 +0000)]
frag6.c: remove dead code

Remove all the #if 0 and #if notyet blocks of dead code which have been
there for at least 18 years from what I can see.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: move variables and sysctls into local file
bz [Fri, 2 Aug 2019 10:29:53 +0000 (10:29 +0000)]
frag6.c: move variables and sysctls into local file

Move the sysctls and the related variables only used in frag6.c
into the file and out of in6_proto.c.  That way everything belonging
together is in one place.

Sort the variables into global and per-vnet scopes and make
them static.  No longer export the (helper) function
frag6_set_bucketsize() now also file-local only.

Should be no functional changes, only reduced public KPI/KBI surface.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: sort includes
bz [Fri, 2 Aug 2019 10:06:54 +0000 (10:06 +0000)]
frag6.c: sort includes

Sort includes and remove duplicate kernel.h as well as the unneeded
systm.h.
Hide the mac framework incude behind #fidef MAC.

MFC after: 3 months
Sponsored by: Netflix

4 years agoIPv6 cleanup: kernel
bz [Fri, 2 Aug 2019 07:41:36 +0000 (07:41 +0000)]
IPv6 cleanup: kernel

Finish what was started a few years ago and harmonize IPv6 and IPv4
kernel names.  We are down to very few places now that it is feasible
to do the change for everything remaining with causing too much disturbance.

Remove "aliases" for IPv6 names which confusingly could indicate
that we are talking about a different data structure or field or
have two fields, one for each address family.
Try to follow common conventions used in FreeBSD.

* Rename sin6p to sin6 as that is how it is spelt in most places.
* Remove "aliases" (#defines) for:
  - in6pcb which really is an inpcb and nothing separate
  - sotoin6pcb which is sotoinpcb (as per above)
  - in6p_sp which is inp_sp
  - in6p_flowinfo which is inp_flow
* Try to use ia6 for in6_addr rather than in6p.
* With all these gone  also rename the in6p variables to inp as
  that is what we call it in most of the network stack including
  parts of netinet6.

The reasons behind this cleanup are that we try to further
unify netinet and netinet6 code where possible and that people
will less ignore one or the other protocol family when doing
code changes as they may not have spotted places due to different
names for the same thing.

No functional changes.

Discussed with: tuexen (SCTP changes)
MFC after: 3 months
Sponsored by: Netflix

4 years agoFix typo in r350529.
mav [Fri, 2 Aug 2019 04:04:18 +0000 (04:04 +0000)]
Fix typo in r350529.

MFC after: 2 weeks

4 years agoAdd more new fields and values from NVMe 1.4.
mav [Fri, 2 Aug 2019 03:43:24 +0000 (03:43 +0000)]
Add more new fields and values from NVMe 1.4.

MFC after: 2 weeks

4 years agoUse ATTR_DBM even when hardware dirty bit management is not enabled.
markj [Thu, 1 Aug 2019 22:48:06 +0000 (22:48 +0000)]
Use ATTR_DBM even when hardware dirty bit management is not enabled.

The ARMv8 reference manual only states that the bit is reserved in
this case; following Linux's example, use it instead of a
software-defined bit for the purpose of indicating that a managed
mapping is writable.

Reviewed by: alc, andrew
MFC after: r350004
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21121

4 years agoRename function added in r350523 to make gcc happy.
mav [Thu, 1 Aug 2019 22:22:06 +0000 (22:22 +0000)]
Rename function added in r350523 to make gcc happy.

MFC after: 2 weeks

4 years agoAdd IOCTL to translate nvdX into nvmeY and NSID.
mav [Thu, 1 Aug 2019 21:44:07 +0000 (21:44 +0000)]
Add IOCTL to translate nvdX into nvmeY and NSID.

While very useful by itself, it also makes `nvmecontrol` not depend on
hardcoded device names parsing, that in its turn makes simple to take
nvdX (and potentially any other) device names as arguments.

Also added IOCTL bypass from nvdX to respective nvmeYnsZ makes them
interchangeable for management purposes.

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

4 years agoIPv6 cleanup: netstat
bz [Thu, 1 Aug 2019 20:36:25 +0000 (20:36 +0000)]
IPv6 cleanup: netstat

Rename the variable for the in6_addr from in6p to ia6 to follow the
convention generally used in FreeBSD.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agoOpps use fetchadd_u64 not long to keep old 32 bit platforms
rrs [Thu, 1 Aug 2019 20:26:27 +0000 (20:26 +0000)]
Opps use fetchadd_u64 not long to keep old 32 bit platforms
happy.

4 years agoFix the reporting of multiple unknown parameters in an received INIT
tuexen [Thu, 1 Aug 2019 19:45:34 +0000 (19:45 +0000)]
Fix the reporting of multiple unknown parameters in an received INIT
chunk. This also plugs an potential mbuf leak.
Thanks to Felix Weinrank for reporting this issue found by fuzz-testing
the userland stack.

MFC after: 3 days

4 years agoInclude caph_rights_limit() in libegacy if need be.
markj [Thu, 1 Aug 2019 19:26:16 +0000 (19:26 +0000)]
Include caph_rights_limit() in libegacy if need be.

Reported by: jenkins
Sponsored by: The FreeBSD Foundation

4 years agoas: add deprecation notice to the man page
emaste [Thu, 1 Aug 2019 19:01:27 +0000 (19:01 +0000)]
as: add deprecation notice to the man page

In the future FreeBSD will ship without GNU binutils 2.17.50.  Add a
note advising users who require GNU as to install the binutils port
or package.

Note that on armv7, arm64, amd64, i386 we currently ship only two
binutils tools (as and objdump).  A deprecation notice was added to
objdump's man page some time ago.

PR: 233611
Discussed with: jhb
MFC after: 1 week
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

4 years agoCapsicumize size(1).
markj [Thu, 1 Aug 2019 18:57:37 +0000 (18:57 +0000)]
Capsicumize size(1).

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21105

4 years agoCapsicumize readelf(1).
markj [Thu, 1 Aug 2019 18:57:08 +0000 (18:57 +0000)]
Capsicumize readelf(1).

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21108

4 years agoCapsicumize addr2line(1).
markj [Thu, 1 Aug 2019 18:56:32 +0000 (18:56 +0000)]
Capsicumize addr2line(1).

Reviewed by: oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21104

4 years agoAdd an MLINK for daemonfd(3).
markj [Thu, 1 Aug 2019 18:51:18 +0000 (18:51 +0000)]
Add an MLINK for daemonfd(3).

MFC after: 3 days

4 years agoFix formatting.
markj [Thu, 1 Aug 2019 18:51:06 +0000 (18:51 +0000)]
Fix formatting.

MFC after: 3 days

4 years agoOnly skip test cases sometimes failing in CI when they are running in CI
lwhsu [Thu, 1 Aug 2019 18:19:16 +0000 (18:19 +0000)]
Only skip test cases sometimes failing in CI when they are running in CI

Suggested by: jhb
Sponsored by: The FreeBSD Foundation

4 years agoreadelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND
emaste [Thu, 1 Aug 2019 17:59:56 +0000 (17:59 +0000)]
readelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND

These bits are used for Intel CET IBT/Shadow Stack.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20516

4 years agoRevert r349863 (ACPICA 20190703).
jkim [Thu, 1 Aug 2019 17:45:43 +0000 (17:45 +0000)]
Revert r349863 (ACPICA 20190703).

This commit caused boot failures on some systems.

Requested by: scottl

4 years agoiflib: Prevent kernel panic caused by loading driver with a specific interrupt config...
erj [Thu, 1 Aug 2019 17:37:25 +0000 (17:37 +0000)]
iflib: Prevent kernel panic caused by loading driver with a specific interrupt configuration

If a device has only 1 MSI-X interrupt available and does not support either
MSI or legacy interrupts, iflib_device_register() will fail, leak memory and
MSI resources, and the driver will not load. Worse, if another iflib-using
driver tries to unload afterwards, a kernel panic will occur because the
previous failed iflib driver loead did not properly call "taskqgroup_detach()"
during it's cleanup.

This patch is band-aid for this situation -- don't try allocating MSI or legacy
interrupts if a single MSI-X interrupt was allocated, but fail to load instead.
As well, during the cleanup, properly call taskqgroup_detach() on the admin
task to prevent panics when other iflib drivers unload.

This whole interrupt allocation process actually needs re-doing to properly
support devices with only a single MSI-X interrupt, devices that only support
MSI-X, non-PCI devices, and multiple non-MSIX interrupts, as well.

Signed-off-by: Eric Joyner <erj@freebsd.org>
Reviewed by: marius@
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20747

4 years agoWhen responding with an ABORT to an INIT chunk containing a
tuexen [Thu, 1 Aug 2019 17:36:15 +0000 (17:36 +0000)]
When responding with an ABORT to an INIT chunk containing a
HOSTNAME parameter or a parameter with an illegal length, only
include an error cause indicating why the ABORT was sent.
This also fixes an mbuf leak which could occur.

MFC after: 3 days

4 years agoiflib: remove kobject class reference increment
erj [Thu, 1 Aug 2019 17:28:36 +0000 (17:28 +0000)]
iflib: remove kobject class reference increment

Commit message from Jake:
In iflib_register, the context is initialized as a kobject using the
device driver's "driver" kobject class. As part of this, the function
mistakenly increments the ref counter.

The ref counter is incremented twice, once in the code directly, and
once again by kobj_class_compile. However, there is no associated
decrement in the detach path. Because of this, the ref counter will
never go back down to zero, and thus the kobject method table will never
be released.

Remove this unnecessary reference count increment.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Submitted by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed by: jhb@, erj@
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21125

4 years agoremove obsolete kernel debugging script
emaste [Thu, 1 Aug 2019 17:02:58 +0000 (17:02 +0000)]
remove obsolete kernel debugging script

For quite some time kgdb has been internally handling FreeBSD kernel
module state; add-on scripts and tools are not needed.  asf(8) served
a similar purpose to this script and was removed in r335222.

PR: 229046
Reported by: jhb
Sponsored by: The FreeBSD Foundation

4 years agoobjdump: be explicit that GNU objdump that will be removed
emaste [Thu, 1 Aug 2019 14:42:41 +0000 (14:42 +0000)]
objdump: be explicit that GNU objdump that will be removed

We may install llvm-objdump as objdump (see review D18307) or just
provide no /usr/bin/objdump, but either way GNU objdump won't be
installed in the future.

MFC after: 3 days

4 years agoTry to decrease the number of bugs in unionfs after the VV_TEXT flag removal.
kib [Thu, 1 Aug 2019 14:40:37 +0000 (14:40 +0000)]
Try to decrease the number of bugs in unionfs after the VV_TEXT flag removal.

- Provide unionfs_add_writecount() which passes the writecount to the
  lower or upper vnode as appropriate.
- In unionfs VOP_RECLAIM() implementation, annulate unionfs
  writecounts from upper or lower vnode.  It is not clear that it is
  always correct to remove the all references from either lower or
  upper vnode, but we currently do not track which vnode get how many
  refs anyway.

Reported and tested by: t_uemura@macome.co.jp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoobjdump: move deprecation notice to indended spot in the man page
emaste [Thu, 1 Aug 2019 14:39:26 +0000 (14:39 +0000)]
objdump: move deprecation notice to indended spot in the man page

r335217 added a deprecation notice to the source file for the objdump
man page, and r335219 added it to the rendered objdump.1, but in the
wrong spot.

MFC after: 3 days

4 years agoMake umtxq_check_susp() to correctly handle thread exit requests.
kib [Thu, 1 Aug 2019 14:34:27 +0000 (14:34 +0000)]
Make umtxq_check_susp() to correctly handle thread exit requests.

The check for P_SINGLE_EXIT was shadowed by the (P_SHOULDSTOP || traced) check.

Reported by: bdrewery (might be)
Reviewed by: markj
Tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21124

4 years agoThis adds the third step in getting BBR into the tree. BBR and
rrs [Thu, 1 Aug 2019 14:17:31 +0000 (14:17 +0000)]
This adds the third step in getting BBR into the tree. BBR and
an updated rack depend on having access to the new
ratelimit api in this commit.

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

4 years agonewvers: append commit count to uname version string
emaste [Thu, 1 Aug 2019 14:13:04 +0000 (14:13 +0000)]
newvers: append commit count to uname version string

In a git world this provides a facsimile of a monotonically increasing
version number.  This might be refined further, but this provides a
starting point for investigation.

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

4 years agoacpi_resource.c: mention ThunderX2 firmware revision with issue
emaste [Thu, 1 Aug 2019 14:02:59 +0000 (14:02 +0000)]
acpi_resource.c: mention ThunderX2 firmware revision with issue

Presumably this will be fixed in the next version, and the workaround
could eventually be removed.  See r330113 and r346066 details.

4 years agotelnet: use asprintf for r349890 change
emaste [Thu, 1 Aug 2019 13:46:04 +0000 (13:46 +0000)]
telnet: use asprintf for r349890 change

Suggested by: imp
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation

4 years agoppp: correct echo-req magic number on big endian archs
emaste [Thu, 1 Aug 2019 13:42:58 +0000 (13:42 +0000)]
ppp: correct echo-req magic number on big endian archs

The magic number is a 32-bit quantity; use uint32_t to match hton's
return type and avoid sending zeros (upper 32 bits) on big-endian
architectures.

PR: 184141
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoAllow Kernel to link in both legacy libkern/zlib and new sys/contrib/zlib,
delphij [Thu, 1 Aug 2019 06:35:33 +0000 (06:35 +0000)]
Allow Kernel to link in both legacy libkern/zlib and new sys/contrib/zlib,
with an eventual goal to convert all legacl zlib callers to the new zlib
version:

 * Move generic zlib shims that are not specific to zlib 1.0.4 to
   sys/dev/zlib.
 * Connect new zlib (1.2.11) to the zlib kernel module, currently built
   with Z_SOLO.
 * Prefix the legacy zlib (1.0.4) with 'zlib104_' namespace.
 * Convert sys/opencrypto/cryptodeflate.c to use new zlib.
 * Remove bundled zlib 1.2.3 from ZFS and adapt it to new zlib and make
   it depend on the zlib module.
 * Fix Z_SOLO build of new zlib.

PR: 229763
Submitted by: Yoshihiro Ota <ota j email ne jp>
Reviewed by: markm (sys/dev/zlib/zlib_kmod.c)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D19706

4 years agopowerpc/powernv: Only clear EEH freeze for some errors
jhibbits [Thu, 1 Aug 2019 03:59:25 +0000 (03:59 +0000)]
powerpc/powernv: Only clear EEH freeze for some errors

Only clear an EEH freeze if an error occurs.  However, if an OPAL_HARDWARE
error is returned, this indicates a hardware failure which cannot be
unfrozen, and instead needs a hardware reset.  Attempting to unfreeze a
broken PCH will result in console spam for each attempt.  To avoid the spam,
just don't do it.

4 years agopowerpc64/mmu: Use a SLIST for the PVO delete list, instead of a RB_TREE
jhibbits [Thu, 1 Aug 2019 03:55:58 +0000 (03:55 +0000)]
powerpc64/mmu: Use a SLIST for the PVO delete list, instead of a RB_TREE

Summary:
Although it's convenient to reuse the pvo_plist for deletion, RB_TREE
insertion and removal is not free, and can result in a lot of extra work
to rebalance the tree.  Instead, use a SLIST as a LIFO delete queue,
which gives us almost free insertion, deletion, and traversal.

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

4 years agovmx: use C99 bool, not boolean_t
emaste [Thu, 1 Aug 2019 02:16:48 +0000 (02:16 +0000)]
vmx: use C99 bool, not boolean_t

Bhyve's vmm is a self-contained modern component and thus a good
candidate for use of C99 types.

Reviewed by: jhb, kib, markj, Patrick Mooney
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21036

4 years agoAdd an entry for the copy_file_range(2) syscall.
rmacklem [Wed, 31 Jul 2019 23:36:23 +0000 (23:36 +0000)]
Add an entry for the copy_file_range(2) syscall.

4 years agoWhen updating the user or group disk quotas for the return of inodes or
mckusick [Wed, 31 Jul 2019 22:44:58 +0000 (22:44 +0000)]
When updating the user or group disk quotas for the return of inodes or
disk blocks, set the FORCE flag in the call to chkiq() or chkdq() since
the user is always allowed to return resources and hence there is no need
to check the user's credential .

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-1-UFS-1: Denial Of Service in mount (prison_priv_check)
Discussed with: kib
MFC:            1 week
Sponsored by:   Netflix

4 years agofusefs: fix the build after r350446
asomers [Wed, 31 Jul 2019 21:48:35 +0000 (21:48 +0000)]
fusefs: fix the build after r350446

fuse needs to include an additional header after r350446

Sponsored by: The FreeBSD Foundation

4 years agoSmall cleanup, no functional change intended.
tuexen [Wed, 31 Jul 2019 21:39:03 +0000 (21:39 +0000)]
Small cleanup, no functional change intended.

MFC after: 3 days

4 years agoConsistently cleanup mbufs in case of other memory errors.
tuexen [Wed, 31 Jul 2019 21:29:17 +0000 (21:29 +0000)]
Consistently cleanup mbufs in case of other memory errors.

MFC after: 3 days

4 years agoadd forgotten opening bracket "("
wosch [Wed, 31 Jul 2019 21:21:34 +0000 (21:21 +0000)]
add forgotten opening bracket "("

PR: 237514
Reviewed by: allanjude
MFC after: soon for 11.3 and 12 series
Differential Revision: https://reviews.freebsd.org/D21009

4 years ago[PPC64] Implement CAS
luporl [Wed, 31 Jul 2019 20:31:36 +0000 (20:31 +0000)]
[PPC64] Implement CAS

Guest PPC OSs running under a hypervisor may communicate the features they
support, in order for the hypervisor to expose a virtualized machine in the way
the client (guest OS) expects (see LoPAPR 1.1 - B.6.2.3).

This is done by calling the "/ibm,client-architecture-support" (CAS) method,
informing supported features in option vectors.  Until now, FreeBSD wasn't
using CAS, but instead relied on hypervisor/QEMU's defaults.

The problem is that, without CAS, it is very inconvenient to run POWER9 VMs on
a POWER9 host running with radix enabled.  This happens because, in this case,
the QEMU default is to present the guest OS a dual MMU (HPT/RPT), instead of
presenting a regular HPT MMU, as FreeBSD expects, resulting in an early panic.
The known workarounds required either changing the host to disable radix or
passing a flag to QEMU to run in a POWER8 compatible mode.

With CAS, FreeBSD is now able to communicate that it wants an HPT MMU,
independent of the host setup, which now makes FreeBSD work on POWER9/pseries,
with KVM enabled and without hugepages (support added in a previous commit).

As CAS is invoked through OpenFirmware's call-method interface, it needs to be
performed early, when OpenFirmware is still operational. Besides, now that FDT
is the default way to inspect the device tree on PPC, OFW call-method feature
will be unavailable by default, when control is passed to the kernel. Because
of this, the call to CAS is being performed at the loader, instead of at the
kernel.

To avoid regressions with old platforms, this change uses CAS only on
POWER8/POWER9.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20827

4 years agoMake randomized stack gap between strings and pointers to argv/envs.
kib [Wed, 31 Jul 2019 20:23:10 +0000 (20:23 +0000)]
Make randomized stack gap between strings and pointers to argv/envs.

This effectively makes the stack base on the csu _start entry
randomized.

The gap is enabled if ASLR is for the ABI is enabled, and then
kern.elf{64,32}.aslr.stack_gap specify the max percentage of the
initial stack size that can be wasted for gap.  Setting it to zero
disables the gap, and max is capped at 50%.

Only amd64 for now.

Reviewed by: cem, markj
Discussed with: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21081

4 years agoAvoid conflicts with libc symbols in libthr jump table.
kib [Wed, 31 Jul 2019 20:04:39 +0000 (20:04 +0000)]
Avoid conflicts with libc symbols in libthr jump table.

In some corner cases of static linking and unexpected libraries order
on the linker command line, libc symbol might preempt the same libthr
symbol, in which case libthr jump table points back to libc causing
either infinite recursion or loop.  Handle all of such symbols by
using private libthr names for them, ensuring that the right pointers
are installed into the table.

In collaboration with: arichardson
PR: 239475
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21088

4 years agognop: add note to the RELNOTES
oshogbo [Wed, 31 Jul 2019 19:32:39 +0000 (19:32 +0000)]
gnop: add note to the RELNOTES

Submitted by: markj

4 years agoAvoid conflicts with libc symbols in libthr jump table.
kib [Wed, 31 Jul 2019 19:27:20 +0000 (19:27 +0000)]
Avoid conflicts with libc symbols in libthr jump table.

In some corner cases of static linking and unexpected libraries order
on the linker command line, libc symbol might preempt the same libthr
symbol, in which case libthr jump table points back to libc causing
either infinite recursion or loop.  Handle all of such symbols by
using private libthr names for them, ensuring that the right pointers
are installed into the table.

In collaboration with: arichardson
PR: 239475
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21088

4 years agoRegen.
kib [Wed, 31 Jul 2019 19:20:39 +0000 (19:20 +0000)]
Regen.

4 years agofreebsd32 shims for copy_file_range(2).
kib [Wed, 31 Jul 2019 19:20:05 +0000 (19:20 +0000)]
freebsd32 shims for copy_file_range(2).

Reviewed by: brooks, rmacklem (previous version)
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21092

4 years agoFix handling of transient casueword(9) failures in do_sem_wait().
kib [Wed, 31 Jul 2019 19:16:49 +0000 (19:16 +0000)]
Fix handling of transient casueword(9) failures in do_sem_wait().

In particular, restart should be only done when the failure is
transient.  For this, recheck the count1 value after the operation.

Note that do_sem_wait() is older usem interface.

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

4 years agoFeature-complete NVMe Namespace Management.
mav [Wed, 31 Jul 2019 18:44:20 +0000 (18:44 +0000)]
Feature-complete NVMe Namespace Management.

This adds several previously missed but important subcommands to list
namespaces and controllers.  It also fixes few previously added but
just found with real testing to be broken subcommands.

Also while there, add possibility to explicitly specify nsid for
`nvmecontrol identify` subcommand.  It may be useful to specify nsids
not having own devices, for example 0xffffffff, or just newly created
ones.

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

4 years agognop: style nits
oshogbo [Wed, 31 Jul 2019 17:51:06 +0000 (17:51 +0000)]
gnop: style nits

4 years agognop: Introduce requests delay.
oshogbo [Wed, 31 Jul 2019 17:47:12 +0000 (17:47 +0000)]
gnop: Introduce requests delay.

This allows to simulated disk that is responding slowly to the IO requests.

Reviewed by: markj, bcr, pjd (previous version)
Differential Revision: https://reviews.freebsd.org/D21052

4 years agopf: zero (another) output buffer in pfioctl
emaste [Wed, 31 Jul 2019 16:58:09 +0000 (16:58 +0000)]
pf: zero (another) output buffer in pfioctl

Avoid potential structure padding leak.  r350294 identified a leak via
static analysis; although there's no report of a leak with the
DIOCGETSRCNODES ioctl it's a good practice to zero the memory.

Suggested by: kp
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years ago[PPC64] Backport fix for missing IRELATIVE relocations
luporl [Wed, 31 Jul 2019 16:22:05 +0000 (16:22 +0000)]
[PPC64] Backport fix for missing IRELATIVE relocations

This is a backport of LLVM commit 8331f61a51a7a0a1efbf5ed398e181593023d151,
llvm-svn: 353981:

ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an
IRELATIVE where possible.

This is needed in order to make ifuncs work correctly on PPC64.

It fixes an issue with lld, in which it would skip emitting necessary IRELATIVE
relocations.  Without this change, indirect calls to ifuncs would result in a
segmentation fault, in static binaries or when defined in the main binary
(outside shared libraries).

This change also reverts the local
"Preserve relocations against ifuncs when -zifunc-noplt" commit and
replaces it by its upstream version, as part of the merge.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D21102

4 years agofusefs: proofread man pages
asomers [Wed, 31 Jul 2019 16:07:16 +0000 (16:07 +0000)]
fusefs: proofread man pages

Reported by: bcr, mandoc, textproc/igor
Sponsored by: The FreeBSD Foundation

4 years agokern_shm_open: push O_CLOEXEC into caller control
kevans [Wed, 31 Jul 2019 15:16:51 +0000 (15:16 +0000)]
kern_shm_open: push O_CLOEXEC into caller control

The motivation for this change is to allow wrappers around shm to be written
that don't set CLOEXEC. kern_shm_open currently accepts O_CLOEXEC but sets
it unconditionally. kern_shm_open is used by the shm_open(2) syscall, which
is mandated by POSIX to set CLOEXEC, and CloudABI's sys_fd_create1().
Presumably O_CLOEXEC is intended in the latter caller, but it's unclear from
the context.

sys_shm_open() now unconditionally sets O_CLOEXEC to meet POSIX
requirements, and a comment has been dropped in to kern_fd_open() to explain
the situation and add a pointer to where O_CLOEXEC setting is maintained for
shm_open(2) correctness. CloudABI's sys_fd_create1() also unconditionally
sets O_CLOEXEC to match previous behavior.

This also has the side-effect of making flags correctly reflect the
O_CLOEXEC status on this fd for the rest of kern_shm_open(), but a
glance-over leads me to believe that it didn't really matter.

Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21119

4 years agoIn pmap_advise(), when we encounter a superpage mapping, we first demote the
alc [Wed, 31 Jul 2019 05:38:39 +0000 (05:38 +0000)]
In pmap_advise(), when we encounter a superpage mapping, we first demote the
mapping and then destroy one of the 4 KB page mappings so that there is a
potential trigger for repromotion.  Currently, we destroy the first 4 KB
page mapping that falls within the (current) superpage mapping or the
virtual address range [sva, eva).  However, I have found empirically that
destroying the last 4 KB mapping produces slightly better results,
specifically, more promotions and fewer failed promotion attempts.
Accordingly, this revision changes pmap_advise() to destroy the last 4 KB
page mapping.  It also replaces some nearby uses of boolean_t with bool.

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

4 years agoTune some commands desctiption.
mav [Wed, 31 Jul 2019 04:19:53 +0000 (04:19 +0000)]
Tune some commands desctiption.

MFC after: 2 weeks

4 years agoFix usage printing for nested subcommands.
mav [Wed, 31 Jul 2019 03:48:48 +0000 (03:48 +0000)]
Fix usage printing for nested subcommands.

Instead of `nvmecontrol create` should be `nvmecontrol ns create`, etc.

MFC after: 2 weeks

4 years agoUse VNASSERT() in checked VOP wrappers.
markj [Tue, 30 Jul 2019 22:41:25 +0000 (22:41 +0000)]
Use VNASSERT() in checked VOP wrappers.

Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21120

4 years agoMake `camcontrol modepage` to use 10 byte commands.
mav [Tue, 30 Jul 2019 20:58:56 +0000 (20:58 +0000)]
Make `camcontrol modepage` to use 10 byte commands.

While old devices may not support 10 byte MODE SENSE/MODE SELECT commands,
new ones may not be able to report all mode pages with 6 byte commands.

This patch makes camcontrol by default start with 10 byte commands and
fall back to 6 byte on ILLEGAL REQUEST error, or 6 byte can be forced.

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

4 years agoBump __FreeBSD_version
asomers [Tue, 30 Jul 2019 19:55:55 +0000 (19:55 +0000)]
Bump __FreeBSD_version

r350437 presents a merge conflict with r350115, which raised
__FreeBSD_version due to the addition of fusefs's intr/nointr mount options.

Sponsored by: The FreeBSD Foundation

4 years agofusefs: fix building tests with GCC 8
asomers [Tue, 30 Jul 2019 19:47:45 +0000 (19:47 +0000)]
fusefs: fix building tests with GCC 8

GCC 8 objected to including C++-only flags in CWARNFLAGS

Sponsored by: The FreeBSD Foundation

4 years agoMFHead @350453
asomers [Tue, 30 Jul 2019 19:42:46 +0000 (19:42 +0000)]
MFHead @350453

Sponsored by: The FreeBSD Foundation

4 years agoAdd a CXXWARNFLAGS variable
asomers [Tue, 30 Jul 2019 19:34:39 +0000 (19:34 +0000)]
Add a CXXWARNFLAGS variable

Some warning flags are valid for C++ but not C. GCC 8 complains if you pass
such flags when building a C file. Using a separate variable for these
flags allows building both C and C++ files in the same directory (such as
the fusefs tests) under GCC.

Reviewed by: cem, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21116

4 years agofusefs: nul-terminate some strings in the readdir test
asomers [Tue, 30 Jul 2019 17:31:09 +0000 (17:31 +0000)]
fusefs: nul-terminate some strings in the readdir test

Reported by: GCC 8
Sponsored by: The FreeBSD Foundation

4 years agolinuxulator: rename linux_locore.s to .asm
emaste [Tue, 30 Jul 2019 17:18:31 +0000 (17:18 +0000)]
linuxulator: rename linux_locore.s to .asm

It is assembled using "${CC} -x assembler-with-cpp", which by convention
(bsd.suffixes.mk) uses the .asm extension.

This is a portion of the review referenced below (D18344).  That review
also renamed linux_support.s to .S, but that is a functional change
(using the compiler's integrated assembler instead of as) and will be
revisited separately.

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

4 years agoEnable witness(4) blessings.
markj [Tue, 30 Jul 2019 17:09:58 +0000 (17:09 +0000)]
Enable witness(4) blessings.

witness has long had a facility to "bless" designated lock pairs.  Lock
order reversals between a pair of blessed locks are not reported upon.
We have a number of long-standing false positive LOR reports; start
marking well-understood LORs as blessed.

This change hides reports about UFS vnode locks and the UFS dirhash
lock, and UFS vnode locks and buffer locks, since those are the two that
I observe most often.  In the long term it would be preferable to be
able to limit blessings to a specific site where a lock is acquired,
and/or extend witness to understand why some lock order reversals are
valid (for example, if code paths with conflicting lock orders are
serialized by a third lock), but in the meantime the false positives
frequently confuse users and generate bug reports.

Reviewed by: cem, kib, mckusick
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21039

4 years agocirrus.yml: stop fetching OVMF.fd now that we're using the pkg
emaste [Tue, 30 Jul 2019 16:40:33 +0000 (16:40 +0000)]
cirrus.yml: stop fetching OVMF.fd now that we're using the pkg

Missed in r350302

Sponsored by: The FreeBSD Foundation

4 years agoRegenerate after r350447.
markj [Tue, 30 Jul 2019 16:01:16 +0000 (16:01 +0000)]
Regenerate after r350447.

4 years agoEnable copy_file_range(2) in capability mode.
markj [Tue, 30 Jul 2019 15:59:44 +0000 (15:59 +0000)]
Enable copy_file_range(2) in capability mode.

copy_file_range() operates on a pair of file descriptors; it requires
CAP_READ for the source descriptor and CAP_WRITE for the destination
descriptor.

Reviewed by: kevans, oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21113

4 years agoHandle refcount(9) wraparound.
markj [Tue, 30 Jul 2019 15:57:31 +0000 (15:57 +0000)]
Handle refcount(9) wraparound.

Attempt to mitigate the security risks around refcount overflows by
introducing a "saturated" state for the counter.  Once a counter reaches
INT_MAX+1, subsequent acquire and release operations will blindly set
the counter value to INT_MAX + INT_MAX/2, ensuring that the protected
resource will not be freed; instead, it will merely be leaked.

The approach introduces a small race: if a refcount value reaches
INT_MAX+1, a subsequent release will cause the releasing thread to set
the counter to the saturation value after performing the decrement.  If
in the intervening window INT_MAX refcount releases are performed by a
different thread, a use-after-free is possible.  This is very difficult
to trigger in practice, and any situation where it could be triggered
would likely be vulnerable to reference count wraparound problems
to begin with.  An alternative would be to use atomic_cmpset to acquire
and release references, but this would introduce a larger performance
penalty, particularly when the counter is contended.

Note that refcount_acquire_checked(9) maintains its previous behaviour;
code which must accurately track references should use it instead of
refcount_acquire(9).

Reviewed by: kib, mjg
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21089

4 years agoCreate the /var/account dir with mode 0750; this is a followup to r349974.
ian [Tue, 30 Jul 2019 15:51:28 +0000 (15:51 +0000)]
Create the /var/account dir with mode 0750; this is a followup to r349974.

The rc.d/account script contains code to create the /var/account dir, so
it hadn't occurred to me that it is normally created via mtree; thanks to
jilles@ for pointing it out.

4 years agoFix EFI loader build when LOADER_NET_SUPPORT=no.
br [Tue, 30 Jul 2019 14:54:18 +0000 (14:54 +0000)]
Fix EFI loader build when LOADER_NET_SUPPORT=no.

Sponsored by: DARPA, AFRL

4 years agoFix MMCCAM kernel build.
br [Tue, 30 Jul 2019 14:21:00 +0000 (14:21 +0000)]
Fix MMCCAM kernel build.

Sponsored by: DARPA, AFRL

4 years agoAdd support for the SD/MMC controller found in Terasic DE10-Pro
br [Tue, 30 Jul 2019 12:51:14 +0000 (12:51 +0000)]
Add support for the SD/MMC controller found in Terasic DE10-Pro
(an Intel Stratix 10 GX/SX FPGA Development Kit).

Set the bus speed manually due to lack of clock management support.

Sponsored by: DARPA, AFRL

4 years agofileargs: fix formating in EXAMPLES
oshogbo [Tue, 30 Jul 2019 08:53:03 +0000 (08:53 +0000)]
fileargs: fix formating in EXAMPLES

PR: 239523
Submitted by: mikael.urankar@gmail.com

4 years agoBump __FreeBSD_version after removal of gzip'ed a.out support.
delphij [Tue, 30 Jul 2019 05:14:28 +0000 (05:14 +0000)]
Bump __FreeBSD_version after removal of gzip'ed a.out support.

4 years agoRemove gzip'ed a.out support.
delphij [Tue, 30 Jul 2019 05:13:16 +0000 (05:13 +0000)]
Remove gzip'ed a.out support.

The current implementation of gzipped a.out support was based
on a very old version of InfoZIP which ships with an ancient
modified version of zlib, and was removed from the GENERIC
kernel in 1999 when we moved to an ELF world.

PR: 205822
Reviewed by: imp, kib, emaste, Yoshihiro Ota <ota at j.email.ne.jp>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D21099

4 years agoMFHead @350426
asomers [Tue, 30 Jul 2019 04:17:36 +0000 (04:17 +0000)]
MFHead @350426

Sponsored by: The FreeBSD Foundation