Commit Graph

212456 Commits

Author SHA1 Message Date
Adrian Chadd
2e79170e4f [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
2016-05-23 03:51:15 +00:00
Adrian Chadd
9d292ea16d [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
2016-05-23 03:47:44 +00:00
Adrian Chadd
aa87465313 [ixl] fix build for RSS.
Untested.
2016-05-23 03:46:36 +00:00
Adrian Chadd
6dcd2b484d [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
2016-05-23 03:29:43 +00:00
Don Lewis
63a4675d89 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
2016-05-23 01:01:23 +00:00
Konstantin Belousov
4c36e917b2 Mark swap-related proc sysctls as not requiring Giant.
Reviewed by:	alc (as part of larger patch)
Sponsored by:	The FreeBSD Foundation
2016-05-22 23:28:23 +00:00
Konstantin Belousov
04533e1ef7 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
2016-05-22 23:25:01 +00:00
Ian Lepore
aa1434ec54 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).
2016-05-22 21:31:20 +00:00
Allan Jude
a1b8f55c77 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
2016-05-22 20:31:52 +00:00
Pedro F. Giffuni
0009715f34 gnugrep: Update the configuration.
The only effect is that it will use our native iconv(3).

Relnotes:	yes
2016-05-22 20:17:55 +00:00
Andriy Voskoboinyk
90ea1c8c7b urtwn: cleanup some unused code in urtwn_tx_data().
- Drop unused 'subtype' variable.
- Remove obsolete comment (hardware crypto support was added in r292175).
2016-05-22 20:12:07 +00:00
Andriy Voskoboinyk
db585a35a8 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]).
2016-05-22 19:43:40 +00:00
Konstantin Belousov
a525fd17cd Remove false claim. Giant is dropped by mi_startup() before passing
the control to swapper.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2016-05-22 19:25:53 +00:00
Dmitry Chagin
df964aa45d 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
2016-05-22 19:08:29 +00:00
Enji Cooper
e5e35a7715 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
2016-05-22 19:06:38 +00:00
Dmitry Chagin
2664baadf3 Remove a now unused global declaration of some sysentvec struct.
MFC after:	2 week
2016-05-22 19:04:34 +00:00
Enji Cooper
0e80f25894 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
2016-05-22 18:20:45 +00:00
Konstantin Belousov
df5905fe7d Remove drop/reacquire of Giant around geom calls for cd9660 and udf.
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2016-05-22 18:16:25 +00:00
Allan Jude
595568b58b 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.
2016-05-22 16:24:21 +00:00
Andrey A. Chernov
23b26e530d Improve panic message by specifying on which cpu it really is. 2016-05-22 15:22:45 +00:00
Kevin Lo
57d2ac2f90 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
2016-05-22 14:31:20 +00:00
Pedro F. Giffuni
91460148b2 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
2016-05-22 14:13:20 +00:00
Luiz Otavio O Souza
9d6672e13b 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)
2016-05-22 13:58:32 +00:00
Jilles Tjoelker
050c87f9a1 vfork(2): Mention some risks of calling vfork() from application code.
MFC after:	1 week
2016-05-22 13:32:45 +00:00
Baptiste Daroussin
306e53bce9 Fix typo introduced by me (not the submitter) when fixing typos 2016-05-22 13:10:48 +00:00
Baptiste Daroussin
2fd642c899 Fix typos in the comments
Submitted by:	cipherwraith666@gmail.com (via github)
2016-05-22 13:04:45 +00:00
Baptiste Daroussin
5e38260c4f Fix typo in comments for the zfsboot script
Submitted by:	Colby Swandale <colby@taplaboratories.com.au> (via github)
2016-05-22 12:59:07 +00:00
Dmitry Chagin
d56e689e7d Add a missing errno translation for SO_ERROR optname.
PR:		135458
Reported by:	Stefan Schmidt @ stadtbuch.de
MFC after:	1 week
2016-05-22 12:49:08 +00:00
Dmitry Chagin
5437e1d103 Add macro to convert errno and use it when appropriate.
MFC after:	1 week
2016-05-22 12:46:34 +00:00
Dmitry Chagin
f8d72f5312 For future use move futex timeout code to the separate function and
switch to the high resolution sbintime_t.

MFC after:	1 week
2016-05-22 12:37:40 +00:00
Dmitry Chagin
a03566dd95 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
2016-05-22 12:35:50 +00:00
Dmitry Chagin
ea53658ed7 Add my copyright as I rewrote most of the futex code. Minor style(9) cleanup
while here.

MFC after:	1 week
2016-05-22 12:28:55 +00:00
Dmitry Chagin
56c4f83d2e Minor style(9) cleanup, no functional changes.
MFC after:	1 week
2016-05-22 12:26:03 +00:00
Svatopluk Kraus
babd771795 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.
2016-05-22 11:42:34 +00:00
Svatopluk Kraus
143d397317 Fix some format strings to make them either correct or uniform.
No functional change.
2016-05-22 09:59:43 +00:00
Andrew Turner
46c1105fbb Stop dereferencing _end in crt1.c. This was only needed for brk/sbrk so is
no longer needed.

Sponsored by:	ABT Systems Ltd
2016-05-22 08:20:30 +00:00
Andrey A. Chernov
fbd6b95ef9 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
2016-05-22 06:18:59 +00:00
Enji Cooper
96331b7705 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
2016-05-22 04:17:00 +00:00
Luiz Otavio O Souza
ad802dc4e3 Remove a couple of extra blank lines. 2016-05-22 04:09:05 +00:00
Luiz Otavio O Souza
0397efe813 Sort and remove a couple of unnecessary headers. 2016-05-22 04:02:34 +00:00
Luiz Otavio O Souza
03302aa37f 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
2016-05-22 03:55:57 +00:00
Luiz Otavio O Souza
16119eeded 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.
2016-05-22 03:34:18 +00:00
Luiz Otavio O Souza
fc5f218ade Fix probe routine to return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.
While here fix a few style(9) issues.
2016-05-22 03:12:49 +00:00
Enji Cooper
f1209420eb 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
2016-05-22 03:05:27 +00:00
Enji Cooper
b70cb0694b 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
2016-05-22 02:53:11 +00:00
Enji Cooper
99d498608a 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
2016-05-22 02:24:38 +00:00
Enji Cooper
3552a02626 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
2016-05-22 02:02:18 +00:00
Enji Cooper
9c11e6b093 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
2016-05-22 01:45:15 +00:00
Pedro F. Giffuni
b9c52b50a7 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
2016-05-22 00:29:25 +00:00
Andriy Voskoboinyk
cd7d06ac7e 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
2016-05-21 23:21:42 +00:00