]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoath: fix memory disclosure from ath_btcoex_ioctl
Ed Maste [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
Ed Maste [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
Ed Maste [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.
Mark Johnston [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
Conrad Meyer [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
Baptiste Daroussin [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
Kyle Evans [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
Ed Maste [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
Eitan Adler [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
Nathan Whitehorn [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
Nathan Whitehorn [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 Roberson [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
Nathan Whitehorn [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
Conrad Meyer [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
Conrad Meyer [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 Chadd [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
Eitan Adler [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 Tjoelker [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
Eitan Adler [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 Brodin [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.
Konstantin Belousov [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.
Konstantin Belousov [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.
Konstantin Belousov [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.
Warner Losh [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
Warner Losh [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
Warner Losh [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.
Xin LI [Mon, 1 Jan 2018 09:41:18 +0000 (09:41 +0000)]
Remove unused includes.

6 years agoRemove unused includes.
Xin LI [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.
Warner Losh [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
Warner Losh [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
Warner Losh [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.
Warner Losh [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
Warner Losh [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.
Warner Losh [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
Nathan Whitehorn [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
Eitan Adler [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
Oleksandr Tymoshenko [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 Lepore [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
Kyle Evans [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
Eitan Adler [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
Alan Cox [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
Oleksandr Tymoshenko [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
Bryan Venteicher [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.
Colin Percival [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 Lepore [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
Nathan Whitehorn [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
Oleksandr Tymoshenko [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.
Nathan Whitehorn [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
Nathan Whitehorn [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
Nathan Whitehorn [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 Tjoelker [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 Lepore [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
Bryan Venteicher [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.
Konstantin Belousov [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!
Bjoern A. Zeeb [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
Kristof Provost [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
Kristof Provost [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
Colin Percival [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.
Colin Percival [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
Colin Percival [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.
Colin Percival [Sun, 31 Dec 2017 09:23:35 +0000 (09:23 +0000)]
Use the TSLOG framework to record entry/exit timestamps for VFS_MOUNT calls.

6 years agoTeach makeobjops.awk to accept PROLOG and EPILOG blocks before
Colin Percival [Sun, 31 Dec 2017 09:23:19 +0000 (09:23 +0000)]
Teach makeobjops.awk to accept PROLOG and EPILOG blocks before
METHOD and STATICMETHOD declarations; that code will be inserted
into the dispatch function before and after the method call.

Use this functionality and the TSLOG framework to record DEVICE_ATTACH
and DEVICE_PROBE entry/exit timestamps.

6 years agoUse the TSLOG framework to record SYSINIT entry/exit timestamps.
Colin Percival [Sun, 31 Dec 2017 09:23:02 +0000 (09:23 +0000)]
Use the TSLOG framework to record SYSINIT entry/exit timestamps.

6 years agoUse the TSLOG framework to record entry/exit timestamps for machine
Colin Percival [Sun, 31 Dec 2017 09:22:31 +0000 (09:22 +0000)]
Use the TSLOG framework to record entry/exit timestamps for machine
independent functions with important roles in the early boot process:
mi_startup (with the "exit" recorded when it becomes swapper),
start_init (with the "exit" recorded when the thread is about to
"return" into the newly created init process), vfs_mountroot, and
vfs_mountroot_wait.

6 years agoUse the TSLOG framework to record entry/exit timestamps for hammer_time.
Colin Percival [Sun, 31 Dec 2017 09:22:07 +0000 (09:22 +0000)]
Use the TSLOG framework to record entry/exit timestamps for hammer_time.
The entry must be logged "manually" using TSRAW rather than TSENTER
since PCPU data structures have not yet been initialized and thus
curthread cannot be accessed; &thread0 is what will become curthread
later in hammer_time.

Other MD initialization code should be similarly instrumented in order
to gain visibility into the time spent before entering mi_startup; this
will require some care and testing from people with access to such
hardware.

6 years agoConnect kern_tslog.c to the build and add TSLOG / TSLOGSIZE kernel options.
Colin Percival [Sun, 31 Dec 2017 09:21:34 +0000 (09:21 +0000)]
Connect kern_tslog.c to the build and add TSLOG / TSLOGSIZE kernel options.
These are intended for debugging purposes and should not be added to
"generic" kernel configurations since they result in a nontrivial amount
of memory being set aside for this purpose, can break if kernel modules are
unloaded, and can potentially leak a dangerous amount of information about
timestamps used as a source of kernel entropy.

6 years agoCode for recording timestamps of events, especially function entries/exits.
Colin Percival [Sun, 31 Dec 2017 09:21:01 +0000 (09:21 +0000)]
Code for recording timestamps of events, especially function entries/exits.
This is a very primitive system, intended for use in measuring performance
during the early system boot, before more sophisticated tools like DTrace
or infrastructure like kernel memory allocation and mutexes are available.

Because this code records pointers to strings rather than copying strings
(in order to keep the memory usage more manageable), if a kernel module is
unloaded after logging an event, Bad Things can happen.  Users are advised
to not do that.

Since cycle counts from the early kernel boot are used as an initial entropy
source, publishing this information to userland could result in inadequate
entropy being kept private to the kernel RNG.  Users are advised to not
enable this on systems with untrusted users.

Discussed on: freebsd-current

6 years agos/=/+=
Eitan Adler [Sun, 31 Dec 2017 07:26:24 +0000 (07:26 +0000)]
s/=/+=

6 years agomtree: remove /etc/skel
Eitan Adler [Sun, 31 Dec 2017 07:25:55 +0000 (07:25 +0000)]
mtree: remove /etc/skel

We use /usr/share/skel instead of /etc/skel. The existence of /etc/skel
has confused people.

PR: 46062 (submitted 2002-12-07)
PR: 218897
Submitted by: carl@slackerbsd.org
Submitted by: asv@inhio.net

6 years agoskel: Quote PAGER in dot.shrc
Eitan Adler [Sun, 31 Dec 2017 06:58:58 +0000 (06:58 +0000)]
skel: Quote PAGER in dot.shrc

PR: 181853
Submitted by: pl@catslair.org
MFC After: 1 week

6 years agoaw_sid: rewrite compat-string configuration to be more flexible
Kyle Evans [Sun, 31 Dec 2017 06:44:15 +0000 (06:44 +0000)]
aw_sid: rewrite compat-string configuration to be more flexible

This will allow easiser support in the future for boards that have thermal
data and different offsets for root key/efuse data.

6 years agoUse data from the boot loader to pick the appropriate output graphics mode
Nathan Whitehorn [Sun, 31 Dec 2017 06:10:07 +0000 (06:10 +0000)]
Use data from the boot loader to pick the appropriate output graphics mode
instead of hard-coding a default. This information is passed implicitly by
the PS3 firmware and can be relied upon. Also adjust the default mode, if
somehow firmware doesn't pass one, to 1920x1080 from 720x480 since it is
2017.

MFC after: 2 weeks

6 years agoMake sure the first instruction of the low-memory spinloop is in the
Nathan Whitehorn [Sun, 31 Dec 2017 05:38:19 +0000 (05:38 +0000)]
Make sure the first instruction of the low-memory spinloop is in the
cacheline being invalidated.

MFC after: 1 month

6 years agostand/fdt: Make fdt_overlay_apply signature-compatible with libfdt
Kyle Evans [Sun, 31 Dec 2017 05:22:26 +0000 (05:22 +0000)]
stand/fdt: Make fdt_overlay_apply signature-compatible with libfdt

libfdt will assume a writable fdt overlay blob has been passed in, so make
ours compatible to allow easier review when we try to drop libfdt into
place. overlay from the calling context is writable, making it safe to
simply rip out everything related to copying the overlay blob in
fdt_overlay_apply.

I note here that we still have problems: fdt_overlay_apply, both our version
and libfdt's, may fail and have already clobbered the base fdt to some
extent. Future work will make sure we don't apply a potentially bogus fdt,
instead discarding the base fdt if we had an error.

Reviewed by: gonzo
Differential Revision: https://reviews.freebsd.org/D13695

6 years agoPreviously, swap_pager_copy() freed swap blocks one at at time, via
Alan Cox [Sun, 31 Dec 2017 04:01:47 +0000 (04:01 +0000)]
Previously, swap_pager_copy() freed swap blocks one at at time, via
swp_pager_meta_ctl(), with no opportunity to recognize freeing of
consecutive blocks and free fewer block ranges.  To open that opportunity,
this change removes the SWM_FREE option from swp_pager_meta_ctl(), and
compels the caller to do the freeing when a valid block address is returned.
In swap_pager_copy(), these frees are aggregated, so that a sequence of them
can be done at one time.

The only other caller to swp_pager_meta_ctl() that passed SWM_FREE,
swp_pager_unswapped(), is also modified to handle its single free
explicitly.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: kib (an earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13290

6 years agosysv_{ipc|shm}: update the NetBSD VCS tags to match nearer our files.
Pedro F. Giffuni [Sun, 31 Dec 2017 03:34:00 +0000 (03:34 +0000)]
sysv_{ipc|shm}: update the NetBSD VCS tags to match nearer our files.

Both files originated in NetBSD:

sysv_ipc.c CVS 1.9:
Most of their changes don't apply to us as we already have similar
changes. This is a better reference for future merges.

sysv_shm.c CVS 1.39:
Most of their changes don't apply to our code but interestingly this
revision merged our changes and is a better point for reference.

Move the VCS tags to the position recommended in our committers guide
(section 8),

No functional change.

6 years agoTeach bsdinstall partedit/sade how to format FAT partitions on GPT, which
Nathan Whitehorn [Sun, 31 Dec 2017 03:13:45 +0000 (03:13 +0000)]
Teach bsdinstall partedit/sade how to format FAT partitions on GPT, which
have the partition type code "ms-basic-data".

MFC after: 2 weeks

6 years agolocks: adjust loop limit check when waiting for readers
Mateusz Guzik [Sun, 31 Dec 2017 02:31:01 +0000 (02:31 +0000)]
locks: adjust loop limit check when waiting for readers

The check was for the exact value, but since the counter started being
incremented by the number of readers it could have jumped over.

6 years agosx: fix up non-smp compilation after r327397
Mateusz Guzik [Sun, 31 Dec 2017 01:59:56 +0000 (01:59 +0000)]
sx: fix up non-smp compilation after r327397

6 years agocacos(3): correct spelling of 'I'
Eitan Adler [Sun, 31 Dec 2017 00:55:00 +0000 (00:55 +0000)]
cacos(3): correct spelling of 'I'

In some cases we had 'i' instead of 'I'.

PR: 195517
Submitted by: stephen

6 years agolocks: re-check the reason to go to sleep after locking sleepq/turnstile
Mateusz Guzik [Sun, 31 Dec 2017 00:47:04 +0000 (00:47 +0000)]
locks: re-check the reason to go to sleep after locking sleepq/turnstile

In both rw and sx locks we always go to sleep if the lock owner is not
running.

We do spin for some time if the lock is read-locked.

However, if we decide to go to sleep due to the lock owner being off cpu
and after sleepq/turnstile gets acquired the lock is read-locked, we should
fallback to the aforementioned wait.

6 years agoisgreater(3): correct description of isunordered macro
Eitan Adler [Sun, 31 Dec 2017 00:46:41 +0000 (00:46 +0000)]
isgreater(3): correct description of isunordered macro

PR: 211376
Submitted by: Duane <parakleta@darkreality.org>
MFC After: 1 week

6 years agosx: read the SX_NOADAPTIVE flag and Giant ownership only once
Mateusz Guzik [Sun, 31 Dec 2017 00:37:50 +0000 (00:37 +0000)]
sx: read the SX_NOADAPTIVE flag and Giant ownership only once

These used to be read multiple times when waiting for the lock the become
free, which had the potential to issue completely avoidable traffic.

6 years agoman(1): document exit code
Eitan Adler [Sun, 31 Dec 2017 00:35:11 +0000 (00:35 +0000)]
man(1): document exit code

man(1) uses standard exit codes, document that.

PR: 223517
Reported by: wosch
MFC after: 1 week

6 years agomtx: deduplicate indefinite wait check in spinlocks and thread lock
Mateusz Guzik [Sun, 31 Dec 2017 00:34:29 +0000 (00:34 +0000)]
mtx: deduplicate indefinite wait check in spinlocks and thread lock

6 years agomtx: pre-read the lock value in thread_lock_flags_
Mateusz Guzik [Sun, 31 Dec 2017 00:33:28 +0000 (00:33 +0000)]
mtx: pre-read the lock value in thread_lock_flags_

Since this function is effectively slow path, if we get here the lock is most
likely already taken in which case it is cheaper to not blindly attempt the
atomic op.

While here move hwpmc probe out of the loop to match other primitives.

6 years agorwlock: tidy up __rw_runlock_hard similarly to r325921
Mateusz Guzik [Sun, 31 Dec 2017 00:31:14 +0000 (00:31 +0000)]
rwlock: tidy up __rw_runlock_hard similarly to r325921

6 years agodwmmc: Fully subclass driver
Emmanuel Vadot [Sat, 30 Dec 2017 22:01:17 +0000 (22:01 +0000)]
dwmmc: Fully subclass driver

Fully subclass the dwmmc driver and split every driver into multiple files.

There is still a few quirks in the dwmmc driver that will need some work.

Tested On: Pine64 Rock64

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

6 years agoAvoid use of the fdt_get_property_*() API, which is intrinsically
Nathan Whitehorn [Sat, 30 Dec 2017 20:28:29 +0000 (20:28 +0000)]
Avoid use of the fdt_get_property_*() API, which is intrinsically
incompatible with FDT versions < 16. This also simplifies the code a bit.

MFC after: 1 month

6 years agoGarbage-collect loader.ps3. It is currently disconnected from the build and
Nathan Whitehorn [Sat, 30 Dec 2017 20:27:13 +0000 (20:27 +0000)]
Garbage-collect loader.ps3. It is currently disconnected from the build and
is superseded by either direct loading of the kernel by petitboot (soon to
become the installer default) or loader.kboot.

6 years agoRemove logic for early console with loader.ps3 now that loader.ps3 is dead.
Nathan Whitehorn [Sat, 30 Dec 2017 20:25:33 +0000 (20:25 +0000)]
Remove logic for early console with loader.ps3 now that loader.ps3 is dead.

6 years agoChange the way SMP startup works to match the new multi-AP features in
Nathan Whitehorn [Sat, 30 Dec 2017 20:24:33 +0000 (20:24 +0000)]
Change the way SMP startup works to match the new multi-AP features in
locore64.S introduced in r327358.

MFC after: 3 weeks

6 years agoCheck more aggressively for whether the desired properties actually exist.
Nathan Whitehorn [Sat, 30 Dec 2017 20:23:14 +0000 (20:23 +0000)]
Check more aggressively for whether the desired properties actually exist.
If they don't, the code would look up some random part of the device tree
and seize the console inappropriately.

MFC after: 2 weeks

6 years agoAdd macro for vxlan list mutex lock and unlock
Bryan Venteicher [Sat, 30 Dec 2017 19:49:40 +0000 (19:49 +0000)]
Add macro for vxlan list mutex lock and unlock

This will simplify some later VNET support.

Submitted by: hrs
MFC after: 2 weeks

6 years agoAdvertise IFCAP_LINKSTAT after r326480 added link status support
Bryan Venteicher [Sat, 30 Dec 2017 19:35:12 +0000 (19:35 +0000)]
Advertise IFCAP_LINKSTAT after r326480 added link status support

MFC after: 2 weeks

6 years agoFix r327383:
Cy Schubert [Sat, 30 Dec 2017 19:27:22 +0000 (19:27 +0000)]
Fix r327383:

.../sys/dev/ep/elink.c:31:1: error: '/*' within block comment
[-Werror,-Wcomment]
/* $NetBSD: elink.c,v 1.6 1995/01/07 21:37:54 mycroft Exp $
^

6 years agoelink.[ch]: Move historic VCS tags after the license.
Pedro F. Giffuni [Sat, 30 Dec 2017 15:13:33 +0000 (15:13 +0000)]
elink.[ch]: Move historic VCS tags after the license.

This matches better our common practices and style.

6 years agoImprove usbconfig(8) manual page by adding descriptions for subcommands.
Edward Tomasz Napierala [Sat, 30 Dec 2017 12:56:50 +0000 (12:56 +0000)]
Improve usbconfig(8) manual page by adding descriptions for subcommands.

Reviewed by: hselasky
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13445

6 years agoMove i386/isa/elink.[hc] to dev/ep.
Konstantin Belousov [Sat, 30 Dec 2017 11:42:49 +0000 (11:42 +0000)]
Move i386/isa/elink.[hc] to dev/ep.

The ep(4) driver is the only consumer of the two functions from
elink.c.  I removed the standalone module as well, and most likely,
the module metadata is not needed anywhere, but this is for later
cleanup.

Discussed with: imp, jhb
Sponsored by: The FreeBSD Foundation

6 years agoMove i386/isa/npx.c to i386i386/npx.c.
Konstantin Belousov [Sat, 30 Dec 2017 11:33:04 +0000 (11:33 +0000)]
Move i386/isa/npx.c to i386i386/npx.c.

The i386 FPU (AKA npx) code does not depend on ISA devices at all,
after the support for IRQ13 FPU exceptions was removed.  Put the file
into the expected place in the kernel source tree.

Discussed with: jhb
Sponsored by: The FreeBSD Foundation