]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoDocument r298192, file(1) updated to 5.26.
Steven Kreuzer [Mon, 23 May 2016 15:33:56 +0000 (15:33 +0000)]
Document r298192, file(1) updated to 5.26.

Approved by: gjb@ (implicit with re@ hat on)

8 years agoAdd the needed hwpmc hooks to subr_intr.c. This is needed for the correct
Andrew Turner [Mon, 23 May 2016 15:26:35 +0000 (15:26 +0000)]
Add the needed hwpmc hooks to subr_intr.c. This is needed for the correct
operation of hwpmc on, for example, arm64 with intrng.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoFix error in bsdinstall where additional filesystems cannot be mounted
Allan Jude [Mon, 23 May 2016 15:11:01 +0000 (15:11 +0000)]
Fix error in bsdinstall where additional filesystems cannot be mounted

Do not set canmount=noauto on the boot environment at create time, because
this causes / to not be mounted, and since the chroot is read only, new
mountpoints cannot be created.

The property is set later, when other properties are adjusted

Reported by: HardenedBSD
Sponsored by: ScaleEngine Inc.

8 years agopf: Fix more ICMP mistranslation
Kristof Provost [Mon, 23 May 2016 13:59:48 +0000 (13:59 +0000)]
pf: Fix more ICMP mistranslation

In the default case fix the substitution of the destination address.

PR: 201519
Submitted by: Max <maximos@als.nnov.ru>
MFC after: 1 week

8 years agoA missing definition needed by ktime_to_ms().
Hans Petter Selasky [Mon, 23 May 2016 13:19:20 +0000 (13:19 +0000)]
A missing definition needed by ktime_to_ms().

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

8 years agoFix some data types and add "inline" keyword for __reg_op() function.
Hans Petter Selasky [Mon, 23 May 2016 13:18:15 +0000 (13:18 +0000)]
Fix some data types and add "inline" keyword for __reg_op() function.

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

8 years agosfxge(4): cleanup: remove unused EFX preempt macros
Andrew Rybchenko [Mon, 23 May 2016 13:17:37 +0000 (13:17 +0000)]
sfxge(4): cleanup: remove unused EFX preempt macros

The EFSYS_PREEMPT_DISABLE() and EFSYS_PREEMPT_ENABLE() macros
were used to ensure correct timing of I2C operations. The APIs
for I2C operations have been removed, so these macros have no
callers.

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week

8 years agoBuild iscsid(8) with ICL_KERNEL_PROXY defined by default, as required
Edward Tomasz Napierala [Mon, 23 May 2016 12:58:24 +0000 (12:58 +0000)]
Build iscsid(8) with ICL_KERNEL_PROXY defined by default, as required
for iSER.

Obtained from: Mellanox Technologies
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoImplement ror32() in the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:53:17 +0000 (12:53 +0000)]
Implement ror32() in the LinuxKPI.

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

8 years agoDefine more copy to/from userspace functions in the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:52:22 +0000 (12:52 +0000)]
Define more copy to/from userspace functions in the LinuxKPI.

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

8 years agopf: Fix ICMP translation
Kristof Provost [Mon, 23 May 2016 12:41:29 +0000 (12:41 +0000)]
pf: Fix ICMP translation

Fix ICMP source address rewriting in rdr scenarios.

PR: 201519
Submitted by: Max <maximos@als.nnov.ru>
MFC after: 1 week

8 years agoAdd more printf() related functions to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:35:07 +0000 (12:35 +0000)]
Add more printf() related functions to the LinuxKPI.

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

8 years agoSet an invalid IRQ number when no PCI IRQ is available in the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:13:16 +0000 (12:13 +0000)]
Set an invalid IRQ number when no PCI IRQ is available in the LinuxKPI.

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

8 years agoAdd more ktime related functions to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:10:28 +0000 (12:10 +0000)]
Add more ktime related functions to the LinuxKPI.

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

8 years agoImplement "kref_put_mutex()" for the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:06:34 +0000 (12:06 +0000)]
Implement "kref_put_mutex()" for the LinuxKPI.

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

8 years agoAdd more list_xxx() functions to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 12:03:40 +0000 (12:03 +0000)]
Add more list_xxx() functions to the LinuxKPI.

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

8 years agoMake header file standalone by including definitions for needed
Hans Petter Selasky [Mon, 23 May 2016 11:57:23 +0000 (11:57 +0000)]
Make header file standalone by including definitions for needed
linux_wait_xxx() functions.

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

8 years agoImplement "_outb()" to the LinuxKPI for i386 and amd64 only.
Hans Petter Selasky [Mon, 23 May 2016 11:53:00 +0000 (11:53 +0000)]
Implement "_outb()" to the LinuxKPI for i386 and amd64 only.

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

8 years agoAdd support for "cdev_add_ext()" to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 11:50:05 +0000 (11:50 +0000)]
Add support for "cdev_add_ext()" to the LinuxKPI.

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

8 years agoAdd more GFP related defines to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 11:47:54 +0000 (11:47 +0000)]
Add more GFP related defines to the LinuxKPI.

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

8 years agoAdd support for atomic_long_inc_not_zero() to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 11:44:46 +0000 (11:44 +0000)]
Add support for atomic_long_inc_not_zero() to the LinuxKPI.

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

8 years agoAdd support for atomic_long_inc_not_zero() to the LinuxKPI.
Hans Petter Selasky [Mon, 23 May 2016 11:41:35 +0000 (11:41 +0000)]
Add support for atomic_long_inc_not_zero() to the LinuxKPI.

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

8 years agoUse DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside
Hans Petter Selasky [Mon, 23 May 2016 10:31:54 +0000 (10:31 +0000)]
Use DELAY() instead of _sleep() when SCHEDULER_STOPPED() is set inside
pause_sbt(). This allows pause() to continue working during a panic()
which is not invoking KDB. This is useful when debugging graphics
drivers using the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week

8 years agohyperv/vmbus: Move IDT vector to vmbus_softc
Sepherosa Ziehau [Mon, 23 May 2016 07:32:34 +0000 (07:32 +0000)]
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

8 years agohyperv/vmbus: Get rid of vmbus_devp
Sepherosa Ziehau [Mon, 23 May 2016 07:23:19 +0000 (07:23 +0000)]
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

8 years agohyperv/vmbus: Declare Synic message and event w/ proper types
Sepherosa Ziehau [Mon, 23 May 2016 07:14:04 +0000 (07:14 +0000)]
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

8 years agohyperv: Move Hypercall setup to an early place.
Sepherosa Ziehau [Mon, 23 May 2016 07:06:53 +0000 (07:06 +0000)]
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

8 years agohyperv/hn: Use hyperv busdma(9) helper.
Sepherosa Ziehau [Mon, 23 May 2016 06:52:42 +0000 (06:52 +0000)]
hyperv/hn: Use hyperv busdma(9) helper.

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

8 years agohyperv: Add helpers for busdma(9) operation
Sepherosa Ziehau [Mon, 23 May 2016 06:35:11 +0000 (06:35 +0000)]
hyperv: Add helpers for busdma(9) operation

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

8 years ago[siba] update device ids.
Adrian Chadd [Mon, 23 May 2016 05:52:47 +0000 (05:52 +0000)]
[siba] update device ids.

Tested:

* BCM4322 11abgn, STA mode

8 years agohyperv: Move guest id setup to early place
Sepherosa Ziehau [Mon, 23 May 2016 05:11:38 +0000 (05:11 +0000)]
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

8 years ago[bwn] convert another PHY-N workaround to the freebsd bwn format.
Adrian Chadd [Mon, 23 May 2016 04:17:27 +0000 (04:17 +0000)]
[bwn] convert another PHY-N workaround to the freebsd bwn format.

These were hidden behind an #ifdef that we weren't setting.

I don't have the hardware in question to check.

8 years agoAdd a note on how to update a self-hosted armv6hf system to the entry
Ian Lepore [Mon, 23 May 2016 04:07:41 +0000 (04:07 +0000)]
Add a note on how to update a self-hosted armv6hf system to the entry
describing the armv6hf->armv6 change.

8 years ago[nvram2env] fix nvram2env to scan all of memory, not 1/4th
Adrian Chadd [Mon, 23 May 2016 03:51:15 +0000 (03:51 +0000)]
[nvram2env] fix nvram2env to scan all of memory, not 1/4th

The variable "size" stores number of words (4bytes). But the loop over
memory uses size as number of bytes to scan memory. As result it fetches
only 1/4th of memory.

This patch solves this problem and nvram2env fetches all NVRAM variables.

Test plan:

Pre-requisites: any MIPS board with ASCII-based NVRAM mapped into memory

* Add "device nvram2env" into kernel configuration
* Specify hints: base is mandatory (according to nvram2env(4))

hint.nvram.0.base=0x1c7f8000 (it's valid address for Asus RT-N53 with
flags = 0x4)

* Build & load kernel with bootverbose

Actual result: only part of nvram variables are found
Expected result: all variables are found

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6466

8 years ago[bhnd] Add support for querying the attachment type of the bhnd bus.
Adrian Chadd [Mon, 23 May 2016 03:47:44 +0000 (03:47 +0000)]
[bhnd] Add support for querying the attachment type of the bhnd bus.

This adds a BHND_BUS_GET_ATTACH_TYPE(); the primary use-case is to let
chipc make a coarse-grained determination as to whether UART, SPI, etc
drivers ought to be attached, and on fullmac devices, whether a real
CPU driver ought to be skipped for the ARM core, etc.

Tested:

* BCM4331 (BHND)
* BCM4312 (SIBA)

Submitted by: Landon Fuller <landonf@landonf.org>
Differential Revision: https://reviews.freebsd.org/D6492

8 years ago[ixl] fix build for RSS.
Adrian Chadd [Mon, 23 May 2016 03:46:36 +0000 (03:46 +0000)]
[ixl] fix build for RSS.

Untested.

8 years ago[bhnd] Fix DEFINE_CLASS_(2|3) multiple inheritance support.
Adrian Chadd [Mon, 23 May 2016 03:29:43 +0000 (03:29 +0000)]
[bhnd] Fix DEFINE_CLASS_(2|3) multiple inheritance support.

This diff updates DEFINE_CLASS_2/_3 to support the specification of class
name separately from the class variable name, bringing them into sync
with their API documentation, as well as the behavior of DEFINE_CLASS_0/_1.

Nothing in the tree currently uses the _2/_3 variants, and I can't
find any references to the API outside of commits to the kobj.h
header itself; given the limitation that currently exists, I'd
be surprised if they've ever been used.

Submitted by: Landon Fuller <landonf@landonf.org>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D6491

8 years agoHopefully fix Coverity CID 1008328 (Out-of-bounds write) in /bin/sh.
Don Lewis [Mon, 23 May 2016 01:01:23 +0000 (01:01 +0000)]
Hopefully fix Coverity CID 1008328 (Out-of-bounds write) in /bin/sh.

Replace the magic constant 127 in the loop interation count with
"PROMPTLEN - 1".

gethostname() is not guaranteed to NUL terminate the destination
string if it is too short. Decrease the length passed to gethostname()
by one, and add a NUL at the end of the buffer to make sure the
following loop to find the end of the name properly terminates.

The default: case is the likely cause of Coverity CID 1008328.  If
i is 126 at the top of the loop interation where the default case
is triggered, i will be incremented to 127 by the default case,
then incremented to 128 at the top of the loop before being compared
to 127 (PROMPTLENT - 1) and terminating the loop. Then the NUL
termination code after the loop will write to ps[128].  Fix by
checking for overflow before incrementing the index and storing the
second character in the buffer.

These fixes are not guaranteed to satisfy Coverity. The code that
increments i in the 'h'/'H' and 'w'/'W' cases may be beyond its
capability to analyze, but the code appears to be safe.

Reported by: Coverity
CID: 1008328
Reviewed by: jilles, cem
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D6482

8 years agoMark swap-related proc sysctls as not requiring Giant.
Konstantin Belousov [Sun, 22 May 2016 23:28:23 +0000 (23:28 +0000)]
Mark swap-related proc sysctls as not requiring Giant.

Reviewed by: alc (as part of larger patch)
Sponsored by: The FreeBSD Foundation

8 years agoReplace hand-made exclusive lock, protecting against parallel
Konstantin Belousov [Sun, 22 May 2016 23:25:01 +0000 (23:25 +0000)]
Replace hand-made exclusive lock, protecting against parallel
swapon/swapoff invocations, with sx.

Reviewed by: alc (as part of larger patch)
Sponsored by: The FreeBSD Foundation

8 years agoRestore the translation of armv6hf->arm when generating MACHINE_CPUARCH.
Ian Lepore [Sun, 22 May 2016 21:31:20 +0000 (21:31 +0000)]
Restore the translation of armv6hf->arm when generating MACHINE_CPUARCH.
It turns out we need to leave this in place for a while so that people
running self-hosting armv6hf systems can do the builds necessary to update
to armv6 (which is now hardfloat by default).

8 years agobsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT
Allan Jude [Sun, 22 May 2016 20:31:52 +0000 (20:31 +0000)]
bsdinstall/zfsboot GPT+BIOS+GELI installs now make use of GELIBOOT

In this configuration, a separate bootpool is not required.
This allows ZFS Boot Environments to be used with GELI encrypted ZFS pools.

Support for GPT+EFI+GELI is planned for the future.

Tested by: Joseph Mingrone, HardenedBSD
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D5869

8 years agognugrep: Update the configuration.
Pedro F. Giffuni [Sun, 22 May 2016 20:17:55 +0000 (20:17 +0000)]
gnugrep: Update the configuration.

The only effect is that it will use our native iconv(3).

Relnotes: yes

8 years agourtwn: cleanup some unused code in urtwn_tx_data().
Andriy Voskoboinyk [Sun, 22 May 2016 20:12:07 +0000 (20:12 +0000)]
urtwn: cleanup some unused code in urtwn_tx_data().

- Drop unused 'subtype' variable.
- Remove obsolete comment (hardware crypto support was added in r292175).

8 years agourtwn: setup per-frame retry limit.
Andriy Voskoboinyk [Sun, 22 May 2016 19:43:40 +0000 (19:43 +0000)]
urtwn: setup per-frame retry limit.

Override global retry limit (which is set in R92C_RL) via per-frame
TX descriptor field. Obsoletes D3840 (should work better with 2+ vaps).

Tested with RTL8188EU and RTL8192CUS in STA mode (maxretry = [3-9]).

8 years agoRemove false claim. Giant is dropped by mi_startup() before passing
Konstantin Belousov [Sun, 22 May 2016 19:25:53 +0000 (19:25 +0000)]
Remove false claim.  Giant is dropped by mi_startup() before passing
the control to swapper.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

8 years agoConvert proto family in both directions. The linux and native values for
Dmitry Chagin [Sun, 22 May 2016 19:08:29 +0000 (19:08 +0000)]
Convert proto family in both directions. The linux and native values for
local and inet are identical, but for inet6 values differ.

PR: 155040
Reported by: Simon Walton
MFC after: 2 week

8 years agoWrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each...
Enji Cooper [Sun, 22 May 2016 19:06:38 +0000 (19:06 +0000)]
Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on each line

As a positive side-effect, this eliminates the double semicolons reported by Coverity:
the macro contained a trailing semicolon, in addition to the semicolon placed on
each line where EXPAND(..) was called.

MFC after: 1 week
Reported by: Coverity
CID: 1194269
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove a now unused global declaration of some sysentvec struct.
Dmitry Chagin [Sun, 22 May 2016 19:04:34 +0000 (19:04 +0000)]
Remove a now unused global declaration of some sysentvec struct.

MFC after: 2 week

8 years agoFix humanized decoding of struct stat with respect to .st_mtim
Enji Cooper [Sun, 22 May 2016 18:20:45 +0000 (18:20 +0000)]
Fix humanized decoding of struct stat with respect to .st_mtim

st_mtim was being incorrectly described as "stime=", not "mtime=". This was
introduced with the original feature commit (r176471).

MFC after: 1 week
PR: 209699
Submitted by: naddy
Sponsored by: EMC / Isilon Storage Division

8 years agoRemove drop/reacquire of Giant around geom calls for cd9660 and udf.
Konstantin Belousov [Sun, 22 May 2016 18:16:25 +0000 (18:16 +0000)]
Remove drop/reacquire of Giant around geom calls for cd9660 and udf.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoFix default ZFS layout to work better by default with sysutils/beadm
Allan Jude [Sun, 22 May 2016 16:24:21 +0000 (16:24 +0000)]
Fix default ZFS layout to work better by default with sysutils/beadm

The root file system is mounted early via vfs.root.mountfrom.
The canmount=noauto property only affects the zfs rc.d script.
This ensures that the 'default' BE is not mounted overtop of another BE when
one is selected from the beastie menu

Sponsored by: ScaleEngine Inc.

8 years agoImprove panic message by specifying on which cpu it really is.
Andrey A. Chernov [Sun, 22 May 2016 15:22:45 +0000 (15:22 +0000)]
Improve panic message by specifying on which cpu it really is.

8 years agoarc4random() returns 0 to (2**32)−1, use an alternative to initialize
Kevin Lo [Sun, 22 May 2016 14:31:20 +0000 (14:31 +0000)]
arc4random() returns 0 to (2**32)−1, use an alternative to initialize
i_gen if it's zero rather than a divide by 2.

With inputs from  delphij, mckusick, rmacklem

Reviewed by: mckusick

8 years agondis(4): Undo unneeded workarounds in ndis' rand().
Pedro F. Giffuni [Sun, 22 May 2016 14:13:20 +0000 (14:13 +0000)]
ndis(4):  Undo unneeded workarounds in ndis' rand().

- Revert the change for seed(0) in r300384. I misunderstood the standard
and while our random() implementation in libkern may be improved, it
handles the seed(0) case fine.

Pointed out by: bde, ache

8 years agoFix the deciKelvin to Celsius conversion in kernel.
Luiz Otavio O Souza [Sun, 22 May 2016 13:58:32 +0000 (13:58 +0000)]
Fix the deciKelvin to Celsius conversion in kernel.

After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by: Rubicon Communications (Netgate)

8 years agovfork(2): Mention some risks of calling vfork() from application code.
Jilles Tjoelker [Sun, 22 May 2016 13:32:45 +0000 (13:32 +0000)]
vfork(2): Mention some risks of calling vfork() from application code.

MFC after: 1 week

8 years agoFix typo introduced by me (not the submitter) when fixing typos
Baptiste Daroussin [Sun, 22 May 2016 13:10:48 +0000 (13:10 +0000)]
Fix typo introduced by me (not the submitter) when fixing typos

8 years agoFix typos in the comments
Baptiste Daroussin [Sun, 22 May 2016 13:04:45 +0000 (13:04 +0000)]
Fix typos in the comments

Submitted by: cipherwraith666@gmail.com (via github)

8 years agoFix typo in comments for the zfsboot script
Baptiste Daroussin [Sun, 22 May 2016 12:59:07 +0000 (12:59 +0000)]
Fix typo in comments for the zfsboot script

Submitted by: Colby Swandale <colby@taplaboratories.com.au> (via github)

8 years agoAdd a missing errno translation for SO_ERROR optname.
Dmitry Chagin [Sun, 22 May 2016 12:49:08 +0000 (12:49 +0000)]
Add a missing errno translation for SO_ERROR optname.

PR: 135458
Reported by: Stefan Schmidt @ stadtbuch.de
MFC after: 1 week

8 years agoAdd macro to convert errno and use it when appropriate.
Dmitry Chagin [Sun, 22 May 2016 12:46:34 +0000 (12:46 +0000)]
Add macro to convert errno and use it when appropriate.

MFC after: 1 week

8 years agoFor future use move futex timeout code to the separate function and
Dmitry Chagin [Sun, 22 May 2016 12:37:40 +0000 (12:37 +0000)]
For future use move futex timeout code to the separate function and
switch to the high resolution sbintime_t.

MFC after: 1 week

8 years agoDue to lack the priority propagation feature replace sx by mutex. WIth this
Dmitry Chagin [Sun, 22 May 2016 12:35:50 +0000 (12:35 +0000)]
Due to lack the priority propagation feature replace sx by mutex. WIth this
commit NPTL tests are ends in 1 minute faster.

MFC after: 1 week

8 years agoAdd my copyright as I rewrote most of the futex code. Minor style(9) cleanup
Dmitry Chagin [Sun, 22 May 2016 12:28:55 +0000 (12:28 +0000)]
Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup
while here.

MFC after: 1 week

8 years agoMinor style(9) cleanup, no functional changes.
Dmitry Chagin [Sun, 22 May 2016 12:26:03 +0000 (12:26 +0000)]
Minor style(9) cleanup, no functional changes.

MFC after: 1 week

8 years agoINTRNG - implement pic_post_filter method. This method is fundamental
Svatopluk Kraus [Sun, 22 May 2016 11:42:34 +0000 (11:42 +0000)]
INTRNG - implement pic_post_filter method. This method is fundamental
one and must always be implemented for a PIC. There is no default for
it intentionally.

8 years agoFix some format strings to make them either correct or uniform.
Svatopluk Kraus [Sun, 22 May 2016 09:59:43 +0000 (09:59 +0000)]
Fix some format strings to make them either correct or uniform.
No functional change.

8 years agoStop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
Andrew Turner [Sun, 22 May 2016 08:20:30 +0000 (08:20 +0000)]
Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
no longer needed.

Sponsored by: ABT Systems Ltd

8 years ago1) POSIX prohibits printing errors to stderr here and require
Andrey A. Chernov [Sun, 22 May 2016 06:18:59 +0000 (06:18 +0000)]
1) POSIX prohibits printing errors to stderr here and require
returning NULL:

"Upon successful completion, initstate() and setstate() shall return a
pointer to the previous state array; otherwise, a null pointer shall
be returned.

Although some implementations of random() have written messages to
standard error, such implementations do not conform to POSIX.1-2008."

2) Move error detections earlier to prevent state modifying.

MFC after:      1 week

8 years agoSilence top(1) compiler warnings
Enji Cooper [Sun, 22 May 2016 04:17:00 +0000 (04:17 +0000)]
Silence top(1) compiler warnings

The contrib/top code is no longer maintained upstream (last pulled 16 years
ago). The K&R-style followed by the code spews -Wimplicit-int and -Wreturn-type
warnings, amongst others. This silences 131 warnings with as little modification
as possible by adding necessary return types, definitions, headers, and header
guards, and missing header includes.

The 5 warnings that remain are due to undeclared ncurses references. I didn't
include curses.h and term.h because there are several local functions and macros
that conflict with those definitions.

MFC after: 3 weeks
Reviewed by: cem, ngie
Submitted by: Randy Westlund <rwestlun@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6468

8 years agoRemove a couple of extra blank lines.
Luiz Otavio O Souza [Sun, 22 May 2016 04:09:05 +0000 (04:09 +0000)]
Remove a couple of extra blank lines.

8 years agoSort and remove a couple of unnecessary headers.
Luiz Otavio O Souza [Sun, 22 May 2016 04:02:34 +0000 (04:02 +0000)]
Sort and remove a couple of unnecessary headers.

8 years agoGet rid of two consumers of gpiobus acquire/release.
Luiz Otavio O Souza [Sun, 22 May 2016 03:55:57 +0000 (03:55 +0000)]
Get rid of two consumers of gpiobus acquire/release.

The GPIO hardware should not be owned by a single device, this defeats any
chance of use of the GPIO controller as an interrupt source.

ow(4) is now the only consumer of this 'feature' before we can remove it
for good.

Discussed with: ian, bsdimp

8 years agoUse a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine.
Luiz Otavio O Souza [Sun, 22 May 2016 03:34:18 +0000 (03:34 +0000)]
Use a better prefix for defines, return BUS_PROBE_DEFAULT for probe routine.

Refuse to attach if the number of given pins is not enough for our needs.

8 years agoFix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.
Luiz Otavio O Souza [Sun, 22 May 2016 03:12:49 +0000 (03:12 +0000)]
Fix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.

While here fix a few style(9) issues.

8 years agonis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)
Enji Cooper [Sun, 22 May 2016 03:05:27 +0000 (03:05 +0000)]
nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)

If the buffer couldn't be adequately resized to accomodate an additional "\n",
it would leak resultbuf by breaking from the loop early

MFC after: 2 weeks
Reported by: Coverity
CID: 1016702
Sponsored by: EMC / Isilon Storage Division

8 years agoCall endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
Enji Cooper [Sun, 22 May 2016 02:53:11 +0000 (02:53 +0000)]
Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
was NULL

This would theoretically happen if the netconfig protocol family and protocol
semantics were never matched.

MFC after: 2 weeks
Reported by: Coverity
CID: 978179
Sponsored by: EMC / Isilon Storage Division

8 years agogetnetid(..): consistently fclose fd at the end of the function
Enji Cooper [Sun, 22 May 2016 02:24:38 +0000 (02:24 +0000)]
getnetid(..): consistently fclose fd at the end of the function

This mutes a false positive with cppcheck, but also helps eliminate future
potential issues with this variable

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't leak `handle` if svc_tp_create(..) succeeds and allocating a new
Enji Cooper [Sun, 22 May 2016 02:02:18 +0000 (02:02 +0000)]
Don't leak `handle` if svc_tp_create(..) succeeds and allocating a new
struct xlist object fails

MFC after: 1 week
Reported by: Coverity
CID: 978277
Sponsored by: EMC / Isilon Storage Division

8 years agoDon't leak `tmp` if `p->nc_lookups` can't be malloced
Enji Cooper [Sun, 22 May 2016 01:45:15 +0000 (01:45 +0000)]
Don't leak `tmp` if `p->nc_lookups` can't be malloced

MFC after: 1 week
Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division

8 years agondis(4): adjustments for our random() specific implementation.
Pedro F. Giffuni [Sun, 22 May 2016 00:29:25 +0000 (00:29 +0000)]
ndis(4):  adjustments for our random() specific implementation.

- Revert r300377: The implementation claims to return a value
  within the range. [1]
- Adjust the value for the case of a zero seed, whihc according
  to standards should be equivalent to a seed of value 1.

Pointed out by: cem

8 years agonet80211: send RTM_IEEE80211_SCAN event when scan was cancelled.
Andriy Voskoboinyk [Sat, 21 May 2016 23:21:42 +0000 (23:21 +0000)]
net80211: send RTM_IEEE80211_SCAN event when scan was cancelled.

wpa_supplicant(8) expects to see 'scan complete' event after every
scan command; in case, when event is not sent it will hang for
indefinite time.

PR: 209198

8 years agoWhen descending a shadow chain of objects, it makes no sense to update
Alan Cox [Sat, 21 May 2016 23:18:23 +0000 (23:18 +0000)]
When descending a shadow chain of objects, it makes no sense to update
the current offset (spelled: "fs.pindex") until it is known whether a
backing object exists.  In fact, if not for the fact that the backing
object offset is zero when there is no backing object, this update would
produce a broken offset.

Reviewed by: kib

8 years agolibc/regex: fix two buffer underruns.
Pedro F. Giffuni [Sat, 21 May 2016 19:54:10 +0000 (19:54 +0000)]
libc/regex: fix two buffer underruns.

Fix some rather complex regex issues found on OpenBSD as part of some
ongoing work to fix a sed(1) bug.

Curiously the OpenBSD tests don't trigger segfaults on FreeBSD but the
bugs were confirmed by running a port of FreeBSD's regex under OpenBSD's
malloc. Huge thanks to Ingo for confirming the behavior.

Taken from: Ingo Schwarze (through openbsd-tech 2016-05-15)
MFC after: 1 week

8 years agondis(4): Avoid overflow.
Pedro F. Giffuni [Sat, 21 May 2016 17:52:44 +0000 (17:52 +0000)]
ndis(4): Avoid overflow.

This is a long standing problem: our random() function returns an
unsigned integer but the rand provided by ndis(4) returns an int.
Scale it down.

MFC after: 2 weeks

8 years agondis(4): Better mimic the behavior of rand() on Windows.
Pedro F. Giffuni [Sat, 21 May 2016 17:38:43 +0000 (17:38 +0000)]
ndis(4): Better mimic the behavior of rand() on Windows.

In ndis(4) we expose a rand() function that was constantly reseeding
with a time depending function every time it was called. This
essentially broke the reasoning behind seeding, and rendered srand()
a no-op.

Keep it simple, just use random() and srandom() as it's meant to work.
It  would have been tempting to just go for arc4random() but we
want to mimic Microsoft, and we don't need crypto-grade randomness
here.

PR: 209616
MFC after: 2 weeks

8 years agoAdjust _ALIGNBYTES to the proper value for arm and armv6 arches. Modern
Ian Lepore [Sat, 21 May 2016 16:52:38 +0000 (16:52 +0000)]
Adjust _ALIGNBYTES to the proper value for arm and armv6 arches.  Modern
compilers can emit arm instructions that require 8-byte alignment.  The
alignment-sensitive instructions were added in armv5, which has to be
supported by our combined v4/v5 kernels, so the value is set uncoditionally
for all arm architecture versions.

Also adjust the comment to explain in more detail why the macros have the
form and values they do.

Per advice from bde@, maintain the unsignedness of the value of _ALIGNBYTES
(but do so using his second choice of allowing sizeof() to supply the
unsignedness, rather than just hardcoding '8U', which in my mind would
require an even more verbose comment to explain why it's right).  Also
explain in the comment that the resulting type of _ALIGN() is equivelent
to uinptr_t on arm (32-bit unsigned int), but it's purposely spelled as
"unsigned" to avoid problems with including other header files.  Even
including machine/_types.h to allow use of __uintptr_t causes compilation
failures because of this header being included (indirectly) in asm code.

The discussion that led to this change (albeit at a glacial pace) is at
https://lists.freebsd.org/pipermail/svn-src-head/2014-November/064593.html

8 years agoelftoolchain: backwards compatability for ELFOSABI_CLOUDABI definition
Ed Maste [Sat, 21 May 2016 15:38:40 +0000 (15:38 +0000)]
elftoolchain: backwards compatability for ELFOSABI_CLOUDABI definition

It is not provided by sys/elf_common.h on older releases or -current
before March 2015.

Reported by: Jenkins

8 years agofix loss of taskqueue wakeups (introduced in r300113)
Andriy Gapon [Sat, 21 May 2016 14:51:49 +0000 (14:51 +0000)]
fix loss of taskqueue wakeups (introduced in r300113)

Submitted by: kmacy
Tested by: dchagin

8 years agoSame as for UFS, remove drop/reacquire of Giant, and use si_mountpt as
Konstantin Belousov [Sat, 21 May 2016 11:40:41 +0000 (11:40 +0000)]
Same as for UFS, remove drop/reacquire of Giant, and use si_mountpt as
the mount semaphore.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoProperly reset session state when using proxy and fail_on_disconnection=1.
Edward Tomasz Napierala [Sat, 21 May 2016 11:26:03 +0000 (11:26 +0000)]
Properly reset session state when using proxy and fail_on_disconnection=1.
Without it the reconnection would fail due to mismatched sequence numbers.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoProvide a way for ICL modules to declare they support PIM_UNMAPPED.
Edward Tomasz Napierala [Sat, 21 May 2016 11:10:48 +0000 (11:10 +0000)]
Provide a way for ICL modules to declare they support PIM_UNMAPPED.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoPass maxtags value to the ICL module. iSER needs it.
Edward Tomasz Napierala [Sat, 21 May 2016 10:59:36 +0000 (10:59 +0000)]
Pass maxtags value to the ICL module.  iSER needs it.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

8 years agoStop dropping and reacquiring Giant around geom calls in UFS.
Konstantin Belousov [Sat, 21 May 2016 10:13:25 +0000 (10:13 +0000)]
Stop dropping and reacquiring Giant around geom calls in UFS.

Sponsored by: The FreeBSD Foundation

8 years agoRemove zero assignments in the cdev allocator. cdp memory is
Konstantin Belousov [Sat, 21 May 2016 09:55:32 +0000 (09:55 +0000)]
Remove zero assignments in the cdev allocator.  cdp memory is
requested with M_ZERO.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoImprove handling of rdev->si_mountpt on mount and unmount of FFS
Konstantin Belousov [Sat, 21 May 2016 09:49:35 +0000 (09:49 +0000)]
Improve handling of rdev->si_mountpt on mount and unmount of FFS
volumes.  Treat the field as a semaphore protecting availability of
the device for mounting.  Do no access devvp->v_rdev without the vnode
lock owned.

Protect change of the devvp->v_bufobj bo_ops vector with the vnode
lock.

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

8 years agoRegen after r300359 (struct l_sched_param removal).
Dmitry Chagin [Sat, 21 May 2016 08:03:13 +0000 (08:03 +0000)]
Regen after r300359 (struct l_sched_param removal).

MFC after: 1 week

8 years agoCorrect an argument param of linux_sched_* system calls as a struct l_sched_param
Dmitry Chagin [Sat, 21 May 2016 08:01:14 +0000 (08:01 +0000)]
Correct an argument param of linux_sched_* system calls as a struct l_sched_param
does not defined due to it's nature.

MFC after: 1 week

8 years agoBetter document security_show_{success,info,badconfig} in /etc/periodic.conf
Alan Somers [Sat, 21 May 2016 02:14:11 +0000 (02:14 +0000)]
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.

Reviewed by: brd
MFC after: 4 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6477