Commit Graph

244127 Commits

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

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

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2019-09-07 15:56:00 +00:00
Philip Paeps
bdc786cc7c riscv: restore default HZ=1000, keep QEMU at HZ=100
This reverts r351918 and r351919.

Discussed with:	br, ian, imp
2019-09-07 05:13:31 +00:00
Warner Losh
1af51473bc Some newer HID devices have descriptors that are larger than 1k. Bump
this to 2k to prevent them from being truncated and ignored. It
appears to be a sanity check only, but bumping it to 2k allows both of
my iic hid devices to be parsed and the second one to work...
2019-09-07 03:51:26 +00:00
Alan Somers
8e7657374a fusefs: coverity cleanup in the tests
Address the following defects reported by Coverity:

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

* Unchecked return value of sysctlbyname (CID 1404321)

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

* Unchecked return value of open(2) (CID 1404402, 1404529)

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

* Buffer overflows. These are all false positives caused by the fact that
  Coverity thinks I'm using a buffer to store strings, when in fact I'm
  really just using it to store a byte array that happens to be initialized
  with a string. I'm changing the type from char to uint8_t in the hopes
  that it will placate Coverity. (CID 1404338, 1404350, 1404367, 1404376,
  1404379, 1404381, 1404388, 1404403, 1404425, 1404433, 1404434, 1404474,
  1404480, 1404484, 1404503, 1404505)

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

* Unannotated file descriptor leak. This will be followed up by a Coverity
  modeling change. (CID 1404326, 1404334, 1404336, 1404357, 1404361,
  1404372, 1404391, 1404395, 1404409, 1404430, 1404448, 1404451, 1404455,
  1404457, 1404458, 1404460)

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

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

Reported by:	Coverity
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21457
2019-09-06 19:50:45 +00:00
Alan Somers
16f8783452 Coverity fixes in fusefs(5)
CID 1404532 fixes a signed vs unsigned comparison error in fuse_vnop_bmap.
It could potentially have resulted in VOP_BMAP reporting too many
consecutive blocks.

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

Reported by:	Coverity
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21466
2019-09-06 19:40:11 +00:00
Toomas Soome
21388f5cf8 loader.efi: UEFI text mode background colors are only using 3 bits
Need to mask background colors to pass allowed value.
2019-09-06 19:30:23 +00:00
Simon J. Gerraty
f18ca7f311 Use file destdir for stage_as sets
We cannot use file (without :T) to name targets
but we can use the destination directory (with / replaced by _)
This has the benefit of minimizing the targets created.

Reviewed by:	bdrewery
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org//D21283
2019-09-06 19:05:01 +00:00
Mateusz Piotrowski
bb66a3e948 rc.8: Update documentation regarding old-style rc scripts
The EXAMPLES section does not contain any examples of output formats for
the old-style scripts. Remove the misleading bits stating otherwise.

Reviewed by:	bcr, imp
Approved by:	src (imp)
Differential Revision:	https://reviews.freebsd.org/D21552
2019-09-06 18:51:41 +00:00
Conrad Meyer
373013b05f Fix build after r351934
tcp_queue_pkts() is only used if TCPHPTS is defined (and it is not by
default).

Reported by:	gcc
2019-09-06 18:33:39 +00:00
Randall Stewart
af9b9e0d9f This adds in the missing counter initialization which
I had forgotten to bring over.. opps.

Differential Revision: https://reviews.freebsd.org/D21127
2019-09-06 18:29:48 +00:00
Warner Losh
82e837f803 Initialize if_hw_tsomaxsegsize to 0 to appease gcc's flow analysis as a
fail-safe.
2019-09-06 18:25:42 +00:00
Scott Long
e996e2bd6e Add myself as a mentor for Scott Phillip (scottph) 2019-09-06 17:06:48 +00:00
Dimitry Andric
211f2e5c6b Pull in r371111 from upstream llvm trunk (by Eli Friedman):
[IfConversion] Fix diamond conversion with unanalyzable branches.

  The code was incorrectly counting the number of identical
  instructions, and therefore tried to predicate an instruction which
  should not have been predicated.  This could have various effects: a
  compiler crash, an assembler failure, a miscompile, or just
  generating an extra, unnecessary instruction.

  Instead of depending on TargetInstrInfo::removeBranch, which only
  works on analyzable branches, just remove all branch instructions.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
  https://bugs.llvm.org/show_bug.cgi?id=41121 .

  Differential Revision: https://reviews.llvm.org/D67203

This should fix "Unable to predicate BX killed renamable $r0" errors
when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
armv7 and armv6.

PR:		236567
MFC after:	3 days
2019-09-06 16:06:37 +00:00
Johannes Lundberg
f6668e9f56 LinuxKPI: Improve sysfs support.
- Add functions for creating and merging sysfs groups.
- Add sysfs_streq function to compare strings ignoring newline from the
  sysctl userland call.
- Add a call to sysfs_create_groups in device_add.
- Remove duplicate header include.
- Bump __FreeBSD_version.

Reviewed by:	hselasky
Approved by:	imp (mentor), hselasky
MFC after:	4 days
Differential Revision:	D21542
2019-09-06 15:43:53 +00:00
Warner Losh
2c24ffacd6 Fix typo not -> nor and add 'the' because we are talking about specific flags
and make the punctuation parallel between the three cases.

Submitted by: Yoshihiro Ota-san
Differential Revision: https://reviews.freebsd.org/D21530
2019-09-06 15:01:47 +00:00
Fabien Thomas
d5f39c34a6 Fix broken window replay check that will allow old packet to be accepted.
This was introduced in r309144.

Submitted by:	Jean-Francois HREN <jean-francois.hren@stormshield.eu>
Approved by:	ae@
MFC after:	3 days
2019-09-06 14:30:23 +00:00
Randall Stewart
e57b2d0e51 This adds the final tweaks to LRO that will now allow me
to add BBR. These changes make it so you can get an
array of timestamps instead of a compressed ack/data segment.
BBR uses this to aid with its delivery estimates. We also
now (via Drew's suggestions) will not go to the expense of
the tcb lookup if no stack registers to want this feature. If
HPTS is not present the feature is not present either and you
just get the compressed behavior.

Sponsored by:	Netflix Inc
Differential Revision: https://reviews.freebsd.org/D21127
2019-09-06 14:25:41 +00:00
Emmanuel Vadot
725ee594b4 pkgbase: r351861 didn't solve everything, we need to default to the utilities package too 2019-09-06 12:26:45 +00:00
Takanori Watanabe
ca78bcd73b Add embedded Managed Object Format blob access to acpi_wmi(4).
This blob is can be converted to human readable form by bmfdec.
(http://github.com/pali/bmfdec)

Differential Revision:	https://reviews.freebsd.org/D21529
2019-09-06 10:12:05 +00:00
Conrad Meyer
f3cf622523 ufs: Remove redundant brelse() after r294954
Same automation.

No functional change.
2019-09-06 08:08:33 +00:00
Conrad Meyer
454409a372 msdosfs: Remove redundant brelse() after r294954
Same automation.

No functional change.
2019-09-06 08:08:10 +00:00
Conrad Meyer
dadc0f97d0 cd9660: Remove redundant brelse() after r294954
Same automation.

No functional change.
2019-09-06 08:07:36 +00:00
Conrad Meyer
fe8b34563d ext2fs: Remove redundant brelse() after r294954
Coccinelle:

@ rule1 @
 identifier __error;
@@
 ...
 int __error;
 ...

@ rule2 depends on rule1 @
 identifier rule1.__error;
 identifier __bp;
@@

 __error =
(
 bread
|
 bread_gb
|
 breadn
|
 breadn_flags
)
 (..., &__bp);
 if (
(
 __error
|
 __error != 0
)
 ) {
 ...
- brelse(__bp);
 ...
 }

No functional change.
2019-09-06 08:07:12 +00:00
Justin Hibbits
e0b5c15c54 powerpc64/pmap: Fix a WITNESS error in alloc_pvo_entry()
We only call alloc_pvo_entry() with M_WAITOK from one location.  However,
this can be called while holding nonsleepable locks.  Rather than passing
M_WAITOK down, use vm_wait() and loop.
2019-09-06 03:02:12 +00:00
Justin Hibbits
197a7e48c9 powerpc64/pmap: Simplify the code path for moea64_pte_replace_native()
Summary:
MOEA64_PTE_REPLACE() is called often with the pmap lock held, and
sometimes with the page pv lock held.  The less work done while holding
a lock, the better.  Since we are intending to replace the same PTE
(same hash index), we don't need to recalculate anything, just flat
replace the PTE.  This cuts more than 200 instructions off the
invalidating code path.  In addition, we don't need to replace a PTE
that's not occupied by this PVO.

Reviewed by:	luporl
Differential Revision:	https://reviews.freebsd.org/D21515
2019-09-06 02:45:46 +00:00
Justin Hibbits
2f6823d4c1 Loader: Add load offset to powerpc kernel entry point
Summary:
There is logic in ELF loadimage() to relocate kernels, but currently
only type ET_EXEC.  PowerPC kernels are ET_DYN, and can be relocated anywhere.
Add the load offset to kernel entry points on this platform.

Reviewed by:	imp, ian
Differential Revision:	https://reviews.freebsd.org/D21286
2019-09-06 02:28:03 +00:00
Philip Paeps
7f0b970948 QEMU: use default HZ
HZ=100 by default on riscv since r351918.
2019-09-06 01:22:16 +00:00
Philip Paeps
7f0851ab19 riscv: default to HZ=100
Most current RISC-V development platforms are not fast enough to benefit
from the increased granularity provided by HZ=1000.

Sponsored by:	Axiado
2019-09-06 01:19:31 +00:00
Rick Macklem
4ce21f37fd Delete the unused "nd" argument for nfsrv_proxyds().
The "nd" argument for nfsrv_proxyds() is no longer used by the function.
This patch deletes it. This allows a subsequent patch to delete the "nd"
argument from nfsvno_getattr(), since it's only use of "nd" was to pass it
to nfsrv_proxyds().
Getting rid of the "nd" argument from nfsvno_getattr() avoids confusion
over why it might need "nd".

This patch is trivial and does not have any semantic effect.
2019-09-05 22:25:19 +00:00
Toomas Soome
56758831fe loader: use teken teminal emulator for x86 and uefi
Replace mini cons25 emulator with teken, this does enable us proper console
terminal for loader and will make it possible to implement different
back end callbacks to draw to screen.

At this time we still only "draw" in text mode.
2019-09-05 22:15:50 +00:00
Conrad Meyer
a6935d085c Remove long-dead BUF_ASSERT_{,UN}HELD assertions
These were fully neutered in r177676 (2008), but not removed at the time for
unclear reasons.  They're totally dead code, so go ahead and yank them now.

No functional change.
2019-09-05 21:43:33 +00:00
Conrad Meyer
f80cbeb292 msdosfs: Drop an unneeded brelse in bread error condition
After r294954, it is an invariant that bread returns non-NULL bp if and only
if the routine succeeded.  On error, it handles any buffer cleanup
internally.  So the brelse(NULL) here was just redundant.

No functional change.

Discussed with:	kib (extracted from a larger differential)
2019-09-05 21:30:52 +00:00
D Scott Phillips
ed4e4cff0e nvdimm(4): Add description of NVDIMM Namespace support
Reviewed by:	kib, bcr
Approved by:	emaste (mentor)
MFC after:	3 days
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D21536
2019-09-05 20:51:41 +00:00
Cy Schubert
4effc02129 Bounds check again after advancing cp, otherwise we have a possible
heap buffer overflow. This was discovered by a Google fuzzer test.
This can lead to remote denial of service. User interaction and
execution privileges are not a prerequisite for exploitation.

Reported by:	enh at Google, to FreeBSD by maya@NetBSD.org
Obtained from:	enh at Google
See also:	NetBSD ns_name.c r1.12
Reviewed by:	delphij, ume
MFC after:	3 days
	https://android-review.googlesource.com/c/platform/bionic/+/1093130
Differential Revision:	https://reviews.freebsd.org/D21523
2019-09-05 19:35:30 +00:00
Ian Lepore
acce2d7606 Use a single write of 3 bytes instead of iicdev_writeto() in ads111x.
The iicdev_writeto() function basically does scatter-gather IO by filling
in a pair of iic_msg structs to write the register address then the data
from different locations but with a single bus START/xfer/STOP sequence.
It turns out several low-level i2c controller drivers do not honor the
IIC_NOSTART flag, so the second piece of the write gets a new START on
the bus, and that confuses the ads111x chips which expect a continuous
write of 3 bytes to set a register.

A proper fix for this is to track down all the misbehaving controllers
drivers and fix them.  For now this change makes this driver work again.
2019-09-05 19:17:53 +00:00
Emmanuel Vadot
f6a3b357e9 pkgbase: Add the pkg trusted keys to the FreeBSD-utilities package 2019-09-05 19:17:17 +00:00
Ian Lepore
c56cf3d276 Ensure a measurement is complete before reading the result in ads111x.
Also, disable the comparator by default; it's not used for anything.

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

The driver now still uses pause_sbt() to yield the cpu while waiting for
the measurement to complete, but after sleeping it checks the chip's status
register to ensure the measurement engine is idle.  If it's not, the driver
uses a retry loop to wait a bit (5% of the original wait time) then check
again for completion.
2019-09-05 19:07:48 +00:00
Kristof Provost
3bc534ea8e Set required program for all acl tests
r339782 re-enabled acl test 00 and 02, which were disabled in r336617
due to PR 229930.
When the tests were disabled the code to set their required programs was
disabled as well, but this was not reinstated when r339782 re-enabled
them.
Do so now.

Sponsored by:	Axiado
2019-09-05 18:54:46 +00:00
Mateusz Guzik
68c3c1abe1 vfs: temporarily revert r351825
There are 2 problems:
- it introduces a funny bug where it can end up trylocking the same vnode [1]
- it exposes a pre-existing softdep deadlock [2]

Both are easier to run into that the bug which got fixed, so revert until
a complete solution is worked out.

Reported by:	cy [1], pho [2]
Sponsored by:	The FreeBSD Foundation
2019-09-05 18:19:51 +00:00
Toomas Soome
8262585607 Adjust teken to allow build as part of loader
Building for loader needs specific headers.
2019-09-05 18:07:40 +00:00
Ruslan Bukin
446e035c30 Add dwgpio to NOTES so it gets built in LINT kernels.
Sponsored by:	DARPA, AFRL
2019-09-05 17:54:57 +00:00
Stephen J. Kiernan
d57cd5ccd3 Bump up the low range of cpuset numbers to account for the kernel cpuset.
Reviewed by:	jeff
Obtained from:	Juniper Networks, Inc.
2019-09-05 17:48:39 +00:00
Adrian Chadd
7e7c290154 [lib80211] add initial VHT (11ac) channel ranges for FCC.
This is a simple set of VHT channels and flags for the FCC (US) regulatory
domain.  This needs to be researched and done for the rest of the
regulatory domains, but this should at least unblock some more ath10k
testing.
2019-09-05 15:55:24 +00:00
Ed Maste
aa91d4b3a9 pcie: return an error if a matching resource is not found
Submitted by:	markj
Reviewed by:	manu
Event:		vBSDCon FreeBSD hackathon
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20884
2019-09-05 15:45:21 +00:00
Kyle Evans
89b5571e0b patch(1): fix the file removal test, strengthen it a bit
To remain compatible with GNU patch, we should ensure that once we're
removing empty files after a reversed /dev/null patch we don't remove files
that have been modified. GNU patch leaves these intact and just reverses the
hunk that created the file, effectively implying --remove-empty-files for
reversed /dev/null patches.
2019-09-05 15:35:57 +00:00
Toomas Soome
938cae327c ficl: add xemit word
While emit will output one byte on screen, the xemit will output xchar.

See: http://forth-standard.org/standard/xchar/XEMIT
2019-09-05 15:06:30 +00:00
Mateusz Piotrowski
d15e810db9 rc: Honor ${name}_env when a custom *_cmd is defined (e.g., start_cmd)
A user may set ${name}_env variable in rc.conf(5) in order to set additional
environment variables for a service command.  Unfortunately, at the moment
this variable is only honored when the command is specified via the command
variable. Those additional environment variables coming from ${name}_env
are never set if the service is started via the ${rc_arg}_cmd variable (for
example start_cmd).

PR:		239692
Reviewed by:	bcr, jilles
Approved by:	src (jilles)
Differential Revision:	https://reviews.freebsd.org/D21228
2019-09-05 14:52:22 +00:00
Emmanuel Vadot
92fd0827c1 pkgbase: pfctl: tests: Put tests files in the FreeBSD-tests package
Reviewed by:	kp, gjb
Differential Revision:	https://reviews.freebsd.org/D21521
2019-09-05 14:19:06 +00:00
Emmanuel Vadot
5112cfa07b pkgbase: Handle FILES when no FILESGROUP isn't used
bsd.files.mk only add the TAG when groups are used, fix this.

Reviewed by:	gjb
Differential Revision:	https://reviews.freebsd.org/D21520
2019-09-05 14:18:13 +00:00
Emmanuel Vadot
ce49128a13 pkgbase: Add tag for LIBSYMLINK case
Otherwised the files aren't packaged.

Reviewed by:	bapt, gjb
Differential Revision:	https://reviews.freebsd.org/D21508
2019-09-05 14:17:28 +00:00