freebsd.git
7 years agoMerge ACPICA 20170531.
jkim [Thu, 1 Jun 2017 00:01:19 +0000 (00:01 +0000)]
Merge ACPICA 20170531.

7 years agoImport ACPICA 20170531.
jkim [Wed, 31 May 2017 22:40:24 +0000 (22:40 +0000)]
Import ACPICA 20170531.

7 years agoparse.c parse_string
stevek [Wed, 31 May 2017 21:31:15 +0000 (21:31 +0000)]
parse.c parse_string
When parse_semi fails, free s before returning

parse.c parse_numeric_aggregate
The memory assigned to bufp is complicated, it can either be from the input
parameter buf or allocated locally. Introduce a new variable lbufp to track
when it is assigned locally and to free it when appropriate.

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: jhb
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9899

7 years agoAdd MD_VERIFY option to enable O_VERIFY in open for vnode type.
stevek [Wed, 31 May 2017 21:18:11 +0000 (21:18 +0000)]
Add MD_VERIFY option to enable O_VERIFY in open for vnode type.
Add -o [no]verify option to mdconfig (and document in man page.)
Implement GEOM attribute MNT::verified to ask md if the backing vnode is
  verified.
Check for MNT::verified in cd9660 mount to flag the mount as MNT_VERIFIED if
  the underlying device has been verified.

Reviewed by: rwatson
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D2902

7 years agoMinor code optimisation.
hselasky [Wed, 31 May 2017 21:05:24 +0000 (21:05 +0000)]
Minor code optimisation.
Avoid locking the global CUSE lock when the polling flags are zero.

MFC after: 1 week

7 years agoMFV: r319352
jkim [Wed, 31 May 2017 19:37:23 +0000 (19:37 +0000)]
MFV: r319352

Merge byacc 20170430.

7 years agoFix typo in Driver Type A/C/D capability checks in sdhci.
ivadasz [Wed, 31 May 2017 19:20:27 +0000 (19:20 +0000)]
Fix typo in Driver Type A/C/D capability checks in sdhci.

Use the SDHCI_CAN_DRIVE_TYPE_A/_C/_D masks to check for Driver Type support,
instead of using the SDHCI_CTRL2_DRIVER_TYPE_A/_C/_D values which are meant
for setting the Driver Type in the HOST_CONTROL2 register.

Approved by: adrian (mentor), jmcneill
Differential Revision: https://reviews.freebsd.org/D10999

7 years ago[ar71xx] rename AR724X_BASE -> std.AR724X
adrian [Wed, 31 May 2017 16:32:33 +0000 (16:32 +0000)]
[ar71xx] rename AR724X_BASE -> std.AR724X

7 years agomakefs: free buf in case of error
emaste [Wed, 31 May 2017 16:28:29 +0000 (16:28 +0000)]
makefs: free buf in case of error

CID: 270190
Submitted by: Siva Mahadevan <smahadevan@freebsdfoundation.org>
Reported by: Coverity
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11011

7 years agoImplement print_hex_dump(), print_hex_dump_bytes() and
hselasky [Wed, 31 May 2017 16:24:02 +0000 (16:24 +0000)]
Implement print_hex_dump(), print_hex_dump_bytes() and
printk_ratelimited() in the LinuxKPI.

While at it fix the inclusion guard of printk.h to be similar to the
rest of the LinuxKPI header files.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoProperly implement idr_preload() and idr_preload_end() in the
hselasky [Wed, 31 May 2017 16:08:30 +0000 (16:08 +0000)]
Properly implement idr_preload() and idr_preload_end() in the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix integer overflow detection in dd
asomers [Wed, 31 May 2017 16:07:32 +0000 (16:07 +0000)]
Fix integer overflow detection in dd

dd(1) tried to detect whether the seek offset would overflow, but it failed
to account for the case where the provided argument was negative and the
file was a regular file (negative seeks are allowed for character devices).
I fixed it, and added a regression test.

Reported by: Coverity
CID: 1368659
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

7 years agoImplement in_atomic() function in the LinuxKPI.
hselasky [Wed, 31 May 2017 15:05:44 +0000 (15:05 +0000)]
Implement in_atomic() function in the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix integer overflow in "camcontrol format"
asomers [Wed, 31 May 2017 14:59:03 +0000 (14:59 +0000)]
Fix integer overflow in "camcontrol format"

Reported by: Coverity
CID: 1011426
MFC after: 1 week
Sponsored by: Spectra Logic Corp

7 years agoFix uninitialized variable in bootparamd.c
asomers [Wed, 31 May 2017 14:53:50 +0000 (14:53 +0000)]
Fix uninitialized variable in bootparamd.c

Restore line that was accidentally deleted in change 318790

Reported by: Coverity
CID: 1375855
MFC after: 1 week
X-MFC-With: 318790
Sponsored by: Spectra Logic Corp

7 years agoProperly set the .d_name field in the cdevsw structure for the
hselasky [Wed, 31 May 2017 13:11:06 +0000 (13:11 +0000)]
Properly set the .d_name field in the cdevsw structure for the
LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMake sure the VMAP's "vm_file" field is referenced in a Linux
hselasky [Wed, 31 May 2017 13:07:05 +0000 (13:07 +0000)]
Make sure the VMAP's "vm_file" field is referenced in a Linux
compatible way by the linux_dev_mmap_single() function in the
LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRemove the VMA handle from its list before calling the LinuxKPI VMA
hselasky [Wed, 31 May 2017 13:05:54 +0000 (13:05 +0000)]
Remove the VMA handle from its list before calling the LinuxKPI VMA
close operation to prevent other threads from reusing the VM object
handle pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoDon't acquire a reference on the VM-space when allocating the LinuxKPI
hselasky [Wed, 31 May 2017 13:01:27 +0000 (13:01 +0000)]
Don't acquire a reference on the VM-space when allocating the LinuxKPI
task structure to avoid deadlock when tearing down the VM object
during a process exit.

Found by: markj @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix a reference count leak in the LinuxKPI due to calling VM open when
hselasky [Wed, 31 May 2017 12:08:25 +0000 (12:08 +0000)]
Fix a reference count leak in the LinuxKPI due to calling VM open when
it shouldn't be called.

Background:
The Linux VM open operation is called when a new VMA is
created on top of the current VMA. This is done through either mremap
flow or split_vma, usually due to mlock, madvise, munmap and so
on. This is currently not supported by the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFixes for refcounting "struct linux_file" in the LinuxKPI.
hselasky [Wed, 31 May 2017 12:02:59 +0000 (12:02 +0000)]
Fixes for refcounting "struct linux_file" in the LinuxKPI.

- Allow "struct linux_file" to be refcounted when its "_file" member
  is NULL by using its "f_count" field. The reference counts are
  transferred to the file structure when the file descriptor is
  installed.

- Add missing vdrop() calls for error cases during open().

- Set the "_file" member of "struct linux_file" during open. This
allows use of refcounting through get_file() and fput() with LinuxKPI
character devices.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMake sure the thread's priority is restored for all three cases inside
hselasky [Wed, 31 May 2017 10:01:15 +0000 (10:01 +0000)]
Make sure the thread's priority is restored for all three cases inside
linux_synchronize_rcu_cb() in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUpdate the usr.bin/mkimg golden test output files after ^/head@r319125
ngie [Wed, 31 May 2017 08:01:12 +0000 (08:01 +0000)]
Update the usr.bin/mkimg golden test output files after ^/head@r319125

^/head@r319125 changed the location of the backup pmbr, requiring the
output files to be regenerated, since they're binary disk dumps.

The output files were regenerated with "make rebase"--fixed in
^/head@r319294.

MFC with: r319125, r319294
PR: 219673
Sponsored by: Dell EMC Isilon

7 years agoFix "make rebase" after ^/head@r315776
ngie [Wed, 31 May 2017 07:49:49 +0000 (07:49 +0000)]
Fix "make rebase" after ^/head@r315776

"make rebase" can be used for rebasing the output files from mkimg
after making a change to mkimg. This will come in handy soon, per
bug 219673.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoFormalize the dependent/dependency relationship for <foo>.gz.uu vs <foo>
ngie [Wed, 31 May 2017 07:42:14 +0000 (07:42 +0000)]
Formalize the dependent/dependency relationship for <foo>.gz.uu vs <foo>

This helps ensure that the output files are regenerated if the input files
change, after the output files have been created.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years ago- Add a simple example to uname(1) manual page to show how the hardware
danfe [Wed, 31 May 2017 03:44:31 +0000 (03:44 +0000)]
- Add a simple example to uname(1) manual page to show how the hardware
  platform (returned by -m) can be different from the machine's processor
  architecture (-p)
- Document that make(1) sets universal MACHINE and MACHINE_ARCH variables
  based on these values

Reviewed by: imp, manpages (bjk)
Approved by: bjk, imp (implied)
Differential Revision: https://reviews.freebsd.org/D10489

7 years agoRemove NORESOLVE (-R) option from poollist() (ippool -l). It is not
cy [Wed, 31 May 2017 03:11:25 +0000 (03:11 +0000)]
Remove NORESOLVE (-R) option from poollist() (ippool -l). It is not
used in poollist().

7 years agoFix bug in r318997: remove the line which overrides vn_fsid()
kib [Tue, 30 May 2017 21:20:54 +0000 (21:20 +0000)]
Fix bug in r318997: remove the line which overrides vn_fsid()
calculation.

Noted by: jhb
Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation

7 years agoRegenerate src.conf(5)
ngie [Tue, 30 May 2017 18:06:19 +0000 (18:06 +0000)]
Regenerate src.conf(5)

This contains a number of content changes due to src.opts.mk changes.

Sponsored by: Dell EMC Isilon

7 years agoUse .Xr to reference libblacklist(3), blacklistctl(8), and blacklistd(8)
ngie [Tue, 30 May 2017 18:03:34 +0000 (18:03 +0000)]
Use .Xr to reference libblacklist(3), blacklistctl(8), and blacklistd(8)

MFC after: now
Sponsored by: Dell EMC Isilon

7 years agoAdd some miscellaneous definitions to support DRM drivers.
markj [Tue, 30 May 2017 17:16:08 +0000 (17:16 +0000)]
Add some miscellaneous definitions to support DRM drivers.

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10985

7 years agoadd a rescue/sh sanity check before installworld on the running system
emaste [Tue, 30 May 2017 15:51:48 +0000 (15:51 +0000)]
add a rescue/sh sanity check before installworld on the running system

FreeBSD does not guarantee kernel forward compatibility (that is,
running a newer userland on an older kernel).  The documented upgrade
procedure specifies that installkernel should be performed, followed by
a reboot and then installworld.  As a sanity check when installing onto
the running system (DESTDIR is / or unset), attempt to run "sh echo OK"
using rescue from the objdir.  If rescue fails (e.g., because the system
has not been rebooted and the "old" kernel lacks a system call required
by the to-be-installed world), abort the installation.

This should avoid ino64 foot-shooting when the proper upgrade procedure
is not followed.

Reviewed by: allanjude, gjb, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10987

7 years agoFix an unnecessary/incorrect check in the PKTOPT_EXTHDRCPY macro.
jtl [Tue, 30 May 2017 14:50:28 +0000 (14:50 +0000)]
Fix an unnecessary/incorrect check in the PKTOPT_EXTHDRCPY macro.

This macro allocates memory and, if malloc does not return NULL, copies
data into the new memory. However, it doesn't just check whether malloc
returns NULL. It also checks whether we called malloc with M_NOWAIT. That
is not necessary.

While it may be that malloc() will only return NULL when the M_NOWAIT flag
is set, we don't need to check for this when checking malloc's return
value. Further, in this case, the check was not completely accurate,
because it checked for flags == M_NOWAIT, rather than treating it as a bit
field and checking for (flags & M_NOWAIT).

Reviewed by: ae
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D10942

7 years agoFix two places in the ICMP6 code where we could dereference a NULL pointer
jtl [Tue, 30 May 2017 14:41:31 +0000 (14:41 +0000)]
Fix two places in the ICMP6 code where we could dereference a NULL pointer
in the icmp6_input() function.

When processing an ICMP6_ECHO_REQUEST, if IP6_EXTHDR_GET fails, it will
set nicmp6 and n to NULL. Therefore, we should condition our modification
to nicmp6 on n being not NULL.

And, when processing an ICMP6_WRUREQUEST in the (mode != FQDN) case, if
m_dup_pkthdr() fails, the code will set n to NULL. However, the very next
line dereferences n. Therefore, when m_dup_pkthdr() fails, we should
discontinue further processing and follow the same path as when m_gethdr()
fails.

Reported by: clang static analyzer
Reviewed by: ae
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D10941

7 years agoEnforce the limit on ICMP messages before doing work to formulate the
jtl [Tue, 30 May 2017 14:32:44 +0000 (14:32 +0000)]
Enforce the limit on ICMP messages before doing work to formulate the
response.

Delete an unneeded rate limit for UDP under IPv6. Because ICMP6
messages have their own rate limit, it is unnecessary to apply a
second rate limit to UDP messages.

Reviewed by: glebius
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D10387

7 years agofix indentation
avg [Tue, 30 May 2017 13:53:03 +0000 (13:53 +0000)]
fix indentation

MFC after: 4 days

7 years agoIntroduce additional locks when releasing TX resources and buffers in ENA
zbb [Tue, 30 May 2017 12:00:56 +0000 (12:00 +0000)]
Introduce additional locks when releasing TX resources and buffers in ENA

There could be race condition with TX cleaning routine when cleaning mbufs,
when it was called directly from main sending thread (ena_mq_start).

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10927

7 years agoMove ENA's hw stats updating routine to separate task
zbb [Tue, 30 May 2017 11:58:51 +0000 (11:58 +0000)]
Move ENA's hw stats updating routine to separate task

Initially, stats were being updated each time OS was requesting for
the first statistic.
To read statistics from hw, condvar was used. cv_timedwait cannot be
called when unsleepable lock is held, and this happens when FreeBSD
is requesting statistic.
Seperate task is reading statistics from NIC each 1 second.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10926

7 years agoAdd error handling to the ENA driver if init of the reset task fails
zbb [Tue, 30 May 2017 11:56:54 +0000 (11:56 +0000)]
Add error handling to the ENA driver if init of the reset task fails

Also, to simplify cleaning routine, reset task is initialized before
allocating statistics and other resources.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10925

7 years agoAdd locks before each ena_up and ena_down
zbb [Tue, 30 May 2017 11:55:02 +0000 (11:55 +0000)]
Add locks before each ena_up and ena_down

Lock only ena_up and ena_down calls in ioctl handler, instead of whole
ioctl. Locking ioctl with sx lock that is sleepable, is not allowed in
some cases, e.g. when multicast options are being changed.
Additional locking was added in deatch function to prevent race condition
with ioctl function.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10924

7 years agoAdd mbuf defragmentation to the ENA driver
zbb [Tue, 30 May 2017 11:53:18 +0000 (11:53 +0000)]
Add mbuf defragmentation to the ENA driver

When mbuf chain is too long and device cannot handle that number
of segments in DMA transaction, mbuf chain will be defragmented.
Initially, driver was dropping all mbuf chains that were exceeding
supported number of segments.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon.com Inc.
Differential revision: https://reviews.freebsd.org/D10923

7 years agomtx: fix whitespace damage in _mtx_trylock_flags_
mjg [Tue, 30 May 2017 02:25:47 +0000 (02:25 +0000)]
mtx: fix whitespace damage in _mtx_trylock_flags_

MFC after: 3 days

7 years agopsm: add support for evdev protocol
wulf [Mon, 29 May 2017 20:43:00 +0000 (20:43 +0000)]
psm: add support for evdev protocol

Both relative and absolute multitouch modes are supported.
To enable psm(4) evdev support one should:
1. Add `device evdev` and `options EVDEV_SUPPORT` to kernel config file
2. Add hw.psm.elantech_support=1 or hw.psm.synaptics_support=1 to
   /boot/loader.conf for activation of absolute mode on touchpads
3. Add kern.evdev.rcpt_mask=12 to /etc/sysctl.conf to enable psm event
   sourcing and disable sysmouse

Reviewed by: gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10265
Tested by: wulf, Jan Kokemueller (Lenovo devs)

7 years agoAlso add libzfs and libmilter to the 64-bit inode library bump list.
kwm [Mon, 29 May 2017 20:27:31 +0000 (20:27 +0000)]
Also add libzfs and libmilter to the 64-bit inode library bump list.
Make the comment more generic.

Approved by: emaste@

7 years ago64-bit inode commit bumped libarchive library version, record the old one.
kwm [Mon, 29 May 2017 20:11:27 +0000 (20:11 +0000)]
64-bit inode commit bumped libarchive library version, record the old one.

Approved by: emaste@

7 years ago:dnvlist_get_string__default_value: fix a bogus string comparison test
ngie [Mon, 29 May 2017 19:02:52 +0000 (19:02 +0000)]
:dnvlist_get_string__default_value: fix a bogus string comparison test

Check actual_value vs "5", not "5" vs itself.

MFC after: 3 days
Reported by: Coverity
CID: 1362021
Sponsored by: Dell EMC Isilon

7 years agologarithm_test: assert that feclearexcept succeeds
ngie [Mon, 29 May 2017 18:49:28 +0000 (18:49 +0000)]
logarithm_test: assert that feclearexcept succeeds

This helps ensure that test preconditons are fulfilled.

MFC after: 3 days
Reported by: Coverity
CID: 1346572
Sponsored by: Dell EMC Isilon

7 years agofma_test: mute a warning about unreachable code on amd64 by restructuring
ngie [Mon, 29 May 2017 18:45:10 +0000 (18:45 +0000)]
fma_test: mute a warning about unreachable code on amd64 by restructuring
the #ifdef block to only handle the rest of the logic in the loop in the
#else case.

MFC after: 3 days
Reported by: Coverity
CID: 1346844
Sponsored by: Dell EMC Isilon

7 years ago:nvlist_unpack__duplicate_key : check the result of nvlist_pack(3)
ngie [Mon, 29 May 2017 18:39:28 +0000 (18:39 +0000)]
:nvlist_unpack__duplicate_key : check the result of nvlist_pack(3)

This fixes a potential NULL pointer dereference.

MFC after: 3 days
Reported by: Coverity
CID: 1362051
Sponsored by: Dell EMC Isilon

7 years agolib/libnv/tests/dnv_test: fix memory leaks for memory allocated via
ngie [Mon, 29 May 2017 18:34:45 +0000 (18:34 +0000)]
lib/libnv/tests/dnv_test: fix memory leaks for memory allocated via
either strdup or one of the dnvlist* libcalls.

Reported by: Coverity
CID: 1362056-1362060
Sponsored by: Dell EMC Isilon

7 years agoDocument direct execution mode for rtld.
kib [Mon, 29 May 2017 13:38:26 +0000 (13:38 +0000)]
Document direct execution mode for rtld.

Reviewed by: emaste, jonathan (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D10826

7 years agoCorrect explanation of the dynamic tokens handling.
kib [Mon, 29 May 2017 13:36:32 +0000 (13:36 +0000)]
Correct explanation of the dynamic tokens handling.

Reviewed by: emaste, jonathan
Sponsored by: The FreeBSD Foundation
X-Differential Revision: https://reviews.freebsd.org/D10826

7 years agobsdgrep: bump version number and add Kyle Evans copyright
emaste [Mon, 29 May 2017 13:10:01 +0000 (13:10 +0000)]
bsdgrep: bump version number and add Kyle Evans copyright

The following changes have been made over the last couple of months:

Features:

 - With bsdgrep -r, the working directory is implied if no directory is
   specified
 - bsdgrep will now behave as bsdgrep -r does when it's named rgrep
 - bsdgrep now understands -z/--null-data to use \0 as EOL
 - GNU regex compatibility is now indicated with a "GNU compatible" in
   the version string

Fixes:

 - --mmap no longer hangs when coming across an EOF without an
   accompanying EOL
 - -o/--color matching generally improved, now produces earliest /
   longest matches
 - Context output now more closely aligns with GNU grep
 - Zero-length matches no longer exhibit broken behavior
 - Every output line now honors -b/-H/-n flags

Tests have been added for previous regressions as well as other
previously untested behaviors.

Various other fixes have been commited, and refactoring for further /
later improvements has taken place.

(The original submission changed the version string to 2.5.2, but I
decided to use 2.6.0 to reflect the addition of new features.)

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

7 years agomkimg: Correct an off by one error in the PMBR size
manu [Mon, 29 May 2017 12:51:02 +0000 (12:51 +0000)]
mkimg: Correct an off by one error in the PMBR size

The PMBR last sector should be number of sector - 1 (As stated in UEFI Spec
2.6 page 118 table 17).
This fixes warning printed by linux tools like parted or fdisk.

Sponsored by: Gandi.net

7 years agoDisable IPsec debugging code by default when IPSEC_DEBUG kernel option
ae [Mon, 29 May 2017 09:30:38 +0000 (09:30 +0000)]
Disable IPsec debugging code by default when IPSEC_DEBUG kernel option
is not specified.

Due to the long call chain IPsec code can produce the kernel stack
exhaustion on the i386 architecture. The debugging code usually is not
used, but it requires a lot of stack space to keep buffers for strings
formatting. This patch conditionally defines macros to disable building
of IPsec debugging code.

IPsec currently has two sysctl variables to configure debug output:
 * net.key.debug variable is used to enable debug output for PF_KEY
   protocol. Such debug messages are produced by KEYDBG() macro and
   usually they can be interesting for developers.
 * net.inet.ipsec.debug variable is used to enable debug output for
   DPRINTF() macro and ipseclog() function. DPRINTF() macro usually
   is used for development debugging. ipseclog() function is used for
   debugging by administrator.

The patch disables KEYDBG() and DPRINTF() macros, and formatting buffers
declarations when IPSEC_DEBUG is not present in kernel config. This reduces
stack requirement for up to several hundreds of bytes.
The net.inet.ipsec.debug variable still can be used to enable ipseclog()
messages by administrator.

PR: 219476
Reported by: eugen
No objection from: #network
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10869

7 years agoIntroduce Genesys GL3224 quirks
wma [Mon, 29 May 2017 09:22:53 +0000 (09:22 +0000)]
Introduce Genesys GL3224 quirks

The Genesys chip is failing when issueing READ_CAP(16) command.
Force a quirk to disable it and use READ_CAP(10) instead.

Also, depending on used firmware, GL3224 can be recognized
either as 'storage device' or 'mass storage class' -
enable both variants in scsi_quirk_table.

Submitted by:    Wojciech Macek <wma@semihalf.com>
                 Konrad Adamczyk <ka@semihalf.com>
Obtained from:   Semihalf
Sponsored by:    Stormshield
Reviewed by:     mav
Differential revision: https://reviews.freebsd.org/D10902

7 years agoIncrease timeout in Atheros HAL
wma [Mon, 29 May 2017 09:21:38 +0000 (09:21 +0000)]
Increase timeout in Atheros HAL

It turned out, that some models of the Atheros PCIe
adapters (e.g. AR983x family) may fail to attach
due to insufficient timeout value.

Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Stormshield
Reviewed by:    adrian
Differential revision: https://reviews.freebsd.org/D10903

7 years agoEnable wireless Atheros cards in ARMADA38X
wma [Mon, 29 May 2017 09:20:20 +0000 (09:20 +0000)]
Enable wireless Atheros cards in ARMADA38X

Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
                Dominik Ermel <der@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Stormshield
Differential revision: https://reviews.freebsd.org/D10904

7 years ago[AP93] fix up the arge0/arge1 hints.
adrian [Mon, 29 May 2017 07:57:01 +0000 (07:57 +0000)]
[AP93] fix up the arge0/arge1 hints.

7 years ago[ar71xx] [ar724x] update to work
adrian [Mon, 29 May 2017 07:30:07 +0000 (07:30 +0000)]
[ar71xx] [ar724x] update to work

* add EARLY_PRINTF for debugging
* update module list to be much larger
* add random, otherwise well, stuff doesn't work.
* IPFIREWALL_DEFAULT_TO_ACCEPT

Tested:

* AP93 (AR7240 + AR9280)

TODO:

* rename to std.AR724X
* unify the built module list between all of the mips24k/mips74k atheros config files -
  now that the HAL, hwpmc, USB, etc are per-chip/per-arch modules it is easy to just
  compile them all and only include the ones you care about.

7 years agoUpdate AP93 support to the new world order.
adrian [Mon, 29 May 2017 07:27:08 +0000 (07:27 +0000)]
Update AP93 support to the new world order.

* Map change: create a combined kernel+rootfs image.  The instructions I'll post
  on the wiki (which will be for a very outdated dev board, but at least will
  explain the what/why for posterity) will include how to reset the boot command.

Tested:

* AP93 dev board (AR7240 + AR9280)

7 years agoRevert r318789. It causes hanging NAT tcp sessions.
cy [Mon, 29 May 2017 07:15:28 +0000 (07:15 +0000)]
Revert r318789. It causes hanging NAT tcp sessions.

7 years agozfs_lookup: fix bogus arguments to lookup of "snapshot" directory
avg [Mon, 29 May 2017 06:30:34 +0000 (06:30 +0000)]
zfs_lookup: fix bogus arguments to lookup of "snapshot" directory

When a parent directory lookup is done at the root of a snapshot mounted
under .zfs/snapshot directory, we need to look up that directory in
the parent filesystem.  We achieve that by doing a VOP_LOOKUP operation
on a .zfs vnode with "snapshot" as a target name.  But previously we
also passed ISDOTDOT flag to the lookup and, because of that, the lookup
actually returned the parent of the .zfs vnode, that is, a root vnode of
the parent filesystem.

Reported by: lev
Tested by: lev
MFC after: 3 days

7 years agortwn: fix connection problems with 'options RTWN_WITHOUT_UCODE'
avos [Sun, 28 May 2017 22:51:06 +0000 (22:51 +0000)]
rtwn: fix connection problems with 'options RTWN_WITHOUT_UCODE'

sc_set_media_status() callback may involve some generic code in addition to
firmware-specific part (e.g., link status register setup for RTL8188E);
so, remove 'RTWN_WITHOUT_UCODE' ifdefs around it.

Tested with RTL8188CUS, RTL8188EU and RTL8821AU, STA mode.

7 years agortwn_usb: fix build with 'options RTWN_WITHOUT_UCODE'
avos [Sun, 28 May 2017 22:38:19 +0000 (22:38 +0000)]
rtwn_usb: fix build with 'options RTWN_WITHOUT_UCODE'

7 years agoMention that the basep argument to getdirentries(2) can be NULL.
kib [Sun, 28 May 2017 21:42:47 +0000 (21:42 +0000)]
Mention that the basep argument to getdirentries(2) can be NULL.

Noted by: dim
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D10972

7 years agouse the same option list for dhcp discovery and request
tsoome [Sun, 28 May 2017 21:30:01 +0000 (21:30 +0000)]
use the same option list for dhcp discovery and request

The DHCP client is supposed to use the same option request list for
both DHCP discovery and request.

This will also allow us to fill the list in single function.

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

7 years agoSmall cleanup in dev_net.c
tsoome [Sun, 28 May 2017 21:20:55 +0000 (21:20 +0000)]
Small cleanup in dev_net.c

The variable servip is unused. One leftover printf and small cstyle nit.

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

7 years agoFollowup on the user-class changes
bapt [Sun, 28 May 2017 18:31:13 +0000 (18:31 +0000)]
Followup on the user-class changes

Reported by: Jose Luis Duran (via github)

7 years ago.Xr mount.conf(5) from boot(8).
trasz [Sun, 28 May 2017 18:13:44 +0000 (18:13 +0000)]
.Xr mount.conf(5) from boot(8).

MFC after: 2 weeks

7 years agoFix Xrs; they were pointing to the wrong section.
trasz [Sun, 28 May 2017 18:09:49 +0000 (18:09 +0000)]
Fix Xrs; they were pointing to the wrong section.

MFC after: 2 weeks

7 years agoMove mount.conf(8) to mount.conf(5); it's a kernel configuration file
trasz [Sun, 28 May 2017 18:07:53 +0000 (18:07 +0000)]
Move mount.conf(8) to mount.conf(5); it's a kernel configuration file
and not an administrative utility.

MFC after: 2 weeks

7 years agoTweak r319058 slightly
ngie [Sun, 28 May 2017 17:50:29 +0000 (17:50 +0000)]
Tweak r319058 slightly

- Specify an explicit mode when using O_CREAT per open(2).
- Fix the error message (add missing enclosing parentheses).

Submitted by: jilles
MFC after: 3 days
MFC with: r319058
Sponsored by: Dell EMC Isilon

7 years agoFix potential memory leak.
pfg [Sun, 28 May 2017 17:48:54 +0000 (17:48 +0000)]
Fix potential memory leak.

Moving the allocation forward, just before it's actually needed, seems
sensible.
Add newline character at the last line while here.

Reported by: pluknet
Differential Revision: https://reviews.freebsd.org/D10974

7 years agoDeclutter rctl(8) by moving kernel build instructions into newly
trasz [Sun, 28 May 2017 17:25:47 +0000 (17:25 +0000)]
Declutter rctl(8) by moving kernel build instructions into newly
created rctl(4).

MFC after: 2 weeks

7 years agoRandom tweaks to rctl(8).
trasz [Sun, 28 May 2017 17:13:38 +0000 (17:13 +0000)]
Random tweaks to rctl(8).

MFC after: 2 weeks

7 years agoMinor tweaks to iscsi(4) and iscsid(8).
trasz [Sun, 28 May 2017 17:02:29 +0000 (17:02 +0000)]
Minor tweaks to iscsi(4) and iscsid(8).

MFC after: 2 weeks

7 years agoRandom tweaks to cfiscsi(4) man page.
trasz [Sun, 28 May 2017 16:53:21 +0000 (16:53 +0000)]
Random tweaks to cfiscsi(4) man page.

MFC after: 2 weeks

7 years agoMake ctld(8) mention cfiscsi(4).
trasz [Sun, 28 May 2017 16:41:42 +0000 (16:41 +0000)]
Make ctld(8) mention cfiscsi(4).

MFC after: 2 weeks

7 years agoSupport for linux ext2fs posix-draft ACLs.
pfg [Sun, 28 May 2017 15:39:11 +0000 (15:39 +0000)]
Support for linux ext2fs posix-draft ACLs.

This is closely tied to the Extended Attribute implementation.

Submitted by: Fedor Uporov
Reviewed by: kevlo, pfg

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

7 years ago[etherswitch] [rtl8366] add phy4cpu setting and support mdioproxy
mizhka [Sun, 28 May 2017 12:14:33 +0000 (12:14 +0000)]
[etherswitch] [rtl8366] add phy4cpu setting and support mdioproxy

Tested on WZR-HP-G301NH(RTL8366RB) and WZR-HP-G300NH(RTL8366SR).

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

7 years ago[mips] [bhnd] Support of old PMU for BMIPS and siba SoC
mizhka [Sun, 28 May 2017 12:05:16 +0000 (12:05 +0000)]
[mips] [bhnd] Support of old PMU for BMIPS and siba SoC

 - Fix typo of PLL Type 4
 - Don't panic of frequency getters

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

7 years agoUpdate getdirentries(2) page for new struct dirent layout.
kib [Sun, 28 May 2017 09:29:53 +0000 (09:29 +0000)]
Update getdirentries(2) page for new struct dirent layout.

Sponsored by: The FreeBSD Foundation

7 years agoSend all of `data`, not just a portion of it
ngie [Sun, 28 May 2017 09:21:28 +0000 (09:21 +0000)]
Send all of `data`, not just a portion of it

It was sending only a long's worth (4 or 8 bytes) of data previously
(instead of the entire buffer) via send(2).

MFC after: 1 week
Reported by: Coverity
CID: 1229966, 1229967, 1230004, 1230005
Sponsored by: Dell EMC Isilon

7 years agoInitial `srv` before using it in bind(2)
ngie [Sun, 28 May 2017 09:08:30 +0000 (09:08 +0000)]
Initial `srv` before using it in bind(2)

MFC after: 3 days
Reported by: Coverity
CID: 1357526
Sponsored by: Dell EMC Isilon

7 years agoDon't leak accept_fd on thread completion
ngie [Sun, 28 May 2017 09:01:58 +0000 (09:01 +0000)]
Don't leak accept_fd on thread completion

MFC after: 3 days
Reported by: Coverity
CID: 1296068
Sponsored by: Dell EMC Isilon

7 years agoUse main(void) instead of main(argc __unused, argv __unused)
ngie [Sun, 28 May 2017 08:57:08 +0000 (08:57 +0000)]
Use main(void) instead of main(argc __unused, argv __unused)

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoUse an exit code of 1 instead of -1 for reasons noted in r319056
ngie [Sun, 28 May 2017 08:55:32 +0000 (08:55 +0000)]
Use an exit code of 1 instead of -1 for reasons noted in r319056

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoCreate a deterministic file in the kyua sandbox, instead of a
ngie [Sun, 28 May 2017 08:52:12 +0000 (08:52 +0000)]
Create a deterministic file in the kyua sandbox, instead of a
temporary file outside the kyua sandbox

This helps ensure that the file is removed at test exit, and as
a side effect, cures a warning about umasks with Coverity.

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years agoIn r246085 some bits that are MI movied out into headers in compat/linux,
dchagin [Sun, 28 May 2017 08:46:57 +0000 (08:46 +0000)]
In r246085 some bits that are MI movied out into headers in compat/linux,
but I missed that when I commited x86_64 Linuxulator. So remove the duplicates.

MFC after: 1 week

7 years agotests/sys/file/ftruncate_test: use an exit code of 1 instead
ngie [Sun, 28 May 2017 08:46:41 +0000 (08:46 +0000)]
tests/sys/file/ftruncate_test: use an exit code of 1 instead
of -1 with err*(3).

An exit code of -1 is implementation defined -- it's best to stick
with something well-defined (1).

MFC after: 3 days
Sponsored by: Dell EMC Isilon

7 years ago[ar71xx] undo read-after-write to flush; some bus devices dislike this.
adrian [Sun, 28 May 2017 07:44:55 +0000 (07:44 +0000)]
[ar71xx] undo read-after-write to flush; some bus devices dislike this.

This broke the PCI fixup on at least the AR7240 + AR9280 reference design
board that I have.

Tested:

* Atheros AP93 reference design - AR7240 + AR9280

7 years agohostent_test_getaddrinfo_eq(..): call freeaddrinfo on `ai` when done
ngie [Sun, 28 May 2017 07:40:42 +0000 (07:40 +0000)]
hostent_test_getaddrinfo_eq(..): call freeaddrinfo on `ai` when done

This plugs a leak of memory allocated via getaddrinfo.

MFC after: 1 week
Reported by: Coverity
CID: 1346866
Sponsored by: Dell EMC Isilon

7 years agoOn success, getrandom() Linux system call returns the number of bytes that
dchagin [Sun, 28 May 2017 07:40:09 +0000 (07:40 +0000)]
On success, getrandom() Linux system call returns the number of bytes that
were copied to the buffer supplied by the user.

Also fix getrandom() if Linuxulator modules are built without the kernel.

PR: 219464
Submitted by: Maciej Pasternacki
Reported by: Maciej Pasternacki
MFC after: 1 week

7 years agoStrip _binary_linux_locore_o_size from ${VDSO}.so as it is a low absolute
dchagin [Sun, 28 May 2017 07:37:40 +0000 (07:37 +0000)]
Strip _binary_linux_locore_o_size from ${VDSO}.so as it is a low absolute
symbol, and this breaks symbol lookup in ddb.

Requested by: bde@

MFC after: 1 week

7 years agohostent_test_getnameinfo_eq(..): initialize found_a_host to false
ngie [Sun, 28 May 2017 07:04:50 +0000 (07:04 +0000)]
hostent_test_getnameinfo_eq(..): initialize found_a_host to false

MFC after: 1 week
Reported by: Coverity
CID: 1368943
Sponsored by: Dell EMC Isilon

7 years agoBump WARNS from 1 to 3 after recent commits to fix warnings in the
ngie [Sun, 28 May 2017 06:29:01 +0000 (06:29 +0000)]
Bump WARNS from 1 to 3 after recent commits to fix warnings in the
directory.

Tested with: clang 4.0, gcc 4.2.1, gcc 6.3.0
MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoPush `snapshot_file` copying down into run_tests function, and mark snapshot_file
ngie [Sun, 28 May 2017 06:26:43 +0000 (06:26 +0000)]
Push `snapshot_file` copying down into run_tests function, and mark snapshot_file
const char *.

This fixes a bogus set of errors from gcc about strdup not being allowed a NULL
argument.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

7 years agoImplement sincos, sincosf, and sincosl.
mmel [Sun, 28 May 2017 06:13:38 +0000 (06:13 +0000)]
Implement sincos, sincosf, and sincosl.
The primary benefit of these functions is that argument
reduction is done once instead of twice in independent
calls to sin() and cos().

* lib/msun/Makefile:
  . Add s_sincos[fl].c to the build.
  . Add sincos.3 documentation.
  . Add appropriate MLINKS.

* lib/msun/Symbol.map:
  . Expose sincos[fl] symbols in dynamic libm.so.

* lib/msun/man/sincos.3:
  . Documentation for sincos[fl].

* lib/msun/src/k_sincos.h:
  . Kernel for sincos() function.  This merges the individual kernels
    for sin() and cos().  The merger offered an opportunity to re-arrange
    the individual kernels for better performance.

* lib/msun/src/k_sincosf.h:
   . Kernel for sincosf() function.  This merges the individual kernels
     for sinf() and cosf(). The merger offered an opportunity to re-arrange
     the individual kernels for better performance.

* lib/msun/src/k_sincosl.h:
   . Kernel for sincosl() function.  This merges the individual kernels
     for sinl() and cosl(). The merger offered an opportunity to re-arrange
     the individual kernels for better performance.

* lib/msun/src/math.h:
  . Add prototytpes for sincos[fl]().

* lib/msun/src/math_private.h:
  . Add RETURNV macros.  This is needed to reset fpsetprec on I386
    hardware for a function with type void.

* lib/msun/src/s_sincos.c:
  . Implementation of sincos() where sin() and cos() were merged into
    one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosf.c:
  . Implementation of sincosf() where sinf() and cosf() were merged into
    one routine and possibly re-arranged for better performance.

* lib/msun/src/s_sincosl.c:
  . Implementation of sincosl() where sinl() and cosl() were merged into
    one routine and possibly re-arranged for better performance.

PR: 215977, 218300
Submitted by: Steven G. Kargl <sgk@troutmask.apl.washington.edu>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10765

7 years agoFix a -Wunused-but-set-variable warning reported by gcc 6.3.0
ngie [Sun, 28 May 2017 05:31:18 +0000 (05:31 +0000)]
Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0

MFC after: 3 days
Sponsored by: Dell EMC Isilon