]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFV r330102: ntp 4.2.8p11
delphij [Wed, 28 Feb 2018 07:59:55 +0000 (07:59 +0000)]
MFV r330102: ntp 4.2.8p11

6 years agoVendor import of ntp-4.2.8p11.
delphij [Wed, 28 Feb 2018 06:23:12 +0000 (06:23 +0000)]
Vendor import of ntp-4.2.8p11.

6 years agolualoader: Add note that \027 is a decimal representation
kevans [Wed, 28 Feb 2018 05:11:10 +0000 (05:11 +0000)]
lualoader: Add note that \027 is a decimal representation

We've included an extra '0' in there (which might get removed later, but
it's maintained for the moment for legacy purposes) which oftentimes
indicate that the following number should be treated as octal. This is not
the case, so note that to prevent future confusion (of myself and others).

6 years agolualoader: Remove debug function
kevans [Wed, 28 Feb 2018 05:02:05 +0000 (05:02 +0000)]
lualoader: Remove debug function

Our module bits ended up more stable than I anticipated, so this turns out
to be no longer useful.

If things like this need to come back, we should do it in a separate 'debug'
module to serve as a collection of debugging aides. As a rule, this 'debug'
module would *not* be allowed as a requirement of any other modules in-tree.

6 years agolualoader: Further screen cleanup
kevans [Wed, 28 Feb 2018 04:31:19 +0000 (04:31 +0000)]
lualoader: Further screen cleanup

- Add screen.default_x and screen.default_y to determine where
  screen.defcursor resets the cursor to.
- Use screen.setcursor in screen.defcursor instead of rewriting the escape
  sequence.
- Use screen.default_y when resetting the cursor after writing the new
  twiddle character, add a comment verbally describing the position just in
  case.

6 years agolualoader: Re-do twiddle
kevans [Wed, 28 Feb 2018 04:23:28 +0000 (04:23 +0000)]
lualoader: Re-do twiddle

It worked on my test setup, but is clearly non-functional on others.

Further examination of check-password.4th showed that it actually reset the
cursor to 0,25 every time and overwrote the previous password prompt. Do
that, and also clear the "Incorrect Password" text if the correct password
gets entered.

6 years agoRevert r314685 in ps
karels [Wed, 28 Feb 2018 00:17:08 +0000 (00:17 +0000)]
Revert r314685 in ps

Revert r314685, and add a comment describing the original
behavior and the intent.

Reviewed by: dab@ vangyzen@ jhb@
Differential Revision: https://reviews.freebsd.org/D14530

6 years agoAdd 'usr.bin/seq' to tests mtree after r330086
kevans [Tue, 27 Feb 2018 22:22:23 +0000 (22:22 +0000)]
Add 'usr.bin/seq' to tests mtree after r330086

6 years agoWhen checking the TCP fast cookie length, conststently also check
tuexen [Tue, 27 Feb 2018 22:12:38 +0000 (22:12 +0000)]
When checking the TCP fast cookie length, conststently also check
for the minimum length.

This fixes a bug where cookies of length 2 bytes (which is smaller
than the minimum length of 4) is provided by the server.

Sponsored by: Netflix, Inc.

6 years agolualoader: Correct test sense, comments, and add some more comments
kevans [Tue, 27 Feb 2018 22:07:41 +0000 (22:07 +0000)]
lualoader: Correct test sense, comments, and add some more comments

6 years agolualoader: Convert instances of KEYSTR_ESCAPE .. "[" -> KEYSTR_CSI
kevans [Tue, 27 Feb 2018 22:02:39 +0000 (22:02 +0000)]
lualoader: Convert instances of KEYSTR_ESCAPE .. "[" -> KEYSTR_CSI

6 years agoseq(1): Consistently include 'last' for non-integers
cem [Tue, 27 Feb 2018 22:01:40 +0000 (22:01 +0000)]
seq(1): Consistently include 'last' for non-integers

The source of error is a rounded increment being too large and thus the loop
steps slightly past 'last'.  Perform a final comparison using the formatted
string values (truncated precision) to determine if we still need to print
the 'last' value.

PR: 217149
Submitted by: Fernando ApesteguĂ­a <fernando.apesteguia AT gmail.com>,
Yuri Pankov <yuripv AT icloud.com> (earlier version)
Reported by: Martijn Dekker <mcdutchie AT hotmail.com>
Sponsored by: Dell EMC Isilon

6 years agodhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP
dab [Tue, 27 Feb 2018 21:59:23 +0000 (21:59 +0000)]
dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP

When dhclient first starts, if an old IP address exists in the
dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s)
in an attempt to re-obtain the old IP address again. These messages
contain the old IP as a requested-IP-address option in the message
body (correct) but also use the old IP address as the packet's source
IP (incorrect).

RFC2131 sec 4.1 states:

  DHCP messages broadcast by a client prior to that client obtaining
  its IP address must have the source address field in the IP header
  set to 0.

The use of the old IP as the packet's source address is incorrect if
(a) the computer is now on a different network or (b) it is on the
same network, but the old IP has been reallocated to another host.

Fix dhclient to use 0.0.0.0 as the source IP in this circumstance
without removing any existing functionality. Any previously-used old
IP is still requested in the body of an early DHCPREQUEST message.

PR: 199378
Submitted by: J.R. Oldroyd <fbsd@opal.com>
Reported by: J.R. Oldroyd <fbsd@opal.com>
Reviewed by: cem, asomers, vangyzen
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14527

6 years agolualoader: Replace instances of \027 with KEYSTR_ESCAPE
kevans [Tue, 27 Feb 2018 21:52:22 +0000 (21:52 +0000)]
lualoader: Replace instances of \027 with KEYSTR_ESCAPE

With exception to drawing bits, which should probably be kept as-is to not
make a mess out of things.

Reported by: rpokala (a while ago)

6 years agolualoader: Remove remnants of testing...
kevans [Tue, 27 Feb 2018 21:30:24 +0000 (21:30 +0000)]
lualoader: Remove remnants of testing...

twiddle_pos didn't need to be a module-scope local, since it's going to get
reset with every read anyways- it was left-over from other things.

screen.movecursor with a y=-1 setting was from a test of movecursor,
resulting in the twiddle characters being drawn going up the console and
looking quite funky.

6 years agolualoader: Add a twiddle at password prompt
kevans [Tue, 27 Feb 2018 21:22:57 +0000 (21:22 +0000)]
lualoader: Add a twiddle at password prompt

This gives some form of feedback while typing, and matches-(ish*) Forth
behavior. The cursor generally rests two column after the password prompt,
then the twiddle is drawn three columns later and the cursor reset to
resting position after being drawn.

I've removed the note about re-evaluating it for security considerations and
instead set it up as a module-local variable that we can set later depending
on environment or something. It's set to false with no chance of changing at
the moment.

*As close as I can tell from reading check-password.4th, because I don't
have an easy test (or deployed) setup for forth loader to check how close
it is. Please do mention if it's not close enough.

6 years agoMove #include for rijndael.h out of x86-specific region.
jhb [Tue, 27 Feb 2018 17:51:58 +0000 (17:51 +0000)]
Move #include for rijndael.h out of x86-specific region.

The #include was added inside of the conditional by accident and the lack
of it broke non-x86 builds.

Reported by: lwhsu (jenkins), andrew

6 years agoDoc __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and BROKEN_OPTIONS
imp [Tue, 27 Feb 2018 17:36:01 +0000 (17:36 +0000)]
Doc __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and BROKEN_OPTIONS
in one paragraph to highlight the relationship between them.

Suggested by: kevans@

6 years agoMove EFI up to common makefile. There's no need for all these .if's
imp [Tue, 27 Feb 2018 17:35:29 +0000 (17:35 +0000)]
Move EFI up to common makefile. There's no need for all these .if's
based on architecture.

Sponsored by: Netflix

6 years agofix typo in ipfw(8). No functional change.
asomers [Tue, 27 Feb 2018 17:12:33 +0000 (17:12 +0000)]
fix typo in ipfw(8).  No functional change.

Submitted by: zxzharmlesszxz
Pull Request: https://github.com/freebsd/freebsd/pull/132

6 years agoGive the 0th domain's page daemon thread a consistent name.
markj [Tue, 27 Feb 2018 16:51:09 +0000 (16:51 +0000)]
Give the 0th domain's page daemon thread a consistent name.

Page daemon threads for other domains show up in ps(1) output as
"pagedaemon/domN", so let that be the case for domain 0 as well.

Submitted by: Kevin Bowling <kevin.bowling@kev009.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14518

6 years agoDefine meaning of remaining clock rounding flags combinations.
mmel [Tue, 27 Feb 2018 16:08:08 +0000 (16:08 +0000)]
Define meaning of remaining clock rounding flags combinations.

MFC after: 2 weeks

6 years agoMake rtld_bind_start() debugger friendly.
mmel [Tue, 27 Feb 2018 15:35:11 +0000 (15:35 +0000)]
Make rtld_bind_start() debugger friendly.
Save link register and annotate call frame structure so debugger can unwind
call frame created by rtld_bind_start().

MFC after: 2 weeks

6 years agoSwitch to mainstream DTS for Raspberry Pi-B and Pi-2.
mmel [Tue, 27 Feb 2018 15:01:17 +0000 (15:01 +0000)]
Switch to mainstream DTS for Raspberry Pi-B  and Pi-2.
This is first step in attempt to make FreeBSD compatible with all variants of
RPi boards.

Reviewed by: gonzo
MFC after: 3 weeks

6 years agoadd ZFS_ENTER protection to .zfs/snapshot vnode operations that need it
avg [Tue, 27 Feb 2018 14:08:54 +0000 (14:08 +0000)]
add ZFS_ENTER protection to .zfs/snapshot vnode operations that need it

Those operations, zfsctl_snapdir_readdir and zfsctl_snapdir_getattr,
access the filesystem's objset and it can be unstable during operations
like receive and rollback.

MFC after: 2 weeks

6 years agolibsa: replace remaining _write callbacks by null_write
tsoome [Tue, 27 Feb 2018 12:53:25 +0000 (12:53 +0000)]
libsa: replace remaining _write callbacks by null_write

There are some _write callbacks left only returning EROFS, replace them
by null_write. return EROFS from null_write().

Reviewed by: cem, imp, kan
Differential Revision: https://reviews.freebsd.org/D14523

6 years agoFix typo.
trasz [Tue, 27 Feb 2018 10:55:33 +0000 (10:55 +0000)]
Fix typo.

Submitted by: jilles@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoImprove missing tty handling in init(8). This removes a check that did
trasz [Tue, 27 Feb 2018 10:54:15 +0000 (10:54 +0000)]
Improve missing tty handling in init(8).  This removes a check that did
nothing - it was checking for ENXIO, which, with devfs, is no longer
returned - and was badly placed anyway, and replaces it with similar
one that works, and is done just before starting getty, instead of being
done when rereading ttys(5).

From the practical point of view, this makes init(8) handle disappearing
terminals (eg /dev/ttyU*) gracefully, without unneccessary getty restarts
and resulting error messages.

Reviewed by: imp@
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14307

6 years agoFix some grammar: "signals <...> are set"
bdrewery [Tue, 27 Feb 2018 04:41:14 +0000 (04:41 +0000)]
Fix some grammar: "signals <...> are set"

6 years agoIncrease the size of a reservation granule for TLB locks
jhibbits [Tue, 27 Feb 2018 04:38:27 +0000 (04:38 +0000)]
Increase the size of a reservation granule for TLB locks

A reservation granule on PowerPC is a cache line.

On e500mc and derivatives a cacheline size is 64 bytes, not 32.  Allocate
the maximum size permitted, but only utilize the size that is needed.  On
e500v1 and e500v2 the reservation granule will still be 32 bytes.

6 years agoFix a minor typo.
jhibbits [Tue, 27 Feb 2018 04:23:03 +0000 (04:23 +0000)]
Fix a minor typo.

6 years agoInitialize all members of vm_page::md_page for armv4/5 systems. This fixes
ian [Tue, 27 Feb 2018 02:11:23 +0000 (02:11 +0000)]
Initialize all members of vm_page::md_page for armv4/5 systems.  This fixes
a hang in SI_SUB_KMEM sysinit, and is apparently required after r323290.
Inspired by the commit message for r323676.

Reported by: andreast@

6 years agoAllow physically non-contiguous chain frames allocation in mps(4)/mpr(4).
mav [Tue, 27 Feb 2018 01:48:13 +0000 (01:48 +0000)]
Allow physically non-contiguous chain frames allocation in mps(4)/mpr(4).

Chain frames required to satisfy all 2K of declared I/Os of 128KB each take
more then a megabyte of a physical memory, all of which existing code tries
allocate as physically contiguous.  This patch removes that physical
contiguousness requirement, leaving only virtual contiguousness.  I was
thinking about other ways of allocation, but the less granular allocation
becomes, the bigger is the overhead and/or complexity, reaching about 100%
overhead if allocate each frame separately.

The patch also bumps the chain frames hard limit from 2K to 16K.  It is more
than enough for the case of default REQ_FRAMES and MAXPHYS (the drivers will
allocate less than that automatically), while in case of increased MAXPHYS
it will control maximal memory usage.

Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14420

6 years agoAdd sysctls/tunables for dbuf cache size.
mav [Tue, 27 Feb 2018 01:36:43 +0000 (01:36 +0000)]
Add sysctls/tunables for dbuf cache size.

MFC after: 2 weeks

6 years agoRemove obsolete options from these kernel configs. The functionality these
ian [Tue, 27 Feb 2018 00:30:10 +0000 (00:30 +0000)]
Remove obsolete options from these kernel configs.  The functionality these
enabled is now on by default since r313330.

6 years agoAdd a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
ian [Mon, 26 Feb 2018 23:58:56 +0000 (23:58 +0000)]
Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar
to what other arches (all except riscv and armv4/5) do.

Submitted by: Hyun Hwang <hyun@caffeinated.codes>
Differential Revision: https://reviews.freebsd.org/D14465

6 years agork_cru: Add missing break
manu [Mon, 26 Feb 2018 22:57:52 +0000 (22:57 +0000)]
rk_cru: Add missing break

6 years agoDon't overflow the ipad[] array when clearing the remainder.
jhb [Mon, 26 Feb 2018 22:17:27 +0000 (22:17 +0000)]
Don't overflow the ipad[] array when clearing the remainder.

After the auth key is copied into the ipad[] array, any remaining bytes
are cleared to zero (in case the key is shorter than one block size).
The full block size was used as the length of the zero rather than the
size of the remaining ipad[].  In practice this overflow was harmless as
it could only clear bytes in the following opad[] array which is
initialized with a copy of ipad[] in the next statement.

Sponsored by: Chelsio Communications

6 years agoMove ccr_aes_getdeckey() from ccr(4) to the cxgbe(4) driver.
jhb [Mon, 26 Feb 2018 22:12:31 +0000 (22:12 +0000)]
Move ccr_aes_getdeckey() from ccr(4) to the cxgbe(4) driver.

This routine will also be used by the TOE module to manage TLS keys.

Sponsored by: Chelsio Communications

6 years agoFetch TLS key parameters from the firmware.
jhb [Mon, 26 Feb 2018 21:56:06 +0000 (21:56 +0000)]
Fetch TLS key parameters from the firmware.

The parameters describe how much of the adapter's memory is reserved for
storing TLS keys.  The 'meminfo' sysctl now lists this region of adapter
memory as 'TLS keys' if present.

Sponsored by: Chelsio Communications

6 years agoMAINTAINERS: add myself for Allwinner and 64bits RockChip
manu [Mon, 26 Feb 2018 21:50:13 +0000 (21:50 +0000)]
MAINTAINERS: add myself for Allwinner and 64bits RockChip

6 years agodwmmc_rockchip: Add support for rk3328-dw-mshc
manu [Mon, 26 Feb 2018 21:29:01 +0000 (21:29 +0000)]
dwmmc_rockchip: Add support for rk3328-dw-mshc

* Do not use pio mode like rk2928
* Change clocks frequency in update_ios

Tested-On:    Pine64 Rock64 (RK3328)

6 years agodwmmc: Add clock support and other improvements
manu [Mon, 26 Feb 2018 21:27:42 +0000 (21:27 +0000)]
dwmmc: Add clock support and other improvements

* If compiled with EXT_RESOURCES look up the "biu" and "ciu" clocks in
  the DT
* Don't use custom property "bus-frequency" but the standard one
  "clock-frequency"
* Use the DT property max-frequency and fall back to 200Mhz if it don't exists
* Add more mmc caps suported by the controller
* Always ack all interrupts
* Subclassed driver can supply an update_ios so they can handle update
  the clocks accordingly
* Take care of the DDR bit in update_ios (no functional change since we
  do not support voltage change for now)
* Make use of the FDT bus-width property

6 years agork3328: Add support for this SoC
manu [Mon, 26 Feb 2018 21:25:50 +0000 (21:25 +0000)]
rk3328: Add support for this SoC

* rk_cru is a cru driver that needs to be subclassed by
  the real CRU driver
* rk_clk_pll handle the pll type clock on RockChip SoC, it's only read
  only for now.
* rk_clk_composite handle the different composite clock types (with gate,
  with mux etc ...)
* rk_clk_gate handle the RockChip gates
* rk_clk_mux handle the RockChip muxes (unused for now)
* Only clocks for supported devices are supported for now, the rest will be
  added when driver support comes
* The assigned-clock* property are not handled for now so we rely a lot on the
  bootloader to setup some initial values for some clocks.

6 years agoEnsure signed comparison to avoid false trip of assert during VNET teardown.
pkelsey [Mon, 26 Feb 2018 20:31:16 +0000 (20:31 +0000)]
Ensure signed comparison to avoid false trip of assert during VNET teardown.

Reported by: lwhsu
MFC after: 1 month

6 years agoFix two memory leaks in syslogd
dab [Mon, 26 Feb 2018 19:27:59 +0000 (19:27 +0000)]
Fix two memory leaks in syslogd

A memory leak in syslogd for processing of forward actions was
reported. This modification adapts the patch submitted with that bug
to fix the leak. While testing the modification, another leak was also
found and fixed.

PR: 198385
Submitted by: Sreeram <sreeramabs@yahoo.com>
Reported by: Sreeram <sreeramabs@yahoo.com>
Reviewed by: hrs
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14510

6 years agoBump the size of virtual machine disk images from 20G to 30G,
gjb [Mon, 26 Feb 2018 19:26:59 +0000 (19:26 +0000)]
Bump the size of virtual machine disk images from 20G to 30G,
providing more space for a local buildworld to succeed without
attaching separate disks for /usr/src and /usr/obj.

Reported by: mckusick
MFC after: 3 days

Sponsored by: The FreeBSD Foundation

6 years agoAdd a new variant of the GLA2GPA ioctl for use by the debug server.
jhb [Mon, 26 Feb 2018 19:19:05 +0000 (19:19 +0000)]
Add a new variant of the GLA2GPA ioctl for use by the debug server.

Unlike the existing GLA2GPA ioctl, GLA2GPA_NOFAULT does not modify
the guest.  In particular, it does not inject any faults or modify
PTEs in the guest when performing an address space translation.

This is used by bhyve's debug server to read and write memory for
the remote debugger.

Reviewed by: grehan
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D14075

6 years agonv was moved to the 9 section.
oshogbo [Mon, 26 Feb 2018 19:08:27 +0000 (19:08 +0000)]
nv was moved to the 9 section.
Fix reference to it.

6 years agoImprove wording of error message when CROSS_TOOLCHAIN is not found.
brooks [Mon, 26 Feb 2018 19:02:11 +0000 (19:02 +0000)]
Improve wording of error message when CROSS_TOOLCHAIN is not found.

Reported by: emaste, jhb

6 years agoFix a typo: "now" -> "no".
jhb [Mon, 26 Feb 2018 18:50:39 +0000 (18:50 +0000)]
Fix a typo: "now" -> "no".

6 years agolibsa: Partially revert r330023
kevans [Mon, 26 Feb 2018 18:24:24 +0000 (18:24 +0000)]
libsa: Partially revert r330023

The removal of tmo >= MAXTMO check should not have been done; this is
specifically what handles timeout if MAXWAIT == 0.

MFC after: 1 week

6 years agoiconv uses strlen directly on user supplied memory
dab [Mon, 26 Feb 2018 18:23:36 +0000 (18:23 +0000)]
iconv uses strlen directly on user supplied memory

`iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the
size of user strings, such that several out of bounds reads could have
been possible.

static int
iconv_sysctl_add(SYSCTL_HANDLER_ARGS)
{
struct iconv_converter_class *dcp;
struct iconv_cspair *csp;
struct iconv_add_in din;
struct iconv_add_out dout;
int error;

error = SYSCTL_IN(req, &din, sizeof(din));
if (error)
return error;
if (din.ia_version != ICONV_ADD_VER)
return EINVAL;
if (din.ia_datalen > ICONV_CSMAXDATALEN)
return EINVAL;
if (strlen(din.ia_from) >= ICONV_CSNMAXLEN)
return EINVAL;
if (strlen(din.ia_to) >= ICONV_CSNMAXLEN)
return EINVAL;
if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN)
return EINVAL;
...

Since the `din` struct is directly copied from userland, there is no
guarantee that the strings supplied will be NULL terminated. The
`strlen` calls could continue reading past the designated buffer
sizes.

Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`:

struct iconv_add_in {
int ia_version;
char ia_converter[ICONV_CNVNMAXLEN];
char ia_to[ICONV_CSNMAXLEN];
char ia_from[ICONV_CSNMAXLEN];
int ia_datalen;
const void *ia_data;
};

Our strings are followed by the `ia_datalen` member, which is checked
before the `strlen` calls:

if (din.ia_datalen > ICONV_CSMAXDATALEN)

Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`),
this ensures that `din.ia_datalen` contains at least 1 byte of 0, so
it is not possible to trigger a read out of bounds of the `struct`
however, this code is fragile and could introduce subtle bugs in the
future if the `struct` is ever modified.

PR: 207302
Submitted by: CTurt <cturt@hardenedbsd.org>
Reported by: CTurt <cturt@hardenedbsd.org>
Reviewed by: jhb, vangyzen
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14521

6 years agolibsa: Move MAXWAIT from net.h to net.c
kevans [Mon, 26 Feb 2018 18:14:37 +0000 (18:14 +0000)]
libsa: Move MAXWAIT from net.h to net.c

It's not a setting that has any effect or use outside of the net.c context.

6 years agoFix typo.
oshogbo [Mon, 26 Feb 2018 18:06:15 +0000 (18:06 +0000)]
Fix typo.

6 years ago.Xr rctl(8) and cpuset(1).
trasz [Mon, 26 Feb 2018 18:04:17 +0000 (18:04 +0000)]
.Xr rctl(8) and cpuset(1).

PR: 225935
Submitted by: D. Ebdrup <debdrup at gmail.com> (earlier version)
MFC after: 2 weeks

6 years agolibsa: Add MAXWAIT to net for establishing max total timeout
kevans [Mon, 26 Feb 2018 18:01:35 +0000 (18:01 +0000)]
libsa: Add MAXWAIT to net for establishing max total timeout

Current timeout behavior is to progress in timeout values from MINTMO to
MAXTMO in MINTMO steps before finally timing out. This results in a fairly
long time before operations finally timeout, which may not be ideal for some
use-cases.

Add MAXWAIT that may be configured along with MINTMO/MAXTMO. If we attempt
to start our send/recv cycle over again but MAXWAIT > 0 and MAXWAIT seconds
have already passed, then go ahead and timeout.

This is intended for those that just want to say "timeout after 180 seconds"
rather than calculate and tweak MINTMO/MAXTMO to get their desired timeout.
The default is 0, or "progress from MINTMO to MAXTMO with no exception."

This has been modified since review to allow for it to be defined via CFLAGS
and doing appropriate error checking. Future work may add some Makefile foo
to respect LOADER_NET_MAXWAIT if it's specified in the environment and pass
it in as MAXWAIT accordingly.

Reviewed by: imp, sbruno, tsoome (all previous version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14389

6 years agoFix gettytab(5) to document f0, f1, and f2 as unsupported; they've been gone
trasz [Mon, 26 Feb 2018 17:51:18 +0000 (17:51 +0000)]
Fix gettytab(5) to document f0, f1, and f2 as unsupported; they've been gone
since r131091.

PR:             184691 (partial)
Submitted by:   naddy@
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation

6 years agoThese two directories build man pages, so it's incorrect to tag them
imp [Mon, 26 Feb 2018 15:41:20 +0000 (15:41 +0000)]
These two directories build man pages, so it's incorrect to tag them
NO_OBJ. Also, make sure the loader.conf.5 man gets built and installed.

6 years agolualoader: Re-work menu skipping bits
kevans [Mon, 26 Feb 2018 15:37:32 +0000 (15:37 +0000)]
lualoader: Re-work menu skipping bits

This is motivated by a want to reduce heap usage if the menu is being
skipped. Currently, the menu module must be loaded regardless of whether
it's being skipped or not, which adds a cool ~50-100KB worth of memory
usage.

Move the menu skip logic out to core (and remove a debug print), then check
in loader.lua if we should be skipping the menu and avoid loading the menu
module entirely if so. This keeps our memory usage below ~115KB for a boot
with the menu stripped.

Also worth noting: with this change, we no longer explicitly invoke autoboot
if we're skipping the menu. Instead, we let the standard loader behavior
apply: try to autoboot if we need to, then drop to a loader prompt if not or
if the autoboot sequence is interrupted. The only thing we still handle
before dropping to the loader autoboot sequence is loadelf(), so that we can
still apply any of our kernel loading behavior.

6 years agoofw_fdt: Simplify parts with new libfdt methods
kevans [Mon, 26 Feb 2018 14:00:23 +0000 (14:00 +0000)]
ofw_fdt: Simplify parts with new libfdt methods

libfdt now provides methods to iterate through subnodes and properties in a
convenient fashion.

Replace our ofw_fdt_{peer,child} searches with calls to their corresponding
libfdt methods. Rework ofw_fdt_nextprop to use the
fdt_for_each_property_offset macro, making it even more obvious what it's
doing.

No functional change intended.

Reviewed by: nwhitehorn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14225

6 years agoIn do_ast, make sure the interrupts are enabled before calling ast().
cognet [Mon, 26 Feb 2018 13:12:51 +0000 (13:12 +0000)]
In do_ast, make sure the interrupts are enabled before calling ast().
We can reach that point with IRQs disabled, and calling ast() with IRQs \7f
disabled can lead to a deadlock.
This should fix the freezes on arm64 under load.

Reviewed by: andrew

6 years agoCheck all entries in the ACPI uart compat table and not just the first.
andrew [Mon, 26 Feb 2018 08:45:38 +0000 (08:45 +0000)]
Check all entries in the ACPI uart compat table and not just the first.

Sponsored by: DARPA, AFRL

6 years agostyle.lua(9): Add some additional notes about naming and commas
kevans [Mon, 26 Feb 2018 04:55:08 +0000 (04:55 +0000)]
style.lua(9): Add some additional notes about naming and commas

camelCase tends to be preferred for function identifiers, while
internal_underscores are preferred for variable identifiers. This convention
makes it a little bit easier to eyeball whether variable/function usage is
correct.

The optional commas for final table values are preferred to reduce chances
for error.

6 years agoAdd MAINTAINERS note for lualoader (stand/lua, specifically)
kevans [Mon, 26 Feb 2018 04:33:05 +0000 (04:33 +0000)]
Add MAINTAINERS note for lualoader (stand/lua, specifically)

While it's a work in progress, at least, I would like a chance to review any
lua that goes into the tree for lualoader. I am also willing to help others
get started writing features or fixing any bugs wandered across.

6 years agolualoader: screen argument fixes
kevans [Mon, 26 Feb 2018 04:12:54 +0000 (04:12 +0000)]
lualoader: screen argument fixes

screen was also guilty of not-so-great argument names, but it was also
guilty of handling color sequences on its own. Change those bits to using
the color module instead.

As a side note, between color and screen, I'm not 100% sure that returning
the color_value is the right thing to do if we won't generate the escape
sequences. This should be re-evaluated at a later time, and they should
likely return nil instead.

6 years agolualoader: More argument name expansion, part 2
kevans [Mon, 26 Feb 2018 04:08:54 +0000 (04:08 +0000)]
lualoader: More argument name expansion, part 2

screen also has some instances, but it also has other cleanup to go with it.
Because of this, I will be committing the screen changes separately.

6 years agolualoader: A little more general menu cleanup
kevans [Mon, 26 Feb 2018 03:46:17 +0000 (03:46 +0000)]
lualoader: A little more general menu cleanup

Instead of a single-letter parameter ('m'), use something a little more
descriptive and meaningful: 'menudef' ("menu definition") -- these functions
expect to be passed a menudef, so call it what it is.

While here, throw an assertion in that we have a handler for the selected
menu item. This is more of a debugging aide so that it's more obvious when
one is testing a menudef that they've added an entry item that we don't
handle.

This is an improvement over the past behavior of ignoring the unknown menu
entry.

6 years agoloader.conf is loader agnostic, so remove 4th references.
imp [Mon, 26 Feb 2018 03:16:57 +0000 (03:16 +0000)]
loader.conf is loader agnostic, so remove 4th references.

6 years agoTake a meat cleaver to defaults/loader.conf
imp [Mon, 26 Feb 2018 03:16:53 +0000 (03:16 +0000)]
Take a meat cleaver to defaults/loader.conf

Remove almost all of the _load=XXX options (kept only those relevant
to splash screens, since there were other settings).
Remove the excessively cutesy comment blocks.
Remove excessive comments and replace with similar content
Remove gratuitous blank lines (while leaving some)

We have too many modules to list them all here. There's no purpose in
doing so and it's a giant hassle to maintain. In addition the extra
~500 lines slow this down on small platforms. It slowed it down
so much small platforms forked, which caused other issues...
This is a compromise between those two extremes.

6 years agoGo back to one loader.conf
imp [Mon, 26 Feb 2018 03:16:47 +0000 (03:16 +0000)]
Go back to one loader.conf

We really only need one loader.conf. The other loader.conf was created
because the current one took forever to parse in FORTH. That will be
fixed in the next commit.

6 years agoAdd NO_OBJ to those directories that don't make anything.
imp [Mon, 26 Feb 2018 03:16:04 +0000 (03:16 +0000)]
Add NO_OBJ to those directories that don't make anything.

For directories that don't many anything, add NO_OBJ=t just before we
include bsd.init.mk. This prevents them from creating an OBJ
directory. In addition, prevent defs.mk from creating the machine
related links in these cases. They aren't needed and break, at least
on stable, the read-only src tree build.

6 years agoCorrect a copy&paste-o -- altivec assist interrupt, not watchdog
jhibbits [Mon, 26 Feb 2018 03:05:36 +0000 (03:05 +0000)]
Correct a copy&paste-o -- altivec assist interrupt, not watchdog

6 years agoGreatly reduce the number of #ifdefs supporting the TCP_RFC7413 kernel option.
pkelsey [Mon, 26 Feb 2018 03:03:41 +0000 (03:03 +0000)]
Greatly reduce the number of #ifdefs supporting the TCP_RFC7413 kernel option.

The conditional compilation support is now centralized in
tcp_fastopen.h and tcp_var.h. This doesn't provide the minimum
theoretical code/data footprint when TCP_RFC7413 is disabled, but
nearly all the TFO code should wind up being removed by the optimizer,
the additional footprint in the syncache entries is a single pointer,
and the additional overhead in the tcpcb is at the end of the
structure.

This enables the TCP_RFC7413 kernel option by default in amd64 and
arm64 GENERIC.

Reviewed by: hiren
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14048

6 years agoThis is an implementation of the client side of TCP Fast Open (TFO)
pkelsey [Mon, 26 Feb 2018 02:53:22 +0000 (02:53 +0000)]
This is an implementation of the client side of TCP Fast Open (TFO)
[RFC7413]. It also includes a pre-shared key mode of operation in
which the server requires the client to be in possession of a shared
secret in order to successfully open TFO connections with that server.

The names of some existing fastopen sysctls have changed (e.g.,
net.inet.tcp.fastopen.enabled -> net.inet.tcp.fastopen.server_enable).

Reviewed by: tuexen
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14047

6 years agoFix harmless locking bug in tfp_fastopen_check_cookie().
pkelsey [Mon, 26 Feb 2018 02:43:26 +0000 (02:43 +0000)]
Fix harmless locking bug in tfp_fastopen_check_cookie().

The keylist lock was not being acquired early enough.  The only side
effect of this bug is that the effective add time of a new key could
be slightly later than it would have been otherwise, as seen by a TFO
client.

Reviewed by: tuexen
MFC after: 1 month
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14046

6 years agoAdd a SPI driver for imx5 and imx6.
ian [Mon, 26 Feb 2018 02:28:32 +0000 (02:28 +0000)]
Add a SPI driver for imx5 and imx6.

It can be compiled into the kernel with "device imx_spi" or loaded as a
module, which is also named "imx_spi".

6 years agoUse a more straight-forward approach to relaxing the location
mckusick [Mon, 26 Feb 2018 00:34:56 +0000 (00:34 +0000)]
Use a more straight-forward approach to relaxing the location
restraints when validating one of the backup superblocks.

6 years agoConsistent casing for fallback SIGCHLD (s/Unknown/unknown/)
dteske [Mon, 26 Feb 2018 00:04:21 +0000 (00:04 +0000)]
Consistent casing for fallback SIGCHLD (s/Unknown/unknown/)

6 years agoUpdates and enhancements to signal.d to aid DTrace scripting
dteske [Sun, 25 Feb 2018 23:59:47 +0000 (23:59 +0000)]
Updates and enhancements to signal.d to aid DTrace scripting

+ Add missing signals SIGTHR (32) and SIGLIBRT (33)
+ Add inline for converting SIG* int to string
+ Add inline for converting CLD_* int to string

Reviewed by: markj
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D14497

6 years agomac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko
eugen [Sun, 25 Feb 2018 23:10:13 +0000 (23:10 +0000)]
mac_portacl(4): stop panicing INVARIANTS-enabled kernel by loading .ko
when kernel already has options MAC_PORTACL.

PR: 183817
Approved by: avg (mentor)
MFC after: 1 week

6 years agoAllow CROSS_TOOLCHAIN to be a path to a file.
brooks [Sun, 25 Feb 2018 20:21:30 +0000 (20:21 +0000)]
Allow CROSS_TOOLCHAIN to be a path to a file.

This allows working with custom cross toolchains without the need to
create files in /usr/local/share/toolchains.

Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14178

6 years agoPrevent getty(8) from looping indefinitely if the device node doesn't
trasz [Sun, 25 Feb 2018 20:15:06 +0000 (20:15 +0000)]
Prevent getty(8) from looping indefinitely if the device node doesn't
exist. This behaviour makes no sense for eg USB serial adapters, or
USB device-side serial templates.

This mostly reverts to pre-r135941 behaviour.

Reviewed by: imp@
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14198

6 years agoTeach the Arm pl011 driver to attach to a SBSA uart. This is defined in
andrew [Sun, 25 Feb 2018 19:43:00 +0000 (19:43 +0000)]
Teach the Arm pl011 driver to attach to a SBSA uart. This is defined in
the Server Base System Architecture to be a subset of the pl011 r1p5. As
we don't use the removed features it is safe to just attach to the existing
driver as is.

Sponsored by: DARPA, AFRL

6 years agoRename the FDT compat_data array to a bus-specific name.
andrew [Sun, 25 Feb 2018 19:33:27 +0000 (19:33 +0000)]
Rename the FDT compat_data array to a bus-specific name.

Sponsored by: DARPA, AFRL

6 years agoAdd support for booting into kdb on arm platforms when the RB_KDB is set
ian [Sun, 25 Feb 2018 18:42:59 +0000 (18:42 +0000)]
Add support for booting into kdb on arm platforms when the RB_KDB is set
(using "boot -d" at the loader propmt or setting boot_ddb in loader.conf).

Submitted by: Thomas Skibo <thomasskibo@yahoo.com>
Differential Revision: https://reviews.freebsd.org/D14428

6 years agoInstead of building ofw_iicbus as a separate module, just compile it in to
ian [Sun, 25 Feb 2018 18:26:50 +0000 (18:26 +0000)]
Instead of building ofw_iicbus as a separate module, just compile it in to
the iicbus module for FDT-based systems.

The primary motivation for this is that host controller drivers which
declare DRIVER_MODULE(ofw_iicbus, thisdriver, etc, etc) now only need a
single MODULE_DEPEND(thisdriver, ofw_iicbus) for runtime linking to resolve
all the symbols.  With ofw_iicbus and iicbus in separate modules, drivers
would need to declare a MODULE_DEPEND() on both, because symbol lookup is
non-recursive through the dependency chain.  Requiring a driver to have
MODULE_DEPENDS() on both amounts to requiring the drivers to understand the
kobj inheritence details of how ofw_iicbus is implemented, which seems like
something they shouldn't have to know (and could even change some day).

Also, this is somewhat analogous to how the drivers get built when compiled
into the kernel.  You don't have to ask for ofw_iicbus separately, it just
gets built in along with iicbus when option FDT is in effect.

6 years agolualoader: Track the menu currently drawn, instead of validity
kevans [Sun, 25 Feb 2018 17:02:50 +0000 (17:02 +0000)]
lualoader: Track the menu currently drawn, instead of validity

This cleans up the odd approach to menu drawing. Instead of tracking
validity, we track the menu that was drawn on the screen. Whenever we draw a
menu, we'll set this to that menu.

Anything that invalidates the screen should go ahead and trigger an explicit
redraw, rather than finding a wy to set screen_invalid.

The currently drawn menu is then reset in menu.run as we exit the menu
system, so that dropping to the loader prompt or leaving menu.run() will
just behave as expected without doing redundant work every time we leave a
menu.

6 years agolualoader: Invalidate the screen from menu perspective upon mnu exit
kevans [Sun, 25 Feb 2018 16:29:02 +0000 (16:29 +0000)]
lualoader: Invalidate the screen from menu perspective upon mnu exit

In the common case, this will effectively do nothing as the menu will get
redrawn as we leave submenus regardless of whether the screen has been
marked invalid or not

However, upon escape to the loader prompt, one could do either of the
following to re-enter the menu system:

-- Method 1
require('menu').run()

-- Method 2
require('menu').process(menu.default)

With method 1, the menu will get redrawn anyways as we do this before
autoboot checking upon entry. With method 2, however, the menu will not be
redrawn without this invalidation.

Both methods are acceptable for re-entering the menu system, although the
latter method in the local module for processing new and interesting menus
is more expected.

6 years agoDon't generate data in sysctl_out_proc unless we intend to copy out.
mjg [Sun, 25 Feb 2018 15:16:58 +0000 (15:16 +0000)]
Don't generate data in sysctl_out_proc unless we intend to copy out.

The first call is used to gauge how much spaces is needed. Just computing
the size instead of generating the output allows to not take the proctree
lock.

6 years agoDon't declare __assfail as static
asomers [Sun, 25 Feb 2018 14:29:43 +0000 (14:29 +0000)]
Don't declare __assfail as static

It gets called by dmu_buf_init_user, which is inline but not static.  So it
needs global linkage itself.

Reported by: GCC-6
MFC after: 17 days
X-MFC-With: 329722

6 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Sun, 25 Feb 2018 13:20:32 +0000 (13:20 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
6.0.0 (branches/release_60 r325932).  This corresponds to 6.0.0 rc3.

MFC after: 3 months
X-MFC-With: r327952
PR: 224669

6 years agopf: Cope with overly large net.pf.states_hashsize
kp [Sun, 25 Feb 2018 08:56:44 +0000 (08:56 +0000)]
pf: Cope with overly large net.pf.states_hashsize

If the user configures a states_hashsize or source_nodes_hashsize value we may
not have enough memory to allocate this. This used to lock up pf, because these
allocations used M_WAITOK.

Cope with this by attempting the allocation with M_NOWAIT and falling back to
the default sizes (with M_WAITOK) if these fail.

PR: 209475
Submitted by: Fehmi Noyan Isi <fnoyanisi AT yahoo.com>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14367

6 years agolualoader: Explain deviation from naming guidelines
kevans [Sun, 25 Feb 2018 05:14:06 +0000 (05:14 +0000)]
lualoader: Explain deviation from naming guidelines

cli_execute is likely the only exception that we should make, due to it
being a global. We don't really need other globals, so this won't really end
up an epidemic.

6 years agolualoader: Pull autoboot handling out into menu.run()
kevans [Sun, 25 Feb 2018 05:00:54 +0000 (05:00 +0000)]
lualoader: Pull autoboot handling out into menu.run()

There's no reason for autoboot handling to be mixed in with menu processing.
It is a distinct process that should only be done once when entering the
menu system.

menu.process has been modified to take an initial keypress to process and to
only draw the screen initially if it's been invalidated. The keypress is
kind of a kludge, although it could be argued to be a potentially useful
kludge if there are other processes that may need to feed a keypress into
the menu system.

6 years agolualoader: Pull menu redrawing specifics out of menu.process
kevans [Sun, 25 Feb 2018 04:44:45 +0000 (04:44 +0000)]
lualoader: Pull menu redrawing specifics out of menu.process

In general, every menu redraw is going to require a screen clear and cursor
reset. Each redraw also has the potential to invalidate the alias table, so
we move the alias table being used out into a module variable. This allows
third party consumers to also inspect or update the alias table if they need
to.

While here, stop searching the alias table once we've found a match.

6 years agolualoader: Clean up menu handling a little bit
kevans [Sun, 25 Feb 2018 04:11:08 +0000 (04:11 +0000)]
lualoader: Clean up menu handling a little bit

This is driven by an urge to separate out the bits that really only need to
happen when the menu system starts up. Key points:

- menu.process now does the bulk of menu handling. It retains autoboot
  handling for dubious reasons, and it no longer accepts a 'nil' menu to
  process as 'the default'. Its return value is insignificant.
- The MENU_SUBMENU handler now returns nothing. If menu.process has exited,
  then we continue processing menu items on the parent menu as expected.
- menu.run is now the entry point of the menu system. It checks whether the
  menu should be skipped, processes the default menu, then returns.

6 years agolualoader: menu: Terminate final values in tables with a comma
kevans [Sun, 25 Feb 2018 03:33:25 +0000 (03:33 +0000)]
lualoader: menu: Terminate final values in tables with a comma

6 years agolualoader: Don't explicitly index tables without reason
kevans [Sun, 25 Feb 2018 03:30:24 +0000 (03:30 +0000)]
lualoader: Don't explicitly index tables without reason

These indices were assigned the same values as they would've been implicitly
assigned anyways.

While here, throw terminating commas after the last value of tables.

6 years agoFix issues with sparse cpu allocation. Consistently use mp_maxid + 1.
jeff [Sun, 25 Feb 2018 00:35:21 +0000 (00:35 +0000)]
Fix issues with sparse cpu allocation.  Consistently use mp_maxid + 1.

Reported by: pho
Reviewed by: markj
Sponsored by: Netflix, Dell/EMC Isilon