freebsd.git
7 years agoFix the client side krpc from doing TCP reconnects for ERESTART from sosend().
rmacklem [Sun, 7 May 2017 12:12:45 +0000 (12:12 +0000)]
Fix the client side krpc from doing TCP reconnects for ERESTART from sosend().

When sosend() replies ERESTART in the client side krpc, it indicates that
the RPC message hasn't yet been sent and that the send queue is full or
locked while a signal is posted for the process.
Without this patch, this would result in a RPC_CANTSEND reply from
clnt_vc_call(), which would cause clnt_reconnect_call() to create a new
TCP transport connection. For most NFS servers, this wasn't a serious problem,
although it did imply retries of outstanding RPCs, which could possibly
have missed the DRC.
For an NFSv4.1 mount to AmazonEFS, this caused a serious problem, since
AmazonEFS often didn't retain the NFSv4.1 session and would reply with
NFS4ERR_BAD_SESSION. This implies to the client a crash/reboot which
requires open/lock state recovery.

Three options were considered to fix this:
- Return the ERESTART all the way up to the system call boundary and then
  have the system call redone. This is fraught with risk, due to convoluted
  code paths, asynchronous I/O RPCs etc. cperciva@ worked on this, but it
  is still a work in prgress and may not be feasible.
- Set SB_NOINTR for the socket buffer. This fixes the problem, but makes
  the sosend() completely non interruptible, which kib@ considered
  inappropriate. It also would break forced dismount when a thread
  was blocked in sosend().
- Modify the retry loop in clnt_vc_call(), so that it loops for this case
  for up to 15sec. Testing showed that the sosend() usually succeeded by
  the 2nd retry. The extreme case observed was 111 loop iterations, or
  about 100msec of delay.
This third alternative is what is implemented in this patch, since the
change is:
- localized
- straightforward
- forced dismount is not broken by it.

This patch has been tested by cperciva@ extensively against AmazonEFS.

Reported by: cperciva
Tested by: cperciva
MFC after: 2 weeks

7 years agoRename a variable, hopefully fixing build after r317901.
trasz [Sun, 7 May 2017 12:08:41 +0000 (12:08 +0000)]
Rename a variable, hopefully fixing build after r317901.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years ago.Xr resizewin from stty(1) man page.
trasz [Sun, 7 May 2017 11:44:25 +0000 (11:44 +0000)]
.Xr resizewin from stty(1) man page.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoImprove error reporting in resizewin(1).
trasz [Sun, 7 May 2017 09:19:42 +0000 (09:19 +0000)]
Improve error reporting in resizewin(1).

Reviewed by: cem (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10624

7 years agoPull in r302362 from upstream libc++ trunk (by me):
dim [Sat, 6 May 2017 21:43:55 +0000 (21:43 +0000)]
Pull in r302362 from upstream libc++ trunk (by me):

  Ensure showbase does not overflow do_put buffers

  Summary:
  In https://bugs.freebsd.org/207918, Daniel McRobb describes how using
  std::showbase with ostreams can cause truncation of unsigned long long
  when output format is octal.  In fact, this can even happen with
  unsigned int and unsigned long.

  To ensure this does not happen, add one additional character to the
  do_put buffers if std::showbase is on.  Also add a test case.

  Reviewers: EricWF, mclow.lists

  Reviewed By: EricWF

  Subscribers: cfe-commits, emaste

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

PR: 207918
MFC after: 3 days

7 years agoloader: network read rework
tsoome [Sat, 6 May 2017 20:32:27 +0000 (20:32 +0000)]
loader: network read rework

The current read from network is working from up to down - we have some
protocol needing the data from the network, so we build the buffer space
for that protocol, add the extra space for headers and pass this buffer
down to be filled by nif get call in hope, we have guessed the incoming
packet size right. Amazingly enough this approach mostly does work, but
not always...

So, this update does work from down to up - we allocate buffer (based
on MTU or frame size info), fill it up, and pass on for upper layers.
The obvious problem is that when we should free the buffer - if at all.

In the current implementation the upper layer will free the packet on error
or when the packet is no longer needed.

While working on the issue, the additional issue did pop up - the bios
implementation does not have generic get/put interface but is using pxe
udpsend/udpreceive instead. So the udp calls are gone and undi interface
is implemented instead. Which in turn means slight other changes as we
do not need to have duplicated pxe implementation and can just use dev_net.

To align packet content, the actual read from nic is using shifted buffer by
ETHER_ALIGN (2).

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D10232

7 years agodistinguish NFS versus TFTP boot by rootpath
bapt [Sat, 6 May 2017 19:23:58 +0000 (19:23 +0000)]
distinguish NFS versus TFTP boot by rootpath

Don't use DHCP 150 option to decide which protocol use to netboot. When
root-path includes ip address - go thru NFS, if ip address not exists in
root-path - go thru TFTP from server which ip address is in next-server.  But
there is one limitation - only one tftp server in network to provide loader and
everything else.  Does enybody use more than only one?

Submitted by: kczekirda
Sponsored by: Oktawave
MFC after: 3 weeks
Relnote: Yes
Differential Revision: https://reviews.freebsd.org/D8740

7 years agoAdd zstd to the rescue binary
bapt [Sat, 6 May 2017 18:35:01 +0000 (18:35 +0000)]
Add zstd to the rescue binary

Having zstd might be useful in rescue to be able to access to log files
compressed by zstandard

Suggested by: ian

7 years agoFix linprocfs_docpuinfo() output regarding to what newer Linux apps expect
mmokhi [Sat, 6 May 2017 17:37:01 +0000 (17:37 +0000)]
Fix linprocfs_docpuinfo() output regarding to what newer Linux apps expect

Reviewed by: trasz
Approved by: trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10274

7 years agosh: Update TOUR and comments for some code changes, some of them old.
jilles [Sat, 6 May 2017 13:28:42 +0000 (13:28 +0000)]
sh: Update TOUR and comments for some code changes, some of them old.

Also, improve some terminology in TOUR and comments.

7 years agoBuild zstandard with threading enabled
bapt [Sat, 6 May 2017 10:59:10 +0000 (10:59 +0000)]
Build zstandard with threading enabled

7 years agoAdd a zstdmt which is equivalent as running zstd -T0
bapt [Sat, 6 May 2017 10:28:57 +0000 (10:28 +0000)]
Add a zstdmt which is equivalent as running zstd -T0

7 years agoImport Zstandard 1.2.0
bapt [Sat, 6 May 2017 10:26:40 +0000 (10:26 +0000)]
Import Zstandard 1.2.0

Among new things it is now threaded by default, use zstd -T# to chose the
number of threads not that -T0 will automatically determine the number of
threads based on the number of CPU online.

7 years agoImport Zstandard 1.2.0
bapt [Sat, 6 May 2017 10:17:59 +0000 (10:17 +0000)]
Import Zstandard 1.2.0
Among changes: threading support is now default and supports freebsd

7 years ago[mediatek] [gpio] add PPS / interrupt support.
adrian [Sat, 6 May 2017 06:22:14 +0000 (06:22 +0000)]
[mediatek] [gpio] add PPS / interrupt support.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D9784

7 years ago[mips] [rt2880] Add oldest Ralink MIPS SOC RT2880 support code.
adrian [Sat, 6 May 2017 06:20:34 +0000 (06:20 +0000)]
[mips] [rt2880] Add oldest Ralink MIPS SOC RT2880 support code.

* Target module have ic plus etherswitch ip175c.
* Also add etherswitch support code on rt driver.

Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D10336

7 years ago[arm] [rt1310] add initial RT1310 SoC code.
adrian [Sat, 6 May 2017 06:14:46 +0000 (06:14 +0000)]
[arm] [rt1310] add initial RT1310 SoC code.

This code base on lpc code. Ralink RT1310 is oem from 5V Technologies.
RT1310 is ARM926EJS(arm5t).

Tested:

* Buffalo WZR2-G300N

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D7238

7 years ago[ar934x] do an ethernet analog reset; apparently some boards don't.
adrian [Sat, 6 May 2017 06:09:50 +0000 (06:09 +0000)]
[ar934x] do an ethernet analog reset; apparently some boards don't.

Tested:

* on IOData WN-G300R. may be same as Sitecom WLR-2100.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Differential Revision: https://reviews.freebsd.org/D10621

7 years ago[mx25l] add new device ids.
adrian [Sat, 6 May 2017 06:08:44 +0000 (06:08 +0000)]
[mx25l] add new device ids.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Differential Revision: https://reviews.freebsd.org/D10621

7 years ago[etherswitch] [e6000sw] fix compile issue under clang/arm
adrian [Sat, 6 May 2017 06:07:44 +0000 (06:07 +0000)]
[etherswitch] [e6000sw] fix compile issue under clang/arm

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Approved by: mizhka
Differential Revision: https://reviews.freebsd.org/D10563

7 years ago[ar531x] [if_are] Fix if_are behaviour under high load traffic
adrian [Sat, 6 May 2017 06:06:11 +0000 (06:06 +0000)]
[ar531x] [if_are] Fix if_are behaviour under high load traffic

* use ifqmaxlen
* handle (inefficiently for now) meeting padding and alignment requirements for
  transmit mbufs.
* change how TX ring handling is done

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Differential Revision: https://reviews.freebsd.org/D10557

7 years ago[etherswitch] add manpages for etherswitch supported devices.
adrian [Sat, 6 May 2017 06:01:17 +0000 (06:01 +0000)]
[etherswitch] add manpages for etherswitch supported devices.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D10278

7 years ago[ip17x] [etherswitch] fdt away and mii hang workaround on ip17x
adrian [Sat, 6 May 2017 05:53:42 +0000 (05:53 +0000)]
[ip17x] [etherswitch] fdt away and mii hang workaround on ip17x

Add workaround mii access because of rt1310 is hang up on etherswitch mii poll.
And FDT away on arm platform.

Tested:

* wzr2-g300n

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka
Differential Revision: https://reviews.freebsd.org/D10295

7 years ago[cfi] fix CFI flash reset command for MX29LV320T/B.
adrian [Sat, 6 May 2017 05:52:01 +0000 (05:52 +0000)]
[cfi] fix CFI flash reset command for MX29LV320T/B.

MX flash MX29LV320T/B datasheet say reset is 0xf0.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Approved by: mizhka
Differential Revision: https://reviews.freebsd.org/D10177

7 years ago[infineon] [etherswitch] no hardcode tagging port setting at amd6996fc
adrian [Sat, 6 May 2017 05:50:07 +0000 (05:50 +0000)]
[infineon] [etherswitch] no hardcode tagging port setting at amd6996fc

Tagging port can set by etherswitchcfg command.

Tested:

* on Netgear_WGR614Cv7

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: mizhka

7 years agoFix some "don't build" optimizations from r308599 not working due to a typo.
bdrewery [Sat, 6 May 2017 05:37:36 +0000 (05:37 +0000)]
Fix some "don't build" optimizations from r308599 not working due to a typo.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoImprove blacklist support before upgrading libblacklist
lidl [Sat, 6 May 2017 04:17:48 +0000 (04:17 +0000)]
Improve blacklist support before upgrading libblacklist

The locally declared enum of blacklistd actions needs to be
hidden when the soon to be committed changes to libblacklist
are brought into the tree.  Fix the type of the "msg" parameter
to match the library.

There should be no functional changes.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoWhen editing a mode page on a tape drive, do not clear the device
ken [Fri, 5 May 2017 21:29:28 +0000 (21:29 +0000)]
When editing a mode page on a tape drive, do not clear the device
specific parameter.

Tape drives include write protect (WP), Buffered Mode and Speed
settings in the device-specific parameter.  Clearing this
parameter on a mode select can have the effect of turning off
write protect or buffered mode, or changing the speed setting of
the tape drive.

Disks report DPO/FUA support via the device specific parameter
for MODE SENSE, but the bit is reserved for MODE SELECT.  So we
clear this for disks (and other non-tape devices) to avoid
potential errors from the target device.

sbin/camcontrol/modeedit.c:
Clear the device-specific parameter in the mode page
header if we're not operating on a tape drive.

MFC after: 3 days
Sponsored by: Spectra Logic

7 years agocxgbe/t4_tom: Per-connection rate limiting for TCP sockets handled by
np [Fri, 5 May 2017 20:06:49 +0000 (20:06 +0000)]
cxgbe/t4_tom: Per-connection rate limiting for TCP sockets handled by
the TOE.  For now this capability is always enabled in kernels with
options RATELIMIT.  t4_tom will check if_capenable once the base driver
gets code to support rate limiting for any socket (TOE or not).

This was tested with iperf3 and netperf ToT as they already support
SO_MAX_PACING_RATE sockopt.  There is a bug in firmwares prior to
1.16.45.0 that affects the BSD driver only and results in rate-limiting
at an incorrect rate.  This will resolve by itself as soon as 1.16.45.0
or later firmware shows up in the driver.

Relnotes: Yes
Sponsored by: Chelsio Communications

7 years agoAdd basic programmable early warning error injection to the sa(4) driver.
ken [Fri, 5 May 2017 20:00:53 +0000 (20:00 +0000)]
Add basic programmable early warning error injection to the sa(4) driver.

This will help application developers simulate end of tape conditions.

To inject an error in sa0:

sysctl kern.cam.sa.0.inject_eom=1

This will return the next read or write request queued with 0 bytes
written.  Any subsequent writes or reads will go along as usual.

This will also cause the early warning position flag to get set
for the next position query.  So, 'mt status' will show the BPEW
(Beyond Programmable Early Warning) flag on the first query after
an error injection.  After that, the position flags will be as they
are in the underlying tape drive.

Also, update the sa(4) man page to describe tape parameters,
which can be set via 'mt param'.

sys/cam/scsi/scsi_sa.c:
In saregister(), create the inject_eom sysctl variable.

In sastart(), check to see whether inject_eom is set.  If
so, return the read or write with 0 bytes written to
indicate EOM.  Set the set_pews_status flag so that we
fake PEWS status in the next position call for reads, and the
next 3 calls for writes.  This allows the user to see the BPEW
flag one time via 'mt status'.

In sagetpos(), check the set_pews_status flag and fake
PEWS status and decrement the counter if it is set.

share/man/man4/sa.4:
Document the inject_eom sysctl variable.

Document all of the parameters currently supported via
'mt param'.

usr.bin/mt/mt.1:
Point the user to the sa(4) man page for more details on
supported parameters.

MFC after: 3 days
Sponsored by: Spectra Logic

7 years agocxgbe(4): The Tx scheduler initialization either works or doesn't. It
np [Fri, 5 May 2017 19:34:05 +0000 (19:34 +0000)]
cxgbe(4): The Tx scheduler initialization either works or doesn't.  It
doesn't need a refresh in either case.

Sponsored by: Chelsio Communications

7 years agoRegent post r317845.
brooks [Fri, 5 May 2017 18:50:22 +0000 (18:50 +0000)]
Regent post r317845.

MFC after: 1 week
MFC with: r317845
Sponsored by: DARPA, AFRL

7 years agoProvide a freebsd32 implementation of sigqueue()
brooks [Fri, 5 May 2017 18:49:39 +0000 (18:49 +0000)]
Provide a freebsd32 implementation of sigqueue()

The previous misuse of sys_sigqueue() was sending random register or
stack garbage to 64-bit targets.  The freebsd32 implementation preserves
the sival_int member of value when signaling a 64-bit process.

Document the mixed ABI implementation of union sigval and the
incompability of sival_ptr with pointer integrity schemes.

Reviewed by: kib, wblock
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10605

7 years agoGrammar fixes.
kib [Fri, 5 May 2017 18:36:41 +0000 (18:36 +0000)]
Grammar fixes.

Noted by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoDefine the scope and purpose of the page.
kib [Fri, 5 May 2017 18:21:33 +0000 (18:21 +0000)]
Define the scope and purpose of the page.

Submitted by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agobsdgrep: don't ouptut matches with -c, -l, -L
emaste [Fri, 5 May 2017 17:35:05 +0000 (17:35 +0000)]
bsdgrep: don't ouptut matches with -c, -l, -L

Refactoring done in r317703 broke -c, -l, and -L flags implying
suppression of match printing.  Fortunately this is just a matter of not
doing any printing of the resulting matches and context printing was not
broken in this refactoring.

Add some regression tests since this area may still see further
refactoring, include different context flags as well even though they
were not broken in this case.

PR: 219077
Submitted by: Kyle kevans91@ksu.edu
Reported by: markj
Reviewed by: cem, ngie
Differential Revision: https://reviews.freebsd.org/D10607

7 years agoFix some grammar, fix some markup, bump copyright year, provide more
kib [Fri, 5 May 2017 17:23:57 +0000 (17:23 +0000)]
Fix some grammar, fix some markup, bump copyright year, provide more
exact claims in some cases.

Discussed with: bde (most parts)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoUse pmap_invalidate_cache() to implement wbinvd_on_all_cpus().
markj [Fri, 5 May 2017 17:22:00 +0000 (17:22 +0000)]
Use pmap_invalidate_cache() to implement wbinvd_on_all_cpus().

Suggested by: jhb
X-MFC with: r317651

7 years agoShow more fields in the IOCFact message
scottl [Fri, 5 May 2017 17:01:54 +0000 (17:01 +0000)]
Show more fields in the IOCFact message

7 years agocxgbe(4): Update the VF device ids too. This should have been part
np [Fri, 5 May 2017 16:52:25 +0000 (16:52 +0000)]
cxgbe(4):  Update the VF device ids too.  This should have been part
of r317820.

Reported by: jhb@
MFC after: 1 week
Sponsored by: Chelsio Communications

7 years agoRelax r317696 locking to not drain taskqueue under the lock.
mav [Fri, 5 May 2017 16:51:53 +0000 (16:51 +0000)]
Relax r317696 locking to not drain taskqueue under the lock.

MFC after: 11 days

7 years agoarch(7): add a table of per-arch initial/final FreeBSD version
emaste [Fri, 5 May 2017 16:40:45 +0000 (16:40 +0000)]
arch(7): add a table of per-arch initial/final FreeBSD version

Reviewed by: kib, wblock
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10573

7 years agoUFS fs.h: clear warning from use in makefs(1)
emaste [Fri, 5 May 2017 15:26:55 +0000 (15:26 +0000)]
UFS fs.h: clear warning from use in makefs(1)

makefs(1) has a number of signedness warnings (when built with higher
WARNS), most of which can be addressed by careful application of casts
in makefs itself.

There is one case where a signedness warning arises from the blksize
macro, so must be addressed in the macro itself.

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

7 years agoIfdef out a redundant if statement when INET6 is disabled.
cy [Fri, 5 May 2017 14:34:09 +0000 (14:34 +0000)]
Ifdef out a redundant if statement when INET6 is disabled.

MFC after: 1 week

7 years agoMFV r317581: less v491.
delphij [Fri, 5 May 2017 14:33:39 +0000 (14:33 +0000)]
MFV r317581: less v491.

MFC after: 1 month

7 years agoFix for use after free in the LinuxKPI.
hselasky [Fri, 5 May 2017 14:09:44 +0000 (14:09 +0000)]
Fix for use after free in the LinuxKPI.

Background:
The same VM object might be shared by multiple processes and the
mm_struct is usually freed when a process exits.

Grab a reference on the mm_struct while the vmap is in the
linux_vma_head list in case the first process which inserted a VM
object has exited.

Tested by: kwm @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUpgrade to OpenPAM Resedacea.
des [Fri, 5 May 2017 13:31:25 +0000 (13:31 +0000)]
Upgrade to OpenPAM Resedacea.

MFC after: 3 weeks

7 years agoAdd reclaim_pv_chunk on arm64. This is based on the amd64 code so should
andrew [Fri, 5 May 2017 10:01:27 +0000 (10:01 +0000)]
Add reclaim_pv_chunk on arm64. This is based on the amd64 code so should
operate similarly, other than not needing the delayed invalidation.

It has been tested with artificial injection of vm_page_alloc failures
while running 'sort /dev/zero'.

Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10574

7 years agohyperv/kbd: Channel read expects non-NULL channel argument.
sephe [Fri, 5 May 2017 03:28:30 +0000 (03:28 +0000)]
hyperv/kbd: Channel read expects non-NULL channel argument.

MFC after: now
Sponsored by: Microsoft

7 years agocxgbe(4): Update the list of PCIe devices claimed by the driver. At
np [Fri, 5 May 2017 00:54:23 +0000 (00:54 +0000)]
cxgbe(4): Update the list of PCIe devices claimed by the driver.  At
this point any board with a T6 should just work.

Obtained from: Chelsio Communications
MFC after: 1 week
Sponsored by: Chelsio Communications

7 years agoReduce synaptics touch sensitivity
wulf [Thu, 4 May 2017 23:19:27 +0000 (23:19 +0000)]
Reduce synaptics touch sensitivity

Increase hw.psm.synaptics.min_pressure default value from 16 to 32
to nearly match Linux driver (30-35 hysteresis loop).
This makes libinput tap detection more reliable.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks

7 years agopsm(4): Remove sys/libkern.h header inclusion
wulf [Thu, 4 May 2017 23:17:21 +0000 (23:17 +0000)]
psm(4): Remove sys/libkern.h header inclusion

It is already included via sys/systm.h

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoSet predefined logical touchpad sizes for several ancient Elan hw v.2
wulf [Thu, 4 May 2017 23:12:45 +0000 (23:12 +0000)]
Set predefined logical touchpad sizes for several ancient Elan hw v.2
models. This change is based on Linux driver.
Determine logical trace size. It used for calculation of touch sizes
in surface units for MT-protocol type B evdev reports.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoReport 3-rd and 4-th fingers as first finger for Elan hw v.2 and v.3 as
wulf [Thu, 4 May 2017 23:08:55 +0000 (23:08 +0000)]
Report 3-rd and 4-th fingers as first finger for Elan hw v.2 and v.3 as
Linux does. It should not affect gesture processing in current state as it
ignores finger coords on 3-finger tap detection but it should make evdev
reports looking more Linux-alike.

Reviewed by: gonzo
Approved by: gonzo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoEnable palm detection on two finger touches for multitouch trackpads.
wulf [Thu, 4 May 2017 23:04:52 +0000 (23:04 +0000)]
Enable palm detection on two finger touches for multitouch trackpads.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agopsm(4): reduce cursor jumping on palm detection
wulf [Thu, 4 May 2017 23:02:34 +0000 (23:02 +0000)]
psm(4): reduce cursor jumping on palm detection

This is done with discarding pointer movements rather then mouse packets

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoAdjust Elantech palm width threshold to nearly match synaptics defaults
wulf [Thu, 4 May 2017 22:53:45 +0000 (22:53 +0000)]
Adjust Elantech palm width threshold to nearly match synaptics defaults

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoReduce default tap_min_queue size for Elan touchpads
wulf [Thu, 4 May 2017 22:51:22 +0000 (22:51 +0000)]
Reduce default tap_min_queue size for Elan touchpads

Elan hw v.4 touchpads often sends touchpad release packet right after
touchpad touch one. Most probably this happens due to PS/2 limited bandwith.
Reducing of tap_min_queue size to 1 makes multifinger tap detection
more reliable in this case.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoFix triple-finger taps reported as double-finger for Elan hw v.4 touchpads
wulf [Thu, 4 May 2017 22:47:18 +0000 (22:47 +0000)]
Fix triple-finger taps reported as double-finger for Elan hw v.4 touchpads

Wait for all advertised head packets after status packet have been received.
This fixes rare but quite annoying issue in Elan hw v.4 touchpads support
when triple-finger taps are reported as double-finger taps under several
circumstances.

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10266

7 years agoPull in r302183 from upstream llvm trunk (by Krzysztof Parzyszek):
dim [Thu, 4 May 2017 21:40:16 +0000 (21:40 +0000)]
Pull in r302183 from upstream llvm trunk (by Krzysztof Parzyszek):

  [PPC] When restoring R30 (PIC base pointer), mark it as <def>

  This happened on the PPC32/SVR4 path and was discovered when building
  FreeBSD on PPC32. It was a typo-class error in the frame lowering
  code.

  This fixes PR26519.

Reported by: Mark Millard
PR: 206990
MFC after: 3 days

7 years agoProvide introduction for the arch(7) manpage.
kib [Thu, 4 May 2017 21:31:50 +0000 (21:31 +0000)]
Provide introduction for the arch(7) manpage.

Start with some words about linear address space and its layout, then
explain pointers models and ABIs, providing explanation to the
structure of the tables.

Reviewed by: emaste, imp
'Future-proof' cheri wording by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D10596

7 years agoThe nandsim(4) simulator driver doesn't have any protection against
glebius [Thu, 4 May 2017 20:42:31 +0000 (20:42 +0000)]
The nandsim(4) simulator driver doesn't have any protection against
races at least in its ioctl handler, and at the same time it creates
device entry with 0666 permissions.

To plug possible issues in it:
- Mark it as needing Giant.
- Switch device mode to 0600.

Submitted by: C Turt
Reviewed by: imp
MFC after: 1 week
Security: Possible double free in ioctl handler

7 years agoRevert r317804; apparently I forgot the auto_master syntax.
trasz [Thu, 4 May 2017 19:55:32 +0000 (19:55 +0000)]
Revert r317804; apparently I forgot the auto_master syntax.

MFC after: 2 weeks

7 years agoMake automount(8) error out when the map name is missing.
trasz [Thu, 4 May 2017 19:41:19 +0000 (19:41 +0000)]
Make automount(8) error out when the map name is missing.

MFC after: 2 weeks

7 years agoEnable automounting of exFAT media.
trasz [Thu, 4 May 2017 19:16:36 +0000 (19:16 +0000)]
Enable automounting of exFAT media.

With fstyp(8) being updated to detect exfat in base r312003, it seems
like a good time to add support for auto-mounting SDXC cards -- which
use exfat by default.

The user will need to locally compile and install sysutils/fusefs-exfat
for this to succeed; logs a message to that effect when not installed.

PR: 218743
Submitted by: eborisch+FreeBSD@gmail.com
MFC after: 2 weeks

7 years agoMerge latest version of blacklist sources from NetBSD (@ 20170503)
lidl [Thu, 4 May 2017 19:07:37 +0000 (19:07 +0000)]
Merge latest version of blacklist sources from NetBSD (@ 20170503)

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agoFix markup in gettytab(5).
trasz [Thu, 4 May 2017 19:01:17 +0000 (19:01 +0000)]
Fix markup in gettytab(5).

Reviewed by: bapt
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10476

7 years agoAdd support for the no-1-8-v and wp-inverted properties in generic SDHCI
loos [Thu, 4 May 2017 18:56:11 +0000 (18:56 +0000)]
Add support for the no-1-8-v and wp-inverted properties in generic SDHCI
FDT glue.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (Netgate)

7 years agoAdd the SCSI Solid State Media Log page (0x11) definition.
ken [Thu, 4 May 2017 17:23:39 +0000 (17:23 +0000)]
Add the SCSI Solid State Media Log page (0x11) definition.

sys/cam/scsi/scsi_all.h:
Add the SCSI Solid State Media log page (0x11) structure
definition.  This gives the percentage used (in terms of
lifetime flash wear) of an SSD.

MFC after: 3 days
Sponsored by: Spectra Logic

7 years agobnxt: Add support for new Broadcom 100Gb adapter BCM57454
sbruno [Thu, 4 May 2017 15:26:28 +0000 (15:26 +0000)]
bnxt: Add support for new Broadcom 100Gb adapter BCM57454

Submitted by: bhargava.marreddy@broadcom.com
Reviewed by: venkatkumar.duvvuru@broadcom.com
Differential Revision: https://reviews.freebsd.org/D10595

7 years agoAvoid wrapping of the machine-dependent type sizes table, by removing
kib [Thu, 4 May 2017 11:57:52 +0000 (11:57 +0000)]
Avoid wrapping of the machine-dependent type sizes table, by removing
non-informational sizeof() expressions.  Add some explanatory and
summary sentences.

Noted by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

7 years agoAdd support for socket option names related to the level IPPROTO_UDPLITE.
tuexen [Thu, 4 May 2017 07:44:07 +0000 (07:44 +0000)]
Add support for socket option names related to the level IPPROTO_UDPLITE.

7 years agopcicfg: Fix direct calls of pci_cfg{read,write} on systems w/o PCI host bridge.
sephe [Thu, 4 May 2017 05:28:46 +0000 (05:28 +0000)]
pcicfg: Fix direct calls of pci_cfg{read,write} on systems w/o PCI host bridge.

Reported by: dexuan@
Reviewed by: jhb@
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10564

7 years agozfsboot: drvsize() may be unusable on some systems
tsoome [Thu, 4 May 2017 05:26:37 +0000 (05:26 +0000)]
zfsboot: drvsize() may be unusable on some systems

From user report, the errors are seen:
error 1
error 1
gptzfsboot: error 1 lba 4294967288
gptzfsboot: error 1 lba 1
gptzfsboot: no ZFS pools located, can't boot

The first two errors above are from issuing INT13 EAX=0x4800, meaning we
need to check if EDD is available and use EAX=0x800 if not.

For an workaround I'm using the similar idea as in biosdisk.c - first probe
ah=8h, then check if we have EDD.

Note we would like to see the correct disk size info, but we *may*
get away with anything >64MB, so we could at least test 2 zfs pool labels
on whole disk setup and not to freak out the INT13 interface.

If we get away with initial disk probing, then we have partition sizes from
the partition table and we should be able to complete the disk probing.

Note: this update does not provide full fix to all errors, but we get
the drvsize() errors removed.

Reported by: Michael W. Lucas
Reviewed by: julian
Differential Revision: https://reviews.freebsd.org/D10591

7 years agocache: stop holding the ncneg_hot lock across purging
mjg [Thu, 4 May 2017 03:11:59 +0000 (03:11 +0000)]
cache: stop holding the ncneg_hot lock across purging

Only non-hot entries are purged so the lock is not needed in the first place.
This saves one lock/unlock pair.

MFC after: 1 week

7 years agohyperv/kvp: Fix pool direcrory and file permission
sephe [Thu, 4 May 2017 01:46:04 +0000 (01:46 +0000)]
hyperv/kvp: Fix pool direcrory and file permission

PR: 209385
MFC after: 2 weeks
Sponsored by: Microsoft

7 years agoMFV r317781:
mm [Thu, 4 May 2017 00:04:17 +0000 (00:04 +0000)]
MFV r317781:
Sync libarchive with vendor

Vendor changes (FreeBSD-related):
  PR 897: add test for ZIP archives with invalid EOCD headers
  PR 901: fix invalid renaming of sparse files
  OSS-Fuzz issue 497: remove fallback tree in LZX decoder
  OSS-Fuzz issue 527: rewrite expressions in lz4 filter
  OSS-Fuzz issue 577: fix integer overflow in cpio reader
  OSS-Fuzz issue 862: fix numerc parsing in mtree reader
  OSS-Fuzz issue 1097: fix undefined shift in rar reader
  cpio: various optimizations and memory leak fixes

MFC after: 1 week

7 years agoUpdate vendor/libarchive to git c253f0aae9ac86a617b4f814137e07757df72391
mm [Wed, 3 May 2017 23:55:12 +0000 (23:55 +0000)]
Update vendor/libarchive to git c253f0aae9ac86a617b4f814137e07757df72391

Vendor changes (FreeBSD-related):
  PR 897: test for ZIP archives with invalid EOCD headers
  PR 901: fix invalid renaming of sparse files
  OSS-Fuzz issue 497: remove fallback tree in LZX decoder
  OSS-Fuzz issue 527: rewrite expressions in lz4 filter
  OSS-Fuzz issue 577: fix integer overflow in cpio reader
  OSS-Fuzz issue 862: fix numerc parsing in mtree reader
  OSS-Fuzz issue 1097: fix undefined shift in rar reader
  cpio: various optimizations and memory leak fixes

7 years agoext2fs: add read-write support for Extended Attributes.
pfg [Wed, 3 May 2017 22:35:41 +0000 (22:35 +0000)]
ext2fs: add read-write support for Extended Attributes.

Extended attributes and their particular implementation in linux are
different from FreeBSD so in this case we have started diverging from
the  UFS EA implementation, which would be the natural reference.

Depending on future progress implementing ACLs this approach may change
but for now bring to the tree an implementation that is consistent and
can be tested.

Submitted by: Fedor Uporov

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

7 years agoImprove documentation of fbuf device.
glebius [Wed, 3 May 2017 21:44:04 +0000 (21:44 +0000)]
Improve documentation of fbuf device.

Submitted by: novel
Reviewed by: grehan, bcr
Differential Revision: https://reviews.freebsd.org/D10014

7 years agoBump the camcontrol(8) man page date.
ken [Wed, 3 May 2017 21:04:32 +0000 (21:04 +0000)]
Bump the camcontrol(8) man page date.

MFC after: 3 days
X-MFC-with: r317774
Sponsored by: Spectra Logic

7 years agoFix error recovery behavior in the pass(4) driver.
ken [Wed, 3 May 2017 20:59:47 +0000 (20:59 +0000)]
Fix error recovery behavior in the pass(4) driver.

After FreeBSD SVN revision 236814, the pass(4) driver changed from
only doing error recovery when the CAM_PASS_ERR_RECOVER flag was
set on a CCB to sometimes doing error recovery if the passed in
retry count was non-zero.

Error recovery would happen if two conditions were met:

1.  The error recovery action was simply a retry.  (Which is most
    cases.)
2.  The retry_count is non-zero. (Which happened a lot because of
    cut-and-pasted code.)

This explains a bug I noticed in with camcontrol:

# camcontrol tur da34 -v
Unit is ready
# camcontrol reset da34
Reset of 1:172:0 was successful

At this point, there should be a Unit Attention:

# camcontrol tur da34 -v
Unit is ready

No Unit Attention.

Try it again:

# camcontrol reset da34
Reset of 1:172:0 was successful

Now set the retry_count to 0 for the TUR:

# camcontrol tur da34 -v -C 0
Unit is not ready
(pass42:mps1:0:172:0): TEST UNIT READY. CDB: 00 00 00 00 00 00
(pass42:mps1:0:172:0): CAM status: SCSI Status Error
(pass42:mps1:0:172:0): SCSI status: Check Condition
(pass42:mps1:0:172:0): SCSI sense: UNIT ATTENTION asc:29,2 (SCSI bus reset occurred)
(pass42:mps1:0:172:0): Field Replaceable Unit: 2

There is the unit attention. camcontrol(8) has a default
retry_count of 1, in case someone sets the -E flag without
setting -C.

The CAM_PASS_ERR_RECOVER behavior was only broken with the
CAMIOCOMMAND ioctl, which is the synchronous pass(4) API.  It has
worked as intended (error recovery is only done when the flag
is set) in the asynchronous API (CAMIOQUEUE ioctl).

sys/cam/scsi/scsi_pass.c:
In passsendccb(), when calling cam_periph_runccb(), only
specify the error routine when CAM_PASS_ERR_RECOVER is set.

share/man/man4/pass.4:
Document that CAM_PASS_ERR_RECOVER is needed to enable
error recovery.

Reported by: Terry Kennedy <TERRY@glaver.org>
PR: kern/218572
MFC after: 1 week
Sponsored by: Spectra Logic

7 years agoAdd the ability to rescan or reset devices specified by peripheral
ken [Wed, 3 May 2017 20:57:52 +0000 (20:57 +0000)]
Add the ability to rescan or reset devices specified by peripheral
name and unit number in camcontrol(8).

Previously camcontrol(8) only supported rescanning or resetting
devices specified by bus:target:lun.  This is because for
rescanning at least, you don't have a peripheral name and unit
number (e.g. da4) for devices that don't exist yet.

That is still the case after this change, but in other cases, when
the device does exist in the CAM EDT (Existing Device Table), we
do a careful lookup of the bus/target/lun if the user supplies a
peripheral name and unit number to find the bus:target:lun and then
issue the requested reset or rescan.

The lookup is done without actually opening the device in question,
since a rescan is often done to make a device go away after it has
been pulled.  (This is especially true for busses/controllers, like
parallel SCSI controllers, that don't automatically detect changes
in topology.)  Opening a device that is no longer there to
determine the bus/target/lun might result in error recovery actions
when the user really just wanted to make the device go away.

sbin/camcontrol/camcontrol.c:
In dorescan_or_reset(), if the use hasn't specified a
numeric argument, assume he has specified a device.  Lookup
the pass(4) instance for that device using the transport
layer CAMGETPASSTHRU ioctl.  If that is successful, we can
use the returned bus:target:lun to rescan or reset the
device.

Under the hood, resetting a device using XPT_RESET_DEV is
actually sent via the pass(4) device anyway.  But this
provides a way for the user to specify devices in a more
convenient way, and can work on device rescans when the
device is going away, assuming it still exists in the EDT.

sbin/camcontrol/camcontrol.8:
Update the man page for the rescan and reset subcommands
to reflect that you can now use a device name and unit
number with them.

Sponsored by: Spectra Logic
MFC after: 3 days

7 years agopf: Fix panic on unload
kp [Wed, 3 May 2017 20:56:54 +0000 (20:56 +0000)]
pf: Fix panic on unload

vnet_pf_uninit() is called through vnet_deregister_sysuninit() and
linker_file_unload() when the pf module is unloaded. This is executed
after pf_unload() so we end up trying to take locks which have been
destroyed already.

Move pf_unload() to a separate SYSUNINIT() to ensure it's called after
all the vnet_pf_uninit() calls.

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

7 years agoAdd myself (wulf) as a src committer with gonzo and bapt as my mentors.
wulf [Wed, 3 May 2017 20:56:34 +0000 (20:56 +0000)]
Add myself (wulf) as a src committer with gonzo and bapt as my mentors.

Approved by: gonzo (mentor)

7 years agoFlush stdout before yes/no confirmations, to force question
phk [Wed, 3 May 2017 20:41:26 +0000 (20:41 +0000)]
Flush stdout before yes/no confirmations, to force question
through pipes/tee(1)/whatever

7 years agoFix memory leaks in camcontrol
asomers [Wed, 3 May 2017 19:56:55 +0000 (19:56 +0000)]
Fix memory leaks in camcontrol

Reported by: Coverity
CID: 1331674, 1331675
Reviewed by: ken
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10588

7 years agoUnbreak ifconfig for mlx4en(4) after r317755
asomers [Wed, 3 May 2017 19:53:01 +0000 (19:53 +0000)]
Unbreak ifconfig for mlx4en(4) after r317755

ifconfig doesn't correctly infer mlx interfaces' module names, so it will
attempt to load the mlx(4) module even when not necessary.

Reported by: rstone
MFC after: 3 weeks
X-MFC-With: 317755
Sponsored by: Spectra Logic Corp

7 years agocpuset.2: Document new API options
cem [Wed, 3 May 2017 18:46:33 +0000 (18:46 +0000)]
cpuset.2: Document new API options

A follow-up to r317756.  Adrian will chase up the userspace cpuset(1)
additions.

Reported by: kib@
Sponsored by: Dell EMC Isilon

7 years agoExtend cpuset_get/setaffinity() APIs
cem [Wed, 3 May 2017 18:41:08 +0000 (18:41 +0000)]
Extend cpuset_get/setaffinity() APIs

Add IRQ placement-only and ithread-only API variants. intr_event_bind
has been extended with sibling methods, as it has many more callsites in
existing code.

Reviewed by: kib@, adrian@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D10586

7 years agoVarious Coverity fixes in ifconfig(8)
asomers [Wed, 3 May 2017 17:21:01 +0000 (17:21 +0000)]
Various Coverity fixes in ifconfig(8)

* Exit early if kldload(2) fails (1011259). This is the only change that
  affects ifconfig's behavior.
* Close memory and resource leaks (1305624, 1305205, 1007100)
* Mark usage() as _Noreturn (1305806, 1305750)
* Fix some dereference after null checks (1011474, 270774)

Reported by: Coverity
CID: 1305624, 1305205, 1007100, 1305806, 1305750, 1011474,
CID: 270774, 1011259
Reviewed by: cem
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10587

7 years agoReplace 'riscv' with the RISC-V targets 'riscv64' and 'riscv64sf'.
jhb [Wed, 3 May 2017 16:55:02 +0000 (16:55 +0000)]
Replace 'riscv' with the RISC-V targets 'riscv64' and 'riscv64sf'.

7 years agoglob: Fix an overlong line
cem [Wed, 3 May 2017 16:34:22 +0000 (16:34 +0000)]
glob: Fix an overlong line

Trivial style(9) fix, no functional change.  There are also some 81
characters lines below, but I don't see a good way to shorten them.

Sponsored by: Dell EMC Isilon

7 years agoFix typo in r317659.
mav [Wed, 3 May 2017 16:34:03 +0000 (16:34 +0000)]
Fix typo in r317659.

MFC after: 2 weeks

7 years agoPull in r301983 from upstream llvm trunk (by Tim Northover):
dim [Wed, 3 May 2017 16:12:43 +0000 (16:12 +0000)]
Pull in r301983 from upstream llvm trunk (by Tim Northover):

  ARM: avoid handing a deleted node back to TableGen during ISel.

  When we replaced the multiplicand the destination node might already
  exist. When that happens the original gets CSEd and deleted. However,
  it's actually used as the offset so nonsense is produced.

  Should fix PR32726.

This fixes an assertion failure when building building www/firefox 53.0
for arm.

Reported by: Bob Prohaska
PR: 218782
MFC after: 3 days

7 years agoAdd support for sctp_generic_sendmsg() and sctp_generic_recvmsg().
tuexen [Wed, 3 May 2017 16:03:33 +0000 (16:03 +0000)]
Add support for sctp_generic_sendmsg() and sctp_generic_recvmsg().

7 years agolibc glob: Avoid pathological exponential behavior
cem [Wed, 3 May 2017 15:55:29 +0000 (15:55 +0000)]
libc glob: Avoid pathological exponential behavior

Adapt glob's match() routine to use a greedy algorithm that avoids
exponential runtime in byzantine inputs.

While here, add a testcase for the byzantine input.

Prompted by: https://research.swtch.com/glob
Authored by: Yves Orton <demerphq at gmail.com>
Obtained from: Perl (33252c318625f3c6c89b816ee88481940e3e6f95)
Sponsored by: Dell EMC Isilon

7 years agoAdd support for socket option names related to the IPPROTO_IPV6 level.
tuexen [Wed, 3 May 2017 15:20:40 +0000 (15:20 +0000)]
Add support for socket option names related to the IPPROTO_IPV6 level.

7 years agoAdd support for socket option names related to the IPPROTO_SCTP level.
tuexen [Wed, 3 May 2017 15:03:00 +0000 (15:03 +0000)]
Add support for socket option names related to the IPPROTO_SCTP level.

7 years agomakefs: clean up warnings
emaste [Wed, 3 May 2017 14:57:04 +0000 (14:57 +0000)]
makefs: clean up warnings

- make functions and variables static where appropriate
- use const char * where appropriate
- remove unused variables

Sponsored by: The FreeBSD Foundation