Commit Graph

243238 Commits

Author SHA1 Message Date
Alexander Motin
df8aa95b31 Use present now scsi_mode_sense_subpage().
MFC after:	2 weeks
2019-07-29 20:41:11 +00:00
Mark Johnston
d7cadafed7 Remove a duplicate file listing in the libarchive tests.
MFC after:	3 days
2019-07-29 20:37:04 +00:00
Mark Johnston
96e90e5f14 Remove an unneeded trunc_page() in pmap_fault().
Reported by:	alc
MFC with:	r350004
Sponsored by:	The FreeBSD Foundation
2019-07-29 20:31:28 +00:00
Mark Johnston
918988576c Avoid relying on header pollution from sys/refcount.h.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2019-07-29 20:26:01 +00:00
Mark Johnston
076574744c Add mkostempsat(3).
This is a variant of mkostemps() which takes a directory descriptor and
returns a descriptor for a tempfile relative to that directory.  Unlike
the other mktemp functions, mkostempsat() can be used in capability
mode.

Reviewed by:	cem
Discussed with:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21031
2019-07-29 19:02:16 +00:00
Ruslan Bukin
4be6714234 Add glue driver for Altera SOCFPGA Ethernet MAC (EMAC) found in
Terasic DE10-Pro (an Intel Stratix 10 GX/SX FPGA Development Kit).

The Altera EMAC is an instance of Synopsys DesignWare Gigabit MAC.

This driver sets correct clock range for MDIO interface on Intel Stratix 10
platform.

This is required due to lack of support for clock manager device for
this platform that could tell us the clock frequency value for ethernet
clock domain.

Sponsored by:	DARPA, AFRL
2019-07-29 16:32:23 +00:00
Andrey V. Elsukov
e758846c09 dd ipfw_get_action() function to get the pointer to action opcode.
ACTION_PTR() returns pointer to the start of rule action section,
but rule can keep several rule modifiers like O_LOG, O_TAG and O_ALTQ,
and only then real action opcode is stored.

ipfw_get_action() function inspects the rule action section, skips
all modifiers and returns action opcode.

Use this function in ipfw_reset_eaction() and flush_nat_ptrs().

MFC after:	1 week
Sponsored by:	Yandex LLC
2019-07-29 15:09:12 +00:00
Kristof Provost
52bb6100e9 riscv: Fix copyin/copyout
r343275 introduced a performance optimisation to the copyin/copyout
routines by attempting to copy word-per-word rather than byte-per-byte
where possible.

This optimisation failed to account for cases where the buffer is longer
than XLEN_BYTES, but due to misalignment does not not allow for any
word-sized copies. E.g. a 9 byte buffer (with XLEN_BYTES == 8) which is
misaligned by 2 bytes. The code nevertheless did a single full-word
copy, which meant we copied too much data. This potentially clobbered
other data.

This is most easily demonstrated by a simple `sysctl -a`.

Fix it by not assuming that we'll always have at least one full-word
copy to do, but instead checking the remaining length first.

Reviewed by:	markj@, mhorne@, br@ (previous version)
MFC after:	1 week
Sponsored by:	Axiado
Differential Revision:	https://reviews.freebsd.org/D21100
2019-07-29 14:59:14 +00:00
Ruslan Bukin
af77cd7584 Find the correct node of PHY chip using "phy-handle" property of
ethernet MAC node.

This fixes operation on Terasic DE10-Pro (Intel Stratix 10 GX/SX
FPGA Development Kit).

Sponsored by:	DARPA, AFRL
2019-07-29 14:58:29 +00:00
Kristof Provost
f287767d4f pf: Remove partial RFC2675 support
Remove our (very partial) support for RFC2675 Jumbograms. They're not
used, not actually supported and not a good idea.

Reviewed by:	thj@
Differential Revision:	https://reviews.freebsd.org/D21086
2019-07-29 13:21:31 +00:00
Andrey V. Elsukov
d4e6a52959 Avoid possible lock leaking.
After r343619 ipfw uses own locking for packets flow. PULLUP_LEN() macro
is used in ipfw_chk() to make m_pullup(). When m_pullup() fails, it just
returns via `goto pullup_failed`. There are two places where PULLUP_LEN()
is called with IPFW_PF_RLOCK() held.

Add PULLUP_LEN_LOCKED() macro to use in these places to be able release
the lock, when m_pullup() fails.

Sponsored by:	Yandex LLC
2019-07-29 12:55:48 +00:00
Emmanuel Vadot
0ce33c042e arm: ti: cpsw: Check the new slave node address
Since DTS from >= Linux 5.0 the slave address are relative to the parent
node address and aren't the full ones.
Check both so the cpsw driver can find the phy id.
2019-07-29 10:42:15 +00:00
Emmanuel Vadot
7be976a88e arm: ti: Get the hwmods property either from the node or the parent
r350229 changed the code to lookup the ti,hwmods property in the parent
as it's now like that in the DTS from >= Linux 5.0, allow the property
to be also in the node itself so we can boot with an older DTB.

Reported by:	"Dr. Rolf Jansen" <rj@obsigna.com>
2019-07-29 10:40:51 +00:00
Michael Tuexen
bb63f59b22 When performing after_idle() or post_recovery(), don't disable the
DCTCP specific methods. Also fallthrough NewReno for non ECN capable
TCP connections and improve the integer arithmetic.

Obtained from:		Richard Scheffenegger
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D20550
2019-07-29 09:19:48 +00:00
Michael Tuexen
333ba164d6 * Improve input validation of sysctl parameters for DCTPC.
* Initialize the alpha parameter to a conservative value (like Linux)
* Improve handling of arithmetic.
* Improve man-page

Obtained from:		Richard Scheffenegger
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D20549
2019-07-29 08:50:35 +00:00
Alexander Motin
8de2d8c009 Add some new fields and bits from NVMe 1.4.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2019-07-29 03:28:46 +00:00
Hans Petter Selasky
f9e3413a3c Add support for tethering with Nokia 7 plus and the alike.
PR:		239495
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-07-28 21:47:04 +00:00
Rick Macklem
b5965b56e8 Fix printing of Server Re-Failed and Server Faults.
nfsstat -s prints bogus large numbers for the Server Re-Failed and Server
Faults fields. This was introduced by r328588.
Although I know nothing about libxo, these lines aren't titles and this
patch seems to fix the problem, so I am committing it for rea@ who emailed
it to me.
It also deleted the trailing ':' from the title lines, since those were not
in the pre-r328588 output.

If there is a more correct fix, someone conversant with libxo will need
to do so.

Submitted by:	rea
MFC after:	2 weeks
2019-07-28 21:44:01 +00:00
Alexander Motin
d7c1da6153 Decode some more IDENTIFY DEVICE bits.
MFC after:	2 weeks
2019-07-28 20:17:40 +00:00
Doug Moore
23612f0df3 In swap_pager_putpages, move the initialization of a free-blocks
counter, and the final freeing of freed swap blocks, outside the
region where an object lock is held.  Correct some style(9) and
spelling errors.  Change a panic() to a KASSERT().  Change a boolean_t
to a bool.

Suggested by: alc
Reviewed by: alc
Approved by: kib, markj (mentors)
Differential Revision: https://reviews.freebsd.org/D21093
2019-07-28 19:32:23 +00:00
Alan Somers
e7d8ebc8ca Better comments for vlrureclaim
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2019-07-28 16:07:27 +00:00
Alan Somers
2240d8c465 Add v_inval_buf_range, like vtruncbuf but for a range of a file
v_inval_buf_range invalidates all buffers within a certain LBA range of a
file. It will be used by fusefs(5). This commit is a partial merge of
r346162, r346606, and r346756 from projects/fuse2.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21032
2019-07-28 00:48:28 +00:00
Alexander Motin
1173e5a721 Reenable UNMAP support on ramdisks by default.
For some reason, I guess just mechanical editing, it was disable in r333446.

MFC after:	2 weeks
2019-07-27 18:07:46 +00:00
Alexander Motin
4b9fba0cc5 Allow WRITE SAME handle more then 2^^32 blocks.
If not limited by write_same_max_lba option, split operation into several
2^^31 blocks chunks in a loop.  For large disks it may take a while, so
setting write_same_max_lba may be useful to avoid timeouts.

While there, fix build with CAM_CTL_DEBUG.

MFC after:	2 weeks
2019-07-27 17:27:26 +00:00
Warner Losh
0d212ef0cd Remove support for kernel.tramp and kernel.tramp.gz
Nothing uses these anymore. They were for super small armv4 boards without
uboot. We removed armv4 support before 13.0, but neglected to garbage collect
this at the same time. Today, both flavors of armv5 kernels (mv and ralink) boot
via uboot which has its own compression scheme for boards that need it.

Note: OLDFILES has not been updated beacuse installkernel will move the whole
directory out of the way before installing the new kernel.

Differential Revision: https://reviews.freebsd.org/D21072
2019-07-27 17:24:19 +00:00
Emmanuel Vadot
1f3392ed10 arm: Fix TEGRA124 kernel
Since r350162 device syscon is needed for sdhci driver.
Add it to the config file.

Reported by:	dim
2019-07-27 15:04:10 +00:00
Andrew Rybchenko
7daf1fed80 sfxge(4): unify power of 2 alignment check macro
Substitute driver-defined IS_P2ALIGNED() with EFX_IS_P2ALIGNED()
defined in libefx.

Add type argument and cast value and alignment to one specified type.

Reported by:    Andrea Valsania <andrea.valsania at answervad.it>
Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D21076
2019-07-27 09:36:45 +00:00
Andrew Rybchenko
e561c5fe44 sfxge(4): fix align to power of 2 when align has smaller type
Substitute driver-defined P2ALIGN() with EFX_P2ALIGN() defined in
libefx.

Cast value and alignment to one specified type to guarantee result
correctness.

Reported by:    Andrea Valsania <andrea.valsania at answervad.it>
Reviewed by:	philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D21075
2019-07-27 09:36:36 +00:00
Andrew Rybchenko
ec30f0bec6 sfxge(4): fix power of 2 round up when align has smaller type
Substitute driver-defined P2ROUNDUP() h with EFX_P2ROUNDUP()
defined in libefx.

Cast value and alignment to one specified type to guarantee result
correctness.

Reported by:	Andrea Valsania <andrea.valsania at answervad.it>
Reviewed by:    philip
Sponsored by:   Solarflare Communications, Inc.
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D21074
2019-07-27 09:36:27 +00:00
Rick Macklem
b4c9955e41 Lock the vnode before calling ufs_bmap_seekdata().
r346932 replaced a call to vn_bmap_seekhole() with a call to
ufs_bmap_seekdata(). Although vn_bmap_seekhole() locks the vnode,
ufs_bmap_seekdata() assumes it is already locked.
This patch adds locking of the vnode before the ufs_bmap_seekdata() call.
If the vn_lock() call fails, it returns EBADF since that is the normal
error returned when a file system is forced dismounted and is already
listed as an error return in the lseek(2) man page.

Discussed with:	markj
Reviewed by:	kib
2019-07-27 01:52:34 +00:00
Kristof Provost
776d3d5924 virtio: Fix running on machines with memory above 0xffffffff
We want to allocate a contiguous memory block anywhere in memory, but
expressed this as having to be between 0 and 0xffffffff. This limits us
on 64-bit machines, and outright breaks on machines where memory is
mapped above that address range.

Allow the full address range to be used for this allocation.

Sponsored by:	Axiado
2019-07-26 19:16:02 +00:00
Alexander Motin
ed3bf01599 Add support for Long LBA mode parameter block descriptor.
It is formally required for SBC Base 2016 feature set.

MFC after:	2 weeks
2019-07-26 19:14:12 +00:00
Dimitry Andric
ba9b2ede8a Pull in r366369 from upstream llvm trunk (by Francis Visoiu Mistrih):
[CodeGen][NFC] Simplify checks for stack protector index checking

  Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex()
  >= 0`.

Pull in r366371 from upstream llvm trunk (by Francis Visoiu Mistrih):

  [PEI] Don't re-allocate a pre-allocated stack protector slot

  The LocalStackSlotPass pre-allocates a stack protector and makes sure
  that it comes before the local variables on the stack.

  We need to make sure that later during PEI we don't re-allocate a new
  stack protector slot. If that happens, the new stack protector slot
  will end up being **after** the local variables that it should be
  protecting.

  Therefore, we would have two slots assigned for two different stack
  protectors, one at the top of the stack, and one at the bottom. Since
  PEI will overwrite the assigned slot for the stack protector, the
  load that is used to compare the value of the stack protector will
  use the slot assigned by PEI, which is wrong.

  For this, we need to check if the object is pre-allocated, and re-use
  that pre-allocated slot.

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

Pull in r367068 from upstream llvm trunk (by Francis Visoiu Mistrih):

  [CodeGen] Don't resolve the stack protector frame accesses until PEI

  Currently, stack protector loads and stores are resolved during
  LocalStackSlotAllocation (if the pass needs to run). When this is the
  case, the base register assigned to the frame access is going to be
  one of the vregs created during LocalStackSlotAllocation. This means
  that we are keeping a pointer to the stack protector slot, and we're
  using this pointer to load and store to it.

  In case register pressure goes up, we may end up spilling this
  pointer to the stack, which can be a security concern.

  Instead, leave it to PEI to resolve the frame accesses. In order to
  do that, we make all stack protector accesses go through frame index
  operands, then PEI will resolve this using an offset from sp/fp/bp.

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

Together, these fix a issue where the stack protection feature in LLVM's
ARM backend can be rendered ineffective when the stack protector slot is
re-allocated so that it appears after the local variables that it is
meant to protect, leaving the function potentially vulnerable to a
stack-based buffer overflow.

Reported by:	andrew
Security:	https://kb.cert.org/vuls/id/129209/
MFC after:	3 days
2019-07-26 18:49:20 +00:00
Ian Lepore
a97202f1f4 Re-wrap the text at 80 columns after fixing the indent in the prior commit. 2019-07-26 17:58:46 +00:00
Dimitry Andric
e91d723ad4 Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d.
Interesting fixes:
f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0
6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265)
db54f53 Added C++14-specific operator delete (#47)

PR:		239265
MFC after:	3 days
2019-07-26 16:55:06 +00:00
Doug Moore
473fe2c000 Rewrite the comments that explain swapon_trim() to make them more
comprehensible.

Suggested by: rpokala
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D21034
2019-07-26 15:18:11 +00:00
Baptiste Daroussin
f34d9e5d6b Fix a bug introduced with parallel mounting of zfs
Incorporate a fix from zol:
ab5036df1c

commit log from upstream:
 Fix race in parallel mount's thread dispatching algorithm

Strategy of parallel mount is as follows.

1) Initial thread dispatching is to select sets of mount points that
 don't have dependencies on other sets, hence threads can/should run
 lock-less and shouldn't race with other threads for other sets. Each
 thread dispatched corresponds to top level directory which may or may
 not have datasets to be mounted on sub directories.

2) Subsequent recursive thread dispatching for each thread from 1)
 is to mount datasets for each set of mount points. The mount points
 within each set have dependencies (i.e. child directories), so child
 directories are processed only after parent directory completes.

The problem is that the initial thread dispatching in
zfs_foreach_mountpoint() can be multi-threaded when it needs to be
single-threaded, and this puts threads under race condition. This race
appeared as mount/unmount issues on ZoL for ZoL having different
timing regarding mount(2) execution due to fork(2)/exec(2) of mount(8).
`zfs unmount -a` which expects proper mount order can't unmount if the
mounts were reordered by the race condition.

There are currently two known patterns of input list `handles` in
`zfs_foreach_mountpoint(..,handles,..)` which cause the race condition.

1) #8833 case where input is `/a /a /a/b` after sorting.
 The problem is that libzfs_path_contains() can't correctly handle an
 input list with two same top level directories.
 There is a race between two POSIX threads A and B,
  * ThreadA for "/a" for test1 and "/a/b"
  * ThreadB for "/a" for test0/a
 and in case of #8833, ThreadA won the race. Two threads were created
 because "/a" wasn't considered as `"/a" contains "/a"`.

2) #8450 case where input is `/ /var/data /var/data/test` after sorting.
 The problem is that libzfs_path_contains() can't correctly handle an
 input list containing "/".
 There is a race between two POSIX threads A and B,
  * ThreadA for "/" and "/var/data/test"
  * ThreadB for "/var/data"
 and in case of #8450, ThreadA won the race. Two threads were created
 because "/var/data" wasn't considered as `"/" contains "/var/data"`.
 In other words, if there is (at least one) "/" in the input list,
 the initial thread dispatching must be single-threaded since every
 directory is a child of "/", meaning they all directly or indirectly
 depend on "/".

In both cases, the first non_descendant_idx() call fails to correctly
determine "path1-contains-path2", and as a result the initial thread
dispatching creates another thread when it needs to be single-threaded.
Fix a conditional in libzfs_path_contains() to consider above two.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

PR:		237517, 237397, 239243
Submitted by:	Matthew D. Fuller <fullermd@over-yonder.net> (by email)
MFC after:	3 days
2019-07-26 13:12:33 +00:00
Baptiste Daroussin
45a5aec3f1 Update mandoc to cvs snapshot 2019-07-23
This snapshot among other things includes a fix for a crash of mandoc with empty
tbl reported by rea@ (his regression test has been incorporated upstream)

MFC after:	3 weeks
2019-07-26 10:00:33 +00:00
Baptiste Daroussin
a5efdeedef Import mandoc snapshot 2019-07-23 2019-07-26 09:51:35 +00:00
Dimitry Andric
0d08e8ebf5 Import libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d.
Interesting fixes:
f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0
6f4cfa2 Fix the uncaught exception count with rethrowing.
db54f53 Added C++14-specific operator delete (#47)
2019-07-26 05:59:04 +00:00
Alan Cox
b3d6ea5bc2 Implement pmap_advise(). (Without a working pmap_advise() implementation
madvise(MADV_DONTNEED) and madvise(MADV_FREE) are NOPs.)

Reviewed by:	markj
X-MFC after:	r350004
Differential Revision:	https://reviews.freebsd.org/D21062
2019-07-26 05:07:09 +00:00
Alexander Motin
ae8828bad1 Add device temperature reporting into CTL.
The values to report can be set via LUN options.  It can be useful for
testing, and also required for Drive Maintenance 2016 feature set.

MFC after:	2 weeks
2019-07-26 03:49:16 +00:00
Alexander Motin
0ea67e7019 Add reporting of SCSI Feature Sets VPD page from SPC-5.
CTL implements all defined feature sets except Drive Maintenance 2016,
which is not very applicable to such a virtual device, and implemented
only partially now.  But may be it could be fixed later at least for
completeness.

MFC after:	2 weeks
2019-07-26 01:49:28 +00:00
Kyle Evans
0dbac71f19 if_tuntap(4): Add TUNGIFNAME
This effectively just moves TAPGIFNAME into common ioctl territory.

MFC after:	3 days
2019-07-25 22:23:34 +00:00
Alan Cox
5d18382b72 Simplify the handling of superpages in pmap_clear_modify(). Specifically,
if a demotion succeeds, then all of the 4KB page mappings within the
superpage-sized region must be valid, so there is no point in testing the
validity of the 4KB page mapping that is going to be write protected.

Deindent the nearby code.

Reviewed by:	kib, markj
Tested by:	pho (amd64, i386)
X-MFC after:	r350004 (this change depends on arm64 dirty bit emulation)
Differential Revision:	https://reviews.freebsd.org/D21027
2019-07-25 22:02:55 +00:00
Warner Losh
08a607e0f3 Widen the type for to.
The timeout field in the CAPS register is defined to be 8 bits, so its type was
uint8_t. We recently started adding 1 to it to cope with rogue devices that
listed 0 timeout time (which is impossible). However, in so doing, other devices
that list 0xff (for a 2 minute timeout) were broken when adding 1
overflowed. Widen the type to be uint32_t like its source register to avoid the
issue.

Reported by: bapt@
2019-07-25 20:26:21 +00:00
Alexander Motin
c15a591cbd Make camcontrol sanitize support also ATA devices.
ATA sanitize is functionally identical to SCSI, just uses different
initiation commands and status reporting mechanism.

While there, make kernel better handle sanitize commands and statuses.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2019-07-25 18:48:31 +00:00
Ed Maste
78aee653e9 libsysdecode: use the proper include directory
Reported by:	cy
Reviewed by:	lwhsu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21068
2019-07-25 17:10:17 +00:00
Benjamin Kaduk
1f0a85545e Fix grammar nit in copy_file_range docs
Bytes are countable, so we have fewer of them, not less of them.
2019-07-25 15:43:15 +00:00
Ian Lepore
c03909c9d8 Fix indentation (spaces->tab).
Reported by:	garga@
2019-07-25 15:31:15 +00:00