Commit Graph

226935 Commits

Author SHA1 Message Date
Bryan Drewery
c16a698b5e xdev: Fix build for platforms needing LLD.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:46 +00:00
Bryan Drewery
57820ca8df 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
2017-10-29 01:21:42 +00:00
Bryan Drewery
2aba4f29f9 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
2017-10-29 01:21:39 +00:00
Bryan Drewery
49c9ea8fe5 AUTO_OBJ: auto.obj.mk mkdir -p simplification
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:36 +00:00
Bryan Drewery
051c25dbf3 Suggest TARGET/TARGET_ARCH, XDEV/XDEV_ARCH are depcrecated in r269031.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:33 +00:00
Bryan Drewery
5bd47cc56f 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
2017-10-29 01:21:29 +00:00
Bryan Drewery
b135fb6ef4 build(7): Document xdev targets.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:26 +00:00
Bryan Drewery
7441e255ed build(7): Document native-xtools.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:22 +00:00
Bryan Drewery
24830684f2 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
2017-10-29 01:21:19 +00:00
Bryan Drewery
bb3f65ea64 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
2017-10-29 01:21:15 +00:00
Bryan Drewery
d3e478c4c3 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
2017-10-29 01:21:12 +00:00
Bryan Drewery
30385347cf 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
2017-10-29 01:21:09 +00:00
Bryan Drewery
0a3c9523e0 Remove comment: debug files can be useful for build tools.
Sponsored by:	Dell EMC Isilon
2017-10-29 01:21:06 +00:00
Bryan Drewery
67d2f51ad6 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
2017-10-29 01:21:02 +00:00
Bryan Drewery
a3d90ddfb2 MK_TESTS is disabled in early phases, no need for TESTBASE extraction here.
Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:59 +00:00
Bryan Drewery
53f3deb166 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
2017-10-29 01:20:56 +00:00
Bryan Drewery
fb3d959c66 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
2017-10-29 01:20:53 +00:00
Bryan Drewery
354ffd5366 We don't need LIB32 directories extracted in early phase legacy/WORLDTMP dirs.
This reverts some changes from r289662

Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:50 +00:00
Bryan Drewery
64ec67921d 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
2017-10-29 01:20:47 +00:00
Bryan Drewery
5e3b906168 Move sendmail special check into a _sanity_check target.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-10-29 01:20:43 +00:00
Pedro F. Giffuni
7e7315b542 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
2017-10-28 21:26:49 +00:00
Pedro F. Giffuni
0f23ab8aac 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
2017-10-28 20:09:34 +00:00
Ian Lepore
3faac3ea79 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.
2017-10-28 20:03:29 +00:00
Mariusz Zaborski
0b9d37d25f 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
2017-10-28 19:39:22 +00:00
Ian Lepore
9aba65fa24 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
2017-10-28 19:34:08 +00:00
Mariusz Zaborski
ceb36bc93a 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
2017-10-28 19:23:57 +00:00
Ian Lepore
b8c7b15a82 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
2017-10-28 19:08:06 +00:00
Ian Lepore
6b5907b353 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.
2017-10-28 18:56:27 +00:00
Philip Paeps
8d7edd1726 Import tzdata 2017c
Changes: https://mm.icann.org/pipermail/tz-announce/2017-October/000047.html

MFC after:	2 days
2017-10-28 18:54:45 +00:00
Philip Paeps
5d3db21cbc Import tzdata 2017c 2017-10-28 17:43:05 +00:00
Ian Lepore
21c4bbedbc 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
2017-10-28 17:30:49 +00:00
Ian Lepore
0a3df28448 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
2017-10-28 17:06:13 +00:00
Ian Lepore
2eedde5f72 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
2017-10-28 16:50:23 +00:00
Mark Johnston
4770655901 Remove a stale and incorrect comment.
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-10-28 02:51:27 +00:00
Mark Johnston
9cf7abcc1d 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
2017-10-28 02:48:37 +00:00
Jeremie Le Hen
0696540011 Update manpage date to when the deprecation notice was removed.
Reported by:	bcr
2017-10-27 21:48:02 +00:00
Oleksandr Tymoshenko
e130435139 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.
2017-10-27 21:22:38 +00:00
Ed Maste
8448a47dcb dma: fix use-after-free
Sponsored by:	The FreeBSD Foundation
2017-10-27 20:21:09 +00:00
Michael Tuexen
966dfbf910 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.
2017-10-27 19:27:05 +00:00
Ian Lepore
ab8e311b11 Actually release resources in detach() rather than just returning EBUSY.
This will enable use of 'devctl disable', allow creation of a module, etc.
2017-10-27 17:21:43 +00:00
Mark Johnston
cef5abd140 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
2017-10-27 17:05:14 +00:00
David E. O'Brien
61407763bc Update comment to match r177997 & r178036 changes. 2017-10-27 16:36:05 +00:00
Ed Maste
732f2c69a1 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
2017-10-27 16:23:45 +00:00
Warner Losh
712ad71996 nvd alias has caused some problems, revert it for the moment.
Sponsored by: Netflix
2017-10-27 14:57:38 +00:00
John Baldwin
6db55a0f3a 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
2017-10-27 14:57:14 +00:00
Andriy Gapon
1c05a6ea6b MFV r325013,r325034: 640 number_to_scaled_string is duplicated in several commands
illumos/illumos-gate@0a0551200e
0a0551200e

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
2017-10-27 12:37:22 +00:00
Andriy Gapon
ae99a88d67 follow up to r325013, add libcmdutils.h to the vendor area 2017-10-27 11:26:36 +00:00
Cy Schubert
e223d957c3 Revert r325031. This breaks the build due to __FBSDID.
Pointy hat to:	cy
2017-10-27 05:04:29 +00:00
Cy Schubert
d022f5de53 Ensure all incude statements are kept together by moving the
sys/cdefs.h include appropriately.

MFC after:	1 week
X-MFC with:	r325030
2017-10-27 04:51:05 +00:00
Cy Schubert
d3add8e174 Remove redundant sys/cdefs.h include.
MFC after:	1 week
2017-10-27 04:47:44 +00:00