]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAdd posixshmcontrol(1), an utility to manipulate posix shared memory segments.
kib [Thu, 23 May 2019 14:33:01 +0000 (14:33 +0000)]
Add posixshmcontrol(1), an utility to manipulate posix shared memory segments.

See usage for the command line structure.  Man page will come shortly.

Reviewed by: jilles, tmunro
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20258

5 years agoRelease the bus-recovery gpio pins in detach(), so that unload then
ian [Thu, 23 May 2019 14:21:23 +0000 (14:21 +0000)]
Release the bus-recovery gpio pins in detach(), so that unload then
reload of the module works without "pin already allocated" errors.

5 years agoetcupdate: Add missing directory when building the tree
manu [Thu, 23 May 2019 14:05:42 +0000 (14:05 +0000)]
etcupdate: Add missing directory when building the tree

Missed in 348151

Reported by: lwshu, ci

5 years agoMark i2c slave devices busy while they own the bus.
ian [Thu, 23 May 2019 14:02:39 +0000 (14:02 +0000)]
Mark i2c slave devices busy while they own the bus.

Many i2c slave drivers are in modules that can be unloaded.  If they detach
while IO is in progress the bus would be hung forever.  Conversely,
lower-layer drivers (iicbus and the hardware driver) also live in modules
and other kinds of bad things happen if they get detached while IO is in
progress.  Because device_busy() propagates up to parents, marking the slave
device busy while it owns the bus solves both kinds of problems that come
with detaching i2c devices while IO is in progress.

5 years agoadd mrsas_shutdown method
avg [Thu, 23 May 2019 12:51:13 +0000 (12:51 +0000)]
add mrsas_shutdown method

It should be safer to flush controller and disk caches on the shutdown.
And to gracefully shut down the controller as well.
It seems that the Linux driver has been doing that for a long time.

Discussed with: scottl
Reviewed by: imp, Sumit Saxena <sumit.saxena@broadcom.com>
(both earlier version)
MFC after: 3 weeks
Sponsored by: Panzura
Differential Revision: https://reviews.freebsd.org/D19817

5 years agoAdd a kern.ipc.posix_shm_list sysctl.
kib [Thu, 23 May 2019 12:35:40 +0000 (12:35 +0000)]
Add a kern.ipc.posix_shm_list sysctl.

The sysctl provides the listing on named linked posix shared memory
segments existing in the system.

Reuse shm_fill_kinfo() for filling individual struct kinfo_file.
Remove unneeded lock around reading of shmfd->shm_mode.

Reviewed by: jilles, tmunro
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20258

5 years agoReport ref count of the backing object as st_nlink for posix shm fd.
kib [Thu, 23 May 2019 12:27:45 +0000 (12:27 +0000)]
Report ref count of the backing object as st_nlink for posix shm fd.

Unless there are transient references to the object, the ref count is
equal to the number of the shared memory segment mappings plus one.

Reviewed by: jilles, tmunro
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20258

5 years agoMake pack_kinfo() available for external callers.
kib [Thu, 23 May 2019 12:25:03 +0000 (12:25 +0000)]
Make pack_kinfo() available for external callers.

Reviewed by: jilles, tmunro
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20258

5 years agogpioled: fix the manual page update in r348154
avg [Thu, 23 May 2019 11:35:00 +0000 (11:35 +0000)]
gpioled: fix the manual page update in r348154

MFC after: 2 weeks

5 years agogpioled: update the manual page after r348153
avg [Thu, 23 May 2019 11:21:27 +0000 (11:21 +0000)]
gpioled: update the manual page after r348153

MFC after: 2 weeks

5 years agogpioled: add a new hint for initial state
avg [Thu, 23 May 2019 11:15:22 +0000 (11:15 +0000)]
gpioled: add a new hint for initial state

hint.gpioled.%d.state determines the initial state of the LED when the
driver takes control over it:
  0 - the LED is off
  1 - the LED is on
 -1 - the LED is kept as it was

While here, add a module version declaration.

MFC after: 2 weks

5 years agoAdd USB ID for CP2112
avg [Thu, 23 May 2019 11:06:38 +0000 (11:06 +0000)]
Add USB ID for CP2112

This is a curious small widget for which I might write a driver.
It is bridge between USB HID interface and I2C interface plus some
GPIO pins.

MFC after:  2 weeks

5 years agoetcupdate: Fix -p after the move of the passwd related files
manu [Thu, 23 May 2019 07:59:16 +0000 (07:59 +0000)]
etcupdate: Fix -p after the move of the passwd related files

Since PREWORLD_FILES only contain files that needs to be copied into /etc
copy directly those files there.

Reported by: many

5 years agopkgbase: Remove etc/zfs from being packaged
manu [Thu, 23 May 2019 06:53:59 +0000 (06:53 +0000)]
pkgbase: Remove etc/zfs from being packaged

This is an empty directory and it cause a FreeBSD-zfs package to
be created when we don't need one.

Reviewed by: bapt

5 years agoDelete unneeded #include <sys/inflate.h> from sys/mips.
delphij [Thu, 23 May 2019 05:17:18 +0000 (05:17 +0000)]
Delete unneeded #include <sys/inflate.h> from sys/mips.

PR: 229763
Submitted by: Yoshihiro Ota <ota at j.email.ne.jp>
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20190

5 years agopowerpc/mpc85xx: Use the proper (EREF) form of writing to DBCR0
jhibbits [Thu, 23 May 2019 03:47:25 +0000 (03:47 +0000)]
powerpc/mpc85xx: Use the proper (EREF) form of writing to DBCR0

DBCR0, according to the Freescale EREF, is guaranteed to be updated, and
changes take effect, after an isync plus change of MSR[DE] from 0 to 1.
Otherwise it's guaranteed to be updated "eventually".  Use the expected
synchronization sequence to write it for resetting.

This prevents "Reset failed" from being printed immediately before the CPU
resets.

MFC after: 2 weeks

5 years agopowerpc/booke: It helps to set variables before using them
jhibbits [Thu, 23 May 2019 03:40:48 +0000 (03:40 +0000)]
powerpc/booke: It helps to set variables before using them

Actually set the source and destination VA's before using them.  Fixes a
bizarre panic on 32-bit Book-E.  Not sure why this wasn't caught by the
compiler.

5 years agoFix typo from r348128: _func__ -> __func__
dougm [Thu, 23 May 2019 02:10:41 +0000 (02:10 +0000)]
Fix typo from r348128: _func__ -> __func__

Reported by: LINT

5 years agoRemove accidentally-added blank line; the style throughout this file
ian [Thu, 23 May 2019 01:49:08 +0000 (01:49 +0000)]
Remove accidentally-added blank line; the style throughout this file
is to use no whitespace between a comment block and the code it describes.

5 years agoHandle the driftfile option correctly when ntpd_flags is empty.
ian [Thu, 23 May 2019 01:41:49 +0000 (01:41 +0000)]
Handle the driftfile option correctly when ntpd_flags is empty.

The logic I originally wrote to detect whether a driftfile option was in the
set of flags was based on the result of removing the pattern *flag* being an
empty string.  That didn't handle the case where the string was empty to
begin with.  Doh!  So now it also specifically checks for an empty string.

The result of the bad check was that ntpd would run without a driftfile, but
it would do so only if it was running as root instead of the non-priveleged
ntpd user, which isn't a typical case.  Ntpd runs fine without a driftfile,
although it does take it longer to stabilize the clock frequency at startup.

Reported by: avg@
Pointy hat: ian@
MFC after: some testing

5 years agoDecode and name additional x86 feature bits
cem [Wed, 22 May 2019 23:22:36 +0000 (23:22 +0000)]
Decode and name additional x86 feature bits

These are all enumerated in Intel's ISA extension reference, 37th ed.

Sponsored by: Dell EMC Isilon

5 years agoCleanups made necessary by r348115, or reactions to it:
dougm [Wed, 22 May 2019 23:11:16 +0000 (23:11 +0000)]
Cleanups made necessary by r348115, or reactions to it:
1. Change size_t to vm_size_t in some places.
2. Rename vm_map_entry_resize_free to drop the _free part.
3. Fix whitespace errors.
4. Fix screwups in patch-conflict-management that left out important
changes related to growing and shrinking objects.

Reviewed by: alc
Approved by: kib (mentor)

5 years agobectl(8): add description for create subcommand
kevans [Wed, 22 May 2019 23:07:40 +0000 (23:07 +0000)]
bectl(8): add description for create subcommand

In commit r345845, a portion of documentation for the create subcommand was
removed. Specifically, for creating a snapshot of an existing boot
environment. bectl even has a test-case for this functionality.

Removing the sub-command description was discussed in PR 235850.

This patch brings back the second "create" description that was originally
in place. Albeit, with a few wording/clarifying changes.

Submitted by: Rob Fairbanks <rob.fx907 gmail com>
Reviewed by: kevans
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D20249

5 years agoAdd pnp info to the imx_i2c driver.
ian [Wed, 22 May 2019 21:47:26 +0000 (21:47 +0000)]
Add pnp info to the imx_i2c driver.

5 years agosave-entropy(8), rc.d/random: Set nodump flag
cem [Wed, 22 May 2019 21:47:17 +0000 (21:47 +0000)]
save-entropy(8), rc.d/random: Set nodump flag

Tag saved entropy files as "nodump," to signal that the files should not be
backed up by dump(8) or other automated backup software that honors the file
flag.

Do not produce an error if the target file resides on a filesystem that does
not support file flags (e.g., msdos /boot).

Reviewed by: delphij
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20358

5 years agoFix gateway setup for the interface routes.
melifaro [Wed, 22 May 2019 21:20:15 +0000 (21:20 +0000)]
Fix gateway setup for the interface routes.

Currently rinit1() and its IPv6 counterpart
  nd6_prefix_onlink_rtrequest() uses dummy null_sdl gateway address
  during route insertion and change it afterwards. This behaviour
  brings complications to the routing stack and the users of its
  upcoming notification system.

This change fixes both rinit1() and nd6_prefix_onlink_rtrequest()
  by filling in proper gateway in the beginning. It does not change any
  of the userland notifications as in both cases, they happen after
  the insertion and fixup process (rt_newaddrmsg_fib() and nd6_rtmsg()).

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20328

5 years agoAdd a new 'tr' (transfer) mode to i2c(8) to support more i2c controllers.
ian [Wed, 22 May 2019 21:06:10 +0000 (21:06 +0000)]
Add a new 'tr' (transfer) mode to i2c(8) to support more i2c controllers.

Some i2c controller hardware does not provide a way to do individual START,
REPEAT-START and STOP actions on the i2c bus.  Instead, they can only do
a complete transfer as a single operation.  Typically they can do either
START-data-STOP or START-data-REPEATSTART-data-STOP.  In the i2c driver
framework, this corresponds to the iicbus_transfer method.  In the userland
interface they are initiated with the I2CRDWR ioctl command.

These changes add a new 'tr' mode which can be specified with the '-m'
command line option.  This mode should work on all hardware; when an i2c
controller driver doesn't directly support the iicbus_transfer method,
code in the i2c driver framework uses the lower-level START/REPEAT/STOP
methods to implement the transfer.  After this new mode has gotten some
testing on various hardware, the 'tr' mode should probably become the
new default mode.

PR: 189914

5 years agoAllocate buffers smaller then ABD chunk size as linear.
mav [Wed, 22 May 2019 18:43:48 +0000 (18:43 +0000)]
Allocate buffers smaller then ABD chunk size as linear.

This allows to reduce memory waste by letting UMA to put multiple small
buffers into one memory page slab.  The page sharing means that UMA
may not be able to free memory page when some of buffers are freed, but
alternatively memory used by that buffer would just be wasted from the
beginning.

This change follows alike change in ZoL, but unlike Linux (according to
my understanding of it from comments) FreeBSD never shares slabs bigger
then one memory page, so this should be even less invasive then there.

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

5 years agoPassing a parameter to vm_map_entry_resize_free that describes the
dougm [Wed, 22 May 2019 17:40:54 +0000 (17:40 +0000)]
Passing a parameter to vm_map_entry_resize_free that describes the
amount of resizing reduces the number of functions changing the vm_map
invariants regarding the max_free field of map entries.

Reviewed by: markj (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D20356

5 years agoFix ObsoleteFiles after ethernet driver removal
zeising [Wed, 22 May 2019 16:59:22 +0000 (16:59 +0000)]
Fix ObsoleteFiles after ethernet driver removal

Fix OpsoleteFiles.inc after removal of ethernet drivers.  The drivers have
manual pages, and manual pages are generally stored compressed, with a .gz
suffix, but this is not reflected in ObsoleteFiles and make delete-old fails
to remove them.

Approved by: brooks
Sponsored by: B3 Init
Differential Revision: https://reviews.freebsd.org/D20351

5 years agoUpdate VFS_FHTOVP(9) with the flags argument
asomers [Wed, 22 May 2019 16:24:39 +0000 (16:24 +0000)]
Update VFS_FHTOVP(9) with the flags argument

Revison 222167 added a new argument to VFS_FHTOVP. This revision updates the
man page to match.

Reviewed by: rmacklem
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20323

5 years agoFix PPC64 kernel build with clang8 + lld8
luporl [Wed, 22 May 2019 15:56:41 +0000 (15:56 +0000)]
Fix PPC64 kernel build with clang8 + lld8

This patch fixes the following lld link errors:

- unsupported dynamic relocations on read-only sections
- out-of-range TOC references

Submitted by: git_bdragon.rtk0.net
Reviewed by: jhibbits, luporl
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D19352

5 years agoSimplify math added in r310524.
mav [Wed, 22 May 2019 15:39:35 +0000 (15:39 +0000)]
Simplify math added in r310524.

Should be no functional change.

Reported by: danfe
MFC after: 1 week

5 years agoFix condition broken at r345815.
mav [Wed, 22 May 2019 15:25:10 +0000 (15:25 +0000)]
Fix condition broken at r345815.

Reported by: danfe
MFC after: 3 days

5 years agox86 MCA: introduce MCA hooks for different vendor implementations
gallatin [Wed, 22 May 2019 13:44:15 +0000 (13:44 +0000)]
x86 MCA: introduce MCA hooks for different vendor implementations

This is needed for AMD SMCA processors, as SMCA uses different
MSR address for access MCA banks.

Use IA32 specific msr_ops as defualt, and use SMCA-specific msr_ops
when on an SMCA-enabled processor

Submitted by: chandu from amd dot com
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D18055

5 years agoacpi_hpet: restore support for timers defined only in HPET table
avg [Wed, 22 May 2019 08:30:03 +0000 (08:30 +0000)]
acpi_hpet: restore support for timers defined only in HPET table

This fixes a regress introduced in r339754.
After that change the code required that there is a HPET device
in the ACPI namespace.
The problem has been noticed on an PC Engines apu2 system.

While here, fix a small formatting issue.

5 years agopkgbase: Really move login.access
manu [Wed, 22 May 2019 07:41:58 +0000 (07:41 +0000)]
pkgbase: Really move login.access

Messed up with git->svn r348102

5 years agopkgbase: Really move termcap.small
manu [Wed, 22 May 2019 07:41:20 +0000 (07:41 +0000)]
pkgbase: Really move termcap.small

Messed up with git->svn in r348101

5 years agopkgbase: Really move rc.sendmail
manu [Wed, 22 May 2019 07:40:39 +0000 (07:40 +0000)]
pkgbase: Really move rc.sendmail

Messed up with git->svn in r348100

5 years agopkgbase: Really move rc.bsdextended
manu [Wed, 22 May 2019 07:39:59 +0000 (07:39 +0000)]
pkgbase: Really move rc.bsdextended

Messed up with git->svn in r348099

5 years agopkgbase: Really move rc.firewall
manu [Wed, 22 May 2019 07:38:54 +0000 (07:38 +0000)]
pkgbase: Really move rc.firewall

Messed up with git->svn in r348098

5 years agopkgbase: Move login.access to usb.bin/login
manu [Wed, 22 May 2019 07:23:03 +0000 (07:23 +0000)]
pkgbase: Move login.access to usb.bin/login

Also remove the etc-examples target as we don't have any files
to handle here.

Reviewed by: bapt

5 years agopkgbase: Move termcap.small to share/termcap
manu [Wed, 22 May 2019 07:22:34 +0000 (07:22 +0000)]
pkgbase: Move termcap.small to share/termcap

Reviewed by: bapt

5 years agopkgbase: Move rc.sendmail to libexec/rc
manu [Wed, 22 May 2019 07:22:08 +0000 (07:22 +0000)]
pkgbase: Move rc.sendmail to libexec/rc

Reviewed by: bapt

5 years agopkgbase: Move rc.bsdextended to libexec/rc
manu [Wed, 22 May 2019 07:21:39 +0000 (07:21 +0000)]
pkgbase: Move rc.bsdextended to libexec/rc

Reviewed by: bapt

5 years agopkgbase: Move rc.firewall to libexec/rc
manu [Wed, 22 May 2019 07:21:05 +0000 (07:21 +0000)]
pkgbase: Move rc.firewall to libexec/rc

Put it with all the other rc files

Reviewed by: bapt

5 years agoMake aacraid(4) working on ASR8805 & ASR8402 in particular. This patch
sobomax [Wed, 22 May 2019 04:51:08 +0000 (04:51 +0000)]
Make aacraid(4) working on ASR8805 & ASR8402 in particular. This patch
has been in the PR system for 5 months and then on reviews for another 5.
Nobody came with any cases where it fails, while many people cried for
it to be commited & merged.

PR: 209468
Submitted by: Prasad B M <prasad.munirathnam@microsemi.com>
Reported by: Steven Peterson <scp@mainstream.net>
Approved by: scottl
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18408

5 years agoMarginally improve usage() message style in bootpd.
markj [Wed, 22 May 2019 04:13:57 +0000 (04:13 +0000)]
Marginally improve usage() message style in bootpd.

- Remove an extra space after "usage:".
- Avoid lines exceeding 80 columns.

Based on notes from rgrimes.

MFC with: r348066
Event: Waterloo Hackathon 2019

5 years agoUpdate the example added in r348082 to specify a dump device priority.
markj [Wed, 22 May 2019 03:52:39 +0000 (03:52 +0000)]
Update the example added in r348082 to specify a dump device priority.

Event: Waterloo Hackathon 2019

5 years agoProvide an example of using dhclient-script(5) to configure netdump.
markj [Wed, 22 May 2019 03:49:38 +0000 (03:49 +0000)]
Provide an example of using dhclient-script(5) to configure netdump.

Reviewed by: cem
MFC after: 1 week
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D20345

5 years agoHook up the existing i386 DTrace tests to the build.
markj [Wed, 22 May 2019 03:42:03 +0000 (03:42 +0000)]
Hook up the existing i386 DTrace tests to the build.

Now that it's relatively easy to do so, we might as well.

MFC after: 1 week
Event: Waterloo Hackathon 2019

5 years agoMake it possible to generate makefiles for arch-dependent DTrace tests.
markj [Wed, 22 May 2019 03:10:23 +0000 (03:10 +0000)]
Make it possible to generate makefiles for arch-dependent DTrace tests.

MFC after: 1 week
Event: Waterloo Hackathon 2019

5 years agopowerpc/booke: Use wrtee instead of msr to restore EE bit
jhibbits [Wed, 22 May 2019 02:43:17 +0000 (02:43 +0000)]
powerpc/booke: Use wrtee instead of msr to restore EE bit

The MSR[EE] bit does not require synchronization when changing.  This is a
trivial micro-optimization, removing the trailing isync from mtmsr().

MFC after: 1 week

5 years agopmc: Fix stack std::string lifetime
cem [Wed, 22 May 2019 01:22:33 +0000 (01:22 +0000)]
pmc: Fix stack std::string lifetime

It's invalid to reference a C++ string's c_str() buffer after the object
goes out of scope.  Adjust the scope of the string to match the use in
write(2) to fix the misuse.

CID: 1393383
Reported by: Coverity

5 years agoLink fhlinkat(2) man page
asomers [Wed, 22 May 2019 01:11:21 +0000 (01:11 +0000)]
Link fhlinkat(2) man page

Reviewed by: kib
MFC after: 3 days
MFC-With: r341689
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20339

5 years agoRevert r348070
cem [Wed, 22 May 2019 00:21:42 +0000 (00:21 +0000)]
Revert r348070

Konstantin points out that lockmgr probably requires the whole lock.h anyway.

Requested by: kib

5 years agoDo not call hw_mds_recalculate() from initializecpu().
kib [Tue, 21 May 2019 22:56:21 +0000 (22:56 +0000)]
Do not call hw_mds_recalculate() from initializecpu().

If MDS mitigation is enabled by the tunable but MDS microcode is not
early-loaded, software mitigation is selected.  This causes
initializecpu() to try to allocate memory which makes boot process
very unhappy.

Create SYSINIT that runs sufficiently late to succeed.

Reported by: naddy
PR: 237968
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoThis revision began as a simple change to eliminate an uninitialized warning
mckusick [Tue, 21 May 2019 22:24:38 +0000 (22:24 +0000)]
This revision began as a simple change to eliminate an uninitialized warning
found by Coverity. However, upon closer inspection the implementation of
fsck_ffs's fsck_readdir() and dircheck() functions is both nearly impossible
to follow and fails to check / fix directories in several cases. So, this
revision is an entire rewrite of these two functions to clarify what they
are doing and also to get something that works properly.

Referred by:  cem
Reviewed by:  kib, David G Lawrence
MFC after:    3 days
CID 1401317:  namlen may be used uninitialized

5 years agoAdd admonitions against using MD5 and SHA1 to the API man pages
allanjude [Tue, 21 May 2019 22:17:00 +0000 (22:17 +0000)]
Add admonitions against using MD5 and SHA1 to the API man pages

5 years agoAdd missing errors section to md[2-5], ripemd160, sha*, and skein* manpages
allanjude [Tue, 21 May 2019 22:11:53 +0000 (22:11 +0000)]
Add missing errors section to md[2-5], ripemd160, sha*, and skein* manpages

PR: 148987
Submitted by: Dan Lukes <dan@obluda.cz> (original version)
MFC after: 1 week
Sponsored by: Klara Systems
Event: Waterloo Hackathon 2019

5 years agoFix typo in r348068
allanjude [Tue, 21 May 2019 21:39:03 +0000 (21:39 +0000)]
Fix typo in r348068

5 years agosys/lockmgr.h: Update #error to point at correct _lock.h
cem [Tue, 21 May 2019 21:35:37 +0000 (21:35 +0000)]
sys/lockmgr.h: Update #error to point at correct _lock.h

After r347984, these macros live in sys/_lock.h.  No functional change.

Sponsored by: Dell EMC Isilon

5 years agobootpd: avoid the same error indication for different issues
emaste [Tue, 21 May 2019 21:27:14 +0000 (21:27 +0000)]
bootpd: avoid the same error indication for different issues

There were several (apparently) copy-pasted NEED validation macros,
leading to the same error string for different issues.  Change the
YP and NTP tags so they are distinct.

PR: 30863
Submitted by: Dan Lukes <dan@obluda.cz>
Reviewed by: markj
MFC after: 1 week
Event: Waterloo Hackathon 2019

5 years agoZFS: Make deadman tunables no longer read-only
allanjude [Tue, 21 May 2019 21:26:18 +0000 (21:26 +0000)]
ZFS: Make deadman tunables no longer read-only

This allows the user to enable, disable, and adjust the I/O deadman at
runtime. This can be especially useful when a pool is backed by remote
storage (such as iscsi, ggated, etc).

PR: 221906
Submitted by: Fabian Keil <fk@fabiankeil.de>
Obtained from: ElectroBSD
MFC after: 1 week
Sponsored by: Klara Systems
Event: Waterloo Hackathon 2019

5 years agomqueuefs: Do not allow manipulation of the pseudo-dirents "." and ".."
cem [Tue, 21 May 2019 21:26:14 +0000 (21:26 +0000)]
mqueuefs: Do not allow manipulation of the pseudo-dirents "." and ".."

"." and ".." names are not maintained in the mqueuefs dirent datastructure and
cannot be opened as mqueues.  Creating or removing them is invalid; return
EINVAL instead of crashing.

PR: 236836
Submitted by: Torbjørn Birch Moltu <t.b.moltu AT lyse.net>
Discussed with: jilles (earlier version)

5 years agobootpd: Add an option to skip modifications to the ARP table.
markj [Tue, 21 May 2019 21:22:43 +0000 (21:22 +0000)]
bootpd: Add an option to skip modifications to the ARP table.

PR: 30854
Submitted by: Dan Lukes <dan@obluda.cz>
Reviewed by: imp (previous version)
MFC after: 1 week
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D2581

5 years agoCorrect the way remaining battery life is calculated
allanjude [Tue, 21 May 2019 21:14:22 +0000 (21:14 +0000)]
Correct the way remaining battery life is calculated

Previously, if a system had multiple batteries, the remaining life
percentage was calculated as the average of each battery's percent
remaining. This results in rather incorrect values when you consider the
case of the Thinkpad X270 that has a small 3 cell internally battery, and
a hot-swappable 9 cell battery that is used first. Battery 0 is at 100%,
but battery 1 is at 10%, you do not infact have 55% of your capacity
remaining.

The new method calculates the percentage based on remaining capacity
out of total capacity, giving a much more accurate reading.

PR: 229818
Submitted by: Keegan Drake H.P. <kd-dev@pm.me>
MFC after: 2 weeks
Sponsored by: Klara Systems
Event: Waterloo Hackathon 2019

5 years agoInclude ktr.h in more compilation units
cem [Tue, 21 May 2019 20:38:48 +0000 (20:38 +0000)]
Include ktr.h in more compilation units

Similar to r348026, exhaustive search for uses of CTRn() and cross reference
ktr.h includes.  Where it was obvious that an OS compat header of some kind
included ktr.h indirectly, .c files were left alone.  Some of these files
clearly got ktr.h via header pollution in some scenarios, or tinderbox would
not be passing prior to this revision, but go ahead and explicitly include it
in files using it anyway.

Like r348026, these CUs did not show up in tinderbox as missing the include.

Reported by: peterj (arm64/mp_machdep.c)
X-MFC-With: r347984
Sponsored by: Dell EMC Isilon

5 years agoAdd very basic afinet socket tests which I started to write in order
bz [Tue, 21 May 2019 19:42:04 +0000 (19:42 +0000)]
Add very basic afinet socket tests which I started to write in order
to then try to reproduce a kernel panic, which turned out to be a
race condition and hard to test from here.

Commit the changes anywhere as the "bind zero" case was a surprise
to me and we should try to maintain this status.

Also it is easy examples someone can build upon.

With help from: markj
Event: Waterloo Hackathon 2019

5 years agoMassively blow up the locking-related KASSERTs used to make sure
bz [Tue, 21 May 2019 19:23:56 +0000 (19:23 +0000)]
Massively blow up the locking-related KASSERTs used to make sure
that we end up in a consistent locking state at the end of
udp_output() in order to be able to see what the values are based
on which we once took a decision (note: some values may have changed).

This helped to debug a syzkaller report.

MFC after: 2 months
Event: Waterloo Hackathon 2019

5 years agoSimilarly to r338257,338306 try to fold the two consecutive
bz [Tue, 21 May 2019 19:18:55 +0000 (19:18 +0000)]
Similarly to r338257,338306 try to fold the two consecutive
#ifdef RSS section in udp_output() into one by moving a '}'
outside of the conditional block.

MFC after: 2 months
Event: Waterloo Hackathon 2019

5 years agovt efifb: add suspend/resume calls
emaste [Tue, 21 May 2019 18:42:36 +0000 (18:42 +0000)]
vt efifb: add suspend/resume calls

Using the latest NVIDIA driver, upon resuming from suspend with X
running the display remained blank.  Additionally OpenGL applications
that were running triggered a number of error messages from the NVIDIA
driver.

This occurred because the vt efifb back-end did not signal the X server
to release the display before suspending (or to re-acquire it after
resuming).  The NVIDIA driver includes code for smoothly shutting down
and re-initializing the GPU, which was not getting called.

Since the NVIDIA driver doesn't currently support framebuffer devices
and vt is forced to fall back to the efifb back-end, add vd_suspend and
vd_resume members to connect the suspend/resume path.  This ensures the
X server is properly able to re-initialize the display.

PR: 237050
Submitted by: Erik Kurzinger <ekurzinger@nvidia.com>
Reviewed by: markj
MFC after: 2 weeks
Event: Waterloo Hackathon 2019

5 years agoDo not leak sa in linux_recvmsg() call if kern_recvit() fails.
dchagin [Tue, 21 May 2019 18:08:19 +0000 (18:08 +0000)]
Do not leak sa in linux_recvmsg() call if kern_recvit() fails.

MFC after: 1 week

5 years agoDo not use uninitialised sa.
dchagin [Tue, 21 May 2019 18:05:57 +0000 (18:05 +0000)]
Do not use uninitialised sa.

Reported by: tijl@
MFC after: 1 week

5 years agoDo not leak sa in linux_recvfrom() call if kern_recvit() fails.
dchagin [Tue, 21 May 2019 18:03:58 +0000 (18:03 +0000)]
Do not leak sa in linux_recvfrom() call if kern_recvit() fails.

MFC after: 1 week

5 years agoNDFREE(): Fix unlocking for LOCKPARENT|LOCKLEAF and ndp->ni_dvp == ndp->ni_vp.
kib [Tue, 21 May 2019 15:12:13 +0000 (15:12 +0000)]
NDFREE(): Fix unlocking for LOCKPARENT|LOCKLEAF and ndp->ni_dvp == ndp->ni_vp.

NDFREE() calculates unlock_dvp after ndp->ni_vp is unlocked and zeroed
out. This makes the comparision of ni_dvp with ni_vp always fail.
Move the calculation of unlock_dvp right after unlock_vp, so that the
code sees correct ni_vp value.

Reproduced by
   chdir("/usr");
   open("/..", O_BENEATH | O_RDONLY);

Reported by: syzkaller
Reviewed by: markj, mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20304

5 years agoThe older detection methods (smbios.bios.vendor and smbios.system.product)
stevek [Tue, 21 May 2019 13:29:53 +0000 (13:29 +0000)]
The older detection methods (smbios.bios.vendor and smbios.system.product)
are able to determine some virtual machines, but the vm_guest variable was
still only being set to VM_GUEST_VM.

Since we do know what some of them specifically are, we can set vm_guest
appropriately.

Also, if we see the CPUID has the HV flag, but we were unable to find a
definitive vendor in the Hypervisor CPUID Information Leaf, fall back to
the older detection methods, as they may be able to determine a specific
HV type.

Add VM_GUEST_PARALLELS value to VM_GUEST for Parallels.

Approved by: cem
Differential Revision: https://reviews.freebsd.org/D20305

5 years agoXr make_dev(9) from devfs(5).
trasz [Tue, 21 May 2019 08:24:22 +0000 (08:24 +0000)]
Xr make_dev(9) from devfs(5).

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoMake linux_ptrace() use linux_msg() instead of printf().
trasz [Tue, 21 May 2019 08:23:24 +0000 (08:23 +0000)]
Make linux_ptrace() use linux_msg() instead of printf().

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

5 years agoAdd my name to the copyright
ngie [Tue, 21 May 2019 04:11:16 +0000 (04:11 +0000)]
Add my name to the copyright

I have contributed a number of changes to these tests over the past few
hundred revisions, and believe I deserve credit for the changes I have
made (plus, the copyright hadn't been updated since 2014).

MFC after: 1 week

5 years agoFollow up to r348042: cast `aad` to a byte array
ngie [Tue, 21 May 2019 04:03:22 +0000 (04:03 +0000)]
Follow up to r348042: cast `aad` to a byte array

This is not completely necessary today, but this change is being made in a
conservative manner to avoid accidental breakage in the future, if this ever
was a unicode string.

PR: 237403
MFC after: 1 week

5 years agoFix encoding issues with python 3
ngie [Tue, 21 May 2019 03:52:48 +0000 (03:52 +0000)]
Fix encoding issues with python 3

In python 3, the default encoding was switched from ascii character sets to
unicode character sets in order to support internationalization by default.
Some interfaces, like ioctls and packets, however, specify data in terms of
non-unicode encodings formats, either in host endian (`fcntl.ioctl`) or
network endian (`dpkt`) byte order/format.

This change alters assumptions made by previous code where it was all
data objects were assumed to be basestrings, when they should have been
treated as byte arrays. In order to achieve this the following are done:
* str objects with encodings needing to be encoded as ascii byte arrays are
  done so via `.encode("ascii")`. In order for this to work on python 3 in a
  type agnostic way (as it anecdotally varied depending on the caller), call
  `.encode("ascii")` only on str objects with python 3 to cast them to ascii
  byte arrays in a helper function name `str_to_ascii(..)`.
* `dpkt.Packet` objects needing to be passed in to `fcntl.ioctl(..)` are done
  so by casting them to byte arrays via `bytes()`, which calls
  `dpkt.Packet__str__` under the covers and does the necessary str to byte array
  conversion needed for the `dpkt` APIs and `struct` module.

In order to accomodate this change, apply the necessary typecasting for the
byte array literal in order to search `fop.name` for nul bytes.

This resolves all remaining python 2.x and python 3.x compatibility issues on
amd64. More work needs to be done for the tests to function with i386, in
general (this is a legacy issue).

PR: 237403
MFC after: 1 week
Tested with: python 2.7.16 (amd64), python 3.6.8 (amd64)

5 years agostand: TARGET_ARCH is spelled MACHINE_ARCH in Makefiles
jhibbits [Tue, 21 May 2019 03:05:24 +0000 (03:05 +0000)]
stand: TARGET_ARCH is spelled MACHINE_ARCH in Makefiles

Reported by: imp

5 years agoRemove spurious newline
ngie [Tue, 21 May 2019 02:49:15 +0000 (02:49 +0000)]
Remove spurious newline

Even though some python styles suggest there should be multiple newlines between
methods/classes, for consistency with the surrounding code, it's best to be
consistent by having merely one newline between each functional block.

MFC after: 1 week

5 years agoFix `KAT(CCM)?Parser` file descriptor leaks
ngie [Tue, 21 May 2019 02:30:43 +0000 (02:30 +0000)]
Fix `KAT(CCM)?Parser` file descriptor leaks

Make `KAT(CCM)?Parser` into a context suite-capable object by implementing
`__enter__` and `__exit__` methods which manage opening up the file descriptors
and closing them on context exit. This implementation was decided over adding
destructor logic to a `__del__` method, as there are a number of issues around
object lifetimes when dealing with threading cleanup, atexit handlers, and a
number of other less obvious edgecases. Plus, the architected solution is more
pythonic and clean.

Complete the iterator implementation by implementing a `__next__` method for
both classes which handles iterating over the data using a generator pattern,
and by changing `__iter__` to return the object instead of the data which it
would iterate over. Alias the `__next__` method to `next` when working with
python 2.x in order to maintain functional compatibility between the two major
versions.

As part of this work and to ensure readability, push the initialization of the
parser objects up one layer and pass it down to a helper function. This could
have been done via a decorator, but I was trying to keep it simple for other
developers to make it easier to modify in the future.

This fixes ResourceWarnings with python 3.

PR: 237403
MFC after: 1 week
Tested with: python 2.7.16 (amd64), python 3.6.8 (amd64)

5 years agoSquash deprecation warning related to array.array(..).tostring()
ngie [Tue, 21 May 2019 02:13:46 +0000 (02:13 +0000)]
Squash deprecation warning related to array.array(..).tostring()

In version 3.2+, `array.array(..).tostring()` was renamed to
`array.array(..).tobytes()`. Conditionally call `array.array(..).tobytes()` if
the python version is 3.2+.

PR: 237403
MFC after: 1 week

5 years agostand/powerpc: Only build loader.kboot for powerpc64
jhibbits [Tue, 21 May 2019 01:42:57 +0000 (01:42 +0000)]
stand/powerpc: Only build loader.kboot for powerpc64

kboot is only made for powerpc64 systems, not 32-bit systems.

This unbreaks the build for powerpcspe.

Reported by: ngie

5 years agoInclude eventhandler.h in more compilation units
cem [Tue, 21 May 2019 01:18:43 +0000 (01:18 +0000)]
Include eventhandler.h in more compilation units

This was enumerated with exhaustive search for sys/eventhandler.h includes,
cross-referenced against EVENTHANDLER_* usage with the comm(1) utility.  Manual
checking was performed to avoid redundant includes in some drivers where a
common os_bsd.h (for example) included sys/eventhandler.h indirectly, but it is
possible some of these are redundant with driver-specific headers in ways I
didn't notice.

(These CUs did not show up as missing eventhandler.h in tinderbox.)

X-MFC-With: r347984

5 years agoUnbreak the build when `ELF_VERBOSE` is defined after r348005
ngie [Tue, 21 May 2019 00:46:47 +0000 (00:46 +0000)]
Unbreak the build when `ELF_VERBOSE` is defined after r348005

This change properly terminates the formatting string quote modification done
in r348005, which is triggered when `ELF_VERBOSE` is defined.

MFC with: r348005
Reported by: ci (amd64, gcc)

5 years agoFollowup to r347996
ngie [Tue, 21 May 2019 00:30:29 +0000 (00:30 +0000)]
Followup to r347996

Replace uses of `foo.encode("hex")` with `binascii.hexlify(foo)` for forwards
compatibility between python 2.x and python 3.

PR: 237403
MFC after: 1 week

5 years agoAdd two missing eventhandler.h headers
cem [Tue, 21 May 2019 00:04:19 +0000 (00:04 +0000)]
Add two missing eventhandler.h headers

These are obviously missing from the .c files, but don't show up in any
tinderbox configuration (due to latent header pollution of some kind).  It
seems some configurations don't have this pollution, and the includes are
obviously missing, so go ahead and add them.

Reported by: Peter Jeremy <peter AT rulingia.com>
X-MFC-With: r347984

5 years agoReverse the bit logic of sc_led_modes_mask. Instead of initializing it to
ian [Mon, 20 May 2019 22:32:31 +0000 (22:32 +0000)]
Reverse the bit logic of sc_led_modes_mask.  Instead of initializing it to
all-ones then carving out blocks of zeroes where specified values go, init
it to all-zeroes, put in ones where values need to be masked, then use it
as value &= ~sc_led_modes_mask.  In addition to being more idiomatic, this
means everything related to FDT data is initialized to zero along with the
rest of the softc, and that allows removing some #ifdef FDT sections and
wrapping the whole muge_set_leds() function in a single ifdef block.

This also deletes the early-out from muge_set_leds() when an eeprom exists.
Even if there is an eeprom with led config in it, the fdt data (if present)
should override that, because the user is in control of the fdt data.

5 years agoAllow the end-user to pass along arguments to cryptotest.py via `$CRYPTOTEST_ARGS`
ngie [Mon, 20 May 2019 22:32:26 +0000 (22:32 +0000)]
Allow the end-user to pass along arguments to cryptotest.py via `$CRYPTOTEST_ARGS`

This allows someone to use `-v` to dump out standard output.

5 years agoA MAC adddress from FDT data should override anything stored in eeprom or
ian [Mon, 20 May 2019 22:21:47 +0000 (22:21 +0000)]
A MAC adddress from FDT data should override anything stored in eeprom or
OTP registers (because the user is in control of the fdt data).  Remove the
early returns from the code that tries to find a good mac address, so that
the execution always flows through the routine to get an address from FDT
data last, when on FDT-enabled systems.

5 years agoDon't detour through sc->sc_ue when we have a direct pointer to ue in hand
ian [Mon, 20 May 2019 22:04:01 +0000 (22:04 +0000)]
Don't detour through sc->sc_ue when we have a direct pointer to ue in hand
already.  Also, shorten a variable name for nicer line-wrapping.

No functional changes.

5 years agoUse the new usb fdt support functions to locate the proper fdt node for
ian [Mon, 20 May 2019 21:45:00 +0000 (21:45 +0000)]
Use the new usb fdt support functions to locate the proper fdt node for
the device instance, and to get the MAC address for the device instance.
The ad-hoc code this replaces could find the wrong instance if multiple
devices were present.

5 years agoHook DEFINE_IFUNC.9 up to the build.
markj [Mon, 20 May 2019 21:23:33 +0000 (21:23 +0000)]
Hook DEFINE_IFUNC.9 up to the build.

Reported by: pluknet
MFC with: r348003

5 years agomips: remove 16-byte alignment from .init and .fini epilogues
emaste [Mon, 20 May 2019 20:48:04 +0000 (20:48 +0000)]
mips: remove 16-byte alignment from .init and .fini epilogues

The .init and .fini epilogues from crtn should be placed immediately
after any instructions in .init and .fini sections from the linked
objects.  Using 16-byte alignment for the epilogues on MIPS was a bug,
but it did not cause any issue with GNU ld as GNU ld (2.17.50) fills the
padding with NOPs.

Current versions of LLD fill any padding between different object files
with trap instructions.  Inserting trap padding prior to the .init/.fini
epilogue is undesriable as the resulting binary will crash at runtime.

The .init and .fini sections in object files linked between crti and
crtn must already be a multiple of the instruction size and so no
alignment directive is required in crtn.  Indeed, other architectures
(except sparc64) do not specify alignment in their crtn implementations.

Reported by: arichardson
Reviewed by: andrew
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D18291

5 years agomuge: update FDT LED configuration
emaste [Mon, 20 May 2019 19:31:49 +0000 (19:31 +0000)]
muge: update FDT LED configuration

Also use LED mode settings from the FDT to set the PHY.
From v3 of the patch submitted in the PR.

I moved the sc_led_modes and sc_led_modes_mask default setting outside
of the #ifdef FDT case.

PR: 237325
Submitted by: Ralf <iz-rpi03@hs-karlsruhe.de>
Reviewed by: ian
MFC after: 2 weeks
MFC with: r348001
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D20325

5 years ago[PowerPC64] stand: fix build using clang 8 as compiler
luporl [Mon, 20 May 2019 19:21:35 +0000 (19:21 +0000)]
[PowerPC64] stand: fix build using clang 8 as compiler

This change fixes "stand" build issues when using clang 8
as compiler.

Submitted by:   alfredo.junior_eldorado.org.br
Reviewed by:    jhibbits
Differential Revision: https://reviews.freebsd.org/D20026