]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoColemak Mod DH keyboard layout
cs [Sun, 5 May 2019 09:02:32 +0000 (09:02 +0000)]
Colemak Mod DH keyboard layout

This is a minor modification of the Colemak keyboard layout.
See: http://colemakmods.github.io/mod-dh/

Reviewed by: philip
Differential Revision: https://reviews.freebsd.org/D20133

5 years agoloader: validate sectorsize argument in disk_open()
tsoome [Sun, 5 May 2019 06:38:47 +0000 (06:38 +0000)]
loader: validate sectorsize argument in disk_open()

The bug and patch is reported against 11.2, but it is good idea to have
the check in place for all versions.

PR: 236585
Submitted by: john@feith.com
Reported by: john@feith.com
MFC after: 1 day

5 years ago[ath_rate_sample] Have the final attempted rate in 11n modes to be the lowest one.
adrian [Sun, 5 May 2019 06:32:40 +0000 (06:32 +0000)]
[ath_rate_sample] Have the final attempted rate in 11n modes to be the lowest one.

Right now ath_rate_sample has a fixed rate schedule, rather than the minstrel_ht
style "best, good, most reliable" triplet.  So, if higher rates are tried then
it'll not fail back to a lower MCS rate in that transmission schedule.

This means that in low SNR situations it'll not easily drop to MCS0 unless enough
transmissions occur to allow rate control to eventually decide to drop; and if
it's TCP traffic it'll get slowed down because of packet loss.

It's worse for 2-stream and 3-stream rates; it doesn't ever fall back to lower
stream rates, and these higher stream rates required higher SNR to work.

So instead let's (for now?) have each of the 11n transmit rates use MCS0 as
the last attempt. ath_rate_sample will quickly see that rate succeeds more
and will move to it much quicker.

Testing:

* AR9344 (Wasp) - 2G STA mode

5 years ago[ath] [ath_rate] Fix ANI calibration during non-ACTIVE states; start poking at rate...
adrian [Sun, 5 May 2019 04:56:37 +0000 (04:56 +0000)]
[ath] [ath_rate] Fix ANI calibration during non-ACTIVE states; start poking at rate control

These are some fun issues I've found with my upstairs wifi link at such a ridiculous
low signal level (like, < 5dB.)

* Add per-station tx/rx rssi statistics, in potential preparation to use that
  in the RX rate control.

* Call the rate control on each received frame to let it potentially use
  it as a hint for what rates to potentially use.  It's a no-op right now.

* Do ANI calibration during scan as well. The ath_newstate() call was disabling the
  ANI timer and only re-enabling it during transitions to _RUN.  This has the
  unfortunate side-effect that if ANI deafened the NIC because of interference
  and it disassociated, it wouldn't be reset and the scan would never hear beacons.

The ANI configuration is stored at least globally on some HALs and per-channel
on others.  Because of this a NIC reset wouldn't help; the ANI parameters would
simply be programmed back in.

Now, I have a feeling I also need to do this during AUTH/ASSOC too and maybe,
if I'm feeling clever, I need to reset the ANI parameters on a given channel
during a transition through INIT or if the VAP is destroyed/re-created.
However for now this gets me out of the immediate weeds with connectivity
upstairs (and thus I /can/ commit); I'll keep chipping away at tidying this
stuff up in subsequent commits.

Tested:

* AR9344 (Wasp), 2G STA mode

5 years agoMFV r347136:
cy [Sun, 5 May 2019 04:14:17 +0000 (04:14 +0000)]
MFV r347136:

Update sqlite3-3.27.2 (3270200) --> sqlite3-3.28.0 (3280000)

MFC after: 3 days
Security: CVE-2019-9937, CVE-2019-9936

5 years agox86: Implement MWAIT support for stopping a CPU
cem [Sat, 4 May 2019 20:34:26 +0000 (20:34 +0000)]
x86: Implement MWAIT support for stopping a CPU

IPI_STOP is used after panic or when ddb is entered manually.  MONITOR/
MWAIT allows CPUs that support the feature to sleep in a low power way
instead of spinning.  Something similar is already used at idle.

It is perhaps especially useful in oversubscribed VM environments, and is
safe to use even if the panic/ddb thread is not the BSP.  (Except in the
presence of MWAIT errata, which are detected automatically on platforms with
known wakeup problems.)

It can be tuned/sysctled with "machdep.stop_mwait," which defaults to 0
(off).  This commit also introduces the tunable
"machdep.mwait_cpustop_broken," which defaults to 0, unless the CPU has
known errata, but may be set to "1" in loader.conf to signal that mwait
wakeup is broken on CPUs FreeBSD does not yet know about.

Unfortunately, Bhyve doesn't yet support MONITOR extensions, so this doesn't
help bhyve hypervisors running FreeBSD guests.

Submitted by:   Anton Rang <rang AT acm.org> (earlier version)
Reviewed by: kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20135

5 years agoarm64: Properly restore PAN when done with userspace access in casueword.
kib [Sat, 4 May 2019 19:40:30 +0000 (19:40 +0000)]
arm64: Properly restore PAN when done with userspace access in casueword.

Approved by: andrew
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agosysv: get rid of fork/exit hooks if the code is compiled in
mjg [Sat, 4 May 2019 19:05:30 +0000 (19:05 +0000)]
sysv: get rid of fork/exit hooks if the code is compiled in

Sponsored by: The FreeBSD Foundation

5 years agoAnnotate nprocs with __exclusive_cache_line
mjg [Sat, 4 May 2019 19:04:17 +0000 (19:04 +0000)]
Annotate nprocs with __exclusive_cache_line

Sponsored by: The FreeBSD Foundation

5 years agoZero out the file directory entry metadata to reduce disk
mckusick [Sat, 4 May 2019 18:00:57 +0000 (18:00 +0000)]
Zero out the file directory entry metadata to reduce disk
scavenging disclosure.

Submitted by: David G. Lawrence <dg@dglawrence.com>
MFC after:    1 week

5 years agox86: Define pc_monitorbuf as a logical structure
cem [Sat, 4 May 2019 17:35:13 +0000 (17:35 +0000)]
x86: Define pc_monitorbuf as a logical structure

Rather than just accessing it via pointer cast.

No functional change intended.

Discussed with: kib (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20135

5 years agopowerpc/mpc85xx: Attach MPC85xx PCI bus and root complex at the right pass
jhibbits [Sat, 4 May 2019 16:24:43 +0000 (16:24 +0000)]
powerpc/mpc85xx: Attach MPC85xx PCI bus and root complex at the right pass

No signifcant change, just matches other PCI attachments, attaching at
BUS_PASS_BUS.

MFC after: 2 weeks

5 years agoAdd emmc clock definitions for Rockchip RK3399 SoC.
ganbold [Sat, 4 May 2019 10:48:44 +0000 (10:48 +0000)]
Add emmc clock definitions for Rockchip RK3399 SoC.

5 years agoFix regression issue after r346645 in the LinuxKPI.
hselasky [Sat, 4 May 2019 09:47:01 +0000 (09:47 +0000)]
Fix regression issue after r346645 in the LinuxKPI.

The S/G list must be mapped AS-IS without any optimisations.
This also implies that sg_dma_len() must be equal to sg->length.
Many Linux drivers assume this and this fixes some DRM issues.

Put the BUS DMA map pointer into the scatter-gather list to
allow multiple mappings on the same physical memory address.

The FreeBSD version has been bumped to force recompilation of
external kernel modules.

Sponsored by: Mellanox Technologies

5 years agoFix regression issue after r346645 in the LinuxKPI.
hselasky [Sat, 4 May 2019 09:30:03 +0000 (09:30 +0000)]
Fix regression issue after r346645 in the LinuxKPI.
Properly handle error case when mapping DMA address fails.

Sponsored by: Mellanox Technologies

5 years agopowerpc: Optimize padding in bus_dma_tag
jhibbits [Sat, 4 May 2019 02:45:24 +0000 (02:45 +0000)]
powerpc: Optimize padding in bus_dma_tag

Avoid 8 bytes of padding (2 noncontiguous ints).

Submitted by: Brandon Bergren <git_bdragon.rtk0.net>
Differential Revision: https://reviews.freebsd.org/D20121

5 years agopowerpc: Merge all pmap struct definitions
jhibbits [Sat, 4 May 2019 02:34:28 +0000 (02:34 +0000)]
powerpc: Merge all pmap struct definitions

Summary:
A few ports fail to build due to missing pmap-related definitions, which are
specific per-pmap type.  This tries to appease those ports, by merging all
pmaps together.

A future change will move the inline page directory out of the Book-E pmap,
to eliminate the last #ifdefs in pmap.h and complete the merge.

Reviewed By: luporl
Differential Revision: https://reviews.freebsd.org/D20119

5 years agoFix `clang -Wcast-qual` issues
ngie [Sat, 4 May 2019 02:09:30 +0000 (02:09 +0000)]
Fix `clang -Wcast-qual` issues

Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and
deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb`
variable.

This unblocks ^/projects/runtime-coverage-v2 from building cleanly on
universe13a.freebsd.org. I suspect the issue was introduced through some
changes to `bsd.*.mk` inclusion on the branch, which I will continue to
investigate/isolate.

MFC after: 1 week
Tested with: clang 8 (arm64)

5 years agoThis update eliminates a kernel stack disclosure bug in UFS/FFS
mckusick [Fri, 3 May 2019 21:54:14 +0000 (21:54 +0000)]
This update eliminates a kernel stack disclosure bug in UFS/FFS
directory entries that is caused by uninitialized directory entry
padding written to the disk. It can be viewed by any user with read
access to that directory. Up to 3 bytes of kernel stack are disclosed
per file entry, depending on the the amount of padding the kernel
needs to pad out the entry to a 32 bit boundry. The offset in the
kernel stack that is disclosed is a function of the filename size.
Furthermore, if the user can create files in a directory, this 3
byte window can be expanded 3 bytes at a time to a 254 byte window
with 75% of the data in that window exposed. The additional exposure
is done by removing the entry, creating a new entry with a 4-byte
longer name, extracting 3 more bytes by reading the directory, and
repeating until a 252 byte name is created.

This exploit works in part because the area of the kernel stack
that is being disclosed is in an area that typically doesn't change
that often (perhaps a few times a second on a lightly loaded system),
and these file creates and unlinks themselves don't overwrite the
area of kernel stack being disclosed.

It appears that this bug originated with the creation of the Fast
File System in 4.1b-BSD (Circa 1982, more than 36 years ago!), and
is likely present in every Unix or Unix-like system that uses
UFS/FFS. Amazingly, nobody noticed until now.

This update also adds the -z flag to fsck_ffs to have it scrub
the leaked information in the name padding of existing directories.
It only needs to be run once on each UFS/FFS filesystem after a
patched kernel is installed and running.

Submitted by: David G. Lawrence <dg@dglawrence.com>
Reviewed by:  kib
MFC after:    1 week

5 years agoEmulate the "ADD reg, r/m" instruction (opcode 03H).
jhb [Fri, 3 May 2019 21:48:42 +0000 (21:48 +0000)]
Emulate the "ADD reg, r/m" instruction (opcode 03H).

OVMF's flash variable storage is using add instructions when indexing
the variable store bootrom location.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed by: rgrimes
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19975

5 years agoSimplify calculation of DIRECTSIZ. No functional change intended.
mckusick [Fri, 3 May 2019 21:46:25 +0000 (21:46 +0000)]
Simplify calculation of DIRECTSIZ. No functional change intended.

Suggested by: kib
MFC after:    1 week

5 years agoDisallow excessively small times of day in clock_settime(2).
markj [Fri, 3 May 2019 21:26:44 +0000 (21:26 +0000)]
Disallow excessively small times of day in clock_settime(2).

Reported by: syzkaller
Reviewed by: cem, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20151

5 years agoUse SRC+= rather than SRC=
imp [Fri, 3 May 2019 21:13:09 +0000 (21:13 +0000)]
Use SRC+= rather than SRC=

To allow boot1/Makefile to be included, use SRC+= rathern than SRC=
so the including Makefile can add additional sources to the build.

5 years agoSubstitute boot1 with ${BOOT1}
imp [Fri, 3 May 2019 21:13:04 +0000 (21:13 +0000)]
Substitute boot1 with ${BOOT1}

Allow for other names to be built, so parameterize this makefile to
avoid hard coding boot1.

5 years agoWhen we can't get memory, trying again right away is going to
imp [Fri, 3 May 2019 21:09:25 +0000 (21:09 +0000)]
When we can't get memory, trying again right away is going to
fail. Rather than print N failure messages, bail on the first one.

5 years agoRemove stray '*'
imp [Fri, 3 May 2019 21:06:34 +0000 (21:06 +0000)]
Remove stray '*'

We're storing an EFI_HANDLE, not an pointer to a handle. Since
EFI_HANDLE is a void * anyway, this has little practical effect since
the conversion to / from void * and void ** is silent.

5 years agoWhen MAC is enabled and a policy module is loaded, don't unconditionally
rwatson [Fri, 3 May 2019 20:38:43 +0000 (20:38 +0000)]
When MAC is enabled and a policy module is loaded, don't unconditionally
lock mac_ifnet_mtx, which protects labels on struct ifnet, unless at least
one policy is actively using labels on ifnets.  This avoids a global mutex
acquire in certain fast paths -- most noticeably ifnet transmit.  This was
previously invisible by default, as no MAC policies were loaded by default,
but recently became visible due to mac_ntpd being enabled by default.

gallatin@ reports a reduction in PPS overhead from 300% to 2.2% with this
change.  We will want to explore further MAC Framework optimisation to
reduce overhead further, but this brings things more back into the world
of the sane.

MFC after: 3 days

5 years agoAllow iflib drivers to pass a pointer to their own ifmedia structure.
mmacy [Fri, 3 May 2019 20:05:31 +0000 (20:05 +0000)]
Allow iflib drivers to pass a pointer to their own ifmedia structure.

Tested by: emaste@

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

5 years agoIncrease the default size of the GCE disk image from 3GB to 20GB,
gjb [Fri, 3 May 2019 17:23:08 +0000 (17:23 +0000)]
Increase the default size of the GCE disk image from 3GB to 20GB,
as 3GB is too small as discovered in this week's snapshot builds.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoSelect lacp egress ports based on NUMA domain
gallatin [Fri, 3 May 2019 14:43:21 +0000 (14:43 +0000)]
Select lacp egress ports based on NUMA domain

This change creates an array of port maps indexed by numa domain
for lacp port selection. If we have lacp interfaces in more than
one domain, then we select the egress port by indexing into the
numa port maps and picking a port on the appropriate numa domain.

This is behavior is controlled by the new ifconfig use_numa flag
and net.link.lagg.use_numa sysctl/tunable (both modeled after the
existing use_flowid), which default to enabled.

Reviewed by: bz, hselasky, markj (and scottl, earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20060

5 years agoFix copying planar bitmaps when the horizontal start and end are both not
bde [Fri, 3 May 2019 13:06:46 +0000 (13:06 +0000)]
Fix copying planar bitmaps when the horizontal start and end are both not
multiples of 8.  Then the misaligned pixels at the end were not copied.

Clean up variable misuse related to this bug.  The width in bytes was
first calculated correctly and used to do complicated reblocking
correctly, but it was stored in an unrelated scratch variable and later
recalculated with an off-by-1-error, so the last byte (times 4 planes)
in the intermediate copy was not copied.

This doubly-misaligned case is especially slow.  Misalignment complicates
the reblocking, and each misaligment requires a read before write, and this
read is still not done from the shadow buffer.

5 years agoIn order to reduce duplication between MD parts of the Linuxulator
dchagin [Fri, 3 May 2019 08:42:49 +0000 (08:42 +0000)]
In order to reduce duplication between MD parts of the Linuxulator
move bits that are MI out into the headers in compat/linux.
For that remove bogus _packed attribute from struct l_sockaddr
and use MI types for struct members.

And continue to move into the linux_common module a code that is
intended for both Linuxulator modules (both instruction set - 32 & 64 bit)
or for external modules like linsysfs or linprocfs.

To avoid header pollution introduce new sys/compat/linux_common.h header.

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

5 years agoDecode more CPU flags in cpuinfo.
trasz [Fri, 3 May 2019 08:27:03 +0000 (08:27 +0000)]
Decode more CPU flags in cpuinfo.

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

5 years ago[libfetch] Fix compilation with WITHOUT_CRYPT.
adrian [Fri, 3 May 2019 06:06:39 +0000 (06:06 +0000)]
[libfetch] Fix compilation with WITHOUT_CRYPT.

5 years agofls() should find the most significant bit of an int faster than a
dougm [Fri, 3 May 2019 02:55:54 +0000 (02:55 +0000)]
fls() should find the most significant bit of an int faster than a
linear search can, so use it to avoid a linear search in isqrt.

Approved by: kib (mentor), markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20102

5 years agoIncrease the VirtIO segment count to support modern Windows guests.
jhb [Thu, 2 May 2019 22:46:37 +0000 (22:46 +0000)]
Increase the VirtIO segment count to support modern Windows guests.

The Windows virtio driver ignores the advertized seg_max field and
assumes the host can accept up to 67 segments in indirect descriptors,
triggering an assert in the bhyve process.

This brings back r282922 but with a couple of changes:
- It raises the block interface segment limit to 128 instead of 67.
- Linux's virtio driver assumes that the segment limit is no
  larger than the ring size.  To avoid breaking Linux guests,
  raise the VirtIO ring size to 128, and cap the VirtIO segment
  limit at ring size - 2 (effectively 126).

Reviewed by: rgrimes, Patrick Mooney <pmooney@pfmooney.com>
Obtained from: Joyent (Linux workaround)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18831

5 years agodirectory.3: add a STANDARDS section
asomers [Thu, 2 May 2019 19:59:37 +0000 (19:59 +0000)]
directory.3: add a STANDARDS section

Reviewed by: jilles, ngie
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20111

5 years agoiflib: remove assertion that isc_capabilities is nonzero
emaste [Thu, 2 May 2019 19:13:31 +0000 (19:13 +0000)]
iflib: remove assertion that isc_capabilities is nonzero

It's atypical, but not invalid, for a driver to pass no capabilities.

Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: shurd
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20142

5 years agoFix flags in cpuinfo.
trasz [Thu, 2 May 2019 19:02:16 +0000 (19:02 +0000)]
Fix flags in cpuinfo.

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

5 years agoAdd a COMPAT_FREEBSD12 kernel option.
cem [Thu, 2 May 2019 18:10:23 +0000 (18:10 +0000)]
Add a COMPAT_FREEBSD12 kernel option.

Use it wherever COMPAT_FREEBSD11 is currently specified, like r309749.

Reviewed by: imp, jhb, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20120

5 years agolibbe: set mountpoint=none in be_import
kevans [Thu, 2 May 2019 17:50:56 +0000 (17:50 +0000)]
libbe: set mountpoint=none in be_import

If we're going to set a mountpoint at all, mountpoint=none makes more sense
than mountpoint=/.

MFC after:  3 days

5 years agolibbe(3): Properly mount BEs with mountpoint=none
kevans [Thu, 2 May 2019 17:44:46 +0000 (17:44 +0000)]
libbe(3): Properly mount BEs with mountpoint=none

Instead of pretending to successfully mount them while not actually
mounting anything, we'll now actually mount them *and* claim we mounted them
successfully.

Reported by: ler
MFC after: 3 days

5 years agodtb: Include RK3399 RockPro64 DTS in kernel build
manu [Thu, 2 May 2019 17:04:01 +0000 (17:04 +0000)]
dtb: Include RK3399 RockPro64 DTS in kernel build

The DTS for this board is already present in sys/gnu/dts/arm64/rockchip/
and just needs to be enabled.

Submitted by: alex@wied.io
Differential Revision: https://reviews.freebsd.org/D19823

5 years agostand: correct mis-merge from r346879
kevans [Thu, 2 May 2019 17:01:13 +0000 (17:01 +0000)]
stand: correct mis-merge from r346879

Small mis-merge from multiple WIP resulted in block io media handles getting
double-initialized. This resulted in some installations oddly landing at the
mountroot prompt.

Reported by: ler
Reviewed by: imp

5 years agofdt: Fix installation of aarch64 dtb
kevans [Thu, 2 May 2019 16:56:03 +0000 (16:56 +0000)]
fdt: Fix installation of aarch64 dtb

r345519 rewrote parts of how we build .dtb, but mistakenly dropped the
vendor dir for aarch64.  Simply drop the :T for building ${DTB} in the
aarch64 case- it'll get applied at install-time as-needed, with :H:T for
determining the vendor dir.

Reported by: manu
Tested by: manu
Reviewed by: manu
MFC after: 3 days

5 years agoEnroll new committer Doug Moore (dougm@freebsd.org).
dougm [Thu, 2 May 2019 16:28:33 +0000 (16:28 +0000)]
Enroll new committer Doug Moore (dougm@freebsd.org).

Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20136

5 years agoCleanup for rtld_malloc.c.
kib [Thu, 2 May 2019 15:03:16 +0000 (15:03 +0000)]
Cleanup for rtld_malloc.c.

- Remove dead and most likely rotten MALLOC_DEBUG, MSTAT, and RCHECK options.
- Remove unused headers.
- Remove one case of undefined behavior where left shift could overflow.
  It is impossible on practice for rtld and libthr consumer.

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

5 years agoarm64: Add support for NanoPI NEO2
manu [Thu, 2 May 2019 12:56:13 +0000 (12:56 +0000)]
arm64: Add support for NanoPI NEO2

Add overlay files and activate devicetree file for NanoPi NEO2 featuring
Allwinner H5 ARM64 core.
To enable sound, dma and codec drivers are enabled for build.

Submitted by: Manuel Stühn (freebsdnewbie@freenet.de)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D20129

5 years agoRemove unneeded includes.
dchagin [Thu, 2 May 2019 09:00:36 +0000 (09:00 +0000)]
Remove unneeded includes.

MFC after: 2 week

5 years agoAdd sys/devices/system/cpu/{possible,present} to linsysfs(5).
trasz [Thu, 2 May 2019 08:17:29 +0000 (08:17 +0000)]
Add sys/devices/system/cpu/{possible,present} to linsysfs(5).
That makes Linux lscpu(1) work.

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

5 years agopowerpc: Drop OPAL_HANDLE_HMI2 for now, to avoid panicking
jhibbits [Thu, 2 May 2019 03:39:03 +0000 (03:39 +0000)]
powerpc: Drop OPAL_HANDLE_HMI2 for now, to avoid panicking

It's possible for a Hypervisor Maintenance Interrupt (HMI) to occur while in
the pmap code, holding locks.  This can cause WITNESS to panic due to lock
errors in calling pmap_kextract().  Since we don't yet handle the flags
returned by OPAL_HANDLE_HMI2, just stop using it, so that we don't call into
pmap_kextract().

Reported by: pkubaj

5 years agoUnbreak the tests after r347002.
trasz [Wed, 1 May 2019 19:35:45 +0000 (19:35 +0000)]
Unbreak the tests after r347002.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoAdd 'Birth' to 'stat -x' output. Current Linux stat(1)
trasz [Wed, 1 May 2019 18:56:22 +0000 (18:56 +0000)]
Add 'Birth' to 'stat -x' output. Current Linux stat(1)
also includes that.

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

5 years agoAdd MLINKS to atf-c.3.
trasz [Wed, 1 May 2019 18:54:27 +0000 (18:54 +0000)]
Add MLINKS to atf-c.3.

Reviewed by: ngie
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D20125

5 years agoRestore x18 in efi_arch_leave.
andrew [Wed, 1 May 2019 17:12:49 +0000 (17:12 +0000)]
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
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Sponsored by: Ampere Computing (hardware)
Differential Revision: https://reviews.freebsd.org/D20127

5 years agoAdd a few regression tests for mlock(2).
markj [Wed, 1 May 2019 15:28:23 +0000 (15:28 +0000)]
Add a few regression tests for mlock(2).

These are intended to exercise some rarely executed code paths.

MFC after: 2 weeks

5 years agoDeactivate IRQ resource by calling to intr_deactivate_irq().
br [Wed, 1 May 2019 15:03:12 +0000 (15:03 +0000)]
Deactivate IRQ resource by calling to intr_deactivate_irq().
This is the part of INTRNG support that was missed.

Sponsored by: DARPA, AFRL

5 years agoAdd a hw.model sysctl oid for arm64 which reports the CPU model similar to armv6/7.
ganbold [Wed, 1 May 2019 14:20:31 +0000 (14:20 +0000)]
Add a hw.model sysctl oid for arm64 which reports the CPU model similar to armv6/7.

Reviewed by: andrew, manu
Differential Revision: https://reviews.freebsd.org/D20123

5 years agoFix another race between vm_map_protect() and vm_map_wire().
kib [Wed, 1 May 2019 13:15:06 +0000 (13:15 +0000)]
Fix another race between vm_map_protect() and vm_map_wire().

vm_map_wire() increments entry->wire_count, after that it drops the
map lock both for faulting in the entry' pages, and for marking next
entry in the requested region as IN_TRANSITION. Only after all entries
are faulted in, MAP_ENTRY_USER_WIRE flag is set.

This makes it possible for vm_map_protect() to run while other entry'
MAP_ENTRY_IN_TRANSITION flag is handled, and vm_map_busy() lock does
not prevent it. In particular, if the call to vm_map_protect() adds
VM_PROT_WRITE to CoW entry, it would fail to call
vm_fault_copy_entry(). There are at least two consequences of the
race: the top object in the shadow chain is not populated with
writeable pages, and second, the entry eventually get contradictory
flags MAP_ENTRY_NEEDS_COPY | MAP_ENTRY_USER_WIRED with VM_PROT_WRITE
set.

Handle it by waiting for all MAP_ENTRY_IN_TRANSITION flags to go away
in vm_map_protect(), which does not drop map lock afterwards. Note
that vm_map_busy_wait() is left as is.

Reported and tested by: pho (previous version)
Reviewed by: Doug Moore <dougm@rice.edu>, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20091

5 years agoRemove trailing slashes from URLs; current mandoc(1) seems to render
trasz [Wed, 1 May 2019 13:00:33 +0000 (13:00 +0000)]
Remove trailing slashes from URLs; current mandoc(1) seems to render
them just fine.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUse D_PARTISGPT rather than bare 255
imp [Wed, 1 May 2019 05:42:13 +0000 (05:42 +0000)]
Use D_PARTISGPT rather than bare 255

These three cases dovetail with other places in the code where we use
or set D_PARTISGPT when we mean that the partitioning scheme is
GPT. Use this #define to make the code easier to undertand.

Reviewed by: tsoome@
Differential Revision: https://reviews.freebsd.org/D20122

5 years agoRespect quotes and escapes when splitting exports fields.
mav [Tue, 30 Apr 2019 21:38:38 +0000 (21:38 +0000)]
Respect quotes and escapes when splitting exports fields.

Without this r293305 was still unable to handle names with spaces.

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

5 years agoAdd a paragraph that mentions gptboot having an interactive mode, and
ian [Tue, 30 Apr 2019 18:48:20 +0000 (18:48 +0000)]
Add a paragraph that mentions gptboot having an interactive mode, and
direct the user to the boot(8) manpage, which provides the details on that.

5 years agozfsboot: to detect disk size, use GPT information first
tsoome [Tue, 30 Apr 2019 17:45:22 +0000 (17:45 +0000)]
zfsboot: to detect disk size, use GPT information first

If we do have GPT on disk, read the disk size from it and do not
call int13.

Since int13 does report bogus informatiopn too often, rather trust the
partition table. We are using the same strategy with loader.

MFC after: 1 month

5 years agoUpdate the manpage text to show the output generated by the first-stage
ian [Tue, 30 Apr 2019 17:42:05 +0000 (17:42 +0000)]
Update the manpage text to show the output generated by the first-stage
bootloader these days (x86 instead of i386).

5 years agoFollow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.
dchagin [Tue, 30 Apr 2019 17:18:05 +0000 (17:18 +0000)]
Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.
It was first introduced in r163734 and missied by me in r283383.

MFC after: 1 week

5 years agorevert QEMU q35 platform use from r346748
emaste [Tue, 30 Apr 2019 15:28:52 +0000 (15:28 +0000)]
revert QEMU q35 platform use from r346748

It seems to be incompatible with the OVMF.fd (of unknown provenance)
in use by the Cirrus-CI config.  We will soon have a known OVMF build
via a port/package (see review D19869) and we can switch back to q35
once packages are available.

Discussed with: bcran

5 years agoRetry upon NET_RT_IFLIST sysctl failure.
markj [Tue, 30 Apr 2019 14:44:39 +0000 (14:44 +0000)]
Retry upon NET_RT_IFLIST sysctl failure.

Port the logic used by getifaddrs(3) to handle the case where
NET_RT_IFLIST returns ENOMEM, which can occur if the list size changes
between the buffer allocation and sysctl read.

PR: 195191
Submitted by: Guy Yur <guyyur@gmail.com> (original version)
MFC after: 1 week

5 years agoReduce the default image size for virtual machine disk images from
gjb [Tue, 30 Apr 2019 14:29:09 +0000 (14:29 +0000)]
Reduce the default image size for virtual machine disk images from
30GB to 3GB.  The raw images can be resized using truncate(1), and
other formats can be resized with tools included with other tools
included with other hypervisors.

Enable the growfs(8) rc(8) at firstboot if the disk was resized
prior to booting the virtual machine for the first time.

Discussed with: several
PR: 232313 (requested in other context)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoReduce the number of mutexes after r346645 in the LinuxKPI.
hselasky [Tue, 30 Apr 2019 10:41:20 +0000 (10:41 +0000)]
Reduce the number of mutexes after r346645 in the LinuxKPI.
Make function macro wrappers for locking and unlocking to ease readability.

No functional change.

Discussed with: kib@, tychon@ and zeising@
Sponsored by: Mellanox Technologies

5 years agoMake the dma_pool structure private to the LinuxKPI similar to Linux.
hselasky [Tue, 30 Apr 2019 09:38:22 +0000 (09:38 +0000)]
Make the dma_pool structure private to the LinuxKPI similar to Linux.

No functional change.

Discussed with: kib @
Sponsored by: Mellanox Technologies

5 years agoStore a pointer to the device instead of the PCI device in the DMA pool
hselasky [Tue, 30 Apr 2019 09:26:11 +0000 (09:26 +0000)]
Store a pointer to the device instead of the PCI device in the DMA pool
implementation in the LinuxKPI. This avoids use of container_of().

No functional change.

Discussed with: kib @
Sponsored by: Mellanox Technologies

5 years agopowerpc: Stop pretending we run on e500v1 cores
jhibbits [Tue, 30 Apr 2019 03:45:46 +0000 (03:45 +0000)]
powerpc: Stop pretending we run on e500v1 cores

Unconditional writing to MAS7, which doesn't exist on the e500v1 core, in a
TLB miss handler has been in the code for several years now.  Since this has
gone unnoticed for so long, it's easily concluded that e500v1 is not in use
with FreeBSD.  Simplify the code path a bit, by unconditionally zeroing MAS7
instead of calling a subroutine to do it.

5 years agopowerpc64: Fix switch panic from cpu_throw()
jhibbits [Mon, 29 Apr 2019 22:37:35 +0000 (22:37 +0000)]
powerpc64: Fix switch panic from cpu_throw()

r18 is used to hold the old PCB flags, but cpu_throw doesn't populate r18
with PCB flags, since the old thread is gone.  This can lead to panics on
cores that don't have the registers guarded by these flags.

5 years agoRewrap some long lines.
jhb [Mon, 29 Apr 2019 22:15:51 +0000 (22:15 +0000)]
Rewrap some long lines.

Whitespace only change.

5 years agoOptimize lseek(SEEK_DATA) on UFS.
markj [Mon, 29 Apr 2019 22:05:26 +0000 (22:05 +0000)]
Optimize lseek(SEEK_DATA) on UFS.

This version fixes the problems identified in r345244.

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

5 years agoNote that ccr(4) now supports AES-CCM.
jhb [Mon, 29 Apr 2019 22:00:45 +0000 (22:00 +0000)]
Note that ccr(4) now supports AES-CCM.

5 years agoUpdate/reformat maintainer entries that I am a part of
ngie [Mon, 29 Apr 2019 18:48:43 +0000 (18:48 +0000)]
Update/reformat maintainer entries that I am a part of

* Replace all instances of freebsd-testing with `#test`. `#test` is the
  Phabricator group that focuses on test-related reviews.
* Replace `atf` with contrib/atf, as that's the actual location for the test
  framework.
* Remove jmmv@ from the maintainers list for atf. He is the upstream project
  owner, but was moved to alumni status after r345787.
* Fix a typo accidentally introduced in r346899 (inpact -> impact).

5 years agoAdd a note to MAINTAINERS for lkpi for graphics
zeising [Mon, 29 Apr 2019 18:20:51 +0000 (18:20 +0000)]
Add a note to MAINTAINERS for lkpi for graphics

Add a note to MAINTAINERS requesting pre-commit review from the graphics
team, using phabricator, for changes to the lkpi subsystem.  This is done in
order to give us a chance to test the graphics drivers (drm drivers) for
regressions, and to try to avoid breakage, errors and issues with the
graphics drivers.
The review is done via the #x11 group on phabricator.

Please note that hselasky also want to review changes.

Discussed with: hselasky, imp
Approved by: imp

5 years agoip multicast debug: fix strings vs defines
mav [Mon, 29 Apr 2019 18:09:55 +0000 (18:09 +0000)]
ip multicast debug: fix strings vs defines

Turning on multicast debug made multicast failure worse
because the strings and #define values no longer matched
up.  Fix them, and make sure they stay matched-up.

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

5 years ago[PPC64] Turn opal_flash.c into a device
luporl [Mon, 29 Apr 2019 16:50:33 +0000 (16:50 +0000)]
[PPC64] Turn opal_flash.c into a device

This change makes it easier to enable/disable the inclusion of
OPAL flash in the kernel.

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

5 years agoo Rewrite softdma_process_tx() of Altera SoftDMA engine driver
br [Mon, 29 Apr 2019 16:27:15 +0000 (16:27 +0000)]
o Rewrite softdma_process_tx() of Altera SoftDMA engine driver
  so it does not require a bounce buffer. The only need for this was
  to align the buffer address. Implement unaligned access and we don't
  need to copy data twice.
o Remove contigmalloc-based bounce buffer from xDMA code since it is
  not suitable for arbitrary memory provided by platform, which is
  sometimes a dedicated piece of memory that is not managed by OS at all.

Sponsored by: DARPA, AFRL

5 years agoSupport all reasonable cursor sizes. Reduce the size of the standard
bde [Mon, 29 Apr 2019 16:26:29 +0000 (16:26 +0000)]
Support all reasonable cursor sizes.  Reduce the size of the standard
cursor from 16x16 (with 6 columns unused) to 10x16 and rename it to
the "small" cursor.  Add a "large" 19x32 cursor and use it for screen
widths larger than 800 pixels.  Use libvgl's too-small indentation for
the large data declarations.

MOUSE_IMG_SIZE = 16 is still part of the API.  If an application supplies
invalid bitmaps for the cursor, then the results may be different from
before.

5 years agoOops, r346889 broke showing of the mouse cursor after clearing, by
bde [Mon, 29 Apr 2019 15:58:05 +0000 (15:58 +0000)]
Oops, r346889 broke showing of the mouse cursor after clearing, by
forgetting to tell the bitmap-copying clearing method to preserve the
cursor.

5 years agoRefactor and simplify hiding the mouse cursor and fix bugs caused by
bde [Mon, 29 Apr 2019 14:13:53 +0000 (14:13 +0000)]
Refactor and simplify hiding the mouse cursor and fix bugs caused by
complications in the previous methods.

r346761 broke showing the mouse cursor after changing its state from
off to on (including initially), since showing the cursor uses the
state to decide whether to actually show and the state variable was
not changed until after null showing.  Moving the mouse or copying
under the cursor fixed the problem.  Fix this and similar problems for
the on to off transition by changing the state variable before drawing
the cursor.

r346641 failed to turn off the mouse cursor on exit from vgl.  It hid
the cursor only temporarily for clearing.  This doesn't change the state
variable, so unhiding the cursor after clearing restored the cursor if its
state was on.  Fix this by changing its state to VGL_MOUSEHIDE using the
application API for changing the state.

Remove the VGLMouseVisible state variable and the extra states given by it.
This was an optimization that was just an obfuscation in at least the
previous version.

Staticize VGLMouseAction().  Remove VGLMousePointerShow/Hide() except as
internals in __VGLMouseMode().  __VGLMouseMouseMode() is the same as the
application API VGLMouseMouseMode() except it returns the previous mode
which callers need to know to restore it after hiding the cursor.

Use the refactoring to make minor improvements in a simpler way than was
possible:
- in VGLMouseAction(), only hide and and unhide the mouse cursor if the
  mouse moved
- in VGLClear(), only hide and and unhide the mouse cursor if the clearing
  method would otherwise clear the cursor.

5 years agoStop checking TD_IDLETHREAD() in buffer cache routines.
markj [Mon, 29 Apr 2019 13:23:32 +0000 (13:23 +0000)]
Stop checking TD_IDLETHREAD() in buffer cache routines.

These predicates are vestigal and cannot be true today.  For example,
idle threads are not allowed to acquire locks.

Also cache curthread in breada().

No functional change intended.

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

5 years agoHandle HAVE_PROTO flag and print "proto" keyword for O_IP4 and O_IP6
ae [Mon, 29 Apr 2019 09:52:53 +0000 (09:52 +0000)]
Handle HAVE_PROTO flag and print "proto" keyword for O_IP4 and O_IP6
opcodes when it is needed.
This should fix the problem, when printed by `ipfw show` rule could not
be added due to missing "proto" keyword.

MFC after: 2 weeks

5 years agoAdd IPv6 support for O_IPLEN opcode.
ae [Mon, 29 Apr 2019 09:33:16 +0000 (09:33 +0000)]
Add IPv6 support for O_IPLEN opcode.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

5 years agoImplement uefi_ignore_boot_mgr env variable.
imp [Mon, 29 Apr 2019 05:02:54 +0000 (05:02 +0000)]
Implement uefi_ignore_boot_mgr env variable.

When set, we ignore all the hints that the UEFI boot manager has set
for us. We also always fail back to the OK prompt when we can't find
the right thing to boot rather than failing back to the UEFI boot
manager. This has the side effect of also expanding the cases where we
fail back to the OK prompt to include when we're booted under UEFI,
but UEFI::BootCurrent isn't set in the environment and we can't find a
proper place to boot from.

Reviewed by: bcran
Differential Revision: https://reviews.freebsd.org/D20016

5 years agoImplement uefi_rootdev
imp [Mon, 29 Apr 2019 05:02:50 +0000 (05:02 +0000)]
Implement uefi_rootdev

If uefi_rootdev is set in the environment, then treat it like a device
path. Convert the string to a device path and see if we can find a
device that matches. If so, use that device at our root dev no matter
what. If it's bad in any way, the boot will fail.

Reviewed by: bcran
Differential Revision: https://reviews.freebsd.org/D20016

5 years agoRead in and parse /efi/freebsd/loader.env from the boot device's
imp [Mon, 29 Apr 2019 05:02:25 +0000 (05:02 +0000)]
Read in and parse /efi/freebsd/loader.env from the boot device's
partition as if it were on the command line.

Fetch FreeBSD-LoaderEnv UEFI enviornment variable. If set, read in
loader environment variables from it. Otherwise read in
/efi/freebsd/loader.env. Both are read relative to the device
loader.efi loaded from (they aren't full UEFI device paths)

Next fetch FreeBSD-NextLoaderEnv UEFI environment variable. If
present, read the file it points to in as above and delete the UEFI
environment variable so it only happens once.

This lets one set environment variables in the bootloader.
Unfortunately, we don't have all the mechanisms in place to parse the
file, nor do we have the magic pattern matching in place that
loader.conf has. Variables are of the form foo=bar. No quotes are
supported, so spaces aren't allowed, for example. Also, variables like
foo_load=yes are intercepted when we parse the loader.conf file and
things are done based on that. Since those aren't done here, variables
that cause an action to happen won't work.

Reviewed by: bcran
Differential Revision: https://reviews.freebsd.org/D20016

5 years agoAdd a trailing empty line to match the test code output
lwhsu [Mon, 29 Apr 2019 03:50:21 +0000 (03:50 +0000)]
Add a trailing empty line to match the test code output

This is added for letting these long failing test case pass, and for
consistency.  The test code should be fixed later to not output this extra
empty line.

Sponsored by: The FreeBSD Foundation

5 years agopowerpc: Make OPAL root node probe at bus pass
jhibbits [Mon, 29 Apr 2019 01:10:57 +0000 (01:10 +0000)]
powerpc: Make OPAL root node probe at bus pass

This way its children can attach earlier if needed, and some subsystems are
attached earlier, like the asynchronous token management.

MFC after: 2 weeks

5 years agoAdd #ifdef INET6 around declaration of nbuf.
rmacklem [Sun, 28 Apr 2019 22:37:59 +0000 (22:37 +0000)]
Add #ifdef INET6 around declaration of nbuf.

It was reported that without #ifdef INET6 around the declaration of "nbuf",
a build would report an unused variable. For some reason, I didn't see that
warning when I did a build, but it seems reasonable to add these #ifdef INET6's.

Submitted by: dmitryluhtionov@gmail.com
MFC after: 1 week

5 years agoSome test scripts use ncat --sctp --listen port to run an SCTP discard
tuexen [Sun, 28 Apr 2019 19:07:31 +0000 (19:07 +0000)]
Some test scripts use ncat --sctp --listen port to run an SCTP discard
server in the background. However, when running in the background,
stdin is closed and ncat initiates a graceful shutdown of the SCTP
association. This is not expected by the client. Therefore, the
ncat-based discard server is replaced by a perl-based one.

In addition, to remove the dependency from ncat, which needs to be
installed via the nmap port, also the code testing for a free SCTP port
is changed to use the perl-based client.

Finally, remove some debug output from the report generated.

Reviewed by: lwhsu@
Differential Revision: https://reviews.freebsd.org/D20086

5 years agoRemove witness warning, same as r346351 for busdma_dmar.
kib [Sun, 28 Apr 2019 18:45:44 +0000 (18:45 +0000)]
Remove witness warning, same as r346351 for busdma_dmar.

bounce_bus_dmamap_create() does not sleep either.

Sponsored by: Mellanox Technologies
MFC after: 1 week

5 years agofsx: seed more randomly with the -S0 option
asomers [Sun, 28 Apr 2019 17:27:06 +0000 (17:27 +0000)]
fsx: seed more randomly with the -S0 option

When using -S0, seed the PRNG with the current time in nanoseconds, not
seconds, so consecutive runs don't accidentally use the same seed.

Also, rename some variables for clarity.

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

5 years agoUpdate the audit(4) man page to talk about dtaudit(4), and also add a
rwatson [Sun, 28 Apr 2019 16:28:36 +0000 (16:28 +0000)]
Update the audit(4) man page to talk about dtaudit(4), and also add a
dtaudit(4) cross reference to auditpipe(4).

MFC after: 3 days
Sponsored by: DARPA, AFRL

5 years agoMake isp(4) suggest loading ispfw(4) when it fails to attach.
trasz [Sun, 28 Apr 2019 15:08:57 +0000 (15:08 +0000)]
Make isp(4) suggest loading ispfw(4) when it fails to attach.
It cannot load it automatically at boot, because the root filesystem
is not there yet. An alternative would be adding ispfw(4) to GENERIC,
but it's an additional 1MB.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D19369

5 years agoAdd a man page for the DTrace Audit Provider, since we are now growing a set
rwatson [Sun, 28 Apr 2019 13:07:38 +0000 (13:07 +0000)]
Add a man page for the DTrace Audit Provider, since we are now growing a set
of provider man pages.

MFC after: 3 days
Sponsored by: DARPA, AFRL