]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
7 years agoMFC r300356
asomers [Mon, 11 Jul 2016 23:15:54 +0000 (23:15 +0000)]
MFC r300356

Better document security_show_{success,info,badconfig} in /etc/periodic.conf

periodic(8) already handles the security_show_{success,info,badconfig}
variables correctly. However, those variables aren't explicitly set in
/etc/defaults/periodic.conf or anywhere else, which suggests to the user
that they shouldn't be used.

etc/defaults/periodic.conf
        Explicitly set defaults for security_show_{success,info,badconfig}

usr.sbin/periodic/periodic.sh
        Update usage string

usr.sbin/periodic/periodic.8
        Minor man page updates

One thing I'm _not_ doing is recommending setting security_output to
/var/log/security.log or adding that file to /etc/newsyslog.conf, because
periodic(8) would create it with default permissions, usually 644, and
that's probably a bad idea.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302600 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302327:
ngie [Mon, 11 Jul 2016 17:31:30 +0000 (17:31 +0000)]
MFC r302327:

Fix .../usr.bin/lastcomm/legacy_test:main on i386

The time in the output files was ahead by 3 hours on i386. Fix the incorrect
offset.

PR: 210329

git-svn-id: svn://svn.freebsd.org/base/stable/10@302583 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302326:
ngie [Mon, 11 Jul 2016 17:30:20 +0000 (17:30 +0000)]
MFC r302326:

Output the diffs to standard error when comparing the expected vs the
obtained output from lastcomm instead of just printing out a summary, e.g.
"they differed".

This will make failures with results more apparent when running kyua debug,
kyua report-html, etc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302582 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302336:
hselasky [Mon, 11 Jul 2016 13:01:42 +0000 (13:01 +0000)]
MFC r302336:
Fix interrupt loop when switching from USB device to USB host mode by
clearing all endpoint interrupt bits.

PR: 210736

git-svn-id: svn://svn.freebsd.org/base/stable/10@302563 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302306:
hselasky [Mon, 11 Jul 2016 12:59:23 +0000 (12:59 +0000)]
MFC r302306:
Fix detection of USB device disconnects in USB host mode when the USB
device is connected directly to the USB port of the DWC OTG, in this
case a RPI-zero.

PR: 210695

git-svn-id: svn://svn.freebsd.org/base/stable/10@302562 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302221,302222:
delphij [Mon, 11 Jul 2016 07:35:58 +0000 (07:35 +0000)]
MFC r302221,302222:

MFV r302218: file 5.28.

Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/10@302555 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302534:
delphij [Mon, 11 Jul 2016 04:11:33 +0000 (04:11 +0000)]
MFC r302534:

Allow - in distribution names.  This is needed for freebsd-update to work
with 11.0+, where the debugging symbols use a new naming scheme for release
distribution files.

Errata candidate.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302536 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302236:
kib [Sun, 10 Jul 2016 04:33:16 +0000 (04:33 +0000)]
MFC r302236:
Handle the vm_fault() handler race with the vm_object_collapse()
sleepable scan.

MFC r302317:
Change type of the 'dead' variable to boolean.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302513 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301871:
ngie [Fri, 8 Jul 2016 20:50:44 +0000 (20:50 +0000)]
MFC r301871:

Add missing break in lock_partialfilelock(..) with NFS_RESERR

This will help ensure that the right error is trickled up when the
function is called if the lock status is NFS_RESERR

Tested with: fsx; svn info/svnversion (uses bdb locking); locktests from Bull http://nfsv4.bullopensource.org/tools/tests/locktest.php
CID: 10081611304956

git-svn-id: svn://svn.freebsd.org/base/stable/10@302455 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301605:
ngie [Fri, 8 Jul 2016 20:39:37 +0000 (20:39 +0000)]
MFC r301605:

Bounds check rpcbs_rmtcall(..) to ensure rtype is less than RPCBVERS_STAT

Not returning if rtype == RPCBVERS_STAT will cause us to overrun the inf array, as
it's defined to be exactly RPCBVERS_STAT elements in rpcb_prot.x:

> include/rpc/rpcb_prot.x:typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];

The proposed change also matches the rest of the rtype upper bound checks in the
file, so the original change was likely a typo.

CID: 1007567

git-svn-id: svn://svn.freebsd.org/base/stable/10@302453 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301800:
ngie [Fri, 8 Jul 2016 20:30:20 +0000 (20:30 +0000)]
MFC r301800:

Deobfuscate cleanup path in clnt_bck_create(..)

Similar to r300836, cl and ct will always be non-NULL as they're allocated
using the mem_alloc routines, which always use `malloc(..., M_WAITOK)`.

Deobfuscating the cleanup path fixes a leak where if cl was NULL and
ct was not, ct would not be free'd, and also removes a duplicate test for
cl not being NULL.

CID: 1229999

git-svn-id: svn://svn.freebsd.org/base/stable/10@302451 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301749:
ngie [Fri, 8 Jul 2016 19:19:30 +0000 (19:19 +0000)]
MFC r301749:

Add debug output to aid in determining why `goodResult` != `result`

PR: 210619 (for diagnosis)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302447 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301708:
ngie [Fri, 8 Jul 2016 19:13:18 +0000 (19:13 +0000)]
MFC r301708:

Revert r301707

getnetent_p doesn't return NULL like getnetent does. coccinelle got confused and
I didn't verify that it worked before committing the change

Pointyhat to: ngie

git-svn-id: svn://svn.freebsd.org/base/stable/10@302444 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301707:
ngie [Fri, 8 Jul 2016 19:04:51 +0000 (19:04 +0000)]
MFC r301707:

Use NULL instead of `0` in _ht_getnetbyname(..)

- getnetent returns NULL on completion/error.
- .h_aliases is NULL terminated.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302442 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302294:
mm [Fri, 8 Jul 2016 10:06:02 +0000 (10:06 +0000)]
MFC r302294:

Sync libarchive with vendor, bugfixes for tests:
- fix tests on filesystems without birthtime support, e.g. UFS1 (1)
- vendor issue #729: avoid use of C99 for-scope declarations in
  test_write_format_gnutar_filenames.c

PR: 204157 (1)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302425 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302338
truckman [Fri, 8 Jul 2016 02:52:39 +0000 (02:52 +0000)]
MFC r302338

Fix a race condition between the main thread in aqm_pie_cleanup() and the
callout thread that can cause a kernel panic.  Always do the final cleanup
in the callout thread by passing a separate callout function for that task
to callout_reset_sbt().

Protect the ref_count decrement in the callout with DN_BH_WLOCK().  All
other ref_count manipulation is protected with this lock.

There is still a tiny window between ref_count reaching zero and the end
of the callout function where it is unsafe to unload the module.  Fixing
this would require the use of callout_drain(), but this can't be done
because dummynet holds a mutex and callout_drain() might sleep.

Remove the callout_pending(), callout_active(), and callout_deactivate()
calls from calculate_drop_prob().  They are not needed because this callout
uses callout_init_mtx().

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>
Differential Revision: https://reviews.freebsd.org/D6928

git-svn-id: svn://svn.freebsd.org/base/stable/10@302422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302196
kib [Fri, 8 Jul 2016 02:34:04 +0000 (02:34 +0000)]
MFC r302196
Since VOP_INACTIVE() is not guaranteed to be called, all cleanups
executed by inactive methods, must be repeated on reclaim.

MFC r302210:
Clean other flags in ncl_inactive, only.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302421 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302305: MFV r302260: expat 2.2.0.
delphij [Thu, 7 Jul 2016 04:59:58 +0000 (04:59 +0000)]
MFC r302305: MFV r302260: expat 2.2.0.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302385 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302296:
cy [Thu, 7 Jul 2016 02:23:52 +0000 (02:23 +0000)]
MFC r302296:

Remove dead code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302383 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300547
truckman [Wed, 6 Jul 2016 17:45:38 +0000 (17:45 +0000)]
MFC r300547

Fix multiple Coverity Out-of-bounds access false postive issues in CAM

The currently used idiom for clearing the part of a ccb after its
header generates one or two Coverity errors for each time it is
used.  All instances generate an Out-of-bounds access (ARRAY_VS_SINGLETON)
error because of the treatment of the header as a two element array,
with a pointer to the non-existent second element being passed as
the starting address to bzero().  Some instances also alsp generate
Out-of-bounds access (OVERRUN) errors, probably because the space
being cleared is larger than the sizeofstruct ccb_hdr).

In addition, this idiom is difficult for humans to understand and
it is error prone.  The user has to chose the proper struct ccb_*
type (which does not appear in the surrounding code) for the sizeof()
in the length calculation.  I found several instances where the
length was incorrect, which could cause either an actual out of
bounds write, or incompletely clear the ccb.

A better way is to write the code to clear the ccb itself starting
at sizeof(ccb_hdr) bytes from the start of the ccb, and calculate
the length based on the specific type of struct ccb_* being cleared
as specified by the union ccb member being used.  The latter can
normally be seen in the nearby code.  This is friendlier for Coverity
and other static analysis tools because they will see that the
intent is to clear the trailing part of the ccb.

Wrap all of the boilerplate code in a convenient macro that only
requires a pointer to the desired union ccb member (or a pointer
to the union ccb itself) as an argument.

Reported by: Coverity
CID: 100757810086841009724100977310113041011306
CID: 101130710113081011309101131010113111011312
CID: 101131310113141011315101131610113171011318
CID: 101131910113201011321101132210113241011325
CID: 101132610113271011328101132910113301011374
CID: 101139010113911011392101139310113941011395
CID: 101139610113971011398101139910114001011401
CID: 101140210114031011404101140510114061011408
CID: 101140910114101011411101141210114131011414
CID: 101746110183871086860108687411942571229897
CID: 122996813062291306234133128213312831331294
CID: 133129513315351331536133153913315401341623
CID: 13416241341637134163813552641355324
Reviewed by: scottl, ken, delphij, imp
MFH: 1 month
Differential Revision: https://reviews.freebsd.org/D6496

git-svn-id: svn://svn.freebsd.org/base/stable/10@302377 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r299371 (by trasz)
truckman [Wed, 6 Jul 2016 17:42:09 +0000 (17:42 +0000)]
MFC r299371 (by trasz)

Add "camcontrol reprobe" subcommand, and implement it for da(4).
This makes it possible to manually force updating capacity data
after the disk got resized. Without it it might be neccessary to
reboot before FreeBSD notices updated disk size under eg VMWare.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@302376 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301007:
wblock [Mon, 4 Jul 2016 14:23:36 +0000 (14:23 +0000)]
MFC r301007:

Clarify the explanations for the hostname and FQDN entries.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302334 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302151: posixshm: Fix lock leak when mac_posixshm_check_read rejects
jilles [Sun, 3 Jul 2016 11:45:54 +0000 (11:45 +0000)]
MFC r302151: posixshm: Fix lock leak when mac_posixshm_check_read rejects
read.

While reading the code, I noticed that shm_read() returns without unlocking
foffset and rangelock if mac_posixshm_check_read() rejects the read.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302323 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoLimit VOLUME_LABEL (first argument to the mkisoimages scripts)
gjb [Sun, 3 Jul 2016 00:31:33 +0000 (00:31 +0000)]
Limit VOLUME_LABEL (first argument to the mkisoimages scripts)
to 32 characters.

This is a direct commit to stable/10, as UEFI support natively
exists for 11.0-CURRENT and unsupported in 9-STABLE.

Submitted by: Rick Miller
PR: 210463
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@302318 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302075:
mm [Thu, 30 Jun 2016 12:44:15 +0000 (12:44 +0000)]
MFC r302075:

Update libarchive to 3.2.1 (bugfix and security fix release)

List of vendor fixes:
- fix exploitable heap overflow vulnerability in Rar decompression
  (vendor issue 719, CVE-2016-4302, TALOS-2016-0154)
- fix exploitable stack based buffer overflow vulnebarility in mtree
  parse_device functionality (vendor PR 715, CVE-2016-4301, TALOS-2016-0153)
- fix exploitable heap overflow vulnerability in 7-zip read_SubStreamsInfo
  (vendor issue 718, CVE-2016-4300, TALOS-2016-152)
- fix integer overflow when computing location of volume descriptor
  (vendor issue 717)
- fix buffer overflow when reading a crafred rar archive (vendor issue 521)
- fix possible buffer overflow when reading ISO9660 archives on machines
  where sizeof(int) < sizeof(size_t) (vendor issue 711)
- tar and cpio should fail if an input file named on the command line is
  missing (vendor issue 708)
- fix incorrect writing of gnutar filenames that are exactly 512 bytes
  long (vendor issue 682)
- allow tests to be run from paths that are equal or longer than 128
  characters (vendor issue 657)
- add memory allocation errors in archive_entry_xattr.c (vendor PR 603)
- remove dead code in archive_entry_xattr_add_entry() (vendor PR 716)
- fix broken decryption of ZIP files (vendor issue 553)
- manpage style, typo and description fixes

Post-3.2.1 vendor fixes:
- fix typo in cpio version reporting (Vendor PR 725, 726)
- fix argument range of ctype functions in libarchive_fe/passphrase.c
- fix ctype use and avoid empty loop bodies in WARC reader

Security: CVE-2016-4300, CVE-2016-4301, CVE-2016-4302

git-svn-id: svn://svn.freebsd.org/base/stable/10@302295 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301956, r301957, r301964, r301966, r301968, r301969, r302080,
hselasky [Wed, 29 Jun 2016 10:58:36 +0000 (10:58 +0000)]
MFC r301956, r301957, r301964, r301966, r301968, r301969, r302080,
    r302125 and r302171:

Added multiple new LibUSB v1.0 API functions.
Refer to the individual commits for more details.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302275 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301842:
hselasky [Wed, 29 Jun 2016 10:43:31 +0000 (10:43 +0000)]
MFC r301842:
Implement code to stop all USB endpoints before executing a USB device
reset command, alternate setting command or set configuration
command. Else LibUSB v1.0 will not re-open the endpoints which the
kernel closes and the USB application might wait infinitely for
transfers to complete.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302272 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301544:
hselasky [Wed, 29 Jun 2016 10:40:34 +0000 (10:40 +0000)]
MFC r301544:
Fallback to arc4rand() in the LinuxKPI when read_random() returns
zero. This can happen for virtual machines.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@302271 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301545:
hselasky [Wed, 29 Jun 2016 10:33:11 +0000 (10:33 +0000)]
MFC r301545:
Add SR-IOV guest support to the mlx5en driver.

This patch adds the missing pieces needed for device setup using the
mlx5en driver inside a virtual machine which is providing hardware
access through SR-IOV.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@302270 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302139:
hselasky [Wed, 29 Jun 2016 10:29:52 +0000 (10:29 +0000)]
MFC r302139:
Use correct Q-counter output array.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@302269 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302076:
hselasky [Wed, 29 Jun 2016 10:21:45 +0000 (10:21 +0000)]
MFC r302076:
Update the definition for number of scratch pages to match the latest
version of the XHCI specification. Make sure the code can handle the
maximum number of allowed scratch pages.

Submitted by: Shichun_Ma@Dell.com

git-svn-id: svn://svn.freebsd.org/base/stable/10@302266 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302213:
dchagin [Wed, 29 Jun 2016 06:04:45 +0000 (06:04 +0000)]
MFC r302213:

Fix a bug introduced in r283433.

[1] Remove unneeded sockaddr conversion before kern_recvit() call as the from
argument is used to record result (the source address of the received message) only.

[2] In Linux the type of msg_namelen member of struct msghdr is signed but native
msg_namelen has a unsigned type (socklen_t). So use the proper storage to fetch fromlen
from userspace and than check the user supplied value and return EINVAL if it is less
than 0 as a Linux do.

Reported by: Thomas Mueller <tmueller at sysgo dot com> [1]
Tested by: Thomas Mueller <tmueller at sysgo dot com> [both]
Reviewed by: kib@

git-svn-id: svn://svn.freebsd.org/base/stable/10@302259 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301138:
pfg [Tue, 28 Jun 2016 03:11:07 +0000 (03:11 +0000)]
MFC r301138:
sed(1): convert sed to use REG_STARTEND more explicitly.

This is a followup to previous r302228, which only merged the
incomplete r300684 causing a regression.

Reported by: mi
PR: 209387
Taken from:     openbsd-tech (Martijn van Duren)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302244 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302063:
kib [Tue, 28 Jun 2016 00:37:34 +0000 (00:37 +0000)]
MFC r302063:
Avoid the active object marking for vm.vmtotal sysctl.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302243 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300809,r300890,r300891:
bdrewery [Mon, 27 Jun 2016 22:21:29 +0000 (22:21 +0000)]
MFC r300809,r300890,r300891:

  r300809:
    filemon exec: Use imgp->execpath rather than vn_fullpath(9).
  r300890:
    exec: Cease tracing if credentials will change with the new image.
  r300891:
    Write to the log using the tracer's credentials.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302241 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300793:
bdrewery [Mon, 27 Jun 2016 22:13:43 +0000 (22:13 +0000)]
MFC r300793:

  exec: Provide execpath in imgp for the process_exec hook.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302239 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300792,r300851,r301580:
bdrewery [Mon, 27 Jun 2016 22:12:11 +0000 (22:12 +0000)]
MFC r300792,r300851,r301580:

  r300792:
    exec: Add credential change information into imgp for process_exec hook.
  r300851:
    exec: get rid of one vnode lock/unlock pair in do_execve
  r301580:
    Old process credentials for setuid execve must not be dereferenced when the
    process credentials were not changed.  This can happen if an error occured
    trying to activate the setuid binary.  And on error, if new credentials
    were not yet assigned, they must be freed to not create the leak.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302238 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r292384:
bdrewery [Mon, 27 Jun 2016 22:10:07 +0000 (22:10 +0000)]
MFC r292384:

  Fix style issues around existing SDT probes.

  ** Changes to sys/netinet/in_kdtrace.c and sys/netinet/in_kdtrace.h skipped.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302237 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r298819:
bdrewery [Mon, 27 Jun 2016 21:50:30 +0000 (21:50 +0000)]
MFC r298819:

  sys/kern: spelling fixes in comments.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297391:
bdrewery [Mon, 27 Jun 2016 21:44:27 +0000 (21:44 +0000)]
MFC r297391:

  Remove some NULL checks for M_WAITOK allocations.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302233 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r285513:
bdrewery [Mon, 27 Jun 2016 21:37:30 +0000 (21:37 +0000)]
MFC r285513:

  exec: textvp -> oldtextvp; binvp -> newtextvp

git-svn-id: svn://svn.freebsd.org/base/stable/10@302232 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r285512:
bdrewery [Mon, 27 Jun 2016 21:35:19 +0000 (21:35 +0000)]
MFC r285512:

  exec plug a redundant vref + vrele of the image vnode

git-svn-id: svn://svn.freebsd.org/base/stable/10@302231 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r273351:
bdrewery [Mon, 27 Jun 2016 21:30:37 +0000 (21:30 +0000)]
MFC r273351:

  Plug unnecessary binvp NULL initialization and test.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302230 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r280130:
bdrewery [Mon, 27 Jun 2016 21:25:01 +0000 (21:25 +0000)]
MFC r280130:

  cred: add proc_set_cred helper

git-svn-id: svn://svn.freebsd.org/base/stable/10@302229 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agosed(1): convert sed to use REG_STARTEND more explicitly.
pfg [Mon, 27 Jun 2016 20:54:02 +0000 (20:54 +0000)]
sed(1): convert sed to use REG_STARTEND more explicitly.

Summarizing the findings in the OpenBSD list:

This solves a reproduceable issue with very recent Mesa where REG_NOTBOL
combined with a match at the begin of the string causes our regex library
to treat the word as not begin of word.

Bump __FreeBSD_version: JIC we hit the issue in recent Mesa ports.

PR: 209352, 209387 (exp-run)
Taken from:     openbsd-tech (Martijn van Duren)
MFC after: 1 month

git-svn-id: svn://svn.freebsd.org/base/stable/10@302228 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r280121:
bdrewery [Mon, 27 Jun 2016 20:38:38 +0000 (20:38 +0000)]
MFC r280121:

  audit: fix cred assignment when A_SETPMASK is used

git-svn-id: svn://svn.freebsd.org/base/stable/10@302227 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r296285:
bdrewery [Mon, 27 Jun 2016 20:31:56 +0000 (20:31 +0000)]
MFC r296285:

  Correct a comment.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302226 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302031
slm [Mon, 27 Jun 2016 17:01:26 +0000 (17:01 +0000)]
MFC r302031

- No log bit in IOCStatus and endian-safe changes.

Use MPI2_IOCSTATUS_MASK when checking IOCStatus to mask off the log bit, and
make a few more things endian-safe.

- Fix possible use of invalid pointer.

It was possible to use an invalid pointer to get the target ID value. To fix
this, initialize a local Target ID variable to an invalid value and change that
variable to a valid value only if the pointer to the Target ID is not NULL.

- No need to set the MPSSAS_SHUTDOWN flag because it's never used.

- done_ccb pointer can be used if it is NULL.

To prevent this, move check for done_ccb == NULL to before done_ccb is used in
mpssas_stop_unit_done().

- Disks can go missing until a reboot is done in some cases.

This is due to the DevHandle not being released, which causes the Firmware to
not allow that disk to be re-added.

Approved by: ken, scottl, ambrisko (mentors)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302225 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agohyperv/vmbus: Fix mismerge of r301015
sephe [Mon, 27 Jun 2016 01:17:00 +0000 (01:17 +0000)]
hyperv/vmbus: Fix mismerge of r301015

Submitted by: Oliver Pinter <oliver.pinter hardenedbsd org>
Sponsored by: Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302220 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302020:
kib [Sun, 26 Jun 2016 13:18:03 +0000 (13:18 +0000)]
MFC r302020:
Handle EDEADLK and EINTR from local adv lock manager.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302209 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302019:
kib [Sun, 26 Jun 2016 13:16:02 +0000 (13:16 +0000)]
MFC r302019:
Do not access NFS data for reclaimed vnode.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302208 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300775:
ed [Sat, 25 Jun 2016 10:08:04 +0000 (10:08 +0000)]
MFC r300775:

  Let l64a() properly null terminate its result.

  Though the buffer used by l64a() is initialized with null bytes,
  repetetive calls may end up having trailing garbage of previous
  invocations because we don't end up terminating the string.

  Instead of importing NetBSD's fix, use this opportunity to simplify this
  function dramatically, for example by just storing the Base64 character
  set in a string. There is also no need to do the bitmasking, as we can
  just use the proper integer type from <stdint.h>.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302193 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r302013:
kib [Sat, 25 Jun 2016 09:32:35 +0000 (09:32 +0000)]
MFC r302013:
After the vnode unlock, mount point might be destroyed immediately,
dropping the reference on mnt_cred. Prevent this by referencing the
temporal credentials before unlock.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302192 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 301483,301484,301487,301488,301583,301588
sephe [Fri, 24 Jun 2016 02:30:14 +0000 (02:30 +0000)]
MFC 301483,301484,301487,301488,301583,301588

301483
    hyperv: Move machine dependent bits into machine dependent files.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6701

301484
    hyperv/vmbus: Define type for channel messages.

    And fix message processing; only channel messages are supported.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6706

301487
    hyperv/vmbus: Factor out channel message processing

    This paves the way for further cleanup.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6707

301488
    hyperv/vmbus: Constify channel message

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6708

301583
    hyperv/vmbus: Busdma-fy MNF and event flags.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6744

301588
    hyperv/vmbus: Change tx_evtflags type to u_long to match vmbus_evtflags

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6745

git-svn-id: svn://svn.freebsd.org/base/stable/10@302170 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300683:
pfg [Fri, 24 Jun 2016 02:24:34 +0000 (02:24 +0000)]
MFC r300683:
libc: regexec(3) adjustment.

Change the behavior of when REG_STARTEND is combined with REG_NOTBOL.

From the original posting[1]:

"Enable the assumption that pmatch[0].rm_so is a continuation offset
to  a string and allows us to do a proper assessment of the character
in  regards to it's word position ('^' or '\<'), without risking going
into unallocated memory."

This change makes us similar to how glibc handles REG_STARTEND |
REG_NOTBOL, and is closely related to a soon-to-land fix to sed.

Special thanks to Martijn van Duren and Ingo Schwarze for working
out some consistent behaviour.

Differential Revision: https://reviews.freebsd.org/D6257
Taken from: openbsd-tech 2016-05-24 [1]  (Martijn van Duren)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302168 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 301113
sephe [Fri, 24 Jun 2016 02:06:13 +0000 (02:06 +0000)]
MFC 301113

    hyperv: Rename some cleaned up/almost cleaned up files

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302167 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 301017,301018,301019,301020,301021,301022,301106
sephe [Fri, 24 Jun 2016 01:49:59 +0000 (01:49 +0000)]
MFC 301017,301018,301019,301020,301021,301022,301106

301017
    hyperv/vmbus: Indentation cleanup

    No functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6602

301018
    hyperv/vmbus: Move global vmbus id array to stack.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6603

301019
    hyperv/vmbus: Redefine SynIC message.

    - Avoid unnecessary indirection.
    - Avoid bit fields.
    - Use __packed.

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6636

301020
    hyperv/vmbus: White space cleanup

    No functional changes

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6637

301021
    hyperv: Move guid2str from vmbus file to hyperv file

    - Use uint8_t for GUID byte array.
    - Define GUID string length.
    - Break long lines.
    - Nuke unnecessary stack variable.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6640

301022
    hyperv/kvp: Use if_xname.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6641

301106
    hyperv/vmbus: Redefine event flags.

    - Nuke unnecessary union.
    - Avoid convoluted macro indirection.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6671

git-svn-id: svn://svn.freebsd.org/base/stable/10@302166 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 301015
sephe [Fri, 24 Jun 2016 01:20:33 +0000 (01:20 +0000)]
MFC 301015

    hyperv/vmbus: Rename ISR functions

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6601

git-svn-id: svn://svn.freebsd.org/base/stable/10@302165 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301963:
kib [Thu, 23 Jun 2016 09:06:11 +0000 (09:06 +0000)]
MFC r301963:
Return usual error indicator to shell.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302137 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301962:
kib [Thu, 23 Jun 2016 09:04:50 +0000 (09:04 +0000)]
MFC r301962:
Always allow loading of cpuctl(4).

git-svn-id: svn://svn.freebsd.org/base/stable/10@302136 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300987,300988,300989,300992,300993,300994,301009
sephe [Thu, 23 Jun 2016 09:03:52 +0000 (09:03 +0000)]
MFC 300987,300988,300989,300992,300993,300994,301009

300987
    hyperv/et: Fix STIMER0 operations.

    - Make sure that STIMER0 is disabled before writting to it, since
      writing to an enabled STIMER will result in undefined behaviour.
    - It is unnecessary to reconfigure STIMER0 upon each et_start().
    - Make sure that MSR_HV_REF_TIME_COUNT will not return 0, since
      writing 0 to STIMER_COUNT will disable the target STIMER.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6573

300988
    hyperv/vmbus: Move SINT settings to vmbus_var.h

    While I'm here remove the event timer's dependency on hv_vmbus_priv.h

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6574

300989
    hyperv/et: Make sure only one event timer will be registered

    This nullifies the need to use softc.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6591

300992
    hyperv: Move timer frequency definition to common place.

    And cleanup event timer period settings.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6597

300993
    hyperv/et: Device renaming; consistent w/ other Hyper-V utils

    While I'm here, prefix function names w/ vmbus, since unlike Hyper-V
    timecounter, Hyper-V event timer will not work w/o vmbus.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6598

300994
    hyperv/et: Allow Hyper-V event timer be disabled

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6599

301009
    hyperv/vmbus: Process event timer before checking events

    And update comment.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6600

git-svn-id: svn://svn.freebsd.org/base/stable/10@302135 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301960:
kib [Thu, 23 Jun 2016 09:02:50 +0000 (09:02 +0000)]
MFC r301960:
Remove XXX comments from kern_thread.c.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302134 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301959:
kib [Thu, 23 Jun 2016 09:00:58 +0000 (09:00 +0000)]
MFC r301959:
Remove code duplication.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302133 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300981
sephe [Thu, 23 Jun 2016 08:38:01 +0000 (08:38 +0000)]
MFC 300981

    tcp: Don't prematurely drop receiving-only connections

    If the connection was persistent and receiving-only, several (12)
    sporadic device insufficient buffers would cause the connection be
    dropped prematurely:
    Upon ENOBUFS in tcp_output() for an ACK, retransmission timer is
    started.  No one will stop this retransmission timer for receiving-
    only connection, so the retransmission timer promises to expire and
    t_rxtshift is promised to be increased.  And t_rxtshift will not be
    reset to 0, since no RTT measurement will be done for receiving-only
    connection.  If this receiving-only connection lived long enough
    (e.g. >350sec, given the RTO starts from 200ms), and it suffered 12
    sporadic device insufficient buffers, i.e. t_rxtshift >= 12, this
    receiving-only connection would be dropped prematurely by the
    retransmission timer.

    We now assert that for data segments, SYNs or FINs either rexmit or
    persist timer was wired upon ENOBUFS.  And don't set rexmit timer
    for other cases, i.e. ENOBUFS upon ACKs.

    Discussed with:     lstewart, hiren, jtl, Mike Karels
    MFC after:  3 weeks
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5872

git-svn-id: svn://svn.freebsd.org/base/stable/10@302132 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300825,300827,300830,300831,300832,300834
sephe [Thu, 23 Jun 2016 08:26:07 +0000 (08:26 +0000)]
MFC 300825,300827,300830,300831,300832,300834

300825
    hyperv: Move CPUID related bits to hyperv_reg.h and give them clean name

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6565

300827
    hyperv: Move timer related MSRs into hyperv_reg.h

    And avoid bit fields for event timer.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6566

300830
    hyperv/vmbus: Move MSR EOM to hyperv_reg.h

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6567

300831
    hyperv: GC unneeded bits

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6568

300832
    hyperv: Clean up Hyper-V timecounter a bit.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6569

300834
    hyperv: Test features before enabling optional functionalities

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6571

git-svn-id: svn://svn.freebsd.org/base/stable/10@302129 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300654,300655,300708
sephe [Thu, 23 Jun 2016 08:09:44 +0000 (08:09 +0000)]
MFC 300654,300655,300708

300654
    hyperv/vmbus: Rework SynIC setup and teardown

    - Avoid bit fields.
    - Fix SINT setup (preserve required bits).

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6529

300655
    hyperv: Preserve required bits when disable Hypercall

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6530

300708
    hyperv: Rework guest id settings according to Hyper-V spec

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6553

git-svn-id: svn://svn.freebsd.org/base/stable/10@302128 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300647,300650,300651,300652,300653
sephe [Thu, 23 Jun 2016 07:53:58 +0000 (07:53 +0000)]
MFC 300647,300650,300651,300652,300653

300647
    hyperv/vmbus: Move vcpuid into vmbus softc per-cpu data

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6521

300650
    hyperv/vmbus: Move two global flags into vmbus softc

    And pack them into one flag field.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6522

300651
    hyperv/vmbus: Minor style and white space cleanup

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6523

300652
    hyperv/vmbus: Pass vmbus softc to vmbus_synic_setup

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6527

300653
    hyperv/vmbus: Nuke unnecessary MSR read

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6528

git-svn-id: svn://svn.freebsd.org/base/stable/10@302127 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300646
sephe [Thu, 23 Jun 2016 07:36:03 +0000 (07:36 +0000)]
MFC 300646

    hyperv/vmbus: Move event/message taskqueue/task to vmbus softc

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6520

git-svn-id: svn://svn.freebsd.org/base/stable/10@302126 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300645
sephe [Thu, 23 Jun 2016 07:09:44 +0000 (07:09 +0000)]
MFC 300645

    hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready

    And release IDT vector before releasing ISR resources on interrupt
    teardown path.  We still have some work to do on the interrupt tearing
    down path.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6519

git-svn-id: svn://svn.freebsd.org/base/stable/10@302124 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300576,300644
sephe [Thu, 23 Jun 2016 06:27:41 +0000 (06:27 +0000)]
MFC 300576,300644

300576
    hyperv/vmbus: Free message taskqueue during interrupt teardown

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6506

300644
    hyperv/vmbus: Check hyperv_dmamem_alloc return value

    Though it is highly unlikely this function would fail w/ BUS_DMA_WAITOK,
    we had better to check its return value; better safe then sorry here.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6518

git-svn-id: svn://svn.freebsd.org/base/stable/10@302122 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300574
sephe [Thu, 23 Jun 2016 06:18:32 +0000 (06:18 +0000)]
MFC 300574

    hyperv/vmbus: Factor out functions for vmbus interrupt set/teardown

    This paves way for further cleanup and fix.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6505

git-svn-id: svn://svn.freebsd.org/base/stable/10@302120 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300573
sephe [Thu, 23 Jun 2016 05:56:04 +0000 (05:56 +0000)]
MFC 300573

    hyperv/vmbus: Git rid of sc version of pcpu data extraction macro

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6503

git-svn-id: svn://svn.freebsd.org/base/stable/10@302119 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300572
sephe [Thu, 23 Jun 2016 05:51:57 +0000 (05:51 +0000)]
MFC 300572

    hyperv/vmbus: Use busdma(9) for messages and event flags

    And
    - Move message and event flags to vmbus_softc per-cpu data.
    - Get rid of hv_setup_arg, which serves no purpose now.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6502

git-svn-id: svn://svn.freebsd.org/base/stable/10@302118 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300565,300567,300568,300570,300571
sephe [Thu, 23 Jun 2016 05:35:08 +0000 (05:35 +0000)]
MFC 300565,300567,300568,300570,300571

300565
    hyperv/vmbus: Move vmbus interrupt counter into vmbus softc

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6497

300567
    hyperv/vmbus: Pass vmbus_softc and curcpu to hv_vmbus_isr()

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6498

300568
    hyperv/busdma: Take BUS_DMA_ZERO into account

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6499

300570
    hyperv/vmbus: Rename local variable and break long lines

    No functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6500

300571
    hyperv/vmbus: Move SynIC setup/teardown from hyperv file to vmbus file

    Avoid unnecessary exposure.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6501

git-svn-id: svn://svn.freebsd.org/base/stable/10@302116 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300487
sephe [Thu, 23 Jun 2016 05:08:17 +0000 (05:08 +0000)]
MFC 300487

    hyperv/vmbus: Move IDT vector to vmbus_softc

    Prepare to get rid of the hv_setup_arg.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6449

git-svn-id: svn://svn.freebsd.org/base/stable/10@302115 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300480,300481,300486
sephe [Thu, 23 Jun 2016 04:40:13 +0000 (04:40 +0000)]
MFC 300480,300481,300486

300480
    hyperv: Move Hypercall setup to an early place.

    It does not belong to the vmbus.

    While I'm here rework the Hypercall setup, e.g. use busdma(9)
    and avoid bit fields.

    Discussed with:     Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6445

300481
    hyperv/vmbus: Declare Synic message and event w/ proper types

    Avoid ugly casts.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6446

300486
    hyperv/vmbus: Get rid of vmbus_devp

    While I'm here, nuke useless print in vmbus_attach().

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6447

git-svn-id: svn://svn.freebsd.org/base/stable/10@302114 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300478,300479
sephe [Thu, 23 Jun 2016 03:25:18 +0000 (03:25 +0000)]
MFC 300478,300479

300478
    hyperv: Add helpers for busdma(9) operation

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6443

300479
    hyperv/hn: Use hyperv busdma(9) helper.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6444

git-svn-id: svn://svn.freebsd.org/base/stable/10@302113 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300122,300123,300124,300126,300127,300129,300455
sephe [Thu, 23 Jun 2016 03:14:09 +0000 (03:14 +0000)]
MFC 300122,300123,300124,300126,300127,300129,300455

300122
    hyperv: Set vm_guest to VM_GUEST_VM, if hypervisor is not Hyper-V

    Reviewed by:        kib
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6412

300123
    hyperv/vmbus: Staticize vmbus_devclass

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6414

300124
    hyperv/vmbus: Reindent and cleanup devmethods.

    While I'm here, use DEVMETHOD_END.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6415

300126
    hyperv/vmbus: Fix SYSINIT function prototype and usage.

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6416

300127
    hyperv/vmbus: Minor function definition style fixup

    Reviewed by:        Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6417

300129
    hyperv/vmbus: Use consistent device description as other devices

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6418

300455
    hyperv: Move guest id setup to early place

    And
    - Rework the guest id composition.
    - Nuke useless saved guest_id.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6430

git-svn-id: svn://svn.freebsd.org/base/stable/10@302112 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 300108,300111,300112,300120,300121
sephe [Thu, 23 Jun 2016 02:53:24 +0000 (02:53 +0000)]
MFC 300108,300111,300112,300120,300121

300108
    hyperv/vmbus: Minor white space and style cleanup

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6407

300111
    hyperv/vmbus: Utilize curcpu

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6408

300112
    hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task

    It is not an SWI handler for a long time.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6409

300120
    hyperv/vmbus: Remove useless modevent handler

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6410

300121
    hyperv/vmbus: Nuke unnecessary function indirection

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6411

git-svn-id: svn://svn.freebsd.org/base/stable/10@302111 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299927,300101,300102,300105,300107
sephe [Thu, 23 Jun 2016 02:37:24 +0000 (02:37 +0000)]
MFC 299927,300101,300102,300105,300107

299927
    hyperv/vmbus: Use atomic_testandclear

    Prepare to use unsigned long for event channel bit array.

    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6382

300101
    hyperv/vmbus: Use unsigned long for event bits.

    And move base channel id calculation out of inner loop.  This prepares
    for more event processing optimization.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6384

300102
    hyperv/vmbus: Reduce the # of event loops by recording event flag count

    Use vmbus softc to save vmbus per-cpu data.  More stuffs will be moved
    into vmbus softc.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6403

300105
    hyperv/vmbus: Use atomic swap and flsl to process event flags

    Greatly reduce the locked instructions and reduce number of inner loops.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6404

300107
    hyperv/vmbus: Avoid two unnecessary protocol checks on isr handling path

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6405

git-svn-id: svn://svn.freebsd.org/base/stable/10@302109 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299912
sephe [Thu, 23 Jun 2016 02:21:37 +0000 (02:21 +0000)]
MFC 299912

    atomic: Add testandclear on i386/amd64

    Reviewed by:        kib
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6381

git-svn-id: svn://svn.freebsd.org/base/stable/10@302108 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299889,299890,299892
sephe [Thu, 23 Jun 2016 01:47:30 +0000 (01:47 +0000)]
MFC 299889,299890,299892

299889
    hyperv/vmbus: Simplify event processing

    While I'm here, remove useless comment and unnecessary return.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6332

299890
    hyperv/vmbus: Simplify event processing

    For channel0, it will never be processed on event handling path,
    so there is no need to install it.  After skipping in the channel0
    installation, we could discard the channel0 check on event
    handling hot code path.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6333

299892
    hyperv/vmbus: Fix event processing loop indentation.

    No functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6334

git-svn-id: svn://svn.freebsd.org/base/stable/10@302107 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301929:
kib [Wed, 22 Jun 2016 09:10:52 +0000 (09:10 +0000)]
MFC r301929:
Do not assume that we own the use reference on the covered vnode until
we set MNTK_UNMOUNT flag on the mp.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302079 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301928:
kib [Wed, 22 Jun 2016 09:08:18 +0000 (09:08 +0000)]
MFC r301928:
Only access vp->v_rdev for VCHR vnodes in devfs_reclaim().

git-svn-id: svn://svn.freebsd.org/base/stable/10@302078 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r300892,r300893,r301130,r301404,r301414,r301460:
bdrewery [Tue, 21 Jun 2016 20:32:34 +0000 (20:32 +0000)]
MFC r300892,r300893,r301130,r301404,r301414,r301460:

  r300892:
    Rename function to be less generic.
  r300893:
    Don't truncate existing error when writing the log.
  r301130:
    Enable filemon on all architectures.
  r301404:
    Support all architectures by just using sysent.
  r301414:
    Fix build after r301404.
  r301460:
    Cleanup COMPAT_FREEBSD32 support.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302072 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297160,r297196:
bdrewery [Tue, 21 Jun 2016 20:20:30 +0000 (20:20 +0000)]
MFC r297160,r297196:

  r297160:
    Document openat(2) behavior.
  r297196:
    Spell out 'system calls'.

git-svn-id: svn://svn.freebsd.org/base/stable/10@302070 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r271049:
bdrewery [Tue, 21 Jun 2016 20:15:30 +0000 (20:15 +0000)]
MFC r271049:

  Note that script(1) consumes filemon(4).

git-svn-id: svn://svn.freebsd.org/base/stable/10@302068 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r297156,r297157,r297158,r297159,r297161,r297172,r297200,r297201,r297202,
bdrewery [Tue, 21 Jun 2016 20:13:19 +0000 (20:13 +0000)]
MFC r297156,r297157,r297158,r297159,r297161,r297172,r297200,r297201,r297202,
    r297203,r297256:

  r297156:
    Track filemon usage via a proc.p_filemon pointer rather than its own lists.
  r297157:
    Stop tracking stat(2).
  r297158:
    Consolidate open(2) and openat(2) code.
  r297159:
    Use curthread for vn_fullpath.
  r297161:
    Attempt to use the namecache for openat(2) path resolution.
  r297172:
    Consolidate common link(2) logic.
  r297200:
    Follow-up r297156: Close the log in filemon_dtr rather than in the last
    reference.
  r297201:
    Return any log write failure encountered when closing the filemon fd.
  r297202:
    Remove unused done argument to copyinstr(9).
  r297203:
    Handle copyin failures.
  r297256:
    Remove unneeded return left from refactoring.

Relnotes: yes (filemon stability/performance updates)
Sponsored by: EMC / Isilon Storage Division

git-svn-id: svn://svn.freebsd.org/base/stable/10@302066 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC r301549, r301550:
pfg [Tue, 21 Jun 2016 15:47:54 +0000 (15:47 +0000)]
MFC r301549, r301550:
ng_mppc(4): Bring netgraph(3) MPPC compression support.

Support for compression has been available from July 2007 but it
was never imported due to concerns with patents once held by
STAC/HiFn. The issues have clearly been resolved so bring it
in now.

Special thanks to Brett Glass for preserving the code and
pointing documentation for the expiration case.

Taken from: mav (through Brett Glass)

git-svn-id: svn://svn.freebsd.org/base/stable/10@302061 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299401,299888
sephe [Tue, 21 Jun 2016 07:05:49 +0000 (07:05 +0000)]
MFC 299401,299888

299401
    hyperv/hn: Extract RSS hash value and type.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6287

299888
    hyperv/hn: Combine per-packet-information parsing.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302053 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 299506
sephe [Tue, 21 Jun 2016 06:56:09 +0000 (06:56 +0000)]
MFC 299506

    mxge: Setup mbuf flowid before calling tcp_lro_rx().

    Reviewed by:        gallatin
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6320

git-svn-id: svn://svn.freebsd.org/base/stable/10@302052 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298696,298730
sephe [Tue, 21 Jun 2016 06:52:21 +0000 (06:52 +0000)]
MFC 298696,298730

298696
    tcp/lro: Fix typo.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298730
    tcp/lro: Fix more typo

    Noticed by: hiren
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302051 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298690,298693,298694
sephe [Tue, 21 Jun 2016 06:45:29 +0000 (06:45 +0000)]
MFC 298690,298693,298694

298690
    hyperv/hn: Mark sysctls MPSAFE

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298693
    hyperv/vmbus: Mark sysctls MPSAFE

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298694
    hyperv/hn: Add stat for # of chimney sending tries

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302050 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298618,298620,298688,298689
sephe [Tue, 21 Jun 2016 06:37:38 +0000 (06:37 +0000)]
MFC 298618,298620,298688,298689

298618
    hyperv/stor: Set description properly in probe devmethod

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298620
    hyperv/hn: Change description to "Hyper-V Network Interface"

    This is consistent w/ other Hyper-V devices.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298688
    hyperv/hn: Restart sending earlier once we gathered some free TX descs

    This greatly reduces the oqdrops under heavy workload.

    For TCP send/recv test (10K concurrent connections):
    oqdrops is reduced by 17% on sending side, and 57% on receiving side.

    For nginx-1.8/wrk-4 1KB object test (10K concurrent connections,
    4 requests/connection):
    oqdrops is reduced by 44% on nginx side, and 10% on wrk side.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298689
    hyperv/hn: Remove unapplied comment.

    Chimney sending buffers are shared across channels.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302049 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298569,298570,298571,298572,298574,298575,298613,298614,298615,298616,298617
sephe [Tue, 21 Jun 2016 06:18:41 +0000 (06:18 +0000)]
MFC 298569,298570,298571,298572,298574,298575,298613,298614,298615,298616,298617

298569
    hyperv/channel: Remove the unnecessary 'new' flag

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298570
    hyperv/channel: Minor style changes; no functional changes.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298571
    hyperv/channel: Remove unapplied comment

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298572
    hyperv/channel: Log a warning about duplicated primary channel offer

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298574
    hyperv/channel: Add functions to synchronize sub-channel offers

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298575
    hyperv/hn: Synchronize sub-channel offers

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298613
    hyperv/stor: Remove the useless hs_open_multi_channel

    This fixes the sub-channel offer race after Hyper-V device probe/attach
    is moved to vmbus SYSINIT/attach.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298614
    hyperv/stor: Synchronize sub-channel offers

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298615
    hyperv/hn: Avoid sub-channel creation callback.

    Since the sub-channel offers are synchronized, we can do our own
    channel setup without using the sub-channel creation callback.

    This paves the way to whack the sub-channel creation callback.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298616
    hyperv/stor: Avoid sub-channel creation callback.

    Since the sub-channel offers are synchronized, we can do our own
    channel setup without using the sub-channel creation callback.

    This paves the way to whack the sub-channel creation callback.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298617
    hyperv/channel: Git rid of the sub-channel creation callback

    It is no longer used.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302048 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298561,298563
sephe [Tue, 21 Jun 2016 05:49:07 +0000 (05:49 +0000)]
MFC 298561,298563

298561
    hn: Increase odrops for if_transmit method if drbr_enqueue fails.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298563
    hyperv/hn: Allow users to configure ifq or bufring depth.

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302047 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298449,298568
sephe [Tue, 21 Jun 2016 05:33:26 +0000 (05:33 +0000)]
MFC 298449,298568

298449
    hyperv/et: Make Hyper-V event timer a device.

    Submitted by:       Jun Su <junsu microsoft com>
    Reviewed by:        sephe, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D5957

298568
    hyperv/et: Strip extra white space in function name

    Reported by:        Sascha Wildner <saw online de>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302046 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298446
sephe [Tue, 21 Jun 2016 05:20:41 +0000 (05:20 +0000)]
MFC 298446

    hyperv: Update copyright to 2016 for the files Microsoft changed in 2016

    Sponsored by:       Microsoft OSTC
    Differential Revision:      https://reviews.freebsd.org/D6039

git-svn-id: svn://svn.freebsd.org/base/stable/10@302045 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298260
sephe [Tue, 21 Jun 2016 05:16:21 +0000 (05:16 +0000)]
MFC 298260

    hyperv/vmbus: Make device probe/attach synchronous w/ vmbus attach/SYSINIT

    Discussed with:     Jun Su <junsu microsoft com>, Dexuan Cui <decui microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302044 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

7 years agoMFC 298041,298259
sephe [Tue, 21 Jun 2016 05:11:19 +0000 (05:11 +0000)]
MFC 298041,298259

298041
    hyperv: No need to zero out softc

    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

298259
    hyperv: Remove two assign-only local variables

    Submitted by:       Jun Su <junsu microsoft com>
    MFC after:  1 week
    Sponsored by:       Microsoft OSTC

git-svn-id: svn://svn.freebsd.org/base/stable/10@302043 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f