]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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: 13316741331675
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 (130562413052051007100)
* Mark usage() as _Noreturn (13058061305750)
* Fix some dereference after null checks (1011474, 270774)

Reported by: Coverity
CID: 130562413052051007100130580613057501011474,
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

7 years agoDon't bother retrying errors for encrypted drives that are locked.
ken [Wed, 3 May 2017 14:53:27 +0000 (14:53 +0000)]
Don't bother retrying errors for encrypted drives that are locked.

sys/cam/scsi/scsi_all.c:
In the asc_table, if we get a 0x20,0x02 error ("Access denied -
no access rights"), don't bother retrying.  Instead, immediately
fail the command.

This is the error returned by Self Encrypting Drives (SED) when
they are locked.

MFC after: 3 days
Sponsored by: Spectra Logic

7 years agomakefs: make buf generic
emaste [Wed, 3 May 2017 14:21:18 +0000 (14:21 +0000)]
makefs: make buf generic

it has nothing to do with ffs and will eventually be moved.
gc sectorsize.

NetBSD versions:
ffs.c 1.58
ffs/buf.c 1.14 1.18
ffs/buf.h 1.8

Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation

7 years agoUse nitems() from sys/param.h.
araujo [Wed, 3 May 2017 14:03:46 +0000 (14:03 +0000)]
Use nitems() from sys/param.h.

Reviewed by: ngie
MFC after: 2 weeks.
Differential Revision: https://reviews.freebsd.org/D9942

7 years agoFree the memory allocated to trackbuf before exiting, it might fix a potential
araujo [Wed, 3 May 2017 13:57:31 +0000 (13:57 +0000)]
Free the memory allocated to trackbuf before exiting, it might fix a potential
memory leak.

Submitted by: trix@juniper.net
MFC after: 2 weeks.
Differential Revision: https://reviews.freebsd.org/D9856

7 years agobsdgrep: correct uninitialized variable introduced in r317703
emaste [Wed, 3 May 2017 13:47:02 +0000 (13:47 +0000)]
bsdgrep: correct uninitialized variable introduced in r317703

CID: 1374747
Submitted by: Kyle Evans <kevans91@ksu.edu>

7 years agoCorrect loop mode CRN resets to adhere to FCP-4 section 4.10
ken [Wed, 3 May 2017 13:17:01 +0000 (13:17 +0000)]
Correct loop mode CRN resets to adhere to FCP-4 section 4.10

Prior to this change, the CRN (Command Reference Number) is reset on any
firmware LIP, LOOP DOWN, or LOOP RESET event in violation of FCP-4 which
specifies that the CRN should only be reset in response to a LIP Reset
(LIPyx) primitive. FCP-4 also indicates PLOGI/LOGO and PRLI/PRLO ELS
actions as conditions for resetting the CRN for the associated initiator
port.

These violations manifest themselves when the HBA is removed from the
loop, or a target device is removed (especially during an outstanding
command) without power cycling. If the HBA and and the target device
determine upon re-establishing the loop that no PLOGI or PRLI is
required, and the target does not issue a LIPxy to the initiator, the
CRN for the target will have been improperly reset by the isp driver. As
a result, the target port will silently ignore all FCP commands issued
during the device probe (which will time out) preventing the device from
attaching.

This change corrects thie CRN reset behavior in response to loop state
changes, also introduces CRN resets for the above mentioned ELS actions
as encountered through async PDB change events.

This change also adds cleanup of outstanding commands in isp_loop_dead()
that was previously missing.

sys/dev/isp/isp.c
Add the last login state to debug output when syncing the pdb

sys/dev/isp/isp_freebsd.c
Replace binary statement setting aborted ccb status in
isp_watchdog() with the XS_SETERR macro used elsewhere

In isp_loop_dead(), abort or complete pending commands as done
in isp_watchdog()

In isp_async(), segregate the ISPASYNC_LOOP_RESET action from
ISPASYNC_LIP, ISPASYNC_LOOP_DOWN, and ISPASYNC_LOOP_UP
fallthroughs, and only reset the CRN in the RESET case. Also add
checks to handle false LOOP RESET actions that do not have a
proper associated LIP primitive, and log the primitive in the
debug messages

In isp_async(), remove the goto from ISP_ASYNC_DEV_STAYED, and
only reset the CRN in the DEV_CHANGED action

In isp_async(), when processing an ISPASYNC_CHANGE_PDB status,
reset CRN(s) for the associated nphdl (or all ports) if the
change reason is some form of ELS login/logout. Also remove
assignment to fc since it is not used in the scope

sys/dev/isp/ispmbox.h
Add macro definition for the global N-Port handle, and correct a
macro typo 'PDB24XX_AE_PRLI_DONJE'

sys/dev/isp/ispvar.h
Add macros FCP_AL_DA_ALL, FCP_AL_PA, and FCP_IS_DEST_ALPD for
more legible code when determining if an AL_PD port matches the
portid for a given struct fcparam* by value or by virtue of the
AL_PD port being 0xFF

Submitted by: Reid Linnemann
Sponsored by: Spectra Logic
MFC after: 1 week

7 years agoAdd support for sendmsg() and recvmsg().
tuexen [Wed, 3 May 2017 12:26:16 +0000 (12:26 +0000)]
Add support for sendmsg() and recvmsg().

7 years agoPrint all virtual addresses in the show vtop ddb command. The results may
andrew [Wed, 3 May 2017 12:24:31 +0000 (12:24 +0000)]
Print all virtual addresses in the show vtop ddb command. The results may
be different with PAN enabled.

MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoDecode the fourth argument of sendto and recvfrom call.
tuexen [Wed, 3 May 2017 12:23:58 +0000 (12:23 +0000)]
Decode the fourth argument of sendto and recvfrom call.

7 years agoAdd support for [gs]etsockopt().
tuexen [Wed, 3 May 2017 12:18:09 +0000 (12:18 +0000)]
Add support for [gs]etsockopt().

7 years agoDecode the third argument of socket().
tuexen [Wed, 3 May 2017 09:23:13 +0000 (09:23 +0000)]
Decode the third argument of socket().

7 years agoAdd Socklent for handling args of type socklen_t.
tuexen [Wed, 3 May 2017 09:20:36 +0000 (09:20 +0000)]
Add Socklent for handling args of type socklen_t.

7 years agoAdd support for listen() call.
tuexen [Wed, 3 May 2017 09:09:34 +0000 (09:09 +0000)]
Add support for listen() call.

7 years agoSilence sysctl in startup scripts.
n_hibma [Wed, 3 May 2017 08:10:03 +0000 (08:10 +0000)]
Silence sysctl in startup scripts.

This makes 'stop' behave consistently with 'start' in the script.
Also use $SYSCTL instead of sysctl for consistency within that script.

MFC after: 3 weeks

7 years ago[net80211] add another hard-learnt lesson about DWDS setup
adrian [Wed, 3 May 2017 07:53:15 +0000 (07:53 +0000)]
[net80211] add another hard-learnt lesson about DWDS setup

wlanwds monitors the physical interface for DWDS requests from VAPs,
but the clone is created against the physical interface.  So, if you
have a secondary VAP setup (with a separate, non-physical-default MAC
address) which is configured for DWDS, the temporary DWDS VAPs created
will have the MAC of the parent physical interface and NOT the
actual cloned interface + MAC.

This .. stumped me for a few minutes.

Maybe I'll fix it.  Maybe I won't.  At least I now have DWDS+encryption
working at home.

Tested:

* yes, with DWDS 11n repeaters now working on freebsd.

7 years ago[mips] default AR933x/AR934x to include mips24k hwpmc and limit umtx chain memory...
adrian [Wed, 3 May 2017 05:45:43 +0000 (05:45 +0000)]
[mips] default AR933x/AR934x to include mips24k hwpmc and limit umtx chain memory wastage.

Tested:

* AR933x SoC (Carambola2)
* AR934x SoC (TP-Link WDR3600)

7 years agoFix an unsafe malloc usage with sbufs.
scottl [Wed, 3 May 2017 05:33:15 +0000 (05:33 +0000)]
Fix an unsafe malloc usage with sbufs.

Reported by: ken
Sponsored by: Netflix

7 years agoFix r317696 build without debug.
mav [Wed, 3 May 2017 02:54:11 +0000 (02:54 +0000)]
Fix r317696 build without debug.

MFC after: 2 weeks

7 years agoifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"
asomers [Wed, 3 May 2017 01:46:39 +0000 (01:46 +0000)]
ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"

PR: 218958
Reviewed by: kristof
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D10543

7 years agoAdd regression tests for r317712 and r306743.
markj [Tue, 2 May 2017 23:31:39 +0000 (23:31 +0000)]
Add regression tests for r317712 and r306743.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoSynchronize unclean mirrors before adding them to a running gmirror.
markj [Tue, 2 May 2017 23:29:42 +0000 (23:29 +0000)]
Synchronize unclean mirrors before adding them to a running gmirror.

During gmirror startup, if component mirrors are found to be dirty as is
typical after a system crash, the mirrors are synchronized to the mirror
with highest priority. However if a gmirror starts without all of its
mirrors present, for example because of some transient delays during
tasting, the remaining mirrors must be synchronized before they may become
active.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoRemove expected failure now that it was fixed in r317660.
brooks [Tue, 2 May 2017 22:14:55 +0000 (22:14 +0000)]
Remove expected failure now that it was fixed in r317660.

PR: 211804
Reviewed by: ngie
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10576

7 years agocsplit: Fix check of fputs() return value, making csplit work again.
jilles [Tue, 2 May 2017 21:56:20 +0000 (21:56 +0000)]
csplit: Fix check of fputs() return value, making csplit work again.

As of r295638, fputs() returns the number of bytes written (if not more than
INT_MAX). This broke csplit completely, since csplit assumed only success
only for the return value 0.

PR: 213510
Submitted by: J.R. Oldroyd
MFC after: 1 week
Relnotes: yes

7 years agoAdd powerpcspe to arch(7)
jhibbits [Tue, 2 May 2017 21:33:27 +0000 (21:33 +0000)]
Add powerpcspe to arch(7)

Reviewed by: emaste

7 years agoCorrect an out-of-bounds read in regcomp when the RE is bad.
brooks [Tue, 2 May 2017 21:20:27 +0000 (21:20 +0000)]
Correct an out-of-bounds read in regcomp when the RE is bad.

When passed the invalid regular expression "a**", the error is
eventually detected and seterr() is called. It sets p->error
appropriatly and p->next and p->end to nuls which is a never used char
nuls[10] which is zeros due to .bss initialization. Unfortunatly,
p_ere_exp() and p_simp_re() both have fall through cases where they set
the error, decrement p->next and access it which means a read from what
ever .bss variable comes before nuls.

Found with regex_test:repet_multi and CHERI bounds checking.

Reviewed by: ngie, pfg, emaste
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10541

7 years agoUse MAN=<empty> rather than MK_MAN=no to not install a manpage.
brooks [Tue, 2 May 2017 21:09:07 +0000 (21:09 +0000)]
Use MAN=<empty> rather than MK_MAN=no to not install a manpage.

MFC after: 1 week

7 years agobsdgrep: avoid use of magic number for REG_NOSPEC
emaste [Tue, 2 May 2017 21:08:38 +0000 (21:08 +0000)]
bsdgrep: avoid use of magic number for REG_NOSPEC

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Differential Revision: https://reviews.freebsd.org/D10420

7 years agobsdgrep: fix escape map building for multibyte strings
emaste [Tue, 2 May 2017 20:44:06 +0000 (20:44 +0000)]
bsdgrep: fix escape map building for multibyte strings

In BSD grep, fix escape map building in the regex parser. It was
previously using memory not explicitly initialized, and the MBS escape
map was being built based on a version of the pattern with escapes
already parsed out.

This is Kyle's change, but I restored the broken style that already
exists in this file.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reviewed by: cem, Kyle Evans (my style changes)
Differential Revision: https://reviews.freebsd.org/D10098

7 years agobsdgrep: fix -w flag matching with an empty pattern
emaste [Tue, 2 May 2017 20:39:33 +0000 (20:39 +0000)]
bsdgrep: fix -w flag matching with an empty pattern

-w flag matching with an empty pattern was generally 'broken', allowing
matches to occur on any line whether or not it actually matches -w
criteria.

This fix required a good amount of refactoring to address.  procline()
is altered to *only* process the line and return whether it was a match
or not, necessary to be able to short-circuit the whole function in case
of this matchall flag. -m flag handling is moved out as well because it
suffers from the same fate as context handling if we bypass any actual
pattern matching.

The matching context (matches, mostly) didn't previously exist outside
of procline(), so we go ahead and create context object for file
processing bits to pass around.  grep_printline() was created due to
this, for the scenarios where the matches don't actually matter and we
just want to print a line or two, a la flushing the context queue and
no -o or --color specified.

Damage from this broken behavior would have been mitigated by the fact
that it is unlikely users would invoke grep -w with an empty pattern.

This was identified while checking PR 105221 for problems it this may
cause in BSD grep, but PR 105221 is *not* a report of this behavior.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Differential Revision: https://reviews.freebsd.org/D10433

7 years agocxgbe(4): Support routines for Tx traffic scheduling.
np [Tue, 2 May 2017 20:38:10 +0000 (20:38 +0000)]
cxgbe(4): Support routines for Tx traffic scheduling.

- Create a new file, t4_sched.c, and move all of the code related to
  traffic management from t4_main.c and t4_sge.c to this file.
- Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl)
  parameters in the PF driver.
- Initialize all the cl_rl limiters with somewhat arbitrary default
  rates and provide routines to update them on the fly.
- Provide routines to reserve and release traffic classes.

MFC after: 1 month
Sponsored by: Chelsio Communications

7 years agobsdgrep: correct test sense from r317700
emaste [Tue, 2 May 2017 20:08:04 +0000 (20:08 +0000)]
bsdgrep: correct test sense from r317700

Kyle's change in review D10098 was correct. I introduced the error when
extracting a portion of that change.

7 years agobsdgrep: use calloc where appropriate in grep's tre-fastmatch
emaste [Tue, 2 May 2017 19:56:42 +0000 (19:56 +0000)]
bsdgrep: use calloc where appropriate in grep's tre-fastmatch

Also apply style(9) to a related NULL check.

Submitted by: Kyle Evans <kevans91 at ksu.edu> (D10098)

7 years agoIntroduce sleepable locks into if_lagg.
mav [Tue, 2 May 2017 19:09:11 +0000 (19:09 +0000)]
Introduce sleepable locks into if_lagg.

Before this change if_lagg was using nonsleepable rmlocks to protect its
internal state.  This patch introduces another sx lock to protect code
paths that require sleeping, while still uses old rmlock to protect hot
nonsleepable data paths.

This change allows to remove taskqueue decoupling used before to change
interface addresses without holding the lock.  Instead it uses sx lock to
protect direct if_ioctl() calls.

As another bonus, the new code synchronizes enabled capabilities of member
interfaces, and allows to control them with ifconfig laggX, that was
impossible before.  This part should fix interoperation with if_bridge,
that may need to disable some capabilities, such as TXCSUM or LRO, to allow
bridging with noncapable interfaces.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10514

7 years agoEmulate pre-r317061 ABI.
kib [Tue, 2 May 2017 18:40:41 +0000 (18:40 +0000)]
Emulate pre-r317061 ABI.

This restores 32bit-sized accesses to vmcnt sysctls, making old
binaries like top(1), systat(8) and reboot(8) mostly functional on
newer kernel.

Reviewed by: bde
Sponsored by: The FreeBSD Foundation

7 years agobsdgrep: revise test case which will soon become a failure
emaste [Tue, 2 May 2017 18:37:11 +0000 (18:37 +0000)]
bsdgrep: revise test case which will soon become a failure

Work in progress (D10315) is going to make egrep_empty_invalid an
actually invalid regex, to be consistent with the equivalent BRE "{"
behavior, when using regex(3).

Any non-0 exit value is acceptable, depending on how the installed grep
interprets the expression. GNU grep interprets it as non-matching, and
in the future BSD grep will interpret it is an error.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reviewed by: cem, ngie
Differential Revision: https://reviews.freebsd.org/D10572`

7 years agoAdd `ipfw table all destroy` support.
ae [Tue, 2 May 2017 17:16:24 +0000 (17:16 +0000)]
Add `ipfw table all destroy` support.

PR: 212669
MFC after: 1 week

7 years agoDocument time_t size.
kib [Tue, 2 May 2017 14:52:35 +0000 (14:52 +0000)]
Document time_t size.

Reviewed by: emaste, imp, vangyzen
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D10568

7 years agoAdd the SCSI SSC Manufacturer assigned serial number VPD page.
ken [Tue, 2 May 2017 14:52:28 +0000 (14:52 +0000)]
Add the SCSI SSC Manufacturer assigned serial number VPD page.

This is current as of SSC-5r03.

Submitted by: Sam Klopsch
MFC after: 3 days

7 years agobsdgrep: correct nls usage data after r317049
emaste [Tue, 2 May 2017 13:47:15 +0000 (13:47 +0000)]
bsdgrep: correct nls usage data after r317049

r317049 added -z/--null-data to BSD grep but missed the update to nls
catalogs.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Differential Revision: https://reviews.freebsd.org/D10456

7 years agobsdgrep: Add GNU compatible version string indicator
emaste [Tue, 2 May 2017 13:38:20 +0000 (13:38 +0000)]
bsdgrep: Add GNU compatible version string indicator

As reported in r218614 it's useful to have an indication of whether or not
BSD grep was built with GNU_GREP_COMPAT.

Submitted by: Kyle Evans <kevans91 at ksu.edu>
Reported by: mandree
Differential Revision: https://reviews.freebsd.org/D10451

7 years agoIn parse_range() validate both range values instead of checking
ae [Tue, 2 May 2017 05:20:54 +0000 (05:20 +0000)]
In parse_range() validate both range values instead of checking
the top  value twice.

PR: 202295
MFC after: 1 week