]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoDon't close fd twice. This line should have been deleted in r327279.
imp [Fri, 5 Jan 2018 05:34:20 +0000 (05:34 +0000)]
Don't close fd twice. This line should have been deleted in r327279.

CID: 1384015

6 years agoOnly call close if fd and fd1 are not -1.
imp [Fri, 5 Jan 2018 05:34:14 +0000 (05:34 +0000)]
Only call close if fd and fd1 are not -1.

CID: 13840181384017

6 years agoFix cut and paste error from devinfo.8 origin of this file
imp [Fri, 5 Jan 2018 05:02:09 +0000 (05:02 +0000)]
Fix cut and paste error from devinfo.8 origin of this file

Noticed by: kevans@

6 years agohexdump(1): Speed up -s flag on devices
kevans [Fri, 5 Jan 2018 01:46:41 +0000 (01:46 +0000)]
hexdump(1): Speed up -s flag on devices

Using the -s flag on devices is extraordinarily slow due to using fseek(3) a
little too conservatively. Address this by using fseek on character/block
devices as well, falling back to getchar(3) only if we fail to seek or we're
operating on tape drives, where fseek may succeed while not actually being
supported.

PR: 86485
Submitted by: arundel (originally; modified since then)
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10939

6 years agoRevert r327360, which can cause boot problems on high-CPU-count (>60)
nwhitehorn [Thu, 4 Jan 2018 23:07:51 +0000 (23:07 +0000)]
Revert r327360, which can cause boot problems on high-CPU-count (>60)
POWER8 and POWER9 systems, pending further analysis.

PR: 224841

6 years agofind: Speed up tests by using touch -d instead of sleep for timestamps
jilles [Thu, 4 Jan 2018 22:59:24 +0000 (22:59 +0000)]
find: Speed up tests by using touch -d instead of sleep for timestamps

I have verified that the tests still detect the absence of the r327362 fix.

6 years agoif_awg: Use syscon prop if it exists
kevans [Thu, 4 Jan 2018 22:37:15 +0000 (22:37 +0000)]
if_awg: Use syscon prop if it exists

The emac bindings that are landing in Linux 4.15 specify a syscon property
on the emac node that point to /soc/syscon. Use this property if it's
specified, but maintain backwards compatibility with the old method.

The older method is still used for boards that we get .dtb from u-boot, such
as pine64, that did not yet have stable emac bindings.

Tested on: Banana Pi-M3 (a83t)
Tested on: Pine64 (a64)
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13296

6 years agoAlways use atomic_fetchadd() when updating per-user accounting values.
jhb [Thu, 4 Jan 2018 22:07:58 +0000 (22:07 +0000)]
Always use atomic_fetchadd() when updating per-user accounting values.

This avoids re-reading a variable after it has been updated via an
atomic op.  It is just a cosmetic cleanup as the read value was only
used to control a diagnostic printf that should rarely occur (if ever).

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D13768

6 years agoReport offset relative to the backing object for kinfo_vmentry structures.
jhb [Thu, 4 Jan 2018 21:59:34 +0000 (21:59 +0000)]
Report offset relative to the backing object for kinfo_vmentry structures.

For the pathname reported in kinfo_vmentry structures (kve_path), the
sysctl handlers walk the object chain to find the bottom-most VM object.
This permits a COW mapping of a file with dirty pages to report the
pathname of the originally mapped file.  Do the same for the object
offset (kve_offset) computing a cumulative offset during the same object
walk so that the reported offset is relative to the reported pathname.

Note that ptrace(PT_VM_ENTRY) already returns a cumulative offset
rather than the raw offset of the VM map entry.

Note also that this does not affect procstat -v output (even structured
output) since that output does not include the kve_offset field.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D13767

6 years agoAllow timed waits with relative timeouts on locks and condvars.
ed [Thu, 4 Jan 2018 21:57:37 +0000 (21:57 +0000)]
Allow timed waits with relative timeouts on locks and condvars.

Even though pthreads doesn't support this, there are various alternative
APIs that use this. For example, uv_cond_timedwait() accepts a relative
timeout. So does Rust's std::sync::Condvar::wait_timeout().

Though I personally think that relative timeouts are bad (due to
imprecision for repeated operations), it does seem that people want
this. Extend the existing futex functions to keep track of whether an
absolute timeout is used in a boolean flag.

MFC after: 1 month

6 years agoDisabled the use of flowid for lagg by default
smh [Thu, 4 Jan 2018 20:05:47 +0000 (20:05 +0000)]
Disabled the use of flowid for lagg by default

Disabled the use of RSS hash from the network card aka flowid for
lagg(4) interfaces by default as it's currently incompatible with
the lacp and loadbalance protocols.

The incompatibility is due to the fact that the flowid isn't know
for the first packet of a new outbound stream which can result in
the hash calculation method changing and hence a stream being
incorrectly split across multiple interfaces during normal
operation.

This can be re-enabled by setting the following in loader.conf:
net.link.lagg.default_use_flowid="1"

Discussed with: kmacy
Sponsored by: Multiplay

6 years agobhnd(4): Add missing BCM4312 backplane clock speed entry.
landonf [Thu, 4 Jan 2018 19:47:01 +0000 (19:47 +0000)]
bhnd(4): Add missing BCM4312 backplane clock speed entry.

The default 80MHz clock speed returned by bhnd_pmu_si_clock() was already
correct; this just prevents the "No backplane clock specified" warning
printf from being emitted when querying backplane clock speed.

Sponsored by: The FreeBSD Foundation

6 years agoRestructure swapout tests after vm map locking was removed.
kib [Thu, 4 Jan 2018 18:14:58 +0000 (18:14 +0000)]
Restructure swapout tests after vm map locking was removed.

Consolidate the regions covered by the process lock.
Combine similar conditions tests into one, e.g. all process flags can
be test with one logical operation.
Add check for in-exec state, since p_vmspace is dererenced.
Remove labels and goto by explicitly tracking state.
Update comments.

Reviewed by: alc, markj (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D13693

6 years agoRemove myself from ports-secteam
junovitch [Thu, 4 Jan 2018 17:58:48 +0000 (17:58 +0000)]
Remove myself from ports-secteam

I will be moving on to other life commitments this year and will not have
the time to support contributions as a ports committer, if able, until life
settles at the end of the year.

Discussed with: portmgr

6 years agocap_unwrap should return a descriptor but also free the structure.
oshogbo [Thu, 4 Jan 2018 08:23:23 +0000 (08:23 +0000)]
cap_unwrap should return a descriptor but also free the structure.

6 years agoCorrect function name in description block.
cy [Thu, 4 Jan 2018 04:11:40 +0000 (04:11 +0000)]
Correct function name in description block.

MFC after: 3 days

6 years agoAdd missing macro in man page.
oshogbo [Thu, 4 Jan 2018 04:04:29 +0000 (04:04 +0000)]
Add missing macro in man page.

Reported by: brueffer@

6 years agoOnce we have decided to swap out a process, don't delay the laundering of
alc [Thu, 4 Jan 2018 03:16:32 +0000 (03:16 +0000)]
Once we have decided to swap out a process, don't delay the laundering of
its per-thread kernel stack pages by making them pass through the inactive
queue first.  Instead, immediately place them in the laundry so that they
might be cleaned and made available for reclamation sooner.

Reviewed by: kib, markj
MFC after: 1 week

6 years agoThe recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
andreast [Wed, 3 Jan 2018 20:20:43 +0000 (20:20 +0000)]
The recent bump of MAXDSIZ made 32-bit binary execution on 64-bit powerpc fail.
The data segement was too big.

Add a fix-up function like on ia32 for MAXDSIZ.

While here, bring also the MAXSSIZ closer to amd64 and add an equal fix-up
function for MAXSSIZ.

Reviewed by: jhibbits@
Obtained from:  jhibbits@
Differential Revision: https://reviews.freebsd.org/D13753

6 years agoath: fix possible memory disclosure in ioctl handler
emaste [Wed, 3 Jan 2018 19:28:13 +0000 (19:28 +0000)]
ath: fix possible memory disclosure in ioctl handler

Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
MFC after: 1 week

6 years agocxgbe(4): Add a knob to enable/disable PCIe relaxed ordering. Disable it by
np [Wed, 3 Jan 2018 19:24:57 +0000 (19:24 +0000)]
cxgbe(4): Add a knob to enable/disable PCIe relaxed ordering.  Disable it by
default when running on Intel CPUs.

This is a crude fix for the performance issues alluded to in these Linux commits:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87e09cdec4dae08acdb4aa49beb793c19d73e73e
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a99b646afa8a02571ea298bedca6592d818229cd

MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoath: revert accidental change committed with r327526
emaste [Wed, 3 Jan 2018 19:24:21 +0000 (19:24 +0000)]
ath: revert accidental change committed with r327526

It will be recommitted with the correct commit message.

6 years agoembed_mfs: correctly test grep return value
emaste [Wed, 3 Jan 2018 19:22:10 +0000 (19:22 +0000)]
embed_mfs: correctly test grep return value

Reported by: br
MFC with: r326992
Sponsored by: The FreeBSD Foundation

6 years agoAdd missing newlines to a couple of error messages.
markj [Wed, 3 Jan 2018 18:19:47 +0000 (18:19 +0000)]
Add missing newlines to a couple of error messages.

Keep error messages on a single line so that they're easier to grep for.

Reported by: pho
MFC after: 1 week

6 years agoUse 'extern uint8_t' instead of 'extern void' for external symbols.
jhb [Wed, 3 Jan 2018 17:40:51 +0000 (17:40 +0000)]
Use 'extern uint8_t' instead of 'extern void' for external symbols.

The beri boot loaders depend on symbols defined in linker scripts or
assembly files.  The boot loaders do not care about the type of these
symbols but just want to extract a pointer to them.  Older versions of
GCC permitted external symbols to be declared of type 'void' and then
'&foo' generated a void pointer to the memory at the symbol's address.
However, void objects are not valid C and newer versions of GCC error if
these are used.  Instead, declare these symbols as being bytes (or
an array of bytes in the cheri_sdcard_vaddr case).

Sponsored by: DARPA / AFRL

6 years agoDon't clobber system LDFLAGS for beri boot loaders.
jhb [Wed, 3 Jan 2018 17:35:38 +0000 (17:35 +0000)]
Don't clobber system LDFLAGS for beri boot loaders.

Prior to r325114, bsd.init.mk was included after assignments to CFLAGS and
LDFLAGS in these Makefiles.  After r325114, bare assignments (= rather than
+=) lost system-assigned default values that are needed when compiling with
an external toolchain.  CFLAGS in both Makefiles already uses +=.  This
commit changes LDFLAGS to use +=.  While here, depend on the LDFLAGS update
in the parent Makefile.inc to set -nostdlib.

Sponsored by: DARPA / AFRL

6 years agoFix warnings from "mandoc -Tlint -Wwarning".
trasz [Wed, 3 Jan 2018 17:28:01 +0000 (17:28 +0000)]
Fix warnings from "mandoc -Tlint -Wwarning".

Reported by: Yuri Pankov <yuripv at gmx.com>
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agomorse(6): fix two typod
eadler [Wed, 3 Jan 2018 17:04:13 +0000 (17:04 +0000)]
morse(6): fix two typod

6 years agoUse the new SDM-approved way to serialize x2APIC MSR writes.
kib [Wed, 3 Jan 2018 11:23:47 +0000 (11:23 +0000)]
Use the new SDM-approved way to serialize x2APIC MSR writes.

SDM editions 64 and below stated that it is enough to use MFENCe or
LFENCE to serialize x2APIC register writes.  New edition 65 requires
either full serialization instruction or MFENCE;LFENCE sequence.  Use
the later, FreeBSD needs serialization to ensure that writes done
before IPI request are visible to the target IPI CPU.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoEliminate a paranthesis which is both unneeded and causing trouble.
phk [Wed, 3 Jan 2018 09:33:59 +0000 (09:33 +0000)]
Eliminate a paranthesis which is both unneeded and causing trouble.

6 years agomorse(6): add a few missing characters
eadler [Wed, 3 Jan 2018 09:08:32 +0000 (09:08 +0000)]
morse(6): add a few missing characters

- add ñ, ', and _
- remove lint support
- add missing header for ioctl

6 years agoNLS data and tz can be cached using caspicum helpers.
oshogbo [Wed, 3 Jan 2018 07:43:04 +0000 (07:43 +0000)]
NLS data and tz can be cached using caspicum helpers.

Using them we simplifies and unifies sandboxed code.

6 years agoAdd info about SW_WATCHDOG change to be dynamic in the common case.
karels [Wed, 3 Jan 2018 06:41:39 +0000 (06:41 +0000)]
Add info about SW_WATCHDOG change to be dynamic in the common case.

6 years agoDocument services which we have in libcasper.
oshogbo [Wed, 3 Jan 2018 06:22:40 +0000 (06:22 +0000)]
Document services which we have in libcasper.

Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D13734

6 years agobsd-family-tree: revert r327333
eadler [Wed, 3 Jan 2018 03:46:28 +0000 (03:46 +0000)]
bsd-family-tree: revert r327333

bsd-family-tree should only contain projects that have had actual
releases.

Requested by: core

6 years agomake SW_WATCHDOG dynamic
karels [Wed, 3 Jan 2018 00:56:30 +0000 (00:56 +0000)]
make SW_WATCHDOG dynamic

Enable the hardclock-based watchdog previously conditional on the
SW_WATCHDOG option whenever hardware watchdogs are not found, and
watchdogd attempts to enable the watchdog. The SW_WATCHDOG option
still causes the sofware watchdog to be enabled even if there is a
hardware watchdog. This does not change the other software-based
watchdog enabled by the --softtimeout option to watchdogd.

Note that the code to reprime the watchdog during kernel core dumps is
no longer conditional on SW_WATCHDOG. I think this was previously a bug.

Reviewed by: imp alfred bjk
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D13713

6 years agokldxref: correct function names in warning messages
emaste [Tue, 2 Jan 2018 21:31:54 +0000 (21:31 +0000)]
kldxref: correct function names in warning messages

Sponsored by: The FreeBSD Foundation

6 years agonctgpio: add new device id for the GPIO chip in PCEngines APU3
gonzo [Tue, 2 Jan 2018 20:58:05 +0000 (20:58 +0000)]
nctgpio: add new device id for the GPIO chip in PCEngines APU3

PR: 224512
Submitted by: mike@sentex.net
MFC after: 2 weeks

6 years agoath: fix possible memory disclosures in ioctl handlers
emaste [Tue, 2 Jan 2018 19:34:23 +0000 (19:34 +0000)]
ath: fix possible memory disclosures in ioctl handlers

Apply the fix from r327499 to additional ioctl handlers.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
MFC after: 1 week
MFC with: r327499
Sponsored by: The FreeBSD Foundation

6 years agoath: fix memory disclosure from ath_btcoex_ioctl
emaste [Tue, 2 Jan 2018 19:29:30 +0000 (19:29 +0000)]
ath: fix memory disclosure from ath_btcoex_ioctl

The ath_btcoex_ioctl handler allocated a buffer without M_ZERO and
returned it to userland without writing to it.

The device has permissions only for root so this is not urgent, and the
fix can be MFCd and considered for a future EN.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com>
Reviewed by: adrian
MFC after: 1 week

6 years agohpt{nr,rr}: plug info leak in hpt_ioctl
emaste [Tue, 2 Jan 2018 18:31:32 +0000 (18:31 +0000)]
hpt{nr,rr}: plug info leak in hpt_ioctl

The hpt{nr,rr} ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27{nr,rr} device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

The same issue was reported in the hpt27xx driver by Ilja Van Sprundel.

Reviewed by: jhb, kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agohpt27xx: plug info leak in hpt_ioctl
emaste [Tue, 2 Jan 2018 18:29:44 +0000 (18:29 +0000)]
hpt27xx: plug info leak in hpt_ioctl

The hpt27xx ioctl handler allocates a buffer without M_ZERO and calls
hpt_do_ioctl(), which might not overwrite the entire buffer.

Also zero bytesReturned in case it is not written by hpt_do_ioctl().

The hpt27xx device has permissions only for root so this is not urgent,
and the fix can be MFCd and considered for a future EN.

Reported by: Ilja van Sprundel <ivansprundel@ioactive.com>
Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> (M_ZERO)
Reviewed by: jhb, kib
MFC after: 3 days
Security: info leak in root-only ioctl
Sponsored by: The FreeBSD Foundation

6 years agoFix some I/O ordering issues in gmirror.
markj [Tue, 2 Jan 2018 18:11:54 +0000 (18:11 +0000)]
Fix some I/O ordering issues in gmirror.

- BIO_FLUSH requests were dispatched to the disks directly from
  g_mirror_start() rather than going through the mirror's I/O request
  queue, so they could have been reordered with preceding writes.
  Address this by processing such requests from the queue, avoiding
  direct dispatch.
- Handling for collisions with synchronization requests was too
  fine-grained and could cause reordering of writes. In particular,
  BIO_ORDERED was not being honoured. Address this by effectively
  freezing the request queue any time a collision with a synchronization
  request occurs. The queue is unfrozen once the collision with the
  first frozen request is over.
- The above-mentioned collision handling allowed reads to jump ahead
  of writes to the same offset. Address this by freezing all request
  types when a collision occurs, not just BIO_WRITEs and BIO_DELETEs.

Also add some more fail points for use in testing error handling.

Reviewed by: imp
MFC after: 3 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13559

6 years agorpcbind: Fix race in signal termination
cem [Tue, 2 Jan 2018 17:25:13 +0000 (17:25 +0000)]
rpcbind: Fix race in signal termination

If a signal was delivered while the main thread was not in poll(2) and after
check was performed, we could reenter poll and never detect termination. Fix
this with the pipefd trick.  (This race was introduced very recently, in
r327482.)

PR: 224503
Reported by: kib
Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon

6 years agoRevert r326844
bapt [Tue, 2 Jan 2018 16:50:57 +0000 (16:50 +0000)]
Revert r326844

There has been some fallout from the change. The change itself was not valueable
enough to spend time investigating the corner cases, let's just back it out.

Reported by: flo

6 years agoaw_sid: Add man page for this driver
kevans [Tue, 2 Jan 2018 14:54:54 +0000 (14:54 +0000)]
aw_sid: Add man page for this driver

Reviewed by: manu, bjk (both earlier version), brueffer (manpages)
Differential Revision: https://reviews.freebsd.org/D13720

6 years agoelfcopy: copy raw (untranslated) contents to binary output
emaste [Tue, 2 Jan 2018 14:07:55 +0000 (14:07 +0000)]
elfcopy: copy raw (untranslated) contents to binary output

Previously elfcopy used elf_getdata to obtain data from ELF sections
being copied to binary output, but elf_getdata returns data that has
been translated - that is, data is in host byte order. When the host and
target differ in endianness (e.g., converting a big-endian MIPS ELF
object to binary on an x86 host) this resulted in byte-swapped data in
certain sections such as .dynamic.

Instead use elf_rawdata to keep data in the original, target endianness.

Reported by: Hiroki Mori <yamori83@yahoo.co.jp>, Bill Yuan
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoshutdown: Fix r327476 by adding init
eadler [Tue, 2 Jan 2018 09:02:42 +0000 (09:02 +0000)]
shutdown: Fix r327476 by adding init

Initialize maybe_today. While here sort.

PR: 32411
Additionally reported by: rgrimes, ian

6 years agoAdd installer support for PS3 and PowerNV systems, also laying the
nwhitehorn [Tue, 2 Jan 2018 05:27:24 +0000 (05:27 +0000)]
Add installer support for PS3 and PowerNV systems, also laying the
foundation for invoking efibootmgr as part of new-style EFI booting on
x86. On PS3 and PowerNV, which are booted using Linux kexec from petitboot
rather than by loader(8), install the kernel and the rest of /boot to a
FAT partition and set up the appropriate petitboot configuration file
there.

The new bootconfig installer stage can do platform-dependent modifications
more complex than partition layout and installation of boot blocks and can
be used to (as here) set up some special configuration files, run efibootmgr,
or boot0cfg.

MFC after: 1 month

6 years agoSkip errors from being unable to set modification and creation times. If
nwhitehorn [Tue, 2 Jan 2018 05:22:54 +0000 (05:22 +0000)]
Skip errors from being unable to set modification and creation times. If
one of the directories in the filesystem hierarchy is a FAT mountpoint,
settings its times will fail, which would cause installation to abort.
Instead, make this a best-effort thing.

Handling this error is a hack and a better internal scheme for handling
this should be added to libarchive.

6 years agoFix arc after r326347 broke various memory limit queries. Use UMA features
jeff [Tue, 2 Jan 2018 04:35:56 +0000 (04:35 +0000)]
Fix arc after r326347 broke various memory limit queries.  Use UMA features
rather than kmem arena size to determine available memory.

Initialize the UMA limit to LONG_MAX to avoid spurious wakeups on boot before
the real limit is set.

PR: 224330 (partial), 224080
Reviewed by: markj, avg
Sponsored by: Netflix / Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13494

6 years agoFix reversed endianness that crept in at some point. Blue is now blue
nwhitehorn [Tue, 2 Jan 2018 03:59:46 +0000 (03:59 +0000)]
Fix reversed endianness that crept in at some point. Blue is now blue
instead of pink.

MFC after: 3 days

6 years agorpcbind: Fix build
cem [Tue, 2 Jan 2018 01:48:11 +0000 (01:48 +0000)]
rpcbind: Fix build

Add missed unistd.h include.  Not sure where it was lost; I believe it
compiled before I submitted the change.

PR: 224503
Reported by: Cy Schubert <Cy.Schubert AT komquats.com>
Sponsored by: Dell EMC Isilon

6 years agorpcbind: Do not use signal-unsafe functions in SIGTERM handler
cem [Tue, 2 Jan 2018 00:48:19 +0000 (00:48 +0000)]
rpcbind: Do not use signal-unsafe functions in SIGTERM handler

syslog(3), routines used in write_warmstart(), and exit(3) are all
signal-unsafe.  Instead, set a signal-safe flag and check the flag in the
rpcbind main loop to shutdown safely.

PR: 224503
Reviewed by: kib, markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13728

6 years ago[net80211] convert all of the WME use over to a temporary copy of WME info.
adrian [Tue, 2 Jan 2018 00:07:28 +0000 (00:07 +0000)]
[net80211] convert all of the WME use over to a temporary copy of WME info.

This removes the direct WME info access in the ieee80211com struct and instead
provides a method of fetching the data.  Right now it's a no-op but eventually
it'll turn into a per-VAP method for drivers that support it (eg iwn, iwm,
upcoming ath10k work) as things like p2p support require this kind of behaviour.

Tested:

* ath(4), STA and AP mode

TODO:

* yes, this is slightly stack size-y, but it is an important first step
  to get drivers migrated over to a sensible WME API.  A lot of per-phy things
  need to be converted to per-VAP before P2P, 11ac firmware, etc stuff shows up.

6 years agoshutdown: Assume absolute time is in the future
eadler [Mon, 1 Jan 2018 22:33:57 +0000 (22:33 +0000)]
shutdown: Assume absolute time is in the future

The original bug describes it best:

When an absolute time is specified to shutdown, the program's
behavior depends on whether that time has passed during the
current calendar day.  POLA would suggest that for shutdown,
whose time argument is always supposed to be in the future,
absolute times specified without a specific date should refer
to the next occurrence of that time, rather than erroring out
if that time has already passed during the current day.

PR: 32411
Submitted by: wollman@khavrinen.lcs.mit.edu
Submitted on: 2001-11-30 20:30:01 UTC
Reviewed by: asmodai (at time of bug submission)

6 years agosh: Move various structs from jobs.h to jobs.c
jilles [Mon, 1 Jan 2018 22:31:52 +0000 (22:31 +0000)]
sh: Move various structs from jobs.h to jobs.c

These implementation details of jobs.c need not be exposed.

6 years agobsdinstall: inform users that typing will not be visible
eadler [Mon, 1 Jan 2018 22:10:21 +0000 (22:10 +0000)]
bsdinstall: inform users that typing will not be visible

Some users, especially those that are new, might be confused when passwd
does not echo anything. Inform users that the password will not be
visible.

PR: 196113
Submitted by: Byron Grobe <grobe0ba@gmail.com>

6 years agosysctl_kern_proc_args: do not take the fast path if p_args is NULL
antoine [Mon, 1 Jan 2018 21:25:01 +0000 (21:25 +0000)]
sysctl_kern_proc_args: do not take the fast path if p_args is NULL
In this case it falls back to reading ps_strings

6 years agoAvoid re-check of usermode condition.
kib [Mon, 1 Jan 2018 20:47:03 +0000 (20:47 +0000)]
Avoid re-check of usermode condition.

It does not change anything in the behavior of trap_pfault(), while
eliminating obfuscation of jumping to the code which checks for the
condition reversed of the goto cause.  Also avoid force initialize the
rv variable, since it is now only accessed after storing vm_fault()
return value.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13725

6 years agoAdd CR4.SMAP control bit.
kib [Mon, 1 Jan 2018 19:34:19 +0000 (19:34 +0000)]
Add CR4.SMAP control bit.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoDo not let vm_daemon run unbounded.
kib [Mon, 1 Jan 2018 19:27:33 +0000 (19:27 +0000)]
Do not let vm_daemon run unbounded.

On a load where single anonymous object consumes almost all memory on
the large system, swapout code executes the iteration over the
corresponding object page queue for long time, owning the map and
object locks.  This blocks pagedaemon which tries to lock the object,
and blocks other threads in the process in vm_fault() waiting for the
map lock.

Handle the issue by terminating the deactivation loop if we executed
too long and by yielding at the top level in vm_daemon.

Reported by: peterj, pho
Reviewed by: alc
Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13671

6 years agoBe less verbose and more precise.
imp [Mon, 1 Jan 2018 19:04:40 +0000 (19:04 +0000)]
Be less verbose and more precise.

6 years agoAdd note that assert.h may be included multiple times
imp [Mon, 1 Jan 2018 18:59:11 +0000 (18:59 +0000)]
Add note that assert.h may be included multiple times
with and without NDEBUG defined.

6 years agoassert(3) appeared first in the 7th Edition Unix, not the 6th, at
imp [Mon, 1 Jan 2018 18:55:13 +0000 (18:55 +0000)]
assert(3) appeared first in the 7th Edition Unix, not the 6th, at
least according to the extant distributions preserved at tuhs.org.

Obtained from: http://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/assert.h

6 years agoRemove unused includes.
delphij [Mon, 1 Jan 2018 09:41:18 +0000 (09:41 +0000)]
Remove unused includes.

6 years agoRemove unused includes.
delphij [Mon, 1 Jan 2018 08:01:26 +0000 (08:01 +0000)]
Remove unused includes.

6 years agoRemove empty directories... silly git svn w/o --rmdir.
imp [Mon, 1 Jan 2018 05:18:28 +0000 (05:18 +0000)]
Remove empty directories... silly git svn w/o --rmdir.

6 years agoRemove sys/mips/rmi. It's been unmaintained since 2011. This hardware
imp [Mon, 1 Jan 2018 05:13:03 +0000 (05:13 +0000)]
Remove sys/mips/rmi. It's been unmaintained since 2011. This hardware
is now unobtanium. It's only had API changes in the last 7 years, and
is responsible for a very large number of them. In addition, there's a
lot of code that reimplements base FreeBSD functionality, diminishing
the chances it still works. Without hardware to teset it on, or
prospects of obtaining such hardware and without vendor support, it's
time to move on.

Suggested by: kan@ in mips@ retirement discussion

6 years agoRemove support for IDT. Only the RouterBoard RB533 used this chip, and
imp [Mon, 1 Jan 2018 04:10:36 +0000 (04:10 +0000)]
Remove support for IDT. Only the RouterBoard RB533 used this chip, and
it's at least 5 years out of production. I couldn't find a used one on
ebay and other secondary markets just now, nor when I tried 4 years
ago. It dates from the initial project/mips2 merge 8 years ago, and
hasn't been updated since.

Discussed on: mips@ (with some dissent)

6 years agoRetire old ADM 5120 port. It never grew much beyond the original port.
imp [Mon, 1 Jan 2018 04:10:31 +0000 (04:10 +0000)]
Retire old ADM 5120 port. It never grew much beyond the original port.
It came into the tree with the project/mips merge 8 years ago. At the
time, it was hard to find a board with enough RAM to run. Now FreeBSD
requires at least 2x the RAM it did then. No changes have happened to
this port apart from API churn and license tagging since then. It ran
OK at the time it was committed, but no sightings in the wild have
happened since shortly after it was committed.

https://www.linux-mips.org/wiki/Adm5120_devices lists a bunch of
boards that were available 5 years ago (but are no longer
available). The beefiest one had only 64MB of RAM which is too
small. The Mirktik RB1xx never had more than 32MB.

Also remove confusing QEMU config file that never ever worked in QEMU
for mips. MALTA is used for that. Another of my past mistakes, false
starts that never amounted to anything.

Discussed on: mips@ (with some dissent)

6 years agoRemove sys/mips/alchemy. It was still-born when I committed it and it
imp [Mon, 1 Jan 2018 04:10:25 +0000 (04:10 +0000)]
Remove sys/mips/alchemy. It was still-born when I committed it and it
never got better. It never worked on real hardware and is still mostly
stubs after 8 years when I added it. It has had no real update in that
time apart from API churn. It was added just so it didn't get lost in
the project/mips merge, but maybe it should have been lost as nothing
has come of it. It is time to give up the ghost on this one.

Approved by: me, shooting my own dog
Discussed on: mips@

6 years agoRemove sys/mips/rt305x. It's been replaced by sys/mips/mediatek.
imp [Mon, 1 Jan 2018 04:06:24 +0000 (04:06 +0000)]
Remove sys/mips/rt305x. It's been replaced by sys/mips/mediatek.

OK'd by: Stanislav Galabov (who did both)
Discussed on: mips@

6 years agoAfter removal of loader.ps3, change petitboot configuration in release media
nwhitehorn [Mon, 1 Jan 2018 03:33:01 +0000 (03:33 +0000)]
After removal of loader.ps3, change petitboot configuration in release media
to directly kexec the kernel. Unlike the old loader.ps3 code, this also works
on PowerNV systems, which also use petitboot.

MFC after: 1 month

6 years agoieee80211(9): update man page
eadler [Mon, 1 Jan 2018 00:20:35 +0000 (00:20 +0000)]
ieee80211(9): update man page

This copies changes from NetBSD into FreeBSD's man page.  I compared the
proposed changes against FreeBSD headers and modified them to match.

PR: 214602
Submitted by: fehmi noyan isi <fnoyanisi@yahoo.com>

6 years agoFix GCC build broken by r32744
gonzo [Sun, 31 Dec 2017 23:40:06 +0000 (23:40 +0000)]
Fix GCC build broken by r32744

Indicate in function declaration that vt_palette_init does not take any arguments

6 years agoAdd a validbcd() routine that uses the bcd2bin_data[] array and returns a
ian [Sun, 31 Dec 2017 22:43:24 +0000 (22:43 +0000)]
Add a validbcd() routine that uses the bcd2bin_data[] array and returns a
bool indicating whether the input value represents a valid BCD byte.

The existing bcd2bin() routine will KASSERT if asked to convert a bad value,
but sometimes the kernel has to handle BCD data from untrusted sources, so
this will provide a mechanism to validate data before attempting conversion.

This would be have easier/cleaner if the bcd2bin_data[] array contained an
out-of-range value (such as 0xff) in the infill locations that aren't valid,
but it's a global symbol that might be referenced by out-of-tree code
relying on the current scheme, so I'm leaving that alone.

6 years agoaw_sid: Add support for a64
kevans [Sun, 31 Dec 2017 22:35:32 +0000 (22:35 +0000)]
aw_sid: Add support for a64

Newer Allwinner SoCs have nearly identical SID controllers with efuse space
starting at 0x200 into their register space and thermal data available at
0x234, making all of these fairly trivial additions.

The h3 will be added at a later time after some testing, due to a silicon
bug that causes the rootkey (at least) to be read incorrectly unless first
read via the control register.

6 years agonewsyslog: implement 'p' flag
eadler [Sun, 31 Dec 2017 22:01:36 +0000 (22:01 +0000)]
newsyslog: implement 'p' flag

Implement the 'p' flag for newsyslog from NetBSD. This flag results in
the first log file for a given file to not be compressed.

While here, don't change file attributes during a no-op run

PR: 162798
Submitted by: heas@shrubbery.net
MFC After: 1 month

6 years agoThe variable "minslptime" is pointless and always has been, ever since its
alc [Sun, 31 Dec 2017 21:36:42 +0000 (21:36 +0000)]
The variable "minslptime" is pointless and always has been, ever since its
introduction in r83366.  (At that time, this code appeared in vm/vm_glue.c,
because vm/vm_swapout.c did not exist.)  When the FOREACH_THREAD loop
completes, we know that the sleep time for every thread is above whichever
threshold is being applied.

Reviewed by: kib
X-MFC with: r327354

6 years agoUnbreak build broken by r327444
gonzo [Sun, 31 Dec 2017 21:29:20 +0000 (21:29 +0000)]
Unbreak build broken by r327444

During review iterations function signature has changed in definition
but not in actual call. Fix call to match the definition.

Reported by: Herbert J. Skuhra
Pointyhat to: gonzo
MFC after: 2 weeks

6 years agoAdd rc.conf vxlan example
bryanv [Sun, 31 Dec 2017 21:23:14 +0000 (21:23 +0000)]
Add rc.conf vxlan example

PR: 206288
Submitted by: james@lodge.me.uk
MFC after: 2 weeks

6 years agoWrap includes in sys/tslog.h with #ifdef TSLOG.
cperciva [Sun, 31 Dec 2017 21:00:21 +0000 (21:00 +0000)]
Wrap includes in sys/tslog.h with #ifdef TSLOG.

This is necessary because some non-kernel code #defines _KERNEL and then
includes kernel headers; as a result, it was getting conflicting versions
of curthread and curproc.  Non-kernel code should probably refrain from
defining _KERNEL, but for now hiding these indirect inclusions fixes the
build.

Reported by: Michael Butler, Herbert J. Skuhra

6 years agoChase r327432... sparc64 clock.c now needs to include sys/tslog.h
ian [Sun, 31 Dec 2017 20:30:51 +0000 (20:30 +0000)]
Chase r327432... sparc64 clock.c now needs to include sys/tslog.h

Discussed with:  cperciva

6 years agoRemove PIR from PCPU data. It has an implementation-defined meaning that
nwhitehorn [Sun, 31 Dec 2017 20:23:39 +0000 (20:23 +0000)]
Remove PIR from PCPU data. It has an implementation-defined meaning that
is of limited utility outside of platform-specific code and can vary
at runtime when running as a hypervisor guest, so does not even have the
virtue of being a static identifier.

Reviewed by: jhibbits

6 years agovt(4): add support for configurable console palette
gonzo [Sun, 31 Dec 2017 20:21:05 +0000 (20:21 +0000)]
vt(4): add support for configurable console palette

Introduce new set of loader tunables kern.vt.color.N.rgb, where N is a
number from 0 to 15. The value is either comma-separated list decimal
numbers ranging from 0 to 255 that represent values of red, green, and
blue components respectively (i.e. "128,128,128") or 6-digit hex triplet
commonly used to represent colors in HTML or xterm settings (i.e. #808080)

Each tunable overrides one of the 16 hardcoded palette codes and can be set
in loader.conf(5)

Reviewed by: bcr(docs), jilles, manu, ray
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13645

6 years agoFix 32-bit build.
nwhitehorn [Sun, 31 Dec 2017 20:20:55 +0000 (20:20 +0000)]
Fix 32-bit build.

6 years agoMake newer binutils happy by using a bl-type branch instead of b, which
nwhitehorn [Sun, 31 Dec 2017 20:10:08 +0000 (20:10 +0000)]
Make newer binutils happy by using a bl-type branch instead of b, which
displeases it for some reason. LR is not relevant in this code, so just
do what it wants.

6 years agoProvide relative, as well as absolute, addresses in trap panic panics. This
nwhitehorn [Sun, 31 Dec 2017 20:08:16 +0000 (20:08 +0000)]
Provide relative, as well as absolute, addresses in trap panic panics. This
makes it easier to cross-correlate them with instruction listings without
worrying about where the kernel was relocated to.

MFC after: 1 week

6 years agofind: Link tests to the build
jilles [Sun, 31 Dec 2017 19:24:13 +0000 (19:24 +0000)]
find: Link tests to the build

6 years agoAllow use of .WAIT in the LOCAL_DIRS and LOCAL_LIB_DIRS lists.
ian [Sun, 31 Dec 2017 18:53:13 +0000 (18:53 +0000)]
Allow use of .WAIT in the LOCAL_DIRS and LOCAL_LIB_DIRS lists.

A comment in Makefile.inc1 has long stated that LOCAL_DIRS are built last,
after the base system.  Incremental improvements in parallel building over
the years have led to LOCAL_DIRS being built in parallel with base system
directories.  This change allows the .WAIT directive to appear in LOCAL_DIRS
and LOCAL_LIB_DIRS lists to give the user some control over parallel
building of local additions.

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

6 years agoAdd VXLAN (RFC 7348) port
bryanv [Sun, 31 Dec 2017 17:11:12 +0000 (17:11 +0000)]
Add VXLAN (RFC 7348) port

PR: 202316
Submitted by: olgeni@
MFC after: 2 weeks

6 years agoRemove MP SAFE marks and stray register name in comments.
kib [Sun, 31 Dec 2017 17:07:59 +0000 (17:07 +0000)]
Remove MP SAFE marks and stray register name in comments.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoHappy New Year 2018 my friends!
bz [Sun, 31 Dec 2017 16:48:04 +0000 (16:48 +0000)]
Happy New Year 2018 my friends!

6 years agopf: Allow the module to be unloaded
kp [Sun, 31 Dec 2017 16:18:13 +0000 (16:18 +0000)]
pf: Allow the module to be unloaded

pf can now be safely unloaded. Most of this code is exercised on vnet
jail shutdown.

Don't block unloading.

6 years agopf: Clean all fragments on shutdown
kp [Sun, 31 Dec 2017 10:01:31 +0000 (10:01 +0000)]
pf: Clean all fragments on shutdown

When pf is unloaded, or a vnet jail using pf is stopped we need to
ensure we clean up all fragments, not just the expired ones.

6 years agoUse the TSLOG framework to record entry/exit timestamps for DELAY and
cperciva [Sun, 31 Dec 2017 09:24:41 +0000 (09:24 +0000)]
Use the TSLOG framework to record entry/exit timestamps for DELAY and
_vprintf; these functions are called in many places and can contribute
meaningfully to the total time spent booting.

6 years agoInstrument thread creations for the the benefit of the TSLOG framework.
cperciva [Sun, 31 Dec 2017 09:24:11 +0000 (09:24 +0000)]
Instrument thread creations for the the benefit of the TSLOG framework.
This assists in tracking time spent while the boot is being "held" waiting
for something to happen.

6 years agoInstrument "boot holds" for the benefit of the TSLOG framework. These
cperciva [Sun, 31 Dec 2017 09:23:52 +0000 (09:23 +0000)]
Instrument "boot holds" for the benefit of the TSLOG framework.  These
are places where the "main thread" of the booting kernel (either the
thread which later becomes swapper or the thread which later becomes
init) has to stop and wait for action to take place in another thread
before continuing.

There are currently three such holds:
1. The intr_config_hooks SYSINIT waits for hooks registered via the
config_intrhook_establish function; this allows (typically) devices
which need interrupts enabled to complete their initialization to do
so before root is mounted.

2. The g_waitidle function waits for the GEOM event queue to be empty;
this ensures that all of the disks which have been attached have been
tasted before we attempt to mount root.

3. The vfs_mountroot_wait function (in addition to calling g_waitidle)
waits for holds registered via root_mount_hold; among other things, this
is used by the USB subsystem to ensure that we don't fail to mount root
if it's located on a USB disk which takes a while to probe.

6 years agoUse the TSLOG framework to record entry/exit timestamps for VFS_MOUNT calls.
cperciva [Sun, 31 Dec 2017 09:23:35 +0000 (09:23 +0000)]
Use the TSLOG framework to record entry/exit timestamps for VFS_MOUNT calls.