]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoConsistently use lowercase hex numbers in ascii(7).
trasz [Fri, 2 Jun 2017 15:32:11 +0000 (15:32 +0000)]
Consistently use lowercase hex numbers in ascii(7).

MFC after: 2 weeks

7 years agostyle(9) fixes, remove unnecessary headers, remove duplicate #defines and
loos [Fri, 2 Jun 2017 15:12:32 +0000 (15:12 +0000)]
style(9) fixes, remove unnecessary headers, remove duplicate #defines and
in some cases, shuffle the code around to simplify locking.

No functional changes.

Sponsored by: Rubicon Communications, LLC (Netgate)

7 years ago- Don't bother flushing the data cache for pages we're about to unmap, there's
cognet [Fri, 2 Jun 2017 14:17:14 +0000 (14:17 +0000)]
- Don't bother flushing the data cache for pages we're about to unmap, there's
no need to.
- Remove pmap_is_current(), pmap_[pte|l3]_valid_cacheable as there were only
used to know if we had to write back pages.
- In pmap_remove_pages(), don't bother invalidating each page in the TLB,
we're about to flush the whole TLB anyway.

This makes make world 8-9% faster on my hardware.

Reviewed by: andrew

7 years agoFix device lookup of for the stdout-path chosen property.
andrew [Fri, 2 Jun 2017 14:01:17 +0000 (14:01 +0000)]
Fix device lookup of for the stdout-path chosen property.

The stdout-path chosen property may include the serial connection details,
e.g. the baud rate. When passing the device to OF_finddevice we need to
strip off this information as it will cause the lookup to fail.

Reviewed by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D6846

7 years agoDecode the arguments passed to __cap_rights_get() and cap_rights_limit().
jhb [Fri, 2 Jun 2017 13:33:50 +0000 (13:33 +0000)]
Decode the arguments passed to __cap_rights_get() and cap_rights_limit().

Submitted by: tobik

7 years agoSkip setting the MTU in the netfront driver (xn# devices) if the new MTU
cperciva [Fri, 2 Jun 2017 07:03:31 +0000 (07:03 +0000)]
Skip setting the MTU in the netfront driver (xn# devices) if the new MTU
is the same as the old MTU.  In particular, on Amazon EC2 "T2" instances
without this change, the network interface is reinitialized every 30
minutes due to the MTU being (re)set when a new DHCP lease is obtained,
causing packets to be dropped, along with annoying syslog messages about
the link state changing.

As a side note, the behaviour this commit fixes was responsible for
exposing the locking problems fixed via r318523 and r318631.

Maintainers of other network interface drivers may wish to consider making
the corresponding change; the handling of SIOCSIFMTU does not seem to
exhibit a great deal of consistency between drivers.

MFC after: 1 week

7 years agoRemove stale cap_rights_get(2) manpage.
jhb [Fri, 2 Jun 2017 03:53:34 +0000 (03:53 +0000)]
Remove stale cap_rights_get(2) manpage.

The documentation moved to section 3 several years ago, but
'man cap_rights_get' pulls up cap_rights_limit(2) (which is
MLINKed to cap_rights_get.2) instead of cap_rights_get(3).

MFC after: 1 week

7 years agoAdd -H as an alias for --speed-large-file to match GNU diff.
jhb [Fri, 2 Jun 2017 03:25:59 +0000 (03:25 +0000)]
Add -H as an alias for --speed-large-file to match GNU diff.

This is undocumented to match GNU diff where -H is also undocumented.
Some existing software (such as kompare) uses this option by default.

Reviewed by: emaste, rpokala
Differential Revision: https://reviews.freebsd.org/D11022

7 years agoBump manpage date.
araujo [Fri, 2 Jun 2017 02:37:17 +0000 (02:37 +0000)]
Bump manpage date.

7 years agoAdd VNC Authentication support based on RFC6143 section 7.2.2.
araujo [Fri, 2 Jun 2017 02:35:16 +0000 (02:35 +0000)]
Add VNC Authentication support based on RFC6143 section 7.2.2.

Submitted by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Reworked by: myself
Reviewed by: grehan, rgrimes and jilles
MFC after: 1 week.
Relnotes: Yes.
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D10818

7 years agonative-xtools: Connect lld.
bdrewery [Fri, 2 Jun 2017 00:57:59 +0000 (00:57 +0000)]
native-xtools: Connect lld.

This will ensure that aarch64 gets a working native /usr/bin/ld rather
than requiring the aarch64-binutils hack in Poudriere, or emulating
the aarch64 lld.

PR: 217189
Reported by: swills, jbeich

7 years agoMETA_MODE: Move ignoring of /usr/local/etc/libmap.d to proper place.
bdrewery [Thu, 1 Jun 2017 23:04:44 +0000 (23:04 +0000)]
META_MODE: Move ignoring of /usr/local/etc/libmap.d to proper place.

This was added in r318194 but local.meta.sys.mk is only used for
DIRDEPS_BUILD.

7 years agocrashinfo: add "batch" mode and use it during boot
vangyzen [Thu, 1 Jun 2017 21:23:04 +0000 (21:23 +0000)]
crashinfo: add "batch" mode and use it during boot

In batch mode, most messages go into the core.txt.N file instead of stdout.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D10429

7 years agortwn: drop obsolete (since r319460) code.
avos [Thu, 1 Jun 2017 21:20:44 +0000 (21:20 +0000)]
rtwn: drop obsolete (since r319460) code.

Tested with RTL8188EU, STA mode.

7 years agoFix some new errors and a warning in cryptotest.
jhb [Thu, 1 Jun 2017 21:07:32 +0000 (21:07 +0000)]
Fix some new errors and a warning in cryptotest.

- Use a new 'char *key' to allocate storage for keys and assign the
  pointer to the session2_op 'const char *' members after the key is
  initialized.
- Mark the 'find' variable used in crfind() static so that crfind()
  doesn't return a pointer to stack garbage.

Reported by: olivier (1)
MFC after: 2 weeks
Sponsored by: Chelsio Communications

7 years agogetenv(9): rename to "kern_getenv", etc.
vangyzen [Thu, 1 Jun 2017 21:07:25 +0000 (21:07 +0000)]
getenv(9): rename to "kern_getenv", etc.

Update the documentation to catch up with r273174, which renamed
      getenv -> kern_getenv
      setenv -> kern_setenv
    unsetenv -> kern_unsetenv

Leave the old links in place to support finger memory.

MFC after: 3 days
Sponsored by: Dell EMC

7 years agoFor arm targets, place ABI at the end of the target triple
dim [Thu, 1 Jun 2017 21:05:56 +0000 (21:05 +0000)]
For arm targets, place ABI at the end of the target triple

For some reason, we have been inserting the ABI specification into the
middle of the target triple, when building LLVM, like so:

    armv6-gnueabi-freebsd12.0

This is the wrong way around.  LLVM even auto-canonicalizes it to:

    armv6--freebsd12.0-gnueabi

Let's do this the right way in llvm.build.mk instead.  While here,
define a proper VENDOR macro which can be overridden easily.

Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10846

7 years agonet80211: initialize i_seq for A-MPDU frames.
avos [Thu, 1 Jun 2017 20:46:43 +0000 (20:46 +0000)]
net80211: initialize i_seq for A-MPDU frames.

Fragment number field (part of i_seq) is used for AAD calculation;
as a result, without this patch every driver without h/w crypto support
need to clear it before ieee80211_crypto_encap().

Also fixes rtwn(4) A-MPDU Tx with dev.rtwn.%d.hwcrypto tunable
set to 0 (h/w crypto is disabled).

Tested with:
 * Intel 6205, STA mode.
 * RTL8188EU, STA mode.

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

7 years agoRevert r319457.
bdrewery [Thu, 1 Jun 2017 20:29:48 +0000 (20:29 +0000)]
Revert r319457.

META_MODE users actually do not need to do anything special assuming
they have COMPAT_FREEBSD11 enabled.  The host tools in WORLDTMP will
continue to work just fine.

7 years agoAdd a few missed files to ObsoleteFiles.inc.
dim [Thu, 1 Jun 2017 20:11:26 +0000 (20:11 +0000)]
Add a few missed files to ObsoleteFiles.inc.

7 years agoMETA_MODE users should build with -DNO_META_IGNORE_HOST once after ino64 upgrade.
bdrewery [Thu, 1 Jun 2017 20:03:20 +0000 (20:03 +0000)]
META_MODE users should build with -DNO_META_IGNORE_HOST once after ino64 upgrade.

See r301467 for more details.

7 years agotests/sys/opencrypto/runtests: apply minor polish to test script
ngie [Thu, 1 Jun 2017 19:58:40 +0000 (19:58 +0000)]
tests/sys/opencrypto/runtests: apply minor polish to test script

- Refactor kld loading/unloading logic:
-- Use a loop instead of an unrolled one.
-- Check for the module being loaded before trying to load it, to reduce
   noise when loading modules that are already loaded.
-- Don't mute stderr from kldload -- it could be potentially useful to
   the tester.
-- In the event that the test script was terminated early, it would leave
   the modules still attached to the system (which is undesirable).
   Always unload the modules at test end with EXIT/SIGINT/SIGTERM so the
   system is returned to its former operating state as best possible.
   Unload the modules in reverse order, in part for consistency and/or
   dependency reasons.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoFix up `TEST_METADATA`
ngie [Thu, 1 Jun 2017 19:46:48 +0000 (19:46 +0000)]
Fix up `TEST_METADATA`

- `TEST_METADATA.foo` should be `TEST_METADATA.run_tests`: this will unbreak
  trying to run the tests on a system without python installed in $PATH.
- The tests require root because they load aesni(4) and/or cryptodev(4) if
  not already loaded.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoHonor the requested crid when running a test.
jhb [Thu, 1 Jun 2017 19:27:38 +0000 (19:27 +0000)]
Honor the requested crid when running a test.

Otherwise, the kernel is free to choose an aribtrary crypto device
rather than the requested device subverting tests that force the use
of a specific device.

MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D10762

7 years agoFix memory leak in edithost
stevek [Thu, 1 Jun 2017 19:21:30 +0000 (19:21 +0000)]
Fix memory leak in edithost

The problem is that when the parameter 'pat' is null, the function locally
allocates a NULL string but never frees it.

Instead of tracking the local alloc, it is noted that the while(*pat) never
enters when there is a local alloc.
So instead of doing the local alloc, check that 'pat' is null before the
while(*pat) loop.

Found using clang's static analyzer - scan-build

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: markm
Approved by: sjg (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9689

7 years agoAs old prophecy says, some day UMA_DEBUG printfs shall be made CTRs.
glebius [Thu, 1 Jun 2017 18:36:52 +0000 (18:36 +0000)]
As old prophecy says, some day UMA_DEBUG printfs shall be made CTRs.

7 years agoSimplify boot pages management in UMA.
glebius [Thu, 1 Jun 2017 18:26:57 +0000 (18:26 +0000)]
Simplify boot pages management in UMA.

It is simply a contigous virtual memory pointer and number of pages.
There is no need to build a linked list here.  Just increment pointer
and decrement counter.  The only functional difference to old allocator
is that before we gave pages from topmost and down to lowest, and now
we give them in normal ascending order.

While here remove padalign from a mutex that is unused at runtime.

Reviewed by: alc

7 years agoMake sure the selrecord() function is only called from within system
hselasky [Thu, 1 Jun 2017 16:49:48 +0000 (16:49 +0000)]
Make sure the selrecord() function is only called from within system
polling contexts in the LinuxKPI.

After the kqueue() support was added to the LinuxKPI in r319409 the
Linux poll file operation will be used outside the system file polling
callback function, which can cause a NULL-pointer panic inside
selrecord() because curthread->td_sel is set to NULL. This patch moves
the selrecord() call away from poll_wait() and to the system file poll
callback function in the LinuxKPI, which essentially wraps the Linux
one. This is similar to what the cuse(3) module is currently doing.
Refer to sys/fs/cuse/*.[ch] for more details.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoWhen sysctlbyname fails, free buf before returning.
stevek [Thu, 1 Jun 2017 16:44:39 +0000 (16:44 +0000)]
When sysctlbyname fails, free buf before returning.

Submitted by: Thomas Rix <trix@juniper.net>
Reviewed by: jhb
Approved by: sjg (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9867

7 years agoImprove comments to describe what the code does.
tuexen [Thu, 1 Jun 2017 15:11:18 +0000 (15:11 +0000)]
Improve comments to describe what the code does.

Reported by: jtl
Sponsored by: Netflix, Inc.

7 years agoUse proper capitalization with .Dd.
trasz [Thu, 1 Jun 2017 15:03:43 +0000 (15:03 +0000)]
Use proper capitalization with .Dd.

Submitted by: oshogbo
MFC after: 2 weeks

7 years agoAllow communication between functions on the same host when using the
hselasky [Thu, 1 Jun 2017 10:44:48 +0000 (10:44 +0000)]
Allow communication between functions on the same host when using the
mlx4en(4) driver in SRIOV mode.

Place a copy of the destination MAC address in the send WQE only under
SRIOV/eSwitch configuration or when the device is in selftest. This
allows communication between functions on the same host.

PR: 216493
MFC after: 3 days
Sponsored by: Mellanox Technologies

7 years agoFree hardware queue resource after port is stopped in the mlx4en(4)
hselasky [Thu, 1 Jun 2017 10:39:00 +0000 (10:39 +0000)]
Free hardware queue resource after port is stopped in the mlx4en(4)
driver. Else if the port is up the resource might still be busy and
the MTT free will fail.

PR: 216493
MFC after: 3 days
Sponsored by: Mellanox Technologies

7 years agoBuild kdebug_secreplay() function only when IPSEC_DEBUG is defined.
ae [Thu, 1 Jun 2017 10:04:12 +0000 (10:04 +0000)]
Build kdebug_secreplay() function only when IPSEC_DEBUG is defined.

This should fix the build on sparc.

Reported by: emaste
X-MFC with: r319118

7 years agoTranslate the ERESTARTSYS error code into ERESTART in the LinuxKPI
hselasky [Thu, 1 Jun 2017 09:53:55 +0000 (09:53 +0000)]
Translate the ERESTARTSYS error code into ERESTART in the LinuxKPI
ioctl(), read() and write() system call handlers. This error code is
internal to the kernel and should not be seen by user-space programs
according to Linux.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd generic kqueue() and kevent() support to the LinuxKPI character
hselasky [Thu, 1 Jun 2017 09:34:51 +0000 (09:34 +0000)]
Add generic kqueue() and kevent() support to the LinuxKPI character
devices. The implementation allows read and write filters to be
created and piggybacks on the poll() file operation to determine when
a filter should trigger. The piggyback mechanism is simply to check
for the EWOULDBLOCK or EAGAIN return code from read(), write() or
ioctl() system calls and then update the kqueue() polling state bits.
The implementation is similar to the one found in the cuse(3) module.
Refer to sys/fs/cuse/*.[ch] for more details.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoipfw.8: Note that the ipfw_nat kernel module must be loaded or that the
manu [Thu, 1 Jun 2017 09:14:49 +0000 (09:14 +0000)]
ipfw.8: Note that the ipfw_nat kernel module must be loaded or that the
IPFIREWALL_NAT options must be in the kernel config in order to use in-kernel
nat.

MFC after: 3 days

7 years ago * limit size of buffers to RPC_MAXDATASIZE
delphij [Thu, 1 Jun 2017 06:12:25 +0000 (06:12 +0000)]
 * limit size of buffers to RPC_MAXDATASIZE
 * don't leak memory
 * be more picky about bad parameters

From:

https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt
https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt

via NetBSD.

Reviewed by: emaste, cem (earlier version)
Differential Revision: https://reviews.freebsd.org/D10922
MFC after: 3 days

7 years agoWelcome back bapt@ to portmgr
rene [Thu, 1 Jun 2017 02:31:14 +0000 (02:31 +0000)]
Welcome back bapt@ to portmgr

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)