]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agorescue: say gbye to 'boot floppies' and moderize
eadler [Sun, 29 Oct 2017 21:21:39 +0000 (21:21 +0000)]
rescue: say gbye to 'boot floppies' and moderize

6 years agoImprove the performance of the hpet timer in bhyve guests by making the
ian [Sun, 29 Oct 2017 20:50:03 +0000 (20:50 +0000)]
Improve the performance of the hpet timer in bhyve guests by making the
timer frequency a power of two.  This changes the frequency from 10 to
16.7 MHz (2 ^ 24 HZ).  Using a power of two avoids roundoff errors when
doing arithmetic in sbintime_t units.

Testing shows this can fix erratic ntpd behavior in guests using the
hpet timer (which is the default for multicore guests).

Reported by: bsam@

6 years agoUpdate the updating URL in UPDATING
eadler [Sun, 29 Oct 2017 20:40:56 +0000 (20:40 +0000)]
Update the updating URL in UPDATING

Also remove references to 9.x

6 years agoCorrect the URLs for both READMEs for tracking src
eadler [Sun, 29 Oct 2017 20:29:31 +0000 (20:29 +0000)]
Correct the URLs for both READMEs for tracking src

Previously there were two different URLs in two
different READMEs, neither of which went anywhere.

6 years agoThe !! trick does not apply to all shells
eadler [Sun, 29 Oct 2017 20:20:51 +0000 (20:20 +0000)]
The !! trick does not apply to all shells

Requested by: emaste

6 years agoFix misleading comment.
mmel [Sun, 29 Oct 2017 14:26:37 +0000 (14:26 +0000)]
Fix misleading comment.
Not a functional change.

MFC after: 3 days

6 years agoPlug memory leak on error case.
trasz [Sun, 29 Oct 2017 12:07:27 +0000 (12:07 +0000)]
Plug memory leak on error case.

Reported by: Coverity
CID: 1382112
MFC after: 2 weeks

6 years agoAdd back missing MTX_DEF, it still needs to be there.
trasz [Sun, 29 Oct 2017 12:03:06 +0000 (12:03 +0000)]
Add back missing MTX_DEF, it still needs to be there.

(Although it's defined to be 0, so there's no functional change.)

Reported by: glebius
MFC after: 2 weeks

6 years agoFix information about nv.h include.
oshogbo [Sun, 29 Oct 2017 09:50:20 +0000 (09:50 +0000)]
Fix information about nv.h include.

MFC after: 1 week

6 years agoUpdate UPDATING
eadler [Sun, 29 Oct 2017 08:25:31 +0000 (08:25 +0000)]
Update UPDATING

- Remove FreeBSD 4.x of building the kernel.
While it might technically work, it is better to
document the 'correct' way than how to shoot oneself
in the foot

- Remove reference to CVS -P for src.

6 years agoUpdate several more URLs
eadler [Sun, 29 Oct 2017 08:17:03 +0000 (08:17 +0000)]
Update several more URLs

- Primarily http -> https
- Primarily FreeBSD project URLs

6 years agoUpdate URLs in usr.bin
eadler [Sun, 29 Oct 2017 08:03:21 +0000 (08:03 +0000)]
Update URLs in usr.bin

- http -> https
- contents have moved locations
- removal of URL if I could not find new location

6 years agoCleanup non-arch Makefiles
imp [Sun, 29 Oct 2017 05:27:22 +0000 (05:27 +0000)]
Cleanup non-arch Makefiles

Use SYSDIR, BOOTSRC, LDRSRC and FDTSRC in preference to relative
paths. Also, use bsd.init.mk where needed.

Sponsored by: Netflix

6 years agoDefine new EFI variables
imp [Sun, 29 Oct 2017 05:26:59 +0000 (05:26 +0000)]
Define new EFI variables

Define EFISRC, EFIINC and EFIINCMD. Use them, as well as using other
symbols defined in defs.mk. Prefer <bsd.init.mk> to ../../Makefile.inc
or <src.opts.mk>.

Sponsored by: Netflix

6 years agoModernize freebsd-tips a bit
eadler [Sun, 29 Oct 2017 04:53:33 +0000 (04:53 +0000)]
Modernize freebsd-tips a bit

- Prefer UTF-8 over ISO-8859-1
- Remove some references to printing man pages
- Combine duplicate '!!' tips
- 'rehash' is no longer needed

6 years agoPrefer using https over http
eadler [Sun, 29 Oct 2017 04:41:01 +0000 (04:41 +0000)]
Prefer using https over http

6 years agoxdev: Consolidate duplicate cross-tools build/install list into XDEVDIRS.
bdrewery [Sun, 29 Oct 2017 01:21:52 +0000 (01:21 +0000)]
xdev: Consolidate duplicate cross-tools build/install list into XDEVDIRS.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoxdev: Remove excess '/' since XDTP is asserted to be an absolute path.
bdrewery [Sun, 29 Oct 2017 01:21:49 +0000 (01:21 +0000)]
xdev: Remove excess '/' since XDTP is asserted to be an absolute path.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoxdev: Fix build for platforms needing LLD.
bdrewery [Sun, 29 Oct 2017 01:21:46 +0000 (01:21 +0000)]
xdev: Fix build for platforms needing LLD.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoxdev: Add missing 'make obj' treewalk for 'make includes'.
bdrewery [Sun, 29 Oct 2017 01:21:42 +0000 (01:21 +0000)]
xdev: Add missing 'make obj' treewalk for 'make includes'.

It is possible that building headers requires an OBJDIR.
The other phases of xdev have their own 'make obj' calls
where needed, such as inside 'make libraries' itself.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agolib32/libsoft: Store object files in a more consistent structure.
bdrewery [Sun, 29 Oct 2017 01:21:39 +0000 (01:21 +0000)]
lib32/libsoft: Store object files in a more consistent structure.

Having objects in world32 and a sysroot in lib32 was confusing and
inconsistent with the normal build.  Now objects are stored in
obj-lib32 (or obj-libsoft) and the sysroot (analagous to WORLDTMP)
is stored in obj-lib32/tmp.

Sponsored by: Dell EMC Isilon

6 years agoAUTO_OBJ: auto.obj.mk mkdir -p simplification
bdrewery [Sun, 29 Oct 2017 01:21:36 +0000 (01:21 +0000)]
AUTO_OBJ: auto.obj.mk mkdir -p simplification

Sponsored by: Dell EMC Isilon

6 years agoSuggest TARGET/TARGET_ARCH, XDEV/XDEV_ARCH are depcrecated in r269031.
bdrewery [Sun, 29 Oct 2017 01:21:33 +0000 (01:21 +0000)]
Suggest TARGET/TARGET_ARCH, XDEV/XDEV_ARCH are depcrecated in r269031.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoChange native-xtools to not install by default; add a native-xtools-install.
bdrewery [Sun, 29 Oct 2017 01:21:29 +0000 (01:21 +0000)]
Change native-xtools to not install by default; add a native-xtools-install.

Without this the user has to mess with 'make -f Makefile.inc1 ...' to figure
out where the files are installed in the OBJDIR and then they need to copy them
to where they really wanted them. Using DESTDIR may be problematic after
r325001 as well.

The files will be installed to DESTDIR/NXTP where NXTP defaults to /nxb-bin.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agobuild(7): Document xdev targets.
bdrewery [Sun, 29 Oct 2017 01:21:26 +0000 (01:21 +0000)]
build(7): Document xdev targets.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agobuild(7): Document native-xtools.
bdrewery [Sun, 29 Oct 2017 01:21:22 +0000 (01:21 +0000)]
build(7): Document native-xtools.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoFix xdev TARGET/TARGET_ARCH assertion and expand to native-xtools.
bdrewery [Sun, 29 Oct 2017 01:21:19 +0000 (01:21 +0000)]
Fix xdev TARGET/TARGET_ARCH assertion and expand to native-xtools.

The top of Makefile.inc1 requires TARGET/TARGET_ARCH be defined.  Just
building 'make xdev' would already set them, so this error was never
triggered.  Moving it to Makefile fixes the problem.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoDisable AUTO_OBJ as a make argument to ensure it really is disabled.
bdrewery [Sun, 29 Oct 2017 01:21:15 +0000 (01:21 +0000)]
Disable AUTO_OBJ as a make argument to ensure it really is disabled.

If the user sets this to yes as a make argument too we still want
to ensure these do not get enabled.

Sponsored by: Dell EMC Isilon

6 years agoMAKEOBJDIR should be an absolute path, not any path with a slash.
bdrewery [Sun, 29 Oct 2017 01:21:12 +0000 (01:21 +0000)]
MAKEOBJDIR should be an absolute path, not any path with a slash.

Using MAKEOBJDIR=foo did not work but MAKEOBJDIR=foo/ did, but
really it needs to be absolute.

Sponsored by: Dell EMC Isilon

6 years agoRework r254951 to not reach into private OBJDIR areas.
bdrewery [Sun, 29 Oct 2017 01:21:09 +0000 (01:21 +0000)]
Rework r254951 to not reach into private OBJDIR areas.

The original change was dealing with the build wanting to run a newer
install(1) that was not yet installed.  The solution to look into the private
legacy directory of the existing build conflicts with 2 upcoming features: a
changed OBJDIR format, and splitting the host tools into arch-dependent and
arch-independent directories.  Rather than hardcoding and changing the paths in
this script, just let kernel-toolchain do the work, while disabling much of the
meat.  With -j15 this finishes in 25 seconds for me and 117 seconds with -j1.
All that is really needed is bootstrap-tools, but the system is not currently
written in a way that all previous dependent steps will have ran.  The previous
steps, such as _worldtmp, are being reworked and renamed and so cannot be
relied upon to be right.

Sponsored by: Dell EMC Isilon

6 years agoRemove comment: debug files can be useful for build tools.
bdrewery [Sun, 29 Oct 2017 01:21:06 +0000 (01:21 +0000)]
Remove comment: debug files can be useful for build tools.

Sponsored by: Dell EMC Isilon

6 years agoMove some LIBCOMPAT tmpdir logic setup to its own build target.
bdrewery [Sun, 29 Oct 2017 01:21:02 +0000 (01:21 +0000)]
Move some LIBCOMPAT tmpdir logic setup to its own build target.

Its own build target was already handling mtree extractions
just as _worldtmp did, so the other cleaning of the
tmpdir makes sense here as well.

Sponsored by: Dell EMC Isilon

6 years agoMK_TESTS is disabled in early phases, no need for TESTBASE extraction here.
bdrewery [Sun, 29 Oct 2017 01:20:59 +0000 (01:20 +0000)]
MK_TESTS is disabled in early phases, no need for TESTBASE extraction here.

Sponsored by: Dell EMC Isilon

6 years agoFAST_DEPEND clean hack: Remove lib32/soft files properly.
bdrewery [Sun, 29 Oct 2017 01:20:56 +0000 (01:20 +0000)]
FAST_DEPEND clean hack: Remove lib32/soft files properly.

Only remove them if the option is enabled and also handle libsoft
by using the proper LIBCOMPAT_OBJTREE.  LIBCOMPAT:D will expand
the text after it as a proper glob to the command line if LIBCOMPAT
is defined.

Sponsored by: Dell EMC Isilon

6 years agoMove FAST_DEPEND cleanup hack into its own target and call from _cleanobj.
bdrewery [Sun, 29 Oct 2017 01:20:53 +0000 (01:20 +0000)]
Move FAST_DEPEND cleanup hack into its own target and call from _cleanobj.

The _worldtmp target is for setting up WORLDTMP.  Nothing between _worldtmp
and _cleanobj will read these files.  Move to its own target since it is
so large.

Sponsored by: Dell EMC Isilon

6 years agoWe don't need LIB32 directories extracted in early phase legacy/WORLDTMP dirs.
bdrewery [Sun, 29 Oct 2017 01:20:50 +0000 (01:20 +0000)]
We don't need LIB32 directories extracted in early phase legacy/WORLDTMP dirs.

This reverts some changes from r289662

Sponsored by: Dell EMC Isilon

6 years agoDisallow using a colon ':' in source checkout paths.
bdrewery [Sun, 29 Oct 2017 01:20:47 +0000 (01:20 +0000)]
Disallow using a colon ':' in source checkout paths.

This leaks into the PATH handling for WORLDTMP and breaks
finding cross-tools.  The PATH handling could be fixed to
properly quote but is not worth the effort.

Also allow this sanity check to always run even with 'make -n'.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agoMove sendmail special check into a _sanity_check target.
bdrewery [Sun, 29 Oct 2017 01:20:43 +0000 (01:20 +0000)]
Move sendmail special check into a _sanity_check target.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

6 years agobsnmpd: Only refresh devtree if devd event is a new or removed device.
pfg [Sat, 28 Oct 2017 21:26:49 +0000 (21:26 +0000)]
bsnmpd: Only refresh devtree if devd event is a new or removed device.

It makes sense to refresh the tree only when a device is inserted or
removed, otherwise bsnmpd wastes lot of CPU.

PR: 209368
MFC after: 1 week

6 years agoFix out-of-bounds read in libc/regex.
pfg [Sat, 28 Oct 2017 20:09:34 +0000 (20:09 +0000)]
Fix out-of-bounds read in libc/regex.

The bug is an out-of-bounds read detected with address sanitizer that
happens when 'sp' in p_b_coll_elems() includes NUL byte[s], e.g. if it's
equal to "GS\x00". In that case len will be equal to 4, and the
strncmp(cp->name, sp, len) call will succeed when cp->name is "GS" but the
cp->name[len] == '\0' comparison will cause the read to go out-of-bounds.

Checking the length using strlen() instead eliminates the issue.

The bug was found in LLVM with oss-fuzz:
https://reviews.llvm.org/D39380

MFC after: 1 week
Obtained from: Vlad Tsyrklevich through posting on openbsd-tech

6 years agoSplit the hardware type enum and the hw feature flags bits into separate
ian [Sat, 28 Oct 2017 20:03:29 +0000 (20:03 +0000)]
Split the hardware type enum and the hw feature flags bits into separate
fields in the softc; they're ORed together in the ofw_compat_data.

I already caught myself doing 'sc->fectype == <enum val>' without masking
out the feature bits in one place, and that's sure to happen again.
Glomming them together is convenient for storing them in the ofw_compat_data
array, but there's no reason to keep them together in the softc.

6 years agoSimplify ping sandbox.
oshogbo [Sat, 28 Oct 2017 19:39:22 +0000 (19:39 +0000)]
Simplify ping sandbox.

We don't need to check if casper is present, this is done in the library itself.

Reviewed by: emaste, cem, ed
Differential Revision: https://reviews.freebsd.org/D8754

6 years agoUse the 16-bit receive shift feature in ffec hardware that supports it.
ian [Sat, 28 Oct 2017 19:34:08 +0000 (19:34 +0000)]
Use the 16-bit receive shift feature in ffec hardware that supports it.

When available, enabling this feature causes the hardware to write data
to the receive buffer starting at a 16-bit offset from the start address.
This eliminates the need to copy the data after receiving to re-align
the protocol headers to a 32-bit boundary.

PR: 222634
Submitted by: sebastian.huber@embedded-brains.de

6 years agoIntroduce caspermocks.
oshogbo [Sat, 28 Oct 2017 19:23:57 +0000 (19:23 +0000)]
Introduce caspermocks.

The idea behinds mocks is that we don't need to ifdef a lot of code in
tools itself but those defines are hidden in the casper library.
Right now the mocks are implemented as define/inlines functions.
There was a very long discussion how this should be implemented.
This approach has some advantages like we don't need to link to any additional
libraries. Unfortunately there are also some disadvantages for example it is
easy to get library out of sync between two versions of functions or that we
need extra define to compile program with casper support.
This isn't an ideal solution but it's good enough for now and should simplify
capsicumizing programs. This also doesn't close us any other ways to do those
mocks and this should evolve in time.

Discussed with: pjd, emaste, ed, rwatson, bapt, cem, bdrewery
Differential Revision:    https://reviews.freebsd.org/D8753

6 years agoSupport up to 3 IRQs in the ffec driver.
ian [Sat, 28 Oct 2017 19:08:06 +0000 (19:08 +0000)]
Support up to 3 IRQs in the ffec driver.

Newer hardware splits the interrupts onto 3 different irq lines, but the
docs barely mention that there are multiple interrupts, and do not detail
how they're split up.  The code now supports 1-3 irqs, and uses the same
interrupt service routine to handle all of them.

I modified the submitted changes to use bus_alloc_resources() instead of
using loops to allocate each irq separately.  Thus, blame any bugs on me (I
can't actually test on imx7 hardware).

PR: 222634
Submitted by: sebastian.huber@embedded-brains.de

6 years agoAdd a #define RESOURCE_SPEC_END. Similar to DEVMETHOD_END and
ian [Sat, 28 Oct 2017 18:56:27 +0000 (18:56 +0000)]
Add a #define RESOURCE_SPEC_END.  Similar to DEVMETHOD_END and
KOBJMETHOD_END, this is to serve as the end marker in an array of
resource_spec structures.

6 years agoImport tzdata 2017c
philip [Sat, 28 Oct 2017 18:54:45 +0000 (18:54 +0000)]
Import tzdata 2017c

Changes: https://mm.icann.org/pipermail/tz-announce/2017-October/000047.html

MFC after: 2 days

6 years agoImport tzdata 2017c
philip [Sat, 28 Oct 2017 17:43:05 +0000 (17:43 +0000)]
Import tzdata 2017c

6 years agoAvoid AXI bus issues due to a MAC reset on imx6sx and imx7.
ian [Sat, 28 Oct 2017 17:30:49 +0000 (17:30 +0000)]
Avoid AXI bus issues due to a MAC reset on imx6sx and imx7.

When the FEC is connected to the AXI bus (indicated by AVB flag), a
MAC reset while a bus transaction is pending can hang the bus.
Instead of resetting, turn off the ENABLE bit, which allows the
hardware to complete any in-progress transfers (appending a bad CRC
to any partial packet) and release the AXI bus.  This could probably
be done unconditionally for all hardware variants, but that hasn't
been tested.

PR: 222634
Submitted by: sebastian.huber@embedded-brains.de

6 years agoAdd FECFLAG_AVB variant flag to support new features on imx7.
ian [Sat, 28 Oct 2017 17:06:13 +0000 (17:06 +0000)]
Add FECFLAG_AVB variant flag to support new features on imx7.

This flag is analogous to the Linux driver FEC_QUIRK_HAS_AVB.  It
indicates an FEC with support for Audio Video Bridging (AVB).  This
indicator is used for various other parts in the Linux driver
(drivers/net/ethernet/freescale/fec_main.c).

Use it to customize the receive/transmit buffer alignment.  The receive
buffer alignment increased to 64-bytes on the i.MX 6SoloX and i.MX
7Dual.  There are no hard alignment restrictions for transmit buffers on
these chips.

Fix the ffec_softc::fectype type to provide enough storage for the
feature flags.

PR: 222634
Submitted by: sebastian.huber@embedded-brains.de

6 years agoIncrease the alignment of the rx/tx descriptor ring buffers to 64 bytes.
ian [Sat, 28 Oct 2017 16:50:23 +0000 (16:50 +0000)]
Increase the alignment of the rx/tx descriptor ring buffers to 64 bytes.

16 was the correct alignment for older hardware, but the imx7 requires
64-byte alignment, which is a fine value to use on all systems.

PR: 222634
Submitted by: sebastian.huber@embedded-brains.de

6 years agoRemove a stale and incorrect comment.
markj [Sat, 28 Oct 2017 02:51:27 +0000 (02:51 +0000)]
Remove a stale and incorrect comment.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoRemove workqueue items after updating the workqueue tail pointer.
markj [Sat, 28 Oct 2017 02:48:37 +0000 (02:48 +0000)]
Remove workqueue items after updating the workqueue tail pointer.

When QUEUE_MACRO_DEBUG_TRASH is configured, the queue linkage fields
are trashed upon removal of the item, so be sure to only read them before
removing the item.

No functional change intended.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoUpdate manpage date to when the deprecation notice was removed.
jlh [Fri, 27 Oct 2017 21:48:02 +0000 (21:48 +0000)]
Update manpage date to when the deprecation notice was removed.

Reported by: bcr

6 years agoFix MAC address detection regression introduced by r324184
gonzo [Fri, 27 Oct 2017 21:22:38 +0000 (21:22 +0000)]
Fix MAC address detection regression introduced by r324184

To accomodate all variaties of Pi DTS files floating around
we look for MAC address property either in DTS node for
USB ethernet (if it exists) or at predefined path
".../usb/hub/ethernet".

After r324184 smsc_fdt_find_eth_node started to return node
with compatibility string "usb424,ec00" as an eth node.
In imported GNU dts files this node still does not have
MAC address related property, and therefor following check for
"mac-address" and "local-mac-address" fails.

To make this logic more robust do not just search for the node
but also make sure it has required property, so if node with
accepted compatibility string exists but doesn't have the
property we fall back to looking for hardoded path mentioned above.

6 years agodma: fix use-after-free
emaste [Fri, 27 Oct 2017 20:21:09 +0000 (20:21 +0000)]
dma: fix use-after-free

Sponsored by: The FreeBSD Foundation

6 years agoFix parsing error when processing cmsg in SCTP send calls. Thei bug is
tuexen [Fri, 27 Oct 2017 19:27:05 +0000 (19:27 +0000)]
Fix parsing error when processing cmsg in SCTP send calls. Thei bug is
related to a signed/unsigned mismatch.
This should most likely fix the issue in sctp_sosend reported by
Dmitry Vyukov on the freebsd-hackers mailing list and found by
running syzkaller.

6 years agoActually release resources in detach() rather than just returning EBUSY.
ian [Fri, 27 Oct 2017 17:21:43 +0000 (17:21 +0000)]
Actually release resources in detach() rather than just returning EBUSY.
This will enable use of 'devctl disable', allow creation of a module, etc.

6 years agoFix a lock leak in g_mirror_destroy().
markj [Fri, 27 Oct 2017 17:05:14 +0000 (17:05 +0000)]
Fix a lock leak in g_mirror_destroy().

g_mirror_destroy() is supposed to unlock the softc before indicating
success, but it wasn't doing so if the caller raced with another
thread destroying the mirror.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoUpdate comment to match r177997 & r178036 changes.
obrien [Fri, 27 Oct 2017 16:36:05 +0000 (16:36 +0000)]
Update comment to match r177997 & r178036 changes.

6 years agolibdtrace: replace "DOODAD" with more descriptive string
emaste [Fri, 27 Oct 2017 16:23:45 +0000 (16:23 +0000)]
libdtrace: replace "DOODAD" with more descriptive string

Previously some unimplemented libdtrace routines printed the function,
file and line number, followed by "DOODAD." That is not particularly
informative, so replace it with a message reporting the actual issue.

Sponsored by: The FreeBSD Foundation

6 years agonvd alias has caused some problems, revert it for the moment.
imp [Fri, 27 Oct 2017 14:57:38 +0000 (14:57 +0000)]
nvd alias has caused some problems, revert it for the moment.

Sponsored by: Netflix

6 years agoRework pass through changes in r305485 to be safer.
jhb [Fri, 27 Oct 2017 14:57:14 +0000 (14:57 +0000)]
Rework pass through changes in r305485 to be safer.

Specifically, devices that do not support PCI-e FLR and were not
gracefully shutdown by the guest OS could continue to issue DMA
requests after the VM was terminated.  The changes in r305485 meant
that those DMA requests were completed against the host's memory which
could result in random memory corruption.  Instead, leave ppt devices
that are not attached to a VM disabled in the IOMMU and only restore
the devices to the host domain if the ppt(4) driver is detached from a
device.

As an added safety belt, disable busmastering for a pass-through device
when before adding it to the host domain during ppt(4) detach.

PR: 222937
Tested by: Harry Schmalzbauer <freebsd@omnilan.de>
Reviewed by: grehan
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12661

6 years agoMFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands
avg [Fri, 27 Oct 2017 12:37:22 +0000 (12:37 +0000)]
MFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands

illumos/illumos-gate@0a0551200ecbcd4f1b17560acaeeb7b6c8b0090e
https://github.com/illumos/illumos-gate/commit/0a0551200ecbcd4f1b17560acaeeb7b6c8b0090e

https://www.illumos.org/issues/640
  du(1), df(1m), ls(1), and swap(1m) all include a copy (it appears literally
  copied) of the 'number_to_scaled_string' function in their source. This should
  be moved to a shared library and all 4 commands should use this instead.

FreeBSD note: of all libcmdutils functionality ZFS (and other illumos
contrib code) currently uses only nicenum() function (which is similar
to humanize_number but has some formatting differences).  For this
reason I decided to not port the whole library.  As a result, nicenum.c
from libcmdutils is compiled into libzfs and libzpool.  This is a bit
ugly, but works.  If one day we are forced to create libillumos, then
the file should be moved to that library.

Reviewed by: Sebastian Wiedenroth <wiedi@frubar.net>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Jason King <jason.brian.king@gmail.com>

MFC after: 2 weeks

6 years agofollow up to r325013, add libcmdutils.h to the vendor area
avg [Fri, 27 Oct 2017 11:26:36 +0000 (11:26 +0000)]
follow up to r325013, add libcmdutils.h to the vendor area

6 years agoRevert r325031. This breaks the build due to __FBSDID.
cy [Fri, 27 Oct 2017 05:04:29 +0000 (05:04 +0000)]
Revert r325031. This breaks the build due to __FBSDID.

Pointy hat to: cy

6 years agoEnsure all incude statements are kept together by moving the
cy [Fri, 27 Oct 2017 04:51:05 +0000 (04:51 +0000)]
Ensure all incude statements are kept together by moving the
sys/cdefs.h include appropriately.

MFC after: 1 week
X-MFC with: r325030

6 years agoRemove redundant sys/cdefs.h include.
cy [Fri, 27 Oct 2017 04:47:44 +0000 (04:47 +0000)]
Remove redundant sys/cdefs.h include.

MFC after: 1 week

6 years agoDiscard the correct thread event reported for a ptrace stop.
jhb [Fri, 27 Oct 2017 03:16:19 +0000 (03:16 +0000)]
Discard the correct thread event reported for a ptrace stop.

When multiple threads wish to report a tracing event to a debugger,
both threads call ptracestop() and one thread will win the race to be
the reporting thread (p->p_xthread).  The debugger uses PT_LWPINFO
with the process ID to determine which thread / LWP is reporting an
event and the details of that event.  This event is cleared as a side
effect of the subsequent ptrace event that resumed the process
(PT_CONTINUE, PT_STEP, etc.).  However, ptrace() was clearing the
event identified by the LWP ID passed to the resume request even if
that wasn't the 'p_xthread'.  This could result in clearing an event
that had not yet been observed by the debugger and leaving the
existing event for 'p_thread' pending so that it was reported a second
time.

Specifically, if the debugger stopped due to a software breakpoint in
one thread, but then switched to another thread that was used to
resume (e.g. if the user switched to a different thread and issued a
step), the resume request (PT_STEP) cleared a pending event (if any)
for the thread being stepped.  However, the process immediately
stopped and the first thread reported it's breakpoint event a second
time.  The debugger decremented the PC for "both" breakpoint events
which resulted in the PC now pointing into the middle of an
instruction (on x86) and a SIGILL fault when the process was resumed a
second time.

To fix, always clear the pending event for 'p_xthread' when resuming a
process.  ptrace() still honors the requested LWP ID when enabling
single-stepping (PT_STEP) or setting a different PC (PT_CONTINUE).

Reported by: GDB testsuite (gdb.threads/continue-pending-status.exp)
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12794

6 years agoWe should be call adaerror() instead of cam_periph_error() always.
imp [Thu, 26 Oct 2017 22:53:55 +0000 (22:53 +0000)]
We should be call adaerror() instead of cam_periph_error() always.

Sponsored by: Netflix

6 years agoAlways send STANDBY IMMEDIATE when shutting down
imp [Thu, 26 Oct 2017 22:53:49 +0000 (22:53 +0000)]
Always send STANDBY IMMEDIATE when shutting down

To save SMART data and for a drive to understand that it's been nicely
shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to
use a local CCB on the stack. When we're panicing, used
xpt_polled_action rather than cam_periph_runccb so that we can SEND
IMMEDIATE after we've shutdown the scheduler.

Sponsored by: Netflix
Reviewed by: scottl@, gallatin@
Differential Revision: https://reviews.freebsd.org/D12799

6 years agoMake time we wait for a power cycle tunable.
imp [Thu, 26 Oct 2017 22:53:02 +0000 (22:53 +0000)]
Make time we wait for a power cycle tunable.

hw.ipmi.cycle_time is the time to wait for the power down phase of the
ipmi power cycle before falling back to either reboot or halt.

Sponsored by: Netflix

6 years agoVarious IPMI watchdog timer improvements
imp [Thu, 26 Oct 2017 22:52:51 +0000 (22:52 +0000)]
Various IPMI watchdog timer improvements

o Make hw.ipmi.on a tuneable
o Changes to keep shutdown from hanging indefinitately after the wd
  would normally have been disabled.
o Add support for setting pretimeout (which fires an interrupt
  some time before the actual watchdog expires)
o Allow refinement of the actions to take when the watchdog expires
o Allow special startup timeout to keep us from hanging in boot
  before watchdogd is started, but after we've loaded the kernel.

Obtained From: Netflix OCA Firmware

6 years agopf tests: Remove temporary files
kp [Thu, 26 Oct 2017 20:55:33 +0000 (20:55 +0000)]
pf tests: Remove temporary files

Remove the created_jails.lst and created_interfaces.lst files in the
cleanup code.

6 years agopf tests: Fragmentation (v6) test
kp [Thu, 26 Oct 2017 20:54:52 +0000 (20:54 +0000)]
pf tests: Fragmentation (v6) test

Test fragmentation handling (i.e. scrub fragment reassemble) code for
IPv6.

Two simple tests: Ping a host (jail) and test forwarding of fragmented
packets.

6 years agopf tests: destroy jails before destroying interfaces
kp [Thu, 26 Oct 2017 20:53:56 +0000 (20:53 +0000)]
pf tests: destroy jails before destroying interfaces

When cleaning up we must destroy the jails before we destroy the interfaces.
Otherwise we might try to destroy interfaces that belong to a jail, which won't
work and fail to completely clean up.

6 years agoIntroduce cnvlist_name() and cnvlist_type() functions.
oshogbo [Thu, 26 Oct 2017 20:44:42 +0000 (20:44 +0000)]
Introduce cnvlist_name() and cnvlist_type() functions.

Those function can be used when we are iterating over nvlist to reduce
amount of extra variables we need to declare.

MFC after: 1 month

6 years agoFix aio_suspend in 32-bit emulation
asomers [Thu, 26 Oct 2017 19:45:15 +0000 (19:45 +0000)]
Fix aio_suspend in 32-bit emulation

An off-by-one error has been present since the system call was first present
in 185878.  It additionally became a memory corruption bug after change
324941.  The failure is actually revealed by our existing AIO tests.
However, apparently nobody's been running those in 32-bit emulation mode.

Reported by: Coverity, cem
CID: 1382114
MFC after: 18 days
X-MFC-With: 324941
Sponsored by: Spectra Logic Corp

6 years agolibnv: Fix strict-aliasing violation with cookie
jilles [Thu, 26 Oct 2017 18:32:04 +0000 (18:32 +0000)]
libnv: Fix strict-aliasing violation with cookie

In rS323851, some casts were adjusted in calls to nvlist_next() and
nvlist_get_pararr() in order to make scan-build happy. I think these changes
just confused scan-build into not reporting the strict-aliasing violation.

For example, nvlist_xdescriptors() is causing nvlist_next() to write to its
local variable nvp of type nvpair_t * using the lvalue *cookiep of type
void *, which is not allowed. Given the APIs of nvlist_next(),
nvlist_get_parent() and nvlist_get_pararr(), one possible fix is to create a
local void *cookie in nvlist_xdescriptors() and other places, and to convert
the value to nvpair_t * when necessary. This patch implements that fix.

Reviewed by: oshogbo
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12760

6 years agoPartially revert r325011: restore Guid's default constructor
asomers [Thu, 26 Oct 2017 17:56:34 +0000 (17:56 +0000)]
Partially revert r325011: restore Guid's default constructor

Reported by: ohartmann
MFC after: 3 weeks
X-MFC-With: 325011
Sponsored by: Spectra Logic Corp

6 years agoAdd a 'place holder' arm struct efi_fb until a real one comes
imp [Thu, 26 Oct 2017 16:36:27 +0000 (16:36 +0000)]
Add a 'place holder' arm struct efi_fb until a real one comes
along. This allows the arm efi boot loader to compile again.

Sponsored by: Netflix

6 years ago640 number_to_scaled_string is duplicated in several commands
avg [Thu, 26 Oct 2017 16:20:47 +0000 (16:20 +0000)]
640 number_to_scaled_string is duplicated in several commands

illumos/illumos-gate@0a0551200ecbcd4f1b17560acaeeb7b6c8b0090e
https://github.com/illumos/illumos-gate/commit/0a0551200ecbcd4f1b17560acaeeb7b6c8b0090e

https://www.illumos.org/issues/640
  du(1), df(1m), ls(1), and swap(1m) all include a copy (it appears literally
  copied) of the 'number_to_scaled_string' function in their source. This should
  be moved to a shared library and all 4 commands should use this instead.

Reviewed by: Sebastian Wiedenroth <wiedi@frubar.net>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Jason King <jason.brian.king@gmail.com>

6 years agoRemove now-empty directories
imp [Thu, 26 Oct 2017 16:02:38 +0000 (16:02 +0000)]
Remove now-empty directories

6 years agozfsd should be able to online an L2ARC that disappears and returns
asomers [Thu, 26 Oct 2017 15:28:18 +0000 (15:28 +0000)]
zfsd should be able to online an L2ARC that disappears and returns

Previously, this didn't work because L2ARC devices' labels don't contain
pool GUIDs.  Modify zfsd so that the pool GUID won't be required:

lib/libdevdctl/guid.h
Change INVALID_GUID from a uint64_t constant to a function that
returns an invalid Guid object.  Remove the void constructor.
Nothing uses it, and it violates RAII.

cddl/usr.sbin/zfsd/case_file.h
cddl/usr.sbin/zfsd/case_file.cc
Allow CaseFile::Find to match a CaseFile based on Vdev GUID alone.
In CaseFile::ReEvaluate, attempt to online devices even if the newly
arrived device has no pool GUID.

cddl/usr.sbin/zfsd/vdev_iterator.cc
Iterate through a pool's cache devices as well as its regular
devices.

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

6 years agoIf the user-provided password exceeds the maximum password length, don't
des [Thu, 26 Oct 2017 13:23:13 +0000 (13:23 +0000)]
If the user-provided password exceeds the maximum password length, don't
bother passing it to crypt().  It won't succeed and may allow an attacker
to confirm that the user exists.

Reported by: jkim@
MFC after: 1 week
Security: CVE-2016-6210

6 years agoMake gmountver(8) use direct dispatch.
trasz [Thu, 26 Oct 2017 10:18:31 +0000 (10:18 +0000)]
Make gmountver(8) use direct dispatch.

MFC after: 2 weeks

6 years agoFix Dummynet AQM packet marking function ecn_mark() and fq_codel /
truckman [Thu, 26 Oct 2017 10:11:35 +0000 (10:11 +0000)]
Fix Dummynet AQM packet marking function ecn_mark() and fq_codel /
fq_pie schedulers packet classification functions in layer2 (bridge mode).

Dummynet AQM packet marking function ecn_mark() and fq_codel/fq_pie
schedulers packet classification functions (fq_codel_classify_flow()
and fq_pie_classify_flow()) assume mbuf is pointing at L3 (IP)
packet. However, this assumption is incorrect if ipfw/dummynet is
used to manage layer2 traffic (bridge mode) since mbuf will point
at L2 frame.  This patch solves this problem by identifying the
source of the frame/packet (L2 or L3) and adding ETHER_HDR_LEN
offset when converting an mbuf pointer to ip pointer if the traffic
is from layer2.  More specifically, in dummynet packet tagging
function, tag_mbuf(), iphdr_off is set to ETHER_HDR_LEN if the
traffic is from layer2 and set to zero otherwise. Whenever an access
to IP header is required, mtodo(m, dn_tag_get(m)->iphdr_off) is
used instead of mtod(m, struct ip *) to correctly convert mbuf
pointer to ip pointer in both L2 and L3 traffic.

Submitted by: lstewart
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D12506

6 years agoMake gmountver(8) use G_PF_ACCEPT_UNMAPPED.
trasz [Thu, 26 Oct 2017 09:29:35 +0000 (09:29 +0000)]
Make gmountver(8) use G_PF_ACCEPT_UNMAPPED.

MFC after: 2 weeks

6 years agoFix typo and bump .Dd date.
imp [Wed, 25 Oct 2017 23:24:30 +0000 (23:24 +0000)]
Fix typo and bump .Dd date.

Noticed by: Richard Tector
Sponsored by: Netflix

6 years agoCleanup pieces missed in r315057 which made mandoc mandatory
bdrewery [Wed, 25 Oct 2017 21:46:39 +0000 (21:46 +0000)]
Cleanup pieces missed in r315057 which made mandoc mandatory

Sponsored by: Dell EMC Isilon

6 years agoFix native-xtools build to use a proper sysroot.
bdrewery [Wed, 25 Oct 2017 21:46:36 +0000 (21:46 +0000)]
Fix native-xtools build to use a proper sysroot.

This takes longer but should reliably produce working binaries.
The old version linked against system libraries and headers
which would be a problem if building a native-xtools against
a newer source than the host system.  With a proper sysroot made
first this is not a problem.

This also allows:
- NXBDIRS to be built in parallel
- NXBDIRS to be installed to NXBDESTDIR in parallel
- SYSTEM_COMPILER logic to work again.  Note that because this change
  is adding a sysroot phase the compiler may be built up to twice now.
  The first is the "cross-compiler" even though it is for the native
  architecture, but it is still built to ensure the latest compiler
  is used to generate the binaries, unless SYSTEM_COMPILER allows
  /usr/bin/cc to be used.  Then the target compiler is built
  which is actually a cross-compiler since it runs on native host
  but generates TARGET.TARGET_ARCH binaries.

Note this also changes the path used for the OBJDIR.  It used to use
/usr/obj/target.target_arch/nxb/<srcdir> for objects and
/usr/obj/target.target_arch/nxb-bin for installed files, but now uses
/usr/obj/nxb/target.target_arch/<srcdir> for objects and
/usr/obj/nxb/target.target_arch/<srcdir>/nxb-bin for installed files.
  - NXBDESTDIR can be specified for where to install or queried with
    `make -f Makefile.inc1 TARGET=... TARGET_ARCH=... -V NXBDESTDIR`

This could potentially be improved to reuse an existing sysroot.  The
problem is with building the SUBDIR_OVERRIDE list it needs to use a
different OBJDIR since it is building all statically.  We don't want to
pollute the existing 'buildworld' OBJDIR and cause confusion on the next
build.  Using a separate OBJDIR for the 'everything' phase mostly works
except for some things like linking in INTERNALLIBS that exist in the
other OBJDIR.

MFC after: 1 month
Sponsored by: Dell EMC Isilon

6 years agonative-xtools: Override proper NXBDESTDIR.
bdrewery [Wed, 25 Oct 2017 21:46:33 +0000 (21:46 +0000)]
native-xtools: Override proper NXBDESTDIR.

The new native-xtools uses 'make toolchain' so overriding DESTDIR
as a make argument may interfere with WORLDTMP handling.
The target also does a 'mkdir -p ${NXBDESTDIR}/usr', so we should
be modifying that rather than DESTDIR.

Note this causes the native-xtools binaries to be installed in
NANO_WORLDDIR/usr NANO_WORLDDIR/bin rather than NANO_WORLDDIR/nxb-bin/usr
and NANO_WORLDDIR/nxb-bin/bin.  This was the case before this change
as well.

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

6 years agoMETA_MODE: Follow-up r319593: Don't use host headers in a fresh new build.
bdrewery [Wed, 25 Oct 2017 21:46:30 +0000 (21:46 +0000)]
META_MODE: Follow-up r319593: Don't use host headers in a fresh new build.

Sponsored by: Dell EMC Isilon

6 years agoPrefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision.
bdrewery [Wed, 25 Oct 2017 21:45:55 +0000 (21:45 +0000)]
Prefix {TARGET,BUILD}_TRIPLE with LLVM_ to avoid Makefile.inc1 collision.

The Makefile.inc1 TARGET_TRIPLE is for specifying which -target is used
during the build of world.

MFC after: 2 weeks
Reviewed by: dim, imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12792

6 years agoEvaluate packet size after the firewall had its chance in the ip6 fast path
kp [Wed, 25 Oct 2017 19:21:48 +0000 (19:21 +0000)]
Evaluate packet size after the firewall had its chance in the ip6 fast path

Defer the packet size check until after the firewall has had a look at it. This
means that the firewall now has the opportunity to (re-)fragment an oversized
packet.
This mirrors what the slow path does.

Reviewed by: ae
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12779

6 years agoloader.efi: Make framebuffer commands available for arm64
manu [Wed, 25 Oct 2017 18:55:04 +0000 (18:55 +0000)]
loader.efi: Make framebuffer commands available for arm64

Move framebuffer.{c,h} to sys/boot/efi/loader and add the efifb
related metadata and pass it to the kernel

Reviewed by: imp, andrew
Differential Revision: https://reviews.freebsd.org/D12757

6 years agoEnable i386 build of the Cavium LiquidIO driver (lio) module.
sbruno [Wed, 25 Oct 2017 17:49:17 +0000 (17:49 +0000)]
Enable i386 build of the Cavium LiquidIO driver (lio) module.

Submitted by: pkanneganti@cavium.com (Prasad V Kanneganti)
MFC after: 1 week
Sponsored by: Cavium Networks
Differential Revision: https://reviews.freebsd.org/D12415

6 years agoAdd a test for sending a signal while stepping a thread via PT_STEP.
jhb [Wed, 25 Oct 2017 17:23:33 +0000 (17:23 +0000)]
Add a test for sending a signal while stepping a thread via PT_STEP.

MFC after: 1 week

6 years agoMake drain_output() use bufobj_wwait().
markj [Wed, 25 Oct 2017 17:20:18 +0000 (17:20 +0000)]
Make drain_output() use bufobj_wwait().

No functional change intended.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12790

6 years agoFix zpool_read_all_labels when vfs.aio.enable_unsafe=0
asomers [Wed, 25 Oct 2017 16:01:19 +0000 (16:01 +0000)]
Fix zpool_read_all_labels when vfs.aio.enable_unsafe=0

Previously, zpool_read_all_labels was trying to do 256KB reads, which are
greater than the default MAXPHYS and therefore must go through the slow,
unsafe AIO path.  Shrink these reads to 112KB so they can use the safe, fast
AIO path instead.

MFC after: 1 week
X-MFC-With: 324568
Sponsored by: Spectra Logic Corp