]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agotrpt(8): Fully remove and undocument '-t' option disabled in 1999
cem [Thu, 15 Feb 2018 18:26:45 +0000 (18:26 +0000)]
trpt(8): Fully remove and undocument '-t' option disabled in 1999

The relevant code was commented out in r50680.

PR: 57045
Submitted by: Fernando ApesteguĂ­a <fernando.apesteguia AT gmail.com>

6 years agopmap_qenter.9: Clarify that not all arch can map NX
cem [Thu, 15 Feb 2018 18:19:25 +0000 (18:19 +0000)]
pmap_qenter.9: Clarify that not all arch can map NX

The goal is to use security features when architectures provide them.

Reported by: kib
Sponsored by: Dell EMC Isilon

6 years agostand/lua: Always boot on 'enter' keypress in menus
kevans [Thu, 15 Feb 2018 18:16:16 +0000 (18:16 +0000)]
stand/lua: Always boot on 'enter' keypress in menus

6 years agoRevert r329323. I missed something in my testing.
brooks [Thu, 15 Feb 2018 17:58:51 +0000 (17:58 +0000)]
Revert r329323.  I missed something in my testing.

6 years agoBuild loader before installing it in lua-img.sh
kevans [Thu, 15 Feb 2018 17:56:45 +0000 (17:56 +0000)]
Build loader before installing it in lua-img.sh

Slightly more foolproof when all you're wanting to do is quickly get off the
ground with testing the lua loader.

6 years agoSet svn:executable on lua-img.sh
kevans [Thu, 15 Feb 2018 17:47:43 +0000 (17:47 +0000)]
Set svn:executable on lua-img.sh

6 years agoFix the test for SET_FOREACH termination.
markj [Thu, 15 Feb 2018 17:35:40 +0000 (17:35 +0000)]
Fix the test for SET_FOREACH termination.

Unlike the queue(3) _FOREACH macros, the iterator for a SET_FOREACH is
not NULL after the end of the set is reached.

6 years agoRegen after r329322: Fix getdirentries(2) under 32-bit compat.
brooks [Thu, 15 Feb 2018 17:27:19 +0000 (17:27 +0000)]
Regen after r329322: Fix getdirentries(2) under 32-bit compat.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14379

6 years agoFix getdirentries(2) under 32-bit compat.
brooks [Thu, 15 Feb 2018 17:26:30 +0000 (17:26 +0000)]
Fix getdirentries(2) under 32-bit compat.

The latest version of getdirentries (syscall 554) takes a pointer
an an off_t as the last argument. The old version which copies out
an int32_t was being used instead. Use the standard sys_getdirentries()
implementation instead.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14379

6 years agoRename the ACPI variant of the gicv2m driver from "gicv2m" to "gicv2m_acpi".
cognet [Thu, 15 Feb 2018 15:46:14 +0000 (15:46 +0000)]
Rename the ACPI variant of the gicv2m driver from "gicv2m" to "gicv2m_acpi".
The FDT variant is called "gicv2m" too, and as both would try to register
on gic, only one of them would succeed, while we want them both in a
GENERIC kernel.

Reviewed by: andrew

6 years agostand: Fix ubldr after r329190
kevans [Thu, 15 Feb 2018 15:01:07 +0000 (15:01 +0000)]
stand: Fix ubldr after r329190

metadata load files were consolidated in r329190, and these relocation fixup
bits were inadvertently dropped in the process. Re-add them to fix boot with
ubldr.

Glanced over by: jhibbits
X-MFC-With: r329190

6 years agoMFV r329313: 8857 zio_remove_child() panic due to already destroyed parent zio
avg [Thu, 15 Feb 2018 14:46:29 +0000 (14:46 +0000)]
MFV r329313: 8857 zio_remove_child() panic due to already destroyed parent zio

illumos/illumos-gate@d6e1c446d7897003fd9fd36ef5aa7da350b7f6af
https://github.com/illumos/illumos-gate/commit/d6e1c446d7897003fd9fd36ef5aa7da350b7f6af

https://www.illumos.org/issues/8857
  I had an OS panic on one of our servers:

  ffffff01809128c0 vpanic()
  ffffff01809128e0 mutex_panic+0x58(fffffffffb94c904ffffff597dde7f80)
  ffffff0180912950 mutex_vector_enter+0x347(ffffff597dde7f80)
  ffffff01809129b0 zio_remove_child+0x50(ffffff597dde7c58ffffff32bd901ac0,
  ffffff3373370908)
  ffffff0180912a40 zio_done+0x390(ffffff32bd901ac0)
  ffffff0180912a70 zio_execute+0x78(ffffff32bd901ac0)
  ffffff0180912b30 taskq_thread+0x2d0(ffffff33bae44140)
  ffffff0180912b40 thread_start+8()

  It panicked here:
  http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/fs/zfs/
  zio.c#430

  pio->io_lock is DEAD, thus a panic. Further analysis shows the "pio"
  (parent zio of "cio") has already been destroyed.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Youzhong Yang <youzhong@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: George Wilson <george.wilson@delphix.com>

PR: 223803
Tested by: shiva.bhanujan@quorum.com
MFC after: 2 weeks

6 years agoetc: clean up trailing whitespace in autofs
eadler [Thu, 15 Feb 2018 11:41:38 +0000 (11:41 +0000)]
etc: clean up trailing whitespace in autofs

Obtained from: DragonFlyBSD (48a93f514f93ff671b7b6c9bbed54d45b3f65180)

6 years agoshare: update pci_vendors to 2018.02.15
eadler [Thu, 15 Feb 2018 11:13:21 +0000 (11:13 +0000)]
share: update pci_vendors to 2018.02.15

MFC After: 1 week

6 years agoxen: fix smp boot after r328157
mjg [Thu, 15 Feb 2018 07:23:41 +0000 (07:23 +0000)]
xen: fix smp boot after r328157

mce_stack was left unset leading to early crashes

6 years agodevd: don't pass &fds in useless parameters to select(2)
eadler [Thu, 15 Feb 2018 03:22:53 +0000 (03:22 +0000)]
devd: don't pass &fds in useless parameters to select(2)

select(2) should be declared as restrict. In addition the only fd in
the fdset is open O_RDONLY, and it's not a socket that can provide OOB
notifications,

Reviewed by: ian, imp, vangyzen

6 years agomxge(4) should pass unhandled ioctls to ether_ioctl()
rpokala [Thu, 15 Feb 2018 03:22:04 +0000 (03:22 +0000)]
mxge(4) should pass unhandled ioctls to ether_ioctl()

Panasas discovered that ioctl(SIOCGLAGGPORT) returns ENOTTY for mxge(4) when
the NIC is not a member of a lagg. This came as a surprise, because the
SIOCGLAGGPORT handler in if_lagg.c only returns ENOENT (if run against the
laggX interface, rather than a physical port) or EINVAL (if run against a
non-member physical port). This behavior was not seen with other drivers,
such as bge(4), igb(4), and cxl(4). When I compared their respective ioctl
handlers, I found that they all called ether_ioctl() for the default (i.e.
unhandled) case; by contrast, mxge(4) only calls ether_ioctl() for two
specific cases, and returns ENOTTY for the default case.

Remove the two cases which explicitly call ether_ioctl(), and let the
default case call it instead. This matches what the vast majority of the NIC
drivers do.

Reviewed by: kmacy
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14381

6 years agozfsd: Allow zfsd to work on any type of GEOM provider
asomers [Wed, 14 Feb 2018 23:52:39 +0000 (23:52 +0000)]
zfsd: Allow zfsd to work on any type of GEOM provider

cddl/usr.sbin/zfsd/zfsd_event.cc
Remove the check for da and ada devices.  This way zfsd can work on md,
geli, glabel, gstripe, etc devices.  geli in particular is useful
combined with ZFS.  gnop is also useful for simulating drive pulls in
the ZFSD test suite.

Also, eliminate the DevfsEvent class entirely.  Move its
responsibilities into GeomEvent.  We can get everything we need to know
just from listening to GEOM events.

lib/libdevdctl/event.cc
Fix GeomEvent::DevName for CREATE events.  Oddly, the relevant field is
named "cdev" for CREATE events but "devname" for disk events.

MFC after: 3 weeks
Relnotes: Yes (probably worth mentioning the geli part)
Sponsored by: Spectra Logic Corp

6 years agopmap_qenter.9: Document API NX mapping
cem [Wed, 14 Feb 2018 23:47:04 +0000 (23:47 +0000)]
pmap_qenter.9: Document API NX mapping

A follow-up to r329281.

Sponsored by: Dell EMC Isilon

6 years agox86 pmap: Make memory mapped via pmap_qenter() non-executable
cem [Wed, 14 Feb 2018 23:35:47 +0000 (23:35 +0000)]
x86 pmap: Make memory mapped via pmap_qenter() non-executable

The idea is, the pmap_qenter() API is now defined to not produce executable
mappings.  If you need executable mappings, use another API.

Add pg_nx flag in pmap_qenter on x86 to make kernel pages non-executable.

Other architectures that support execute-specific permissons on page table
entries should subsequently be updated to match.

Submitted by: Darrick Lew <darrick.freebsd AT gmail.com>
Reviewed by: markj
Discussed with: alc, jhb, kib
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14062

6 years agong_pppoe(8): add support for user-supplied Host-Uniq tag.
eugen [Wed, 14 Feb 2018 21:17:44 +0000 (21:17 +0000)]
ng_pppoe(8): add support for user-supplied Host-Uniq tag.

A few ISP filter PADI requests based on such tag,
to force the use of their own routers.
The custom Host-Uniq tag is passed in the NGM_PPPOE_CONNECT
control message, so it can be used with FreeBSD ppp(8)
and mpd without any other change.

Add support to send and receive PADM messages,
HURL and MOTM, often used by service providers to provide
ACS information and other configuration settings
to the user CPE.

Submitted by: ale
Approved by: mav (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9270

6 years agoAdd mtree entry for 329275
asomers [Wed, 14 Feb 2018 21:02:38 +0000 (21:02 +0000)]
Add mtree entry for 329275

MFC after: 3 weeks
X-MFC-With: 329275
Sponsored by: Spectra Logic Corp

6 years agorwlock: diff-reduction of runlock compared to sx sunlock
mjg [Wed, 14 Feb 2018 20:37:33 +0000 (20:37 +0000)]
rwlock: diff-reduction of runlock compared to sx sunlock

6 years agogpart: append partition name to the underlying provider's physical path
asomers [Wed, 14 Feb 2018 20:26:09 +0000 (20:26 +0000)]
gpart: append partition name to the underlying provider's physical path

If the underlying provider's physical path is null, then the gpart device's
physical path will be, too. Otherwise, it will append the partition name,
such as "/p1" or "/s1/a". This will make gpart work better with zfsd(8).

PR: 224965
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14010

6 years agostand/lua: Exit sub-menus on backspace
kevans [Wed, 14 Feb 2018 20:18:23 +0000 (20:18 +0000)]
stand/lua: Exit sub-menus on backspace

6 years agogeli: append "/eli" to the underlying provider's physical path
asomers [Wed, 14 Feb 2018 20:15:32 +0000 (20:15 +0000)]
geli: append "/eli" to the underlying provider's physical path

If the underlying provider's physical path is null, then the geli device's
physical path will be, too. Otherwise, it will append "/eli".  This will make
geli work better with zfsd(8).

PR: 224962
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D13979

6 years agonanosleep(2): Fix bogus incrementing of rmtp by tc_tick_sbt on [EINTR].
bdrewery [Wed, 14 Feb 2018 18:43:50 +0000 (18:43 +0000)]
nanosleep(2): Fix bogus incrementing of rmtp by tc_tick_sbt on [EINTR].

sbt is the time in the future that the tsleep_sbt() is expected to be completed
at.  sbtt is the current time.  Depending on the precision with sysctl
kern.timecounter.alloweddeviation the start time may be incremented by
tc_tick_sbt.  The same increment is needed for the current time of sbtt before
calculating the difference.  The impact of missing this increment is that rmtp
may increase by one tc_tick_sbt on every early [EINTR] return.  If the same
struct is passed in for rqtp as rmtp this can result in rqtp effectively
incrementing by tc_tick_sbt and sleeping longer than originally intended.

This problem was introduced in r247797.

Reviewed by: kib, markj, vangyzen (all on an older version of the test)
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14362

6 years agoSimple script to image a small test area from a built tree. Build with
imp [Wed, 14 Feb 2018 18:21:54 +0000 (18:21 +0000)]
Simple script to image a small test area from a built tree. Build with
'cd stand; make MK_FORTH=no MK_LOADER_LUA=yes' then run this script.
You can then test with lua-test.sh with the same parameter.

6 years agoReformat to come significantly closer to style(9).
benno [Wed, 14 Feb 2018 18:07:27 +0000 (18:07 +0000)]
Reformat to come significantly closer to style(9).

Reviewed by: imp, jhibbits
Differential Revision: https://reviews.freebsd.org/D14366

6 years agoefi: Only scan the BLKIO MEDIA once
manu [Wed, 14 Feb 2018 18:05:37 +0000 (18:05 +0000)]
efi: Only scan the BLKIO MEDIA once

Scan only the BLOCK IO MEDIA once instead of each time for each type of
device (fd, cd and hdd).
Leave the mechanism to free and reprobe all devices if one day we want
to implement a "dev rescan" thing.

Reviewed by: imp, tsoome
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14334

6 years agoA quick test script that we can run to use userboot's test mode to
imp [Wed, 14 Feb 2018 17:51:51 +0000 (17:51 +0000)]
A quick test script that we can run to use userboot's test mode to
excersize the load loader. Assumes that we already have a suitable
root area that you pass in with the first arg.

6 years agoImplement .vop_pathconf and .vop_getacl for the .zfs ctldir
asomers [Wed, 14 Feb 2018 15:49:31 +0000 (15:49 +0000)]
Implement .vop_pathconf and .vop_getacl for the .zfs ctldir

zfsctl_common_pathconf will report all the same variables that regular ZFS
volumes report. zfsctl_common_getacl will report an ACL equivalent to 555,
except that you can't read xattrs or edit attributes.

Fixes a bug where "ls .zfs" will occasionally print something like:
ls: .zfs/.: Operation not supported

PR: 225793
Reviewed by: avg
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14365

6 years agolibsa: Fix IP recv timeout
kevans [Wed, 14 Feb 2018 15:40:13 +0000 (15:40 +0000)]
libsa: Fix IP recv timeout

readip() doesn't, at the moment, properly indicate to callers that it has
timed out. One can tell that it's timed out if errno == EAGAIN when it
returns, but this is not ideal. Restructure it a little bit to explicitly
set errno to ETIMEDOUT if we've exhausted tleft.

I found two places that care about where it timed out or not: sendrecv in
net.c and sendrecv_tftp. Both are structured to pass smaller timeout values
to readip while tracking a larger timeout. Neither of them were able to do
this properly with readip not indicating ETIMEDOUT, so fix it.

While here, straighten out the time (t/t1) usage in sendrecv_tftp.

This would have manifested itself in periodic failures to NFS/TFTP boot for
no apparent reason because MINTMO/MAXTMO were not actually being respected
properly. Problems were not reported with NFS, only TFTP.

Reported by: sbruno
Reviewed by: sbruno, tsoome
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D14350

6 years agoFix a panic introduced in r329225
jhibbits [Wed, 14 Feb 2018 15:12:09 +0000 (15:12 +0000)]
Fix a panic introduced in r329225

Some GEOM partition tables may be destroyed with incomplete partition
entries.  Guard against this with NULL checks.

Reported by: pholm,others
Reviewed by: markj
Tested by: pholm

6 years agomsun: signed overflow in atan2
eadler [Wed, 14 Feb 2018 07:59:30 +0000 (07:59 +0000)]
msun: signed overflow in atan2

As a component of atan2(y, x), the case of x == 1.0 is farmed out to
atan(y). The current implementation of this comparison is vulnerable
to signed integer underflow (that is, undefined behavior), and it's
performed in a somewhat more complicated way than it need be. Change
it to not be quite so cute, rather directly comparing the high/low
bits of x to the specific IEEE-754 bit pattern that encodes 1.0.

Note that while there are three different e_atan* files in the
relevant directory, only this one needs fixing. e_atan2f.c already
compares against the full bit pattern encoding 1.0f, while
e_atan2l.cuses bitwise-ands/ors/nots and so doesn't require a change.

Closes #130

Submitted by: Jeff Walden (@jswalden github PR #130)
Reviewed by: bde
MFC After: 1 month

6 years agoPPC64: Get the timestap from the proper OF field
jhibbits [Wed, 14 Feb 2018 02:51:28 +0000 (02:51 +0000)]
PPC64: Get the timestap from the proper OF field

Summary:
After revision rS328534('PPC64: use hwref instead of cpuid'), FreeBSD on
powerpc64 virtual machine panics since it is unable to read the
timebase, showing the following error:

     get-property for timebase-frequency on zero phandle

     panic: Unable to determine timebase frequency!

With the change above,  cpuref->cr_hwref does not contain the phandle
anymore, thus, it never reads the proper CPU entry in OF.

Submitted by: Breno Leitao
Differential Revision: https://reviews.freebsd.org/D14204

6 years agopowerpc64/pseries: Define new hcalls
jhibbits [Wed, 14 Feb 2018 02:48:27 +0000 (02:48 +0000)]
powerpc64/pseries: Define new hcalls

Summary:
Define new hcalls as in 'Linux on Power Architecture Platform Reference'
version 1.1 (24 March 2016) downloaded from:

        https://members.openpowerfoundation.org/document/dl/469

Submitted by: Breno Leitao
Differential Revision: https://reviews.freebsd.org/D14281

6 years agoCleanup unused page argument for vm_reserv_break().
kib [Wed, 14 Feb 2018 00:34:02 +0000 (00:34 +0000)]
Cleanup unused page argument for vm_reserv_break().

Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D14364

6 years agoEnsure memory consistency on COW.
kib [Wed, 14 Feb 2018 00:31:45 +0000 (00:31 +0000)]
Ensure memory consistency on COW.

From the submitter description:
The process is forked transitioning a map entry to COW
Thread A writes to a page on the map entry, faults, updates the pmap to
  writable at a new phys addr, and starts TLB invalidations...
Thread B acquires a lock, writes to a location on the new phys addr, and
  releases the lock
Thread C acquires the lock, reads from the location on the old phys addr...
Thread A ...continues the TLB invalidations which are completed
Thread C ...reads from the location on the new phys addr, and releases
  the lock

In this example Thread B and C [lock, use and unlock] properly and
neither own the lock at the same time.  Thread A was writing somewhere
else on the page and so never had/needed the lock. Thread C sees a
location that is only ever read|modified under a lock change beneath
it while it is the lock owner.

To fix this, perform the two-stage update of the copied PTE.  First,
the PTE is updated with the address of the new physical page with
copied content, but in read-only mode.  The pmap locking and the page
busy state during PTE update and TLB invalidation IPIs ensure that any
writer to the page cannot upgrade the PTE to the writable state until
all CPUs updated their TLB to not cache old mapping.  Then, after the
busy state of the page is lifted, the faults for write can proceed and
do not violate the consistency of the reads.

The change is done in vm_fault because most architectures do need IPIs
to invalidate remote TLBs.  More, I think that hardware guarantees of
atomicity of the remote TLB invalidation are not enough to prevent the
inconsistent reads of non-atomic reads, like multi-word accesses
protected by a lock.  So instead of modifying each pmap invalidation
code, I did it there.

Discovered and analyzed by: Elliott.Rabe@dell.com
Reviewed by: markj
PR: 225584 (appeared to have the same cause)
Tested by: Elliott.Rabe@dell.com, emaste, Mike Tancsa <mike@sentex.net>, truckman
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D14347

6 years agoDo not call pmap_enter() with invalid protection mode.
kib [Wed, 14 Feb 2018 00:25:18 +0000 (00:25 +0000)]
Do not call pmap_enter() with invalid protection mode.

If the map entry elookup was performed due to the mapping changes, we
need to ensure that there is still some access permission bit
requested which is compatible with the current vm_map_entry mode.  If
not, restart the handler from scratch instead of trying to save the
current progress.

Also adjust fault_type to not include cleared permission bits.

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

6 years agokgssapi: Remove trivial deadcode
cem [Wed, 14 Feb 2018 00:12:03 +0000 (00:12 +0000)]
kgssapi: Remove trivial deadcode

CID: 1385956
Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoAdd DECLARE_MODULE_TIED mlink missed in r329244
emaste [Tue, 13 Feb 2018 21:33:40 +0000 (21:33 +0000)]
Add DECLARE_MODULE_TIED mlink missed in r329244

Reported by: imp

6 years agoDocument DECLARE_MODULE_TIED
emaste [Tue, 13 Feb 2018 21:22:09 +0000 (21:22 +0000)]
Document DECLARE_MODULE_TIED

It was introduced in r213716.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

6 years agobwn(4): Conditionalize "RX decryption attempted" message on a new
landonf [Tue, 13 Feb 2018 20:07:40 +0000 (20:07 +0000)]
bwn(4): Conditionalize "RX decryption attempted" message on a new
BWN_DEBUG_HWCRYPTO debug flag.

The MAC will attempt decryption (and set BWN_RX_MAC_DEC) even if a key has
not been supplied to the hardware; this is expected behavior, and there's
no need to spam users' console with this debugging printf.

6 years agoAdd support for zstd-compressed user and kernel core dumps.
markj [Tue, 13 Feb 2018 19:28:02 +0000 (19:28 +0000)]
Add support for zstd-compressed user and kernel core dumps.

This works similarly to the existing gzip compression support, but
zstd is typically faster and gives better compression ratios.

Support for this functionality must be configured by adding ZSTDIO to
one's kernel configuration file. dumpon(8)'s new -Z option is used to
configure zstd compression for kernel dumps. savecore(8) now recognizes
and saves zstd-compressed kernel dumps with a .zst extension.

Submitted by: cem (original version)
Relnotes: yes
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13101,
https://reviews.freebsd.org/D13633

6 years agoamd64/pmap: Move Foundation copyright to the 2-clause section
emaste [Tue, 13 Feb 2018 19:19:26 +0000 (19:19 +0000)]
amd64/pmap: Move Foundation copyright to the 2-clause section

Sponsored by: The FreeBSD Foundation

6 years agoMove zstd malloc()/free()/calloc() macros to stdlib.h.
markj [Tue, 13 Feb 2018 19:18:00 +0000 (19:18 +0000)]
Move zstd malloc()/free()/calloc() macros to stdlib.h.

The definitions otherwise leak into anything that includes zstd.h,
which is not desirable for native FreeBSD code.

Reviewed by: allanjude, cem, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14352

6 years agolibkern: use nul for terminating char rather than 0
emaste [Tue, 13 Feb 2018 19:17:48 +0000 (19:17 +0000)]
libkern: use nul for terminating char rather than 0

Akin to the change made in r188080 for lib/libc/string/.

Reported by: bde
Sponsored by: The FreeBSD Foundation

6 years agoFix Coverity CIDs in the sys/kern/sysv_test tests
asomers [Tue, 13 Feb 2018 19:17:33 +0000 (19:17 +0000)]
Fix Coverity CIDs in the sys/kern/sysv_test tests

CID 979810: strcpy => strlcpy
CID 1193367: don't leak a file descriptor
CID 1299856: Check the return value of read(2)

Reported by: Coverity
Coverity CID: 978910 1193367 1299856
MFC after: 3 weeks
X-MFC-With: 328896
Sponsored by: Spectra Logic Corp

6 years agoports modules: Don't leak AUTO_OBJ changes into the port builds.
bdrewery [Tue, 13 Feb 2018 17:51:16 +0000 (17:51 +0000)]
ports modules: Don't leak AUTO_OBJ changes into the port builds.

This came about when r328489 made ports modules builds no longer use the
in-tree share/mk files, but didn't cleanup MAKEOBJDIR from the
environment.

This fixes "Variable OBJTOP is recursive".

Sponsored by: Dell EMC

6 years agobwn(4): txpid2g/txpid5g[lh] are not defined after sromrev 7; the default
landonf [Tue, 13 Feb 2018 17:43:54 +0000 (17:43 +0000)]
bwn(4): txpid2g/txpid5g[lh] are not defined after sromrev 7; the default
indices into the TX power gain table should be used instead.

This enables use of bwn(4) with later BCM4321 revisions.

Reported by: Trev Roydhouse

6 years agoAdd /boot/lua.
imp [Tue, 13 Feb 2018 17:42:10 +0000 (17:42 +0000)]
Add /boot/lua.

6 years agoNarrow a race, and fix a leak, in g_part_wither
jhibbits [Tue, 13 Feb 2018 17:40:09 +0000 (17:40 +0000)]
Narrow a race, and fix a leak, in g_part_wither

A race in g_part_wither() can lead to I/O being performed with a freed GEOM
when the device disappears.  Close the race as best as we can for now,
following the code patterns from g_part_ctl_destroy() and g_part_ctl_undo().
This also fixes a leak, as g_wither_geom() does not wither providers, it
only orphans them, so the partition entries would never get destroyed in
g_wither_washer().

Note, this is not a complete fix, it can still race with g_part_start(), the
race has merely been narrowed.

Reviewed by: markj
Sponsored by: Dell EMC Isilon

6 years agoFix bad indentation. Whitespace only, no functional changes.
ian [Tue, 13 Feb 2018 17:38:08 +0000 (17:38 +0000)]
Fix bad indentation.  Whitespace only, no functional changes.

Reported by: bde@

6 years agoPull in r323998 from upstream clang trunk (by Richard Smith):
dim [Tue, 13 Feb 2018 17:05:50 +0000 (17:05 +0000)]
Pull in r323998 from upstream clang trunk (by Richard Smith):

  PR36157: When injecting an implicit function declaration in C89, find
  the right DeclContext rather than injecting it wherever we happen to
  be.

  This avoids creating functions whose DeclContext is a struct or
  similar.

This fixes assertion failures when parsing certain not-completely-valid
struct declarations.

Reported by: ae
PR: 225862
MFC after: 3 months
X-MFC-With: r327952

6 years agoImport the mthca kernel side infiniband driver from Linux 4.9 and fix
hselasky [Tue, 13 Feb 2018 17:04:34 +0000 (17:04 +0000)]
Import the mthca kernel side infiniband driver from Linux 4.9 and fix
compilation under FreeBSD. The mthca driver was temporarily removed as
part of the Linux 4.9 RoCE/infinband upgrade.

Top commit in Linux source tree:
69973b830859bc6529a7a0468ba0d80ee5117826

Sponsored by: Mellanox Technologies

6 years agoAllow overriding VTABSIZE at compile-time.
bdrewery [Tue, 13 Feb 2018 16:48:57 +0000 (16:48 +0000)]
Allow overriding VTABSIZE at compile-time.

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D14339

6 years agoFix non-64-bit platform build by printing bus_addr_t values using %#jx
lwhsu [Tue, 13 Feb 2018 16:26:06 +0000 (16:26 +0000)]
Fix non-64-bit platform build by printing bus_addr_t values using %#jx

Reviewed by: slm
Differential Revision: https://reviews.freebsd.org/D14344

6 years agolist myself in the MAINTAINERS file for Xen bits
royger [Tue, 13 Feb 2018 16:25:43 +0000 (16:25 +0000)]
list myself in the MAINTAINERS file for Xen bits

6 years agoFix resolv to run when it should and not when it should not..
brd [Tue, 13 Feb 2018 16:07:39 +0000 (16:07 +0000)]
Fix resolv to run when it should and not when it should not..

Approved by: manu
Reported by: manu
Pointy hat to: brd

6 years agolinuxkpi: Do not leak pages on put.
kib [Tue, 13 Feb 2018 15:44:35 +0000 (15:44 +0000)]
linuxkpi: Do not leak pages on put.

When the owner of the wire reference releases the last reference, it
might be that the page was already attempted to be freed (but free
cannot be performed at that time due to wire).  Check that the page
was removed from the object as the indicator of the free attempt and
finish the free operation if so.

Reported and tested by: Slava Shwartsman
Reviewed by: hselasky
Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agoDo not leak rv->psind in some specific situations.
kib [Tue, 13 Feb 2018 15:36:28 +0000 (15:36 +0000)]
Do not leak rv->psind in some specific situations.

Suppose that we have an object with a mapped superpage, and that all
pages in the superpages are held (by some driver).  Additionally,
suppose that the object is terminated, e.g. because the only process
mapping it is exiting.  Then the reservation is broken, but the pages
cannot be freed until later, when they are unheld.  In this situation,
the reservation code cannot clean psind, since no pages are freed, and
the page is freed and then reused with invalid psind.

Clean psind on vm_reserv_break() to avoid the situation.

Reported and tested by: Slava Shwartsman
Reviewed by: markj
Sponsored by: Mellanox Technologies
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D14335

6 years agoFix build with gas.
kib [Tue, 13 Feb 2018 15:30:31 +0000 (15:30 +0000)]
Fix build with gas.

Do not use C constant suffixes.  Bit values are small enough to not
require typing, despite they are used for 64bit MSR writes.  The added
cast in hw_ibrs_recalculate() is redundand but I prefer to add it for
clarity.

Reported by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoUpdate the secteam/security officer list to match reality.
remko [Tue, 13 Feb 2018 15:13:43 +0000 (15:13 +0000)]
Update the secteam/security officer list to match reality.

6 years agoFix for incorrect PnP information used by devmatch(8).
hselasky [Tue, 13 Feb 2018 11:43:57 +0000 (11:43 +0000)]
Fix for incorrect PnP information used by devmatch(8).

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoDSCP values passed to setdscp need to be lowercase.
n_hibma [Tue, 13 Feb 2018 10:11:39 +0000 (10:11 +0000)]
DSCP values passed to setdscp need to be lowercase.

See definition of f_ipdscp values. They are compared against using bcmp
which is case sensitive.

MFC after: 1 week

6 years agoRemove leftover empty directory.
hselasky [Tue, 13 Feb 2018 08:17:19 +0000 (08:17 +0000)]
Remove leftover empty directory.

6 years agoAdd new USB quirk.
hselasky [Tue, 13 Feb 2018 08:13:20 +0000 (08:13 +0000)]
Add new USB quirk.

PR: 225844
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd missing semicolon to not break devd during system startup.
hselasky [Tue, 13 Feb 2018 08:10:17 +0000 (08:10 +0000)]
Add missing semicolon to not break devd during system startup.

6 years ago- I'm not using nis(8) and ypldap(8) anymore, so I'm removing myself
araujo [Tue, 13 Feb 2018 06:36:27 +0000 (06:36 +0000)]
- I'm not using nis(8) and ypldap(8) anymore, so I'm removing myself
  from MAINTAINERS list.

6 years agoUnify metadata load files for arm, mips, powerpc, sparc64
jhibbits [Tue, 13 Feb 2018 03:44:50 +0000 (03:44 +0000)]
Unify metadata load files for arm, mips, powerpc, sparc64

Summary:
All metadata.c files are very similar, with only trivial changes.  Unify them
into a single common file, with minor special-casing where needed.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D13978

6 years agoUse tabs in io.d, fix alignment issues, remove extraneous newlines
dteske [Mon, 12 Feb 2018 23:53:38 +0000 (23:53 +0000)]
Use tabs in io.d, fix alignment issues, remove extraneous newlines

6 years agoMake v_wire_count a per-cpu counter(9) counter. This eliminates a
jeff [Mon, 12 Feb 2018 22:53:00 +0000 (22:53 +0000)]
Make v_wire_count a per-cpu counter(9) counter.  This eliminates a
significant source of cache line contention from vm_page_alloc().  Use
accessors and vm_page_unwire_noq() so that the mechanism can be easily
changed in the future.

Reviewed by: markj
Discussed with: kib, glebius
Tested by: pho (earlier version)
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14273

6 years agodevmatch.8: Link to MODULE_PNP_INFO(9)
cem [Mon, 12 Feb 2018 22:43:47 +0000 (22:43 +0000)]
devmatch.8: Link to MODULE_PNP_INFO(9)

Sponsored by: Dell EMC Isilon

6 years agoTake a first stab at documenting use of MODULE_PNP_INFO
cem [Mon, 12 Feb 2018 22:42:06 +0000 (22:42 +0000)]
Take a first stab at documenting use of MODULE_PNP_INFO

Sponsored by: Dell EMC Isilon

6 years agobwn(4): Fix outstanding bug in PHY-G tssi2dbm table generation caught by
landonf [Mon, 12 Feb 2018 22:21:11 +0000 (22:21 +0000)]
bwn(4): Fix outstanding bug in PHY-G tssi2dbm table generation caught by
-Wconstant-conversion, and remove now unnecessary warning suppression
flags.

6 years agoUpdate the MTU in affected routes when IPv6 RA changes the MTU
vangyzen [Mon, 12 Feb 2018 19:49:20 +0000 (19:49 +0000)]
Update the MTU in affected routes when IPv6 RA changes the MTU

ip6_calcmtu() only looks at the interface MTU if neither the TCP hostcache
nor the route provides an MTU.  Update the routes so they do not provide
stale MTUs.

This fixes UNH IPv6 conformance test cases v6LC_4_1_08 and v6LC_4_1_09,
which use a RA to reduce the link MTU from 1500 to 1280.

Reported and tested by: Farrell Woods <Farrell_Woods@Dell.com>
Reviewed by: dab, melifaro
Discussed with: ae
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14257

6 years agosiba(4): Ignore disabled per-core address match entries.
landonf [Mon, 12 Feb 2018 19:36:26 +0000 (19:36 +0000)]
siba(4): Ignore disabled per-core address match entries.

Previously, the address regions described by disabled admatch entries would
be treated as being mapped to the given core; while incorrect, this was
essentially harmless given that the entries describe unused address space
on the few affected devices.

We now perform parsing of per-core admatch registers and interrupt flags in
siba_erom, correctly skip any disabled admatch entries, and use the
siba_erom API in siba_add_children() to perform enumeration of attached
cores.

6 years agoFix a comment. No functional change.
asomers [Mon, 12 Feb 2018 17:42:28 +0000 (17:42 +0000)]
Fix a comment.  No functional change.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoAdd a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot
ian [Mon, 12 Feb 2018 17:41:11 +0000 (17:41 +0000)]
Add a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot
read or write of all registered realtime clocks.  In the read case, the
values read are simply discarded.  For writes, there's no alternative but
to actually write the current system time to the device.

6 years agoAdd a set of convenience routines for RTC drivers to use for debug output,
ian [Mon, 12 Feb 2018 17:33:14 +0000 (17:33 +0000)]
Add a set of convenience routines for RTC drivers to use for debug output,
and a debug.clock_show_io sysctl to control debugging output.

6 years agoMark the pages used for the initial page-table entries as wired. This
jtl [Mon, 12 Feb 2018 17:27:50 +0000 (17:27 +0000)]
Mark the pages used for the initial page-table entries as wired. This
makes them consistent with the way other page-table pages are allocated.
It also provides the rest of the VM system a good clue that these pages
are used.

Reviewed by: alc, kib, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14269

6 years agoReplace the existing print_ct() private debugging function with a set of
ian [Mon, 12 Feb 2018 16:25:56 +0000 (16:25 +0000)]
Replace the existing print_ct() private debugging function with a set of
three public functions to format and print the three major data structures
used by realtime clock drivers (clocktime, bcd_clocktime, and timespec).

6 years agoAdd lua to build script
imp [Mon, 12 Feb 2018 15:32:05 +0000 (15:32 +0000)]
Add lua to build script

6 years agoAdd the lua scripts from the lua-bootloader SoC
imp [Mon, 12 Feb 2018 15:32:00 +0000 (15:32 +0000)]
Add the lua scripts from the lua-bootloader SoC

These are the .lua files from from Pedro Souza's 2014 Summer of Code
project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also
contributed.

Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code

Improve the SoC lua menu code to bring it in line with forth
menu functionality

Submitted by: Zakary Nafziger
Sponsored by: FreeBSD Foundation

Use loader.setenv and loader.unsetenv instead of loader.perform

Convert from include("/boot/foo.lua") to foo = require("foo");
to bring in line with latest lua module conventions.

Enforce a uniform style for the new .lua files:
o hard tab indenation for 8 spaces
o don't have if foo then bar; else bas; end on one line

MFC After: 1 month
Relnotes: yes
Differential Review: https://reviews.freebsd.org/D14295

6 years agoAdd Lua as a scripting langauge to /boot/loader
imp [Mon, 12 Feb 2018 15:31:53 +0000 (15:31 +0000)]
Add Lua as a scripting langauge to /boot/loader

liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.

Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.

Add LOADER_LUA option, currently off by default.

Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.

Bump FreeBSD version to 1200058 to mark the milestone.

Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.

Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295

6 years agoMove __va_list and related defines to sys/sys/_types.h
imp [Mon, 12 Feb 2018 14:48:20 +0000 (14:48 +0000)]
Move __va_list and related defines to sys/sys/_types.h

__va_list and related defines are identical in all the
ARCH/include/_types.h files. Move them to sys/sys/_types.h

Sponsored by: Netflix

6 years agoWe don't support gcc < 4.2.1, so varargs.h now is just #error
imp [Mon, 12 Feb 2018 14:48:14 +0000 (14:48 +0000)]
We don't support gcc < 4.2.1, so varargs.h now is just #error
always. Unifdef for versions prior to 4.2.1 and remove now-unused
header files.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14323

6 years agoUse standard pattern for stdargs.h
imp [Mon, 12 Feb 2018 14:48:05 +0000 (14:48 +0000)]
Use standard pattern for stdargs.h

We don't support older compilers. Most of the code in these files is
for pre-3.0 gcc, which is at least 15 years obsolete. Move to using
phk's sys/_stdargs.h for all these platforms.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14323

6 years agoProvide further mitigation against CVE-2017-5715 by flushing the
tychon [Mon, 12 Feb 2018 14:45:27 +0000 (14:45 +0000)]
Provide further mitigation against CVE-2017-5715 by flushing the
return stack buffer (RSB) upon returning from the guest.

This was inspired by this linux commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/kvm?id=117cc7a908c83697b0b737d15ae1eb5943afe35b

Reviewed by: grehan
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14272

6 years agoMove devmatch to sbin from usr/sbin.
imp [Mon, 12 Feb 2018 14:44:21 +0000 (14:44 +0000)]
Move devmatch to sbin from usr/sbin.

Since we want to use devmatch in context before a split /,/usr system
has mounted /usr, move devmatch to /sbin.

Sponsored by: Netflix

6 years agoFix typo
imp [Mon, 12 Feb 2018 06:52:49 +0000 (06:52 +0000)]
Fix typo

6 years agoTurn devmatch on by default.
imp [Mon, 12 Feb 2018 06:51:20 +0000 (06:51 +0000)]
Turn devmatch on by default.

Turn devmatch on by default. However, use 'start' instead of
'onestart' in the devmatch.conf file so the setting of
'devmatch_enable' is honored. Give an example of what to put in
devd.conf if you want to disable just the run-time part of devmatch.

Relnotes: yes

6 years agoAdd usb.conf to ObsoleteFiles.
imp [Mon, 12 Feb 2018 06:42:38 +0000 (06:42 +0000)]
Add usb.conf to ObsoleteFiles.
Add a note to UPDATING.
Fix a missing tab.

Relnotes: Yes

6 years agoInstall devmatch.conf, don't install usb.conf
imp [Mon, 12 Feb 2018 04:54:51 +0000 (04:54 +0000)]
Install devmatch.conf, don't install usb.conf

6 years agoInstall devmatch int /etc/rc.d and echo modules being installed.
imp [Mon, 12 Feb 2018 04:52:25 +0000 (04:52 +0000)]
Install devmatch int /etc/rc.d and echo modules being installed.

6 years agoSwitch to using devmatch to autoload drivers. Remove usb.conf
imp [Mon, 12 Feb 2018 04:45:26 +0000 (04:45 +0000)]
Switch to using devmatch to autoload drivers. Remove usb.conf
as obsolete because devmatch gets its information from the same
place as the genration scripts.

6 years agoAdd devmatch rc.d integration
imp [Mon, 12 Feb 2018 04:45:17 +0000 (04:45 +0000)]
Add devmatch rc.d integration

Create simple script to load modules on demand based on the device
identifying information.

Sponsored by: Netflix

6 years agodevice_add_child.9: reference logical opposite, device_delete_child(9)
cem [Sun, 11 Feb 2018 22:09:07 +0000 (22:09 +0000)]
device_add_child.9: reference logical opposite, device_delete_child(9)

6 years agoPrint out the shared memory queues during initialization
scottl [Sun, 11 Feb 2018 20:15:47 +0000 (20:15 +0000)]
Print out the shared memory queues during initialization

Sponsored by: Netflix