]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoFix mis-manual merge.
jhibbits [Tue, 4 Apr 2017 02:37:41 +0000 (02:37 +0000)]
Fix mis-manual merge.

Timeout is now effectively a boolean rather than a time-remaining.  This was
missed in r316478, but included in the original patch (mis-merged with a manual
merge).

7 years agoFix set-but-not-used warnings
jhibbits [Tue, 4 Apr 2017 00:46:48 +0000 (00:46 +0000)]
Fix set-but-not-used warnings

Submitted by: Sebastian Huber <sebastian_DOT_huber_AT_embedded-brains_DOT_de>

7 years agoUse a common tsec_mii_wait() function to busy wait for status changes.
jhibbits [Tue, 4 Apr 2017 00:43:09 +0000 (00:43 +0000)]
Use a common tsec_mii_wait() function to busy wait for status changes.

The status indicators are not set immediatly after a command.  Discard
the first value.

Unlock the PHY mutex after a timeout in tsec_init_locked().

Tested on the P1020RDB.

Submitted by: Sebastian Huber <sebastian_DOT_huber_AT_embedded-brains_DOT_de>

7 years agobsdgrep: fix matching behaviour
emaste [Mon, 3 Apr 2017 23:16:51 +0000 (23:16 +0000)]
bsdgrep: fix matching behaviour

- Set REG_NOTBOL if we've already matched beginning of line and we're
  examining later parts

- For each pattern we examine, apply it to the remaining bits of the
  line rather than (potentially) smaller subsets

- Check for REG_NOSUB after we've looked at all patterns initially
  matching the line

- Keep track of the last match we made to later determine if we're
  simply not matching any longer or if we need to proceed another byte
  because we hit a zero-length match

- Match the earliest and longest bit of each line before moving the
  beginning of what we match to further in the line, past the end of the
  longest match; this generally matches how gnugrep(1) seems to behave,
  and seems like pretty good behavior to me

- Finally, bail out of printing any matches if we were set to print all
  (empty pattern) but -o (output matches) was set

PR: 195763, 180990, 197555, 197531, 181263, 209116
Submitted by: "Kyle Evans" <kevans91@ksu.edu>
Reviewed by: cem
MFC after: 1 month
Relnotes: Yes
Differential Revision: https://reviews.freebsd.org/D10104

7 years agoFix spelling mistake, BCM2835_PASWORD -> BCM2835_PASSWORD
gavin [Mon, 3 Apr 2017 22:36:45 +0000 (22:36 +0000)]
Fix spelling mistake, BCM2835_PASWORD -> BCM2835_PASSWORD

7 years agoRemove unsafe and non-functional DDB functions that I added long ago
sbruno [Mon, 3 Apr 2017 21:19:12 +0000 (21:19 +0000)]
Remove unsafe and non-functional DDB functions that I added long ago
for debugging.

7 years agoRemove rx_processing_limit sysctl and now orphaned function em_set_sysctl_value
sbruno [Mon, 3 Apr 2017 21:17:57 +0000 (21:17 +0000)]
Remove rx_processing_limit sysctl and now orphaned function em_set_sysctl_value

Sponsored by: Limelight Networks

7 years agobsdgrep: treat rgrep as grep -r
emaste [Mon, 3 Apr 2017 21:10:02 +0000 (21:10 +0000)]
bsdgrep: treat rgrep as grep -r

Submitted by:    Kyle Evans <kevans91@ksu.edu>

7 years agoFix typo.
trasz [Mon, 3 Apr 2017 20:35:17 +0000 (20:35 +0000)]
Fix typo.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

7 years agoAdd basic description of kernel source layout.
trasz [Mon, 3 Apr 2017 20:33:14 +0000 (20:33 +0000)]
Add basic description of kernel source layout.

MFC after: 2 weeks

7 years agoRemove excessive horizontal whitespace from hier(7) by correctly
trasz [Mon, 3 Apr 2017 20:28:34 +0000 (20:28 +0000)]
Remove excessive horizontal whitespace from hier(7) by correctly
using "-width". The http://mdocml.bsd.lv/mdoc/details/width.html
says: "Do not use macros in the argument specifying the width,
that's not portable. While GNU troff can handle it, mandoc cannot."
The same problem seems to exist in many other man pages.

Reviewed by: bapt, vangyzen
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10238

7 years agoWhilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually
sevan [Mon, 3 Apr 2017 18:50:04 +0000 (18:50 +0000)]
Whilst mount_pcfs originated as a patch in 386BSD, NetBSD 0.8 actually
was the first release of an OS to ship with it.
Heads up by Ingo Schwarze.

Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D10209

7 years agoFix a missing const in my previous commit which broke the build at
bde [Mon, 3 Apr 2017 15:11:28 +0000 (15:11 +0000)]
Fix a missing const in my previous commit which broke the build at
normal WARNS.

Reported by: lwhsu

7 years agoRemove "IPFW static rules" rmlock.
ae [Mon, 3 Apr 2017 13:35:04 +0000 (13:35 +0000)]
Remove "IPFW static rules" rmlock.

Make PFIL's lock global and use it for this purpose.
This reduces the number of locks needed to acquire for each packet.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC
No objection from: #network
Differential Revision: https://reviews.freebsd.org/D10154

7 years agoFix expandsz 16.0E vals and vdev_min_asize of RAIDZ children
smh [Mon, 3 Apr 2017 13:11:28 +0000 (13:11 +0000)]
Fix expandsz 16.0E vals and vdev_min_asize of RAIDZ children

When a member of a RAIDZ has been replaced with a device smaller than the
original, then the top level vdev can report its expand size as 16.0E.

The reduced child asize causes the RAIDZ to have a vdev_asize lower than its
vdev_max_asize which then results in an underflow during the calculation of
the parents expand size.

Fix this by updating the vdev_asize if it shrinks, which is already
protected by a check against vdev_min_asize so should always be safe.

Also for RAIDZ vdevs, ensure that the sum of their child vdev_min_asize is
always greater than the parents vdev_min_size.

Fixes: https://www.illumos.org/issues/7885
MFC after: 2 weeks
Sponsored by: Multiplay

7 years agoShow high (blinking foreground/bright background) background colors. Format
bde [Mon, 3 Apr 2017 13:06:28 +0000 (13:06 +0000)]
Show high (blinking foreground/bright background) background colors.  Format
output and source better for this.  Format output for 40 columns if there
are less than 80 columns.

7 years agoMFV r316454,316455:
mm [Mon, 3 Apr 2017 12:26:20 +0000 (12:26 +0000)]
MFV r316454,316455:

Vendor changes (FreeBSD-related):
  Report which extended attributes could not be restored
  Update archive_read_disk.3 and archive_write_disk.3 manual pages
  Plug memory leaks in xattr tests.

MFC after: 1 week

7 years agoRemove the global variable 'info' and fix associated bugs and style bugs.
bde [Mon, 3 Apr 2017 10:47:01 +0000 (10:47 +0000)]
Remove the global variable 'info' and fix associated bugs and style bugs.

This variable was used 4 times in 1 function and all uses were wrong.
The 4 uses were in he test_frame() (show) function, to try to restore
4 colors, 2 unnecessarily and these 2 now broken.  This was wrong
because it is the previous colors that must be restored, but the global
holds the original colors.  Excessive setting of colors at the end
restored the previous colors correctly in most cases, but I removed
this a couple of revisions ago.

Originally, this variable had 1 correct use, to test for being on a vty
as a side effect of initializing it.  This is now down in init(), and
init() also leaves a better-named global with the same contents.

Fix this by reading the current console info into a local variable in
test_frame(), as is done for several other functions.  Fix style bugs
in this reading for all callers:
- extra blank lines
- all error messages different.  The first one now in init() is not as
  specific as the old one, but it is after a different specific one for
  another ioctl and is unlikely to be reached when the first ioctl
  succeeds.  Ones after the first are to repeat the ioctl, so are even
  more likely to be reached.  The correctness of full removal of the
  old global depends on the error handling for failure to initialize
  it being unreachable.
- err() instead of warn() for failure in load_font().  This is almost
  unreachable, and it makes no sense to continue after undoing previous
  changes with revert().
- unreachable return after err() for failure in dump_screen().

Undo large renaming of local variables from the good name 'info' to the
bad name _info, which was done to protect the buggy global's bad name
from -Wshadow warnings.

7 years agoBreak audit_bsm_klib.c into two files: one (audit_bsm_klib.c)
rwatson [Mon, 3 Apr 2017 10:15:58 +0000 (10:15 +0000)]
Break audit_bsm_klib.c into two files: one (audit_bsm_klib.c)
retaining various utility functions used during BSM generation,
and a second (audit_bsm_db.c) that contains the various in-kernel
databases supporting various audit activities (the class and
event-name tables).

(No functional change is intended.)

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years agoSave errno across revert().
bde [Mon, 3 Apr 2017 09:21:00 +0000 (09:21 +0000)]
Save errno across revert().

Change 25 uses of errc() to err().  2 of these were correct.  23 used
errno for the arg so were just a verbose spelling of err().  5 of these
were just style bugs, and 18 depended on revert() saving errno.

1 warn() also depended on revert() saving errno.

Remove 2 warnx()'s that duplicate the message from a later errx().
These used to be before returns, and should have reported errno in
some cases.  errno is also not reported for for openguess() failures.

Only "restore" the video mode in revert() if the mode was just set
(necessarily partially).  Setting the mode to its current setting
doesn't "restore" it, but resets it, with the least harmful change
being to clear the screen.  revert() is called even for some harmless
syntax errors and usually did nothing except reset the mode.  Now it
usually does nothing.  The only things that it tries to restore apart
from the mode are the active vty number, the screen map, 2 colors that
only need to be restored (only after a mode change) to fix kernel bugs,
and 3 colors that can't be restored due to kernel bugs.  (This is
mostly for sc, since vt doesn't support mode changes.)

revert() is not called for syntax and setting errors after [mode], so
the mode reset is only done for failures to set raster mode after
setting graphics mode.  normal colors can only be set after [mode],
and that is why reverting them should be unnecessary.

7 years agoFix some parsing and error handling bugs.
bde [Mon, 3 Apr 2017 06:52:02 +0000 (06:52 +0000)]
Fix some parsing and error handling bugs.

r146736 added an undocumented syntax and many bugs handling it.  The
documented syntax is "... [mode] [fg [bg]] [show]", where it is critical
for reducing ambiguity and keeping things simple that the mode is
parsed first.  r146736 added buggy support for "... [mode] [fg [bg]]
[show] [mode] [fg [bg]]".  One error was that after for failing to set
a partially-supported graphics mode, argv[optind] remains pointing to
the mode so doesn't match the first [fg [bg]], so the setting is
attempted again, with slightly worse error handling.

Fix this by removing it (support for the trailing '[mode] [fg [bg]]')
and cleaning up.  The cleanups are mostly to remove convolutions and
bugs that didn't work to handle the ambiguous syntax '[fg [bg]] [fg [bg]]'
when [mode] and [show] are not present.  Globals were set to allow
repeating the color settings at the end.  The functions that set the
colors earlier were misnamed from set* to get*.  All that they "got" is
is settings from argv.  They applied the settings to the kernel and
the globals.

Fix restoration of colors in revert() by restoring 2 after the mode
change.  Colors should not need to be restored, but a bug in scteken
clobbers them on any mode change, including ones for restoration.  Don't
move the restoration of the other 3.  Teken doesn't clobber them on
mode changes because it doesn't support them at all (sc still supports
the border color, but only using a non-teken ioctl).

Add restoration of colors after a successful mode change to work around
the scteken bug there too.  The bug was previously masked by the general
setting of colors at the end.

Fix a longstanding parsing/error handling bug by exiting almost immediately
after matching the [mode] arg but failing to set the mode.  Just revert
if necessary.  Don't return to continue parsing but do it wrong.  This
bug caused spamming the output with a usage() message and exiting with
status 1 whenever [mode] is not present bug [fg [bg]] or [show].  The
exit code 1 was actualy an ambiguous internal code for failure to match
[mode] or failure to set [mode].  This 1 was obfuscated by spelling it
EXIT_FAILURE, but actual exit codes spell EXIT_FAILURE as 1.  Remove
another global which could have been used to disambiguate this but was
only used to micro-optimize the (unnecessary except for other bugs)
setting of colors at the end.

7 years agoGC some unused declarations.
ae [Mon, 3 Apr 2017 04:44:56 +0000 (04:44 +0000)]
GC some unused declarations.

MFC after: 1 week

7 years agoSmall cleanup to make i386/loader match efi/loader boot environment code
allanjude [Mon, 3 Apr 2017 04:29:57 +0000 (04:29 +0000)]
Small cleanup to make i386/loader match efi/loader boot environment code

7 years agoRestore EFI boot environment functionality broken in r313333
allanjude [Mon, 3 Apr 2017 04:28:53 +0000 (04:28 +0000)]
Restore EFI boot environment functionality broken in r313333

Reported by: Graham Perrin, JT Pennington <q5sys@bsdnow.tv>
Sponsored by: ScaleEngine Inc.

7 years agoAdd ipfw_pmod kernel module.
ae [Mon, 3 Apr 2017 03:07:48 +0000 (03:07 +0000)]
Add ipfw_pmod kernel module.

The module is designed for modification of a packets of any protocols.
For now it implements only TCP MSS modification. It adds the external
action handler for "tcp-setmss" action.

A rule with tcp-setmss action does additional check for protocol and
TCP flags. If SYN flag is present, it parses TCP options and modifies
MSS option if its value is greater than configured value in the rule.
Then it adjustes TCP checksum if needed. After handling the search
continues with the next rule.

Obtained from: Yandex LLC
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Yandex LLC
No objection from: #network
Differential Revision: https://reviews.freebsd.org/D10150

7 years agoAdd O_EXTERNAL_DATA opcode support.
ae [Mon, 3 Apr 2017 02:44:40 +0000 (02:44 +0000)]
Add O_EXTERNAL_DATA opcode support.

This opcode can be used to attach some data to external action opcode.
And unlike to O_EXTERNAL_INSTANCE opcode, this opcode does not require
creating of named instance to pass configuration arguments to external
action handler. The data is coming just next to O_EXTERNAL_ACTION opcode.

The userlevel part currenly supports formatting for opcode with ipfw_insn
size, by default it expects u16 numeric value in the arg1.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC

7 years agoAdd the log formatting for an external action opcode.
ae [Mon, 3 Apr 2017 02:26:30 +0000 (02:26 +0000)]
Add the log formatting for an external action opcode.

Obtained from: Yandex LLC
MFC after: 2 weeks
Sponsored by: Yandex LLC

7 years agoFix indentation in dd(1)
vangyzen [Sun, 2 Apr 2017 21:30:05 +0000 (21:30 +0000)]
Fix indentation in dd(1)

Quoting http://mdocml.bsd.lv/mdoc/details/width.html

Do not use macros in the argument specifying the width,
since that's not portable.  While GNU troff can handle it,
mandoc cannot.

MFC after: 3 days
Sponsored by: Dell EMC

7 years ago[net80211] refactor the A-MPDU RX window code
adrian [Sun, 2 Apr 2017 20:59:12 +0000 (20:59 +0000)]
[net80211] refactor the A-MPDU RX window code

The RX window update code is effectively the same in both locations.

Reviewed by: avos
Differential Revision: https://reviews.freebsd.org/D10208

7 years agoFix variable for sizeof() in previous commit.
mav [Sun, 2 Apr 2017 20:57:59 +0000 (20:57 +0000)]
Fix variable for sizeof() in previous commit.

MFC after: 2 weeks

7 years agoAdd Log directory and SATA NCQ Send and Receive Log.
mav [Sun, 2 Apr 2017 20:39:51 +0000 (20:39 +0000)]
Add Log directory and SATA NCQ Send and Receive Log.

Those are used at least by Linux guests to detect queued TRIM support.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

7 years agoUse the kern_clock_nanosleep() to implement Linux clock_nanosleep() with
dchagin [Sun, 2 Apr 2017 18:16:00 +0000 (18:16 +0000)]
Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() with
the proper handling of the TIMER_ABSTIME flag.

XMFC after: r315526

MFC after: 1 month

7 years agoFix sparc64 build broken by r316343 and r316076
allanjude [Sun, 2 Apr 2017 17:25:37 +0000 (17:25 +0000)]
Fix sparc64 build broken by r316343 and r316076

Reported by: markj
Sponsored by: ScaleEngine Inc.

7 years agoRemove checks that background (bg) colors are not bright and buggy
bde [Sun, 2 Apr 2017 16:39:39 +0000 (16:39 +0000)]
Remove checks that background (bg) colors are not bright and buggy
attempts to keep them that way.  The bg brightness bit is interpreted
as blinking in some modes, but it would barely be useful to disallow
setting it when it would give blinking in code which knew when that
is.  The old code mostly knew this wrong, and added handling errors.
It is in fact impossible to know, since future mode switches may
change the meaning of the bit many times on the screen and in history.

Old versions of vidcontrol disallowed bg color numbers >= 8 in all
cases.  This is very VGA/syscons-centric.  Syscons uses the VGA defaults
of blinking fg instead of bright bg in text mode and bright bg in
graphics mode.  On VGA, this is very easy to toggle at any time, and
vt blows away the VGA text mode default at boot time.

r146736 changed this to try to allow bg color numbers in graphics mode
only.  This is even more VGA/syscons-centric, and there are many bugs
in this, and many nearby bugs in the parser.  These are increased or
decreased by differences and bugs in vt and teken.

Perhaps the most obvious bug was that almost any vidcontrol command
which changes any color or the mode causes an error if the initial fg
color is bright.  E.g., in syscons text mode, after "vidcontrol
lightwhite" to make the fg bright, another "vidcontrol lightwhite" is
rejected and buggy fixup code changes the fg to white.  This is because
the bright fg color creates a bright bg color for the phantom reverse
video attribute, so was rejected.  (The reverse video attribute is
phantom because teken ignores the user's setting of it and simply
reverses the fg attributes to create the bg attributes.  Sometimes
some layer masks off the brightness/blinking bit, but not here.)

Perhaps the next most obvious one was that "vidcontrol lightgreen
lightblue" was misparsed as 2 settings of the fg instead of 1 setting
of the fg and 1 invalid setting of the bg.  This is because the
parser supports an undocumented syntax with many parsing bugs (an
ambiguity gives this one).

I recently fix bugs in teken that broke setting of bright fg's and
bg's in the normal way.  This gave more settings of then, so the old
bugs showed up more often.

7 years agosh: Remove an XXX comment: it is normal for builtins to use argptr.
jilles [Sun, 2 Apr 2017 15:53:11 +0000 (15:53 +0000)]
sh: Remove an XXX comment: it is normal for builtins to use argptr.

7 years agosh: Remove global state from collate_range_cmp().
jilles [Sun, 2 Apr 2017 14:02:10 +0000 (14:02 +0000)]
sh: Remove global state from collate_range_cmp().

The global state is not used across invocations of collate_range_cmp().

7 years agosh: Don't scan word twice in ${param=word}.
jilles [Sun, 2 Apr 2017 13:43:45 +0000 (13:43 +0000)]
sh: Don't scan word twice in ${param=word}.

7 years agosh: Don't scan word twice in ${param#%##%%word}.
jilles [Sun, 2 Apr 2017 13:29:27 +0000 (13:29 +0000)]
sh: Don't scan word twice in ${param#%##%%word}.

If word is expanded, use the found end instead of iterating over the data
again.

7 years agoiwn: use correct mask for queue ids (0xf -> 0x1f).
avos [Sun, 2 Apr 2017 13:24:58 +0000 (13:24 +0000)]
iwn: use correct mask for queue ids (0xf -> 0x1f).

7 years agosh: Don't scan word twice in ${param+-word}.
jilles [Sun, 2 Apr 2017 12:37:43 +0000 (12:37 +0000)]
sh: Don't scan word twice in ${param+-word}.

There is no longer a case where argbackq has already been advanced but the
string pointer needs to be advanced.

7 years agoAdd IDs for several missing Intel SMBus controllers.
gavin [Sun, 2 Apr 2017 11:36:25 +0000 (11:36 +0000)]
Add IDs for several missing Intel SMBus controllers.

Obtained from: Data sheets, Linux defines, local hardware
MFH: 2 weeks

7 years agoAdd IDs for Intel Cougar Point USB 2.0 controller.
mav [Sun, 2 Apr 2017 11:32:05 +0000 (11:32 +0000)]
Add IDs for Intel Cougar Point USB 2.0 controller.

MFC after: 1 week

7 years agoRemove the unportable -msse4 here too after fixing crc32_sse42.c to not
bde [Sun, 2 Apr 2017 09:24:58 +0000 (09:24 +0000)]
Remove the unportable -msse4 here too after fixing crc32_sse42.c to not
depend on it.  This should have been part of r315983.

7 years agoReset the DAC to 6-bit mode before calling the BIOS to set the screen
bde [Sun, 2 Apr 2017 08:39:32 +0000 (08:39 +0000)]
Reset the DAC to 6-bit mode before calling the BIOS to set the screen
mode.  This works around bugs in at least 2 Intel BIOSes for our
subsequent setting of the DAC back to 8-bit mode.  The bug caused dark
(mostly 1/4-intensity) colors for all except the first setting to a
VESA graphics mode (including for settings to the current mode).

Remove restoration (with less bits) of the palette in vesa_unload()
after resetting the DAC to 6-bit mode.  Depend on the BIOS to keep
the palette consistent with the DAC for the simpler reset case like
we do everywhere else in places that are actually important.

Setting the video mode should reset everything to defaults, although
we usually don't want that.  Even the buggy BIOSes set the DAC to the
default 6-bit mode, and set the palette to a default that matches the
DAC.  We don't undo the reset for most things, but we do undo it for
the DAC (more precisely, we change to an 8-bit DAC if possible, and
this is the only way that we set to an 8-bit DAC; it is accidental
that if the DAC was in 8-bit mode from a previous mode switch then
setting it to 8-bit mode is an undo).  The buggy BIOSes are confused
by our setting of the DAC to 8-bit mode in the "undo" case.  They
should multiply palette entries by 4 to match, but they actually leave
all palette entries except #2 (green) and #248-255 (unused) untouched.
Green is mysteriously scaled from 0x2a to 0x6a, and #248-255 are scaled
correctly.

Our support for the 8-bit DAC had almost no effect except to enable
bugs.  Syscons barely supports 16 colors, so it doesn't benefit much
from having a palette with 16 million colors instead of only 256K.
Applications can manage the palette using FBIO_{GET,SET}PALETTE, but
the palette managed by this is only used in the less interesting modes
(text and non-truecolor graphics modes up to 8 bits wide), and the
kernel loses the changes on any mode switch (including to another vt
in a different mode).

7 years agoRemove excess tv_nsec test as this is done by linux_to_native_timespec().
dchagin [Sun, 2 Apr 2017 07:49:05 +0000 (07:49 +0000)]
Remove excess tv_nsec test as this is done by linux_to_native_timespec().

MFC after: 1 week

7 years agoThe value in the tv_nsec field should be in the range 0 to 999999999.
dchagin [Sun, 2 Apr 2017 07:47:28 +0000 (07:47 +0000)]
The value in the tv_nsec field should be in the range 0 to 999999999.

Pointed out by: bde@

MFC after: 1 week

7 years agoAs noted by bde@ negative tv_sec values are not checked for overflow,
dchagin [Sun, 2 Apr 2017 07:46:13 +0000 (07:46 +0000)]
As noted by bde@ negative tv_sec values are not checked for overflow,
so overflow can still occur. Fix that. Also remove the extra check for
tv_sec size as under COMPAT_LINUX32 it is always true.

Pointed out by: bde@

MFC after: 1 week

7 years agoAdd Freescale eSPI driver found on QorIQ SoCs
jhibbits [Sun, 2 Apr 2017 01:21:35 +0000 (01:21 +0000)]
Add Freescale eSPI driver found on QorIQ SoCs

7 years agoUse the newly added mpc85xx_get_system_clock()
jhibbits [Sat, 1 Apr 2017 22:35:03 +0000 (22:35 +0000)]
Use the newly added mpc85xx_get_system_clock()

Simplify the platform clock acquisition by using the new helper function.

7 years agoAdd a helper function to get system reference clock
jhibbits [Sat, 1 Apr 2017 22:29:11 +0000 (22:29 +0000)]
Add a helper function to get system reference clock

Many devices are clocked from the SoC's platform clock / 2.  Some device nodes
include their own clock-frequency property, while others are dependent on the
SoC's bus-frequency property instead.  To simplify, add a helper function to get
this clock.

7 years agoCorrect a comment... the stack used by ubldr is the same stack u-boot was
ian [Sat, 1 Apr 2017 22:03:00 +0000 (22:03 +0000)]
Correct a comment... the stack used by ubldr is the same stack u-boot was
running on when it jumped to the ubldr entry point.  None of the arches
that use this code set up a different stack in their start.S routines.

7 years agoReduce the diff on beaglebone-black DTS.
manu [Sat, 1 Apr 2017 21:55:09 +0000 (21:55 +0000)]
Reduce the diff on beaglebone-black DTS.

The HDMI TX (tda19988) is already enabled in upstream DTS so use it directly
instead.

7 years agoPreserve the registers containing argc, argv, and return address values
ian [Sat, 1 Apr 2017 21:51:34 +0000 (21:51 +0000)]
Preserve the registers containing argc, argv, and return address values
passed in from u-boot across the call to self_reloc and any other early-init
code, and restore them before calling main().

The self_reloc() routine uses r0 and r1 (and calling it uses lr), and
depending on what values get left in them, main() would intermittantly lock
up trying to interpret them as argc and argv values.  This problem affected
the self-relocatable ubldr.bin but not ubldr (the elf version).

7 years ago[versatilepb] Fix keyboard driver after switching to upstream DTS
gonzo [Sat, 1 Apr 2017 20:38:12 +0000 (20:38 +0000)]
[versatilepb] Fix keyboard driver after switching to upstream DTS

FreeBSD's DTS contained only one PL050 node and driver considered it to
be PS/2 keyboard. In reality PL050 is a PS/2 port that pushes bytes to/from
the periphers connected to it. New DTS contains two nodes and QEMU emulates
keyboard connected to port #0 and mouse connected to port #1. Since there
is no way to say what's connected to port by checking DTS we hardcode
this knowledge in the driver: it assumes keyboard on port #0 and ignores
port #1 altogether.

Also QEMU defaults emulated keyboard to scan code set 2 while driver used
to work with scan code set 1 so when initializing driver make sure keyboard
is switched to scan code set 1

7 years ago[versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB
gonzo [Sat, 1 Apr 2017 20:10:08 +0000 (20:10 +0000)]
[versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB

Scope of this change is somewhat larger than just converting to INTRNG.
The reason for this is that INTRNG support required switching from custom
to upstream DTS because custom DTS didn't have interrup routing information.
This switch caused rewrite of PCI and CLCD drivers and adding SCM module.
List of changes in this commit:

- Enable INTRNG and switch to versatile-pb.dts

- Add SCM driver that controls various peripheral devices like LCD or
  PCI controller. Previously registers required for power-up and
  configuring peripherals were part of their respective nodes. Upstream
  DTS has dedicated node for SCM

- Convert PL190 driver to INTRNG

- Convert Versatile SIC (secondary interrupt controller) to INTRNG

- Refactor CLCD driver to use SCM API to power up and configuration

- Refactor PCI driver to use SCM API to enable controller

- Refactor PCI driver to use interrupt map provided in DTS for
  interrupt routing. As a result it fixes broken IRQ routing and
  it's no longer required to run QEMU with "-global versatile_pci.broken-irq-mapping=1"
  command-line arguments

7 years agoFix typos to stop removing new files.
jkim [Sat, 1 Apr 2017 19:08:22 +0000 (19:08 +0000)]
Fix typos to stop removing new files.

7 years agoFix man page typo from r316342
asomers [Sat, 1 Apr 2017 15:04:37 +0000 (15:04 +0000)]
Fix man page typo from r316342

Reported by: rgrimes
MFC after: 20 days
X-MFC-With: 316342

7 years agoMinor style improvements in bhyve.8
novel [Sat, 1 Apr 2017 15:01:10 +0000 (15:01 +0000)]
Minor style improvements in bhyve.8

Replace "as of now" with "at present". As the change is a really minor one,
don't bump .Dd.

Suggested by: wblock
Approved by: wblock (implicit)

7 years agopf: Fix leak of pf_state_keys
kp [Sat, 1 Apr 2017 12:22:34 +0000 (12:22 +0000)]
pf: Fix leak of pf_state_keys

If we hit the state limit we returned from pf_create_state() without cleaning
up.

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

7 years agoImplement boot-time encryption key passing (keybuf)
allanjude [Sat, 1 Apr 2017 05:05:22 +0000 (05:05 +0000)]
Implement boot-time encryption key passing (keybuf)

This patch adds a general mechanism for providing encryption keys to the
kernel from the boot loader. This is intended to enable GELI support at
boot time, providing a better mechanism for passing keys to the kernel
than environment variables. It is designed to be extensible to other
applications, and can easily handle multiple encrypted volumes with
different keys.

This mechanism is currently used by the pending GELI EFI work.
Additionally, this mechanism can potentially be used to interface with
GRUB, opening up options for coreboot+GRUB configurations with completely
encrypted disks.

Another benefit over the existing system is that it does not require
re-deriving the user key from the password at each boot stage.

Most of this patch was written by Eric McCorkle. It was extended by
Allan Jude with a number of minor enhancements and extending the keybuf
feature into boot2.

GELI user keys are now derived once, in boot2, then passed to the loader,
which reuses the key, then passes it to the kernel, where the GELI module
destroys the keybuf after decrypting the volumes.

Submitted by: Eric McCorkle <eric@metricspace.net> (Original Version)
Reviewed by: oshogbo (earlier version), cem (earlier version)
MFC after: 3 weeks
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9575

7 years agoConsolidate random sleeps in periodic scripts
asomers [Sat, 1 Apr 2017 04:42:35 +0000 (04:42 +0000)]
Consolidate random sleeps in periodic scripts

Multiple periodic scripts sleep for a random amount of time in order to
mitigate the thundering herd problem. This is bad, because the sum of
multiple uniformly distributed random variables approaches a normal
distribution, so the problem isn't mitigated as effectively as it would be
with a single sleep.

This change creates a single configurable anticongestion sleep. periodic
will only sleep if at least one script requires it, and it will never sleep
more than once per invocation. It also won't sleep if periodic was run
interactively, fixing an unrelated longstanding bug.

PR: 217055
PR: 210188
Reviewed by: cy
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D10211

7 years agoext2fs: Initial support for Extended Attributes.
pfg [Sat, 1 Apr 2017 01:00:36 +0000 (01:00 +0000)]
ext2fs: Initial support for Extended Attributes.

Currently read-only.

Submitted by: Fedor Uporov
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D10151

7 years ago[ifconfig] add some comments around missing net80211 VHT configuration.
adrian [Fri, 31 Mar 2017 22:05:10 +0000 (22:05 +0000)]
[ifconfig] add some comments around missing net80211 VHT configuration.

VHT STBC, A-MPDU density and A-MPDU size configuration parameters are
different when doing VHT.

7 years agoCurrently, less(1) uses K&R prototypes, which both fails to provide useful
rwatson [Fri, 31 Mar 2017 21:29:43 +0000 (21:29 +0000)]
Currently, less(1) uses K&R prototypes, which both fails to provide useful
compiler-time type checking, and also causes problems for targets where
multiple incompatible calling conventions may be selected based on argument
types.  This change switches less(1) to ANSI prototypes.

While there, we also remove use of "register", and attempt to use "const" a
bit better now that the compiler can check argument types.

Reviewed by: cem, emaste
MFC after: 3 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10152

7 years agoRework BGX detection to support both new and old firmware
zbb [Fri, 31 Mar 2017 18:04:34 +0000 (18:04 +0000)]
Rework BGX detection to support both new and old firmware

Improve existing BGX detection and adjust it to support both
new and older ThunderX firmwares. Match BGX FDT nodes by name
and reg. Match PHY instances by qlm-mode and name.
Tested on Firmware Version: 2016-09-30 09:12:11

Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D9863

7 years agoAudit arguments to posix_fallocate(2) and posix_fadvise(2) system calls.
rwatson [Fri, 31 Mar 2017 14:17:14 +0000 (14:17 +0000)]
Audit arguments to posix_fallocate(2) and posix_fadvise(2) system calls.

As posix_fadvise() does not lock the vnode argument, don't capture
detailed vnode information for the time being.

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years agoCorrect macro names and signatures for !AUDIT versions of canonical
rwatson [Fri, 31 Mar 2017 14:13:13 +0000 (14:13 +0000)]
Correct macro names and signatures for !AUDIT versions of canonical
path auditing.

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years agoAudit arguments to POSIX message queues, semaphores, and shared memory.
rwatson [Fri, 31 Mar 2017 13:43:00 +0000 (13:43 +0000)]
Audit arguments to POSIX message queues, semaphores, and shared memory.

This requires minor changes to the audit framework to allow capturing
paths that are not filesystem paths (i.e., will not be canonicalised
relative to the process current working directory and/or filesystem
root).

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years agoReset the cached state of last lookup in the dynamic states when an
ae [Fri, 31 Mar 2017 09:26:08 +0000 (09:26 +0000)]
Reset the cached state of last lookup in the dynamic states when an
external action is completed, but the rule search is continued.

External action handler can change the content of @args argument,
that is used for dynamic state lookup. Enforce the new lookup to be able
install new state, when the search is continued.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

7 years agoAllow explicitly assigned IPv6 loopback address to be used in jails
smh [Fri, 31 Mar 2017 09:10:05 +0000 (09:10 +0000)]
Allow explicitly assigned IPv6 loopback address to be used in jails

If a jail has an explicitly assigned IPv6 loopback address then allow it
to be used instead of remapping requests for the loopback adddress to the
first IPv6 address assigned to the jail.

This fixes issues where applications attempt to detect their bound port
where they requested a loopback address, which was available, but instead
the kernel remapped it to the jails first address.

This is the same fix applied to IPv4 fix by: r316313

Also:
* Correct the description of prison_check_ip6_locked to match the code.

MFC after: 2 weeks
Relnotes: Yes
Sponsored by: Multiplay

7 years agoAdd support for ThingM blink(1) notification LED to uled(4).
kevlo [Fri, 31 Mar 2017 08:20:59 +0000 (08:20 +0000)]
Add support for ThingM blink(1) notification LED to uled(4).

7 years agoRevert debugging that was accidently committed in r316314
allanjude [Fri, 31 Mar 2017 03:11:25 +0000 (03:11 +0000)]
Revert debugging that was accidently committed in r316314

7 years agofix top(1) ZFS compressed ARC support
allanjude [Fri, 31 Mar 2017 03:08:07 +0000 (03:08 +0000)]
fix top(1) ZFS compressed ARC support

top(1) read the wrong amount of data from sysctl, uint64_t instead of
boolean_t, resulting in the stats not showing in many cases.

X-MFC-With: r315435
Sponsored by: ScaleEngine Inc.

7 years agoAllow explicitly assigned IPv4 loopback address to be used in jails
smh [Fri, 31 Mar 2017 00:41:54 +0000 (00:41 +0000)]
Allow explicitly assigned IPv4 loopback address to be used in jails

If a jail has an explicitly assigned loopback address then allow it to be
used instead of remapping requests for the loopback adddress to the first
IPv4 address assigned to the jail.

This fixes issues where applications attempt to detect their bound port
where they requested a loopback address, which was available, but instead
the kernel remapped it to the jails first address.

A example of this is binding nginx to 127.0.0.1 and then running "service
nginx upgrade" which before this change would cause nginx to fail.

Also:
* Correct the description of prison_check_ip4_locked to match the code.

MFC after: 2 weeks
Relnotes: Yes
Sponsored by: Multiplay

7 years agosys/geom/eli: Switch bzero() to explicit_bzero() for sensitive data
allanjude [Fri, 31 Mar 2017 00:07:03 +0000 (00:07 +0000)]
sys/geom/eli: Switch bzero() to explicit_bzero() for sensitive data

In GELI, anywhere we are zeroing out possibly sensitive data, like
the metadata struct, the metadata sector (both contain the encrypted
master key), the user key, or the master key, use explicit_bzero.

Didn't touch the bzero() used to initialize structs.

Reviewed by: delphij, oshogbo
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9809

7 years agoAdd explicit_bzero() to libstand, and switch GELIBoot to using it
allanjude [Fri, 31 Mar 2017 00:04:32 +0000 (00:04 +0000)]
Add explicit_bzero() to libstand, and switch GELIBoot to using it

Make sure sensitive memory is properly cleared when finished with it

Reviewed by: Eric McCorkle <eric@metricspace.net>
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D9798

7 years agoUpdate man page for commit r316309 "Add support for optional Soft LRO".
davidcs [Thu, 30 Mar 2017 23:49:57 +0000 (23:49 +0000)]
Update man page for commit r316309 "Add support for optional Soft LRO".
The driver provides the ability to select either HW or Software LRO, when
LRO is enabled (default HW LRO).

MFC after:5 days

7 years agoAdd support for optional Soft LRO
davidcs [Thu, 30 Mar 2017 22:43:32 +0000 (22:43 +0000)]
Add support for optional Soft LRO

MFC after:5 days

7 years agoAudit arguments to System V IPC system calls implementing sempahores,
rwatson [Thu, 30 Mar 2017 22:26:15 +0000 (22:26 +0000)]
Audit arguments to System V IPC system calls implementing sempahores,
message queues, and shared memory.

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years agoAdd system-call argument auditing for ACL-related system calls.
rwatson [Thu, 30 Mar 2017 22:00:58 +0000 (22:00 +0000)]
Add system-call argument auditing for ACL-related system calls.

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years ago[am335x] Fix HDMI suport for Beaglebone Black
gonzo [Thu, 30 Mar 2017 21:54:57 +0000 (21:54 +0000)]
[am335x] Fix HDMI suport for Beaglebone Black

Fallback to Linux video interface bindings introduced in r313068 worked
with then current DTS but that DTS turned out to be not conformant to
the the bindings spec. DTS import in r314854 fixed the conformancy but
broke the functionality. This commit syncs up functionality to the actual
spec.

Reported by: manu@

7 years agoVarious BSM generation improvements when auditing AUE_ACCEPT,
rwatson [Thu, 30 Mar 2017 21:39:03 +0000 (21:39 +0000)]
Various BSM generation improvements when auditing AUE_ACCEPT,
AUE_PROCCTL, AUE_SENDFILE, AUE_ACL_*, and AUE_POSIX_FALLOCATE.
Audit AUE_SHMUNLINK path in the path token rather than as a
text string, and AUE_SHMOPEN flags as an integer token rather
than a System V IPC address token.

Obtained from: TrustedBSD Project
MFC after: 3 weeks
Sponsored by: DARPA, AFRL

7 years agoReorder includes to placate MIPS build.
tychon [Thu, 30 Mar 2017 20:42:16 +0000 (20:42 +0000)]
Reorder includes to placate MIPS build.

Reported by: markj
Sponsored by: Dell EMC Isilon

7 years agoUse kern_mincore() helper instead of abusing syscall entry.
dchagin [Thu, 30 Mar 2017 19:45:07 +0000 (19:45 +0000)]
Use kern_mincore() helper instead of abusing syscall entry.

Suggested by: kib@
Reviewed by: kib@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10143

7 years agoAdd kern_mincore() helper for micore() syscall.
dchagin [Thu, 30 Mar 2017 19:42:49 +0000 (19:42 +0000)]
Add kern_mincore() helper for micore() syscall.

Suggested by: kib@
Reviewed by: kib@
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10143

7 years agoRemove OLD_NFSV2 from loader and libstand
tsoome [Thu, 30 Mar 2017 19:32:25 +0000 (19:32 +0000)]
Remove OLD_NFSV2 from loader and libstand

We have parallel NFSv2 and NFSv3 reader implementations, only configurable at
build time, defaulting to v3. Remove v2.

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D10206

7 years agoAdd support for capturing 'struct ptrace_lwpinfo' for signals
tychon [Thu, 30 Mar 2017 18:21:36 +0000 (18:21 +0000)]
Add support for capturing 'struct ptrace_lwpinfo' for signals
resulting in a process dumping core in the corefile.

Also extend procstat to view select members of 'struct ptrace_lwpinfo'
from the contents of the note.

Sponsored by: Dell EMC Isilon

7 years agoMake dhcp-lease-time option supersedable as well.
n_hibma [Thu, 30 Mar 2017 18:20:04 +0000 (18:20 +0000)]
Make dhcp-lease-time option supersedable as well.

Note: It is not recommended to set this value to above the value that
the server provided, unless that value is bogus.

7 years agoelfcopy: remove temporary ELF file when converting from binary
emaste [Thu, 30 Mar 2017 17:37:12 +0000 (17:37 +0000)]
elfcopy: remove temporary ELF file when converting from binary

Previously a command like

  objcopy --input-target binary --output-target elf64-x86-64-freebsd \
    binary_file object.o

would leave a temporary file behind.

ELF Tool Chain ticket #543

Reported by: Roger Marquis
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

7 years agoAllow superseding the lease renewal and rebind times.
n_hibma [Thu, 30 Mar 2017 17:31:12 +0000 (17:31 +0000)]
Allow superseding the lease renewal and rebind times.

Also make sure that the renewal is never more than 1/2 * expiry and
rebind never more than 7/4 * renewal (the default values in the spec).
This should allow adjusting high values from the server as well as
making sure the values from the server make sense.

Renewal and rebind times will be adjusted down if the expiry time is set
very high in a server, not the other way around. This change just makes
sure the values keep making sense.

7 years agoDon't call init functions directly from the timer/watchdog function.
sbruno [Thu, 30 Mar 2017 16:54:01 +0000 (16:54 +0000)]
Don't call init functions directly from the timer/watchdog function.

Enqueue this in the admin task now that it can process it.

Submitted by: Matt Macy <mmacy@nextbsd.org>
Sponsored by: Limelight Networks

7 years agoloader: simplify efi_zfs_probe and avoid double probing for zfs.
tsoome [Thu, 30 Mar 2017 16:31:35 +0000 (16:31 +0000)]
loader: simplify efi_zfs_probe and avoid double probing for zfs.

The current efi_zfs_probe() is overcomplicated and can be made
simpler. Still we need to pick up the device handle for our boot
disk first, because the ESP does not have to be the first partition on the
disk.

Once we do have the handle for boot disk, we probe that disk with
pointer for pool GUID.

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D10198

7 years agoloader: efipart should check disk size from partition table
tsoome [Thu, 30 Mar 2017 16:23:31 +0000 (16:23 +0000)]
loader: efipart should check disk size from partition table

While testing 32bit UEFI OVMF (which has bug about how the disk size
is presented), I did witness the errors from blkio->ReadBlocks().

It became apparent we can not entirely trust UEFI interfaces either,
so additional checks are needed.

So we use disk_ioctl(DIOCGMEDIASIZE) for disks, with fallback of
Media->LastBlock for other media.

In addition, we need to check if there is media present.

+ small fixes for error printout, and avoiding multiple blk * 512.

Reviewed by: allanjude
Approved by: allanjude (mentor)
Differential Revision: https://reviews.freebsd.org/D10197

7 years agoAssert IFF_DRV_OACTIVE in iflib_timer() when the "hung" case is detected
sbruno [Thu, 30 Mar 2017 16:03:51 +0000 (16:03 +0000)]
Assert IFF_DRV_OACTIVE in iflib_timer() when the "hung" case is detected
so that iflib's admin task can still process the reset directive and restore
functionality.

Sponsored by: Limelight Networks

7 years agoAdd nctgpio conf lines so it can be compiled into the kernel.
n_hibma [Thu, 30 Mar 2017 15:05:10 +0000 (15:05 +0000)]
Add nctgpio conf lines so it can be compiled into the kernel.

MFC after: 2 days

7 years agoDon't ifdef KDTRACE_HOOKS struct, variable, and function prototype
rwatson [Thu, 30 Mar 2017 12:35:56 +0000 (12:35 +0000)]
Don't ifdef KDTRACE_HOOKS struct, variable, and function prototype
definitions for the DTrace audit provider, so that the dtaudit module
can compile in the absence of kernel DTrace support.  This doesn't
really make run-time sense (since the binary dependencies for the
module won't be present), but it allows the dtaudit module to compile
successfully regardless of the kernel configuration.

MFC after: 3 weeks
Sponsored by: DARPA, AFRL
Reported by: kib

7 years agoAnnotate all changes made in r316178-r316180 with __FreeBSD__
ngie [Thu, 30 Mar 2017 07:13:47 +0000 (07:13 +0000)]
Annotate all changes made in r316178-r316180 with __FreeBSD__

Restore the stock (upstream) code under an #else block, so it's easier
for me to visualize and understand the code that needs to be upstreamed.

MFC after: 2 months
X-MFC with: r316178, r316179, r316180
Sponsored by: Dell EMC Isilon

7 years agoOnly activate __EXT1_VISIBLE block when using sys/errno.h in userspace.
kib [Thu, 30 Mar 2017 06:24:30 +0000 (06:24 +0000)]
Only activate __EXT1_VISIBLE block when using sys/errno.h in userspace.

The prerequisite for '#if __EXT1_VISIBLE' functionality is the
inclusion of sys/cdefs.h.  errno.h only auto-includes the header for
non-kernel environment, and EXT1 block only useful for non-kernel as
well.

Reported by: lwhsu
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

7 years agoAdd an UPDATING entry for cfiscsi(4)'s addition in r316212
ngie [Thu, 30 Mar 2017 05:11:58 +0000 (05:11 +0000)]
Add an UPDATING entry for cfiscsi(4)'s addition in r316212

MFC after: 2 months
X-MFC with: r316212
Requested by: mav (D10099)
Sponsored by: Dell EMC Isilon

7 years agoImplement the memset_s(3) function as specified by the C11 ISO/IEC
kib [Thu, 30 Mar 2017 04:57:26 +0000 (04:57 +0000)]
Implement the memset_s(3) function as specified by the C11 ISO/IEC
9899:2011 Appendix K 3.7.4.1.

Other needed supporting types, defines and constraint_handler
infrastructure is added as specified in the C11 spec.

Submitted by: Tom Rix <trix@juniper.net>
Sponsored by: Juniper Networks
Discussed with: ed
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D9903
Differential revision: https://reviews.freebsd.org/D10161