Commit Graph

241209 Commits

Author SHA1 Message Date
Adrian Chadd
7d450faa6f [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
2019-05-05 04:56:37 +00:00
Cy Schubert
02273ca832 MFV r347136:
Update sqlite3-3.27.2 (3270200) --> sqlite3-3.28.0 (3280000)

MFC after:	3 days
Security:	CVE-2019-9937, CVE-2019-9936
2019-05-05 04:14:17 +00:00
Cy Schubert
32335203e0 Import sqlite3-3.28.0 (3280000)
Security:	CVE-2019-9937, CVE-2019-9936
2019-05-05 00:16:24 +00:00
Conrad Meyer
665919aaaf 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
2019-05-04 20:34:26 +00:00
Konstantin Belousov
ecaed009a9 arm64: Properly restore PAN when done with userspace access in casueword.
Approved by:	andrew
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2019-05-04 19:40:30 +00:00
Mateusz Guzik
5408c6db4e sysv: get rid of fork/exit hooks if the code is compiled in
Sponsored by:	The FreeBSD Foundation
2019-05-04 19:05:30 +00:00
Mateusz Guzik
37d2b1f3e5 Annotate nprocs with __exclusive_cache_line
Sponsored by:	The FreeBSD Foundation
2019-05-04 19:04:17 +00:00
Kirk McKusick
44b193b09e Zero out the file directory entry metadata to reduce disk
scavenging disclosure.

Submitted by: David G. Lawrence <dg@dglawrence.com>
MFC after:    1 week
2019-05-04 18:00:57 +00:00
Conrad Meyer
83dc49beaf 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
2019-05-04 17:35:13 +00:00
Justin Hibbits
73a30b035e 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
2019-05-04 16:24:43 +00:00
Ganbold Tsagaankhuu
07be3e3dc9 Add emmc clock definitions for Rockchip RK3399 SoC. 2019-05-04 10:48:44 +00:00
Hans Petter Selasky
442d12d89c 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
2019-05-04 09:47:01 +00:00
Hans Petter Selasky
8ec9f0282a Fix regression issue after r346645 in the LinuxKPI.
Properly handle error case when mapping DMA address fails.

Sponsored by:		Mellanox Technologies
2019-05-04 09:30:03 +00:00
Justin Hibbits
e280e2ea3d 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
2019-05-04 02:45:24 +00:00
Justin Hibbits
5d67b612d0 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
2019-05-04 02:34:28 +00:00
Enji Cooper
a6e9cd258c 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)
2019-05-04 02:09:30 +00:00
Kirk McKusick
0061238fb0 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
2019-05-03 21:54:14 +00:00
John Baldwin
c2b4cedd78 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
2019-05-03 21:48:42 +00:00
Kirk McKusick
ab2214d400 Simplify calculation of DIRECTSIZ. No functional change intended.
Suggested by: kib
MFC after:    1 week
2019-05-03 21:46:25 +00:00
Mark Johnston
bc79b41c40 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
2019-05-03 21:26:44 +00:00
Warner Losh
1f6ba72eb4 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.
2019-05-03 21:13:09 +00:00
Warner Losh
ce2403e672 Substitute boot1 with ${BOOT1}
Allow for other names to be built, so parameterize this makefile to
avoid hard coding boot1.
2019-05-03 21:13:04 +00:00
Warner Losh
6f21634d55 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.
2019-05-03 21:09:25 +00:00
Warner Losh
aacd73b871 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.
2019-05-03 21:06:34 +00:00
Robert Watson
5c95417dad 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
2019-05-03 20:38:43 +00:00
Matt Macy
e2621d9657 Allow iflib drivers to pass a pointer to their own ifmedia structure.
Tested by: emaste@

Differential Revision:	https://reviews.freebsd.org/D19946
2019-05-03 20:05:31 +00:00
Glen Barber
a7976e867f 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
2019-05-03 17:23:08 +00:00
Andrew Gallatin
35961dce98 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
2019-05-03 14:43:21 +00:00
Bruce Evans
2f5cff3750 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.
2019-05-03 13:06:46 +00:00
Dmitry Chagin
d151344dbf 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
2019-05-03 08:42:49 +00:00
Edward Tomasz Napierala
967cbe64b1 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
2019-05-03 08:27:03 +00:00
Adrian Chadd
819082e103 [libfetch] Fix compilation with WITHOUT_CRYPT. 2019-05-03 06:06:39 +00:00
Doug Moore
64f8d2575a 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
2019-05-03 02:55:54 +00:00
John Baldwin
8c74ade848 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
2019-05-02 22:46:37 +00:00
Alan Somers
05a179e83e 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
2019-05-02 19:59:37 +00:00
Ed Maste
ce3da455e9 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
2019-05-02 19:13:31 +00:00
Edward Tomasz Napierala
6c8cb13dd8 Fix flags in cpuinfo.
Reviewed by:	dchagin
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20139
2019-05-02 19:02:16 +00:00
Conrad Meyer
d6745408c7 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
2019-05-02 18:10:23 +00:00
Kyle Evans
ac34fe239d 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
2019-05-02 17:50:56 +00:00
Kyle Evans
011fdcbf1c 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
2019-05-02 17:44:46 +00:00
Emmanuel Vadot
9acc2a6af6 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
2019-05-02 17:04:01 +00:00
Kyle Evans
83475ff137 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
2019-05-02 17:01:13 +00:00
Kyle Evans
2de4a7aa21 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
2019-05-02 16:56:03 +00:00
Doug Moore
b96fbd3cf3 Enroll new committer Doug Moore (dougm@freebsd.org).
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20136
2019-05-02 16:28:33 +00:00
Konstantin Belousov
5cac2021fe 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
2019-05-02 15:03:16 +00:00
Emmanuel Vadot
5b1309542e 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
2019-05-02 12:56:13 +00:00
Dmitry Chagin
03ddf624e6 Remove unneeded includes.
MFC after:	2 week
2019-05-02 09:00:36 +00:00
Edward Tomasz Napierala
12f3888a98 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
2019-05-02 08:17:29 +00:00
Justin Hibbits
b4698b7a6c 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
2019-05-02 03:39:03 +00:00
Edward Tomasz Napierala
98ce554a3d Unbreak the tests after r347002.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2019-05-01 19:35:45 +00:00