freebsd.git
8 years agoEnable kernel debugging on arm64, other than GDB as it fails to build.
andrew [Thu, 2 Jul 2015 14:35:30 +0000 (14:35 +0000)]
Enable kernel debugging on arm64, other than GDB as it fails to build.

Sponsored by: ABT Systems Ltd

8 years agoVnode is not referenced by the vfs_domount() at the point where
kib [Thu, 2 Jul 2015 14:31:47 +0000 (14:31 +0000)]
Vnode is not referenced by the vfs_domount() at the point where
asserts are made.  Remove them, since we might dereference freed
memory.  Leaked locks are asserted by the syscall return code anyway.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoSave & restore the floating-pont argument registers before calling
andrew [Thu, 2 Jul 2015 14:00:07 +0000 (14:00 +0000)]
Save & restore the floating-pont argument registers before calling
_rtld_bind. The compiler may generate code using these registers and not
save them. Unfortunately, as we make use of libc, we are unable to disallow
rtld from using floating-point register without also doing the same for the
parts of libc we use, or by limiting what _rtld_bind is able to call.

Obtained from: ABT Systems Ltd
Sponsored by: The FReeBSD Foundation

8 years agoAdd -b to the devlist usage info, forgotten in r260059.
brueffer [Thu, 2 Jul 2015 13:57:26 +0000 (13:57 +0000)]
Add -b to the devlist usage info, forgotten in r260059.

PR: 195094
Submitted by: robin.hahling@gw-computing.net
MFC after: 1 week

8 years agoSet MACHINE_CPU to arm64 when building for arm64. This is needed by the
andrew [Thu, 2 Jul 2015 13:42:57 +0000 (13:42 +0000)]
Set MACHINE_CPU to arm64 when building for arm64. This is needed by the
ports tree as they check this value in a number of ports.

PR: 201259
Sponsored by: ABT Systems Ltd

8 years agoFix couple panics on forced unmount of backing file.
mav [Thu, 2 Jul 2015 12:53:22 +0000 (12:53 +0000)]
Fix couple panics on forced unmount of backing file.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

8 years agoFix an obviously wrong boolean operator.
brueffer [Thu, 2 Jul 2015 12:14:48 +0000 (12:14 +0000)]
Fix an obviously wrong boolean operator.

PR: 200983
Submitted by: David Bindeman
MFC after: 1 week

8 years agoAdd the year to the VAX-11/780 announcement entry.
brueffer [Thu, 2 Jul 2015 12:08:05 +0000 (12:08 +0000)]
Add the year to the VAX-11/780 announcement entry.

PR: 200961
Submitted by: John Marshall
MFC after: 1 week

8 years agoFix a typo.
brueffer [Thu, 2 Jul 2015 11:46:35 +0000 (11:46 +0000)]
Fix a typo.

PR: 199453
Submitted by: John Nielsen

8 years agoProperly propagate errors in metadata reading.
pjd [Thu, 2 Jul 2015 10:57:34 +0000 (10:57 +0000)]
Properly propagate errors in metadata reading.

PR: 198860
Submitted by: Matthew D. Fuller

8 years agoAllow to omit keyfile number for the first keyfile.
pjd [Thu, 2 Jul 2015 10:55:32 +0000 (10:55 +0000)]
Allow to omit keyfile number for the first keyfile.

8 years agozfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls
avg [Thu, 2 Jul 2015 08:32:02 +0000 (08:32 +0000)]
zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls

We now take z_teardown_lock as a writer to ensure that there is no I/O
while the filesystem state is in a flux.  Also, zfs_suspend_fs() ->
zfsvfs_teardown() call zfs_unregister_callbacks() and zfs_resume_fs() ->
zfsvfs_setup() call zfs_unregister_callbacks().  Previously there was no
synchronization between those calls and the calls in the re-mounting
case.  That could lead to concurrent execution and a crash.

PR: 180060
Differential Revision: https://reviews.freebsd.org/D2865
Suggested by: mahrens
Reviewed by: delphij, pho, mahrens, will
MFC after: 13 days
Sponsored by: ClusterHQ

8 years agoDisable port multiplier support on Marvell 88SE61xx chips.
mav [Thu, 2 Jul 2015 08:25:45 +0000 (08:25 +0000)]
Disable port multiplier support on Marvell 88SE61xx chips.

According to report, some recent unrelated changes in the driver triggered
timeouts when testing for absent port multiplier.  Cause of this behavior
channge is unclear, but since these chips are old, rare and buggy, it is
easier to just disable port multiplier support, same as done in Linux.

Reported by: bar
MFC after: 3 days

8 years agoFix the path to the UFS/MSDOSFS filesystem labels, since they
gjb [Thu, 2 Jul 2015 02:33:58 +0000 (02:33 +0000)]
Fix the path to the UFS/MSDOSFS filesystem labels, since they
cannot possibly exist within the chroot(8) before the target
filesystem actually exists.

MFC after: 3 days
X-MFC-With: r285018
Sponsored by: The FreeBSD Foundation

8 years agoImplement an evil workaround that prevents UFS/MSDOS labels from being
gjb [Thu, 2 Jul 2015 02:13:20 +0000 (02:13 +0000)]
Implement an evil workaround that prevents UFS/MSDOS labels from being
written to disk with newfs(8) and newfs_msdosfs(8).

When iterating through snapshot builds in serial, it is possible for
a build failure to leave stale md(4) devices behind, in some cases, they
could have a UFS or MSDOS filesystem label assigned.

If the md(4) is not destroyed (or not able to be destroyed, as has
happened recently due to my own fault), the filesystem label that
already exists can interfere with a new md(4) device that is targeted to
have the same label.

This behavior, although admittedly a logic error in the wrapper build
scripts, has caused intermittent reports (in particular with the armv6
builds) of missing UFS/MSDOSFS labels, causing the image to fallback to
the mountroot prompt.  This appears to only happen when the backing
md(4) device is destroyed before the calling umount(8) on the target
mount, after which the UFS/MSDOSFS label persists.

The workaround is this:  If EVERYTHINGISFINE is set to non-empty value,
check for an existing ufs/rootfs and msdosfs/MSDOSBOOT filesystem label
in arm_create_disk(), and rm(1) them if they exist.

The EVERYTHINGISFINE variable is chosen because it is used in exactly
one other place - release/Makefile.mirrors - and there are big scary
warnings at the top of that file as well that it should *not* be used
under normal circumstances.  This should not destroy a build machine
that also uses '/dev/ufs/rootfs' as the UFS label, and I have verified
in extensive local testing that the destroyed label is recreated when
the md(4) is unmounted/mounted, but this really should not be enabled
by anyone.

Having said all that, I absolutely *do* plan MFC this to stable/10 for
the 10.2-RELEASE cycle, as so far, I have only observed this behavior
on stable/10, but this is a temporary solution until I can unravel all
of the failure paths to properly trap them.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agoAdd DMA support for Allwinner MMC controller.
loos [Wed, 1 Jul 2015 23:27:01 +0000 (23:27 +0000)]
Add DMA support for Allwinner MMC controller.

DMA handles all data transfers up to 128K or 16 segments and fallback to
pio mode when DMA requirements are not met.

The read performance has improved greatly while the write performance also
showed some improvement but seems limited by the card type and quality.

Submitted by: Pratik Singhal <pratiksinghal@freebsd.org>
Sponsored by: Google Summer of Code 2015
Tested on: A10 (cubieboard) and A20 (cubieboard 2 and banana pi)

8 years agoFix the logic for when to restore the VFP registers. It should restore
andrew [Wed, 1 Jul 2015 17:27:44 +0000 (17:27 +0000)]
Fix the logic for when to restore the VFP registers. It should restore
them when a different thread last used them, or when the thread was last
run on a different cpu.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

8 years agoBump .Dd for the example code update.
brueffer [Wed, 1 Jul 2015 16:50:01 +0000 (16:50 +0000)]
Bump .Dd for the example code update.

Submitted by: loos

8 years agoDisallow a debugger on 64bit system to set fs/gs bases of the 32bit
kib [Wed, 1 Jul 2015 16:37:03 +0000 (16:37 +0000)]
Disallow a debugger on 64bit system to set fs/gs bases of the 32bit
process beyond the end of the process address space.  Such setting is
not dangerous to the kernel integrity, but it causes confusing
application misbehaviour.

Sponsored by: The FreeBSD Foundation
MFC after: 12 days

8 years agoAdd one more file missed in the BIND-removal entries.
brueffer [Wed, 1 Jul 2015 15:54:13 +0000 (15:54 +0000)]
Add one more file missed in the BIND-removal entries.

PR: 196515
Submitted by: Trond Endrestol
MFC after: 1 week

8 years agoFirst cut of DTrace for AArch64.
br [Wed, 1 Jul 2015 15:51:11 +0000 (15:51 +0000)]
First cut of DTrace for AArch64.

Reviewed by: andrew, emaste
Sponsored by: ARM Limited
Differential Revision: https://reviews.freebsd.org/D2738

8 years agoUse the correct le*dec function to decode a 16bit type.
brueffer [Wed, 1 Jul 2015 14:54:13 +0000 (14:54 +0000)]
Use the correct le*dec function to decode a 16bit type.

PR: 194228
Submitted by: David Horwitt
MFC after: 2 weeks

8 years agoRemove the HH-MM suffix from the build date suffix.
gjb [Wed, 1 Jul 2015 14:51:26 +0000 (14:51 +0000)]
Remove the HH-MM suffix from the build date suffix.

It was useful when working out several kinks when
testing automated image uploading when retrying was
necessary, but now it is making things much too messy.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agoAdd a central location for exclusion checks. We check
br [Wed, 1 Jul 2015 14:09:59 +0000 (14:09 +0000)]
Add a central location for exclusion checks. We check
here if function is excluded from FBT instrumentation.

Reviewed by: andrew, emaste, markj
Differential Revision: https://reviews.freebsd.org/D2899

8 years agoMake libproc compilable on AArch64.
br [Wed, 1 Jul 2015 13:59:26 +0000 (13:59 +0000)]
Make libproc compilable on AArch64.

8 years agoRefine the lockstat(1) entry based on corrections and
gjb [Wed, 1 Jul 2015 10:33:19 +0000 (10:33 +0000)]
Refine the lockstat(1) entry based on corrections and
clarifications received during review.

Submitted by: avg
Sponsored by: The FreeBSD Foundation

8 years agoMake the example code actually work.
brueffer [Wed, 1 Jul 2015 09:25:23 +0000 (09:25 +0000)]
Make the example code actually work.

PR: 199440
Submitted by: waitman@waitman.net
Reviewed by: loos
MFC after: 1 week

8 years agoFix the gcloud port/package name.
gjb [Wed, 1 Jul 2015 08:48:49 +0000 (08:48 +0000)]
Fix the gcloud port/package name.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agocxgbe(4): request an automatic tx update when a netmap tx queue idles.
np [Wed, 1 Jul 2015 00:34:14 +0000 (00:34 +0000)]
cxgbe(4): request an automatic tx update when a netmap tx queue idles.
The NIC tx queues already do this.

MFC after: 1 week
Differential Revision:

8 years agocxgbetool: fix code that decodes T5 SGE contexts. Some of the fields
np [Tue, 30 Jun 2015 22:30:21 +0000 (22:30 +0000)]
cxgbetool: fix code that decodes T5 SGE contexts.  Some of the fields
that changed between T4 and T5 were not displayed correctly.

Obtained from: Chelsio
MFC after: 3 days
Differential Revision:

8 years ago- Fix `make depend` in sys/modules
lwhsu [Tue, 30 Jun 2015 19:35:14 +0000 (19:35 +0000)]
- Fix `make depend` in sys/modules

Differential Revision: https://reviews.freebsd.org/D2951
Approved by: delphij

8 years agoDefault the VAGRANT_VERSION to ${REVISION}-${BRANCH} if
gjb [Tue, 30 Jun 2015 19:18:08 +0000 (19:18 +0000)]
Default the VAGRANT_VERSION to ${REVISION}-${BRANCH} if
not set, which expands to '11.0-CURRENT', for example.

If the branch is -CURRENT, -STABLE, or -PRERELEASE, suffix
the VAGRANT_VERSION with the snapshot date.

MFC after: 3 days
X-MFC-Needs: r284893, r284895, r284896, r284897, r284942
Tested with: head@r284961 (patched)
Sponsored by: The FreeBSD Foundation

8 years agoadd units to the length and count so that it's clear what they
jmg [Tue, 30 Jun 2015 19:06:14 +0000 (19:06 +0000)]
add units to the length and count so that it's clear what they
are measured in...  Gems like: "len is the length of the buffer."
aren't useful in man pages.

8 years agoDocument x86 machine-specific ptrace(2) requests. Provide list of the
kib [Tue, 30 Jun 2015 18:53:42 +0000 (18:53 +0000)]
Document x86 machine-specific ptrace(2) requests.  Provide list of the
ppc requests.

Reviewed by: brueffer, emaste, gjb (previous version)
Sponsored by: The FreeBSD Foundation
Review: https://reviews.freebsd.org/D2962
MFC after: 2 weeks

8 years agoAdd missing DTrace scripts that exist in the source tree to the Makefile for
hiren [Tue, 30 Jun 2015 18:23:08 +0000 (18:23 +0000)]
Add missing DTrace scripts that exist in the source tree to the Makefile for
install.
While here, sort the list.

Differential Revision: D2950
Submitted by: Jason Wolfe <j at nitrology.com>
Reviewed by: gnn, markj, hiren
Sponsored by: Limelight Networks

8 years agoFix leak in tcp_lro_rx. Simply clearing M_PKTHDR isn't enough, any tags
np [Tue, 30 Jun 2015 17:19:58 +0000 (17:19 +0000)]
Fix leak in tcp_lro_rx.  Simply clearing M_PKTHDR isn't enough, any tags
hanging off the header need to be freed too.

Differential Revision: https://reviews.freebsd.org/D2708
Reviewed by: ae@, hiren@

8 years agoUpdated random(4) boot/shutdown scripting.
markm [Tue, 30 Jun 2015 17:09:41 +0000 (17:09 +0000)]
Updated random(4) boot/shutdown scripting.
Fix the man pages as well.

Differential Revision: https://reviews.freebsd.org/D2924
Approved by: so (delphij)

8 years agoHuge cleanup of random(4) code.
markm [Tue, 30 Jun 2015 17:00:45 +0000 (17:00 +0000)]
Huge cleanup of random(4) code.

* GENERAL
- Update copyright.
- Make kernel options for RANDOM_YARROW and RANDOM_DUMMY. Set
  neither to ON, which means we want Fortuna
- If there is no 'device random' in the kernel, there will be NO
  random(4) device in the kernel, and the KERN_ARND sysctl will
  return nothing. With RANDOM_DUMMY there will be a random(4) that
  always blocks.
- Repair kern.arandom (KERN_ARND sysctl). The old version went
  through arc4random(9) and was a bit weird.
- Adjust arc4random stirring a bit - the existing code looks a little
  suspect.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Redo read_random(9) so as to duplicate random(4)'s read internals.
  This makes it a first-class citizen rather than a hack.
- Move stuff out of locked regions when it does not need to be
  there.
- Trim RANDOM_DEBUG printfs. Some are excess to requirement, some
  behind boot verbose.
- Use SYSINIT to sequence the startup.
- Fix init/deinit sysctl stuff.
- Make relevant sysctls also tunables.
- Add different harvesting "styles" to allow for different requirements
  (direct, queue, fast).
- Add harvesting of FFS atime events. This needs to be checked for
  weighing down the FS code.
- Add harvesting of slab allocator events. This needs to be checked for
  weighing down the allocator code.
- Fix the random(9) manpage.
- Loadable modules are not present for now. These will be re-engineered
  when the dust settles.
- Use macros for locks.
- Fix comments.

* src/share/man/...
- Update the man pages.

* src/etc/...
- The startup/shutdown work is done in D2924.

* src/UPDATING
- Add UPDATING announcement.

* src/sys/dev/random/build.sh
- Add copyright.
- Add libz for unit tests.

* src/sys/dev/random/dummy.c
- Remove; no longer needed. Functionality incorporated into randomdev.*.

* live_entropy_sources.c live_entropy_sources.h
- Remove; content moved.
- move content to randomdev.[ch] and optimise.

* src/sys/dev/random/random_adaptors.c src/sys/dev/random/random_adaptors.h
- Remove; plugability is no longer used. Compile-time algorithm
  selection is the way to go.

* src/sys/dev/random/random_harvestq.c src/sys/dev/random/random_harvestq.h
- Add early (re)boot-time randomness caching.

* src/sys/dev/random/randomdev_soft.c src/sys/dev/random/randomdev_soft.h
- Remove; no longer needed.

* src/sys/dev/random/uint128.h
- Provide a fake uint128_t; if a real one ever arrived, we can use
  that instead. All that is needed here is N=0, N++, N==0, and some
  localised trickery is used to manufacture a 128-bit 0ULLL.

* src/sys/dev/random/unit_test.c src/sys/dev/random/unit_test.h
- Improve unit tests; previously the testing human needed clairvoyance;
  now the test will do a basic check of compressibility. Clairvoyant
  talent is still a good idea.
- This is still a long way off a proper unit test.

* src/sys/dev/random/fortuna.c src/sys/dev/random/fortuna.h
- Improve messy union to just uint128_t.
- Remove unneeded 'static struct fortuna_start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])

* src/sys/dev/random/yarrow.c src/sys/dev/random/yarrow.h
- Improve messy union to just uint128_t.
- Remove unneeded 'staic struct start_cache'.
- Tighten up up arithmetic.
- Provide a method to allow eternal junk to be introduced; harden
  it against blatant by compress/hashing.
- Assert that locks are held correctly.
- Fix the nasty pre- and post-read overloading by providing explictit
  functions to do these tasks.
- Turn into self-sufficient module (no longer requires randomdev_soft.[ch])
- Fix some magic numbers elsewhere used as FAST and SLOW.

Differential Revision: https://reviews.freebsd.org/D2025
Reviewed by: vsevolod,delphij,rwatson,trasz,jmg
Approved by: so (delphij)

8 years agoDo not calculate the stack's bottom address twice.
kib [Tue, 30 Jun 2015 15:22:47 +0000 (15:22 +0000)]
Do not calculate the stack's bottom address twice.

Submitted by: Olivц╘r Pintц╘r
Review: https://reviews.freebsd.org/D2953
MFC after: 1 week

8 years agoo DragonFly 4.2.0 added.
maxim [Tue, 30 Jun 2015 07:46:06 +0000 (07:46 +0000)]
o DragonFly 4.2.0 added.

8 years agoThe LDFLAGS isn't needed, and breaks the build on powerpc64.
jhibbits [Tue, 30 Jun 2015 06:02:42 +0000 (06:02 +0000)]
The LDFLAGS isn't needed, and breaks the build on powerpc64.

This hack is very fragile, and was broken on powerpc64 when metamode was
introduced.  Removing it survives a buildworld for all architectures, and
fixes the build on powerpc64.

8 years agoAdd Support for uploading Vagrant images to Hashicorp Atlas.
brd [Mon, 29 Jun 2015 21:26:41 +0000 (21:26 +0000)]
Add Support for uploading Vagrant images to Hashicorp Atlas.

Approved by: re (gjb)

8 years agoAvoid a situation where we do not set persist timer after a zero window
hiren [Mon, 29 Jun 2015 21:23:54 +0000 (21:23 +0000)]
Avoid a situation where we do not set persist timer after a zero window
condition.
If you send a 0-length packet, but there is data is the socket buffer, and
neither the rexmt or persist timer is already set, then activate the persist
timer.

PR: 192599
Differential Revision: D2946
Submitted by: jlott at averesystems dot com
Reviewed by: jhb, jch, gnn, hiren
Tested by: jlott at averesystems dot com, jch
MFC after: 2 weeks

8 years agoDelete the refernce to VLAN handling being disabled by default. This is
sbruno [Mon, 29 Jun 2015 17:59:00 +0000 (17:59 +0000)]
Delete the refernce to VLAN handling being disabled by default.  This is
no longer the case.

PR: 118693
MFC after: 3 days

8 years agoSet the initial system time to a sane (as in: not end of 21st century) value when
brueffer [Mon, 29 Jun 2015 17:02:09 +0000 (17:02 +0000)]
Set the initial system time to a sane (as in: not end of 21st century) value when
booting on a PC with CMOS clock set to a year before 2000.

This uses 1980 (instead of 1970 as in the initial patch) as pivot year as
suggested by imp in the PR followup.

PR: 195703
Submitted by: cs@soi.spb.ru
Reviewed by: imp
MFC after: 1 weeks

8 years agoAdd CouchDB ports (5984 TCP/UDP).
brueffer [Mon, 29 Jun 2015 15:38:34 +0000 (15:38 +0000)]
Add CouchDB ports (5984 TCP/UDP).

PR: 193268
Submitted by: yuri@rawbw.com
MFC after: 1 week

8 years agoFix issues that kept some of the examples from actually working.
brueffer [Mon, 29 Jun 2015 14:41:19 +0000 (14:41 +0000)]
Fix issues that kept some of the examples from actually working.

PR: 144534
Submitted by: Nicolas Edel
MFC after: 1 week

8 years agospeed up ar(1) on UFS file systems
emaste [Mon, 29 Jun 2015 13:48:44 +0000 (13:48 +0000)]
speed up ar(1) on UFS file systems

Fault in the buffer prior to writing to workaround poor performance due
to interaction with kernel fs deadlock avoidance code. See the comment
prior to vn_io_fault_doio() in sys/kern/vfs_vnops.c for details of the
issue.

On my stable/10 desktop with a 16MB obj.o and "ar r out.a obj.o" I see
the following run times (seconds):

x ar.r284891
+ ar.patched
+----------------------------------------------------------------------+
|+                                                                     |
|+                                                                    x|
|+                                                                   xx|
|A                                                                   |A|
+----------------------------------------------------------------------+
    N         Min          Max        Median           Avg        Stddev
x   3       1.307        1.321         1.315     1.3143333  0.0070237692
+   3       0.020        0.023         0.022   0.021666667  0.0015275252
Difference at 95.0% confidence
        -1.29267 +/- 0.0115203
        -98.3515% +/- 0.876513%
        (Student's t, pooled s = 0.00508265)

Thanks to kib for diagnosing and explaining the issue and suggesting
the workaround.

Reviewed by: eadler, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2933

8 years agoSimplify code, no need to test the flag before clearing it.
kib [Mon, 29 Jun 2015 13:06:24 +0000 (13:06 +0000)]
Simplify code, no need to test the flag before clearing it.

Submitted by: ed
MFC after: 12 days

8 years agoProvide npx_get_fsave(9) and npx_set_fsave(9) functions to obtain and
kib [Mon, 29 Jun 2015 12:06:36 +0000 (12:06 +0000)]
Provide npx_get_fsave(9) and npx_set_fsave(9) functions to obtain and
restore the FPU state from the format of machine FSAVE area.  The
intended use is for ABI emulators to provide FSAVE-formatted FPU state
to usermode requiring it, while kernel could use FXSAVE due to
XMM/XSAVE.

The core functionality to convert from/to FXSAVE format is shared with
the fill_fpregs_xmm() and set_fpregs_xmm().  Move the later functions
to npx.c and rename them to npx_fill_fpregs_xmm() and
npx_set_fpregs_xmm().  They differ from nptx_get/set_fsave(9) since
our mcontext contains padding to be zeroed or ignored.

fill_fpregs() and set_fpregs() could be converted to use the new
interface, but there are small differences to handle.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoMove CS_SECURE() and EFL_SECURE() macros to the machine/frame.h. They
kib [Mon, 29 Jun 2015 10:35:00 +0000 (10:35 +0000)]
Move CS_SECURE() and EFL_SECURE() macros to the machine/frame.h.  They
are useful for most implementations of sendsig().

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agosvr4 emulator has custom sendsig() implementation, it does not use
kib [Mon, 29 Jun 2015 10:33:04 +0000 (10:33 +0000)]
svr4 emulator has custom sendsig() implementation, it does not use
sv_sigtbl.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

8 years agoRemove sv_sigtbl handling from the arm64 sendsig(). There is no ABI
kib [Mon, 29 Jun 2015 10:31:12 +0000 (10:31 +0000)]
Remove sv_sigtbl handling from the arm64 sendsig().  There is no ABI
emulators on arm64.

Reviewed by: andrew
Review: https://reviews.freebsd.org/D2889
Sponsored by: The FreeBSD Foundation

8 years agoAdd a comment about too strong semantic of atomic_load_acq() on x86.
kib [Mon, 29 Jun 2015 09:58:40 +0000 (09:58 +0000)]
Add a comment about too strong semantic of atomic_load_acq() on x86.

Submitted by: bde
MFC after: 2 weeks

8 years agopcb_gs32sd is unused for long time, remove it. Keep the padding in pcb.
kib [Mon, 29 Jun 2015 07:53:44 +0000 (07:53 +0000)]
pcb_gs32sd is unused for long time, remove it.  Keep the padding in pcb.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoSlight tidy up of comments before MFC
julian [Mon, 29 Jun 2015 07:43:09 +0000 (07:43 +0000)]
Slight tidy up of comments before MFC

MFC after: 2 days

8 years agoAdd x86 PT_GETFSBASE, PT_GETGSBASE machine-depended ptrace requests to
kib [Mon, 29 Jun 2015 07:07:24 +0000 (07:07 +0000)]
Add x86 PT_GETFSBASE, PT_GETGSBASE machine-depended ptrace requests to
obtain the thread %fs and %gs bases.  Add x86 PT_SETFSBASE and
PT_SETGSBASE requests to set the bases from debuggers.  The set
requests, similarly to the sysarch({I386,AMD64}_SET_FSBASE),
override the corresponding segment registers.

The main purpose of the operations is to retrieve and modify the tcb
address for debuggee.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoReduce code duplication. Add helper fill_based_sd(9) which creates a
kib [Mon, 29 Jun 2015 06:59:08 +0000 (06:59 +0000)]
Reduce code duplication.  Add helper fill_based_sd(9) which creates a
based user data descriptor covering whole VA.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoAdd a new __sentinel attribute.
pfg [Mon, 29 Jun 2015 00:30:30 +0000 (00:30 +0000)]
Add a new __sentinel attribute.

The sentinel attribute was originally implemented in OpenBSD's gcc and
later adopted by upstream GCC 4.0 (and clang). From the OpenBSD's
gcc-local manpage:

-   gcc recognizes the extra attribute __sentinel__, which can be used to
    mark varargs function that need a NULL pointer to mark argument
    termination, like execl(3).  This exposes latent bugs for 64-bit
    architectures, where a terminating 0 will expand to a 32-bit int, and
    not a full-fledged 64-bits pointer.

While here sort the visibility attributes.

Hinted-by: OpenBSD

8 years agomv: Improve message when moving two or more files to non-directory.
jilles [Sun, 28 Jun 2015 21:36:00 +0000 (21:36 +0000)]
mv: Improve message when moving two or more files to non-directory.

The message text is from cp, which has had a nicer message for this since
2007 (PR bin/50656).

As with cp, the exit status changes from 64 to 1.

PR: 201083
MFC after: 1 week

8 years agoMake the system queue header file fully usable within C++ programs by
hselasky [Sun, 28 Jun 2015 21:06:45 +0000 (21:06 +0000)]
Make the system queue header file fully usable within C++ programs by
adding macros to define class lists.

This change is backwards compatible for all use within C and C++
programs. Only C++ programs will have added support to use the queue
macros within classes. Previously the queue macros could only be used
within structures.

The queue.3 manual page has been updated to describe the new
functionality and some alphabetic sorting has been done while
at it.

Differential Revision: https://reviews.freebsd.org/D2745
PR: 200827 (exp-run)
MFC after: 2 weeks

8 years agoFix a couple of missing lines that obscured the -p description.
wblock [Sun, 28 Jun 2015 20:53:36 +0000 (20:53 +0000)]
Fix a couple of missing lines that obscured the -p description.

Submitted by: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com>
MFC after: 1 week

8 years agodconschat(8): Use NULL instead of 0 for the last argument in execl(3)
pfg [Sun, 28 Jun 2015 20:32:03 +0000 (20:32 +0000)]
dconschat(8): Use NULL instead of 0 for the last argument in execl(3)

Found while experimenting with the gcc sentinel attribute.

MFC after: 3 days

8 years agoOnly initialize libedit when necessary
jmmv [Sun, 28 Jun 2015 16:43:07 +0000 (16:43 +0000)]
Only initialize libedit when necessary

The code path to support units conversions from the command line
need not initialize neither libedit nor the history.  Therefore, only do
that when in interactive mode.

This hides the issue reported in PR bin/201167 whereby running commands
of the form 'echo "$(units ft in)"' would corrupt the terminal.  The real
issue causing the corruption most likely still remains somewhere.

PR: bin/201167
Differential Revision: D2935
Reviewed by: eadler

8 years agoAdd const to char * pointers. This breaks nothing, and means const
markm [Sun, 28 Jun 2015 12:52:28 +0000 (12:52 +0000)]
Add const to char * pointers. This breaks nothing, and means const
chars can be passed with no warnings.

8 years agoAnsify another function. This is the last in the file, I hope.
markm [Sun, 28 Jun 2015 10:51:08 +0000 (10:51 +0000)]
Ansify another function. This is the last in the file, I hope.

8 years agoANSIfy the only function that uses K&R definition in this file.
markm [Sun, 28 Jun 2015 09:44:58 +0000 (09:44 +0000)]
ANSIfy the only function that uses K&R definition in this file.

8 years agoSteve KArgl's commit bit taken in at his own request
matthew [Sun, 28 Jun 2015 09:03:26 +0000 (09:03 +0000)]
Steve KArgl's commit bit taken in at his own request

With hat:     core-secretary
Approved by: core

8 years agoRemove unneeded data dependency, currently imposed by
kib [Sun, 28 Jun 2015 05:04:08 +0000 (05:04 +0000)]
Remove unneeded data dependency, currently imposed by
atomic_load_acq(9), on it source, for x86.

Right now, atomic_load_acq() on x86 is sequentially consistent with
other atomics, code ensures this by doing store/load barrier by
performing locked nop on the source.  Provide separate primitive
__storeload_barrier(), which is implemented as the locked nop done on
a cpu-private variable, and put __storeload_barrier() before load, to
keep seq_cst semantic but avoid introducing false dependency on the
no-modification of the source for its later use.

Note that seq_cst property of x86 atomic_load_acq() is not documented
and not carried by atomics implementations on other architectures,
although some kernel code relies on the behaviour.  This commit does
not intend to change this.

Reviewed by: alc
Discussed with: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoMake all shared library a relative symlink
bapt [Sat, 27 Jun 2015 23:28:56 +0000 (23:28 +0000)]
Make all shared library a relative symlink

This makes sysroot usable for cross building, it also removes the need for
_SHLIBDIRPREFIX (keeps its definition since picobsd uses it and I have no time
to test it)

Differential Revision: https://reviews.freebsd.org/D2920
Submitted by: imp, adrian
Tested by: adrian

8 years agoInstead of hard-coding the PROVIDERS for upload, add the
gjb [Sat, 27 Jun 2015 23:03:28 +0000 (23:03 +0000)]
Instead of hard-coding the PROVIDERS for upload, add the
VAGRANT_PROVIDERS variable.  Right now, it defaults to only
vmware_desktop, virtualbox support is to follow at some point.

While here, fix the hashicorp URL: s/vagrant/atlas/, which
was result of a sed(1) replace (and my fault).

Sponsored by: The FreeBSD Foundation

8 years agoRemove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the
gjb [Sat, 27 Jun 2015 22:59:29 +0000 (22:59 +0000)]
Remove _ACCOUNT and add _USERNAME, _NAME, _VERSION for the
VAGRANT_${VAR} variables extracted from VAGRANT_UPLOAD_CONF.

Set ATLAS_${VAR} to VAGRANT_${VAR} if VAGRANT_UPLOAD_CONF
is set.  There is intent to intentionally have separate
variants of configuration entries, but the defaults do not
yet have any reason to be different.

Sponsored by: The FreeBSD Foundation

8 years agoAdd default VAGRANT_IMG variable.
gjb [Sat, 27 Jun 2015 22:54:16 +0000 (22:54 +0000)]
Add default VAGRANT_IMG variable.

Sponsored by: The FreeBSD Foundation

8 years agoAdd initial support for building Vagrant images for VMWare. Next steps will be adding...
brd [Sat, 27 Jun 2015 20:39:13 +0000 (20:39 +0000)]
Add initial support for building Vagrant images for VMWare. Next steps will be adding Virtualbox support and uploading to Hashicorp Atlas for others to consume.

Approved by: re (gjb)

8 years agoFix issues detected by 'mandoc -Tlint bhyveload.8'
neel [Sat, 27 Jun 2015 18:24:23 +0000 (18:24 +0000)]
Fix issues detected by 'mandoc -Tlint bhyveload.8'

Pointed out by: wblock
Differential Revision: https://reviews.freebsd.org/D2762

8 years agoUse correct flag in iovctl_start().
pkelsey [Sat, 27 Jun 2015 18:01:50 +0000 (18:01 +0000)]
Use correct flag in iovctl_start().

Differential Revision: https://reviews.freebsd.org/D2921
Reviewed by: rstone
Approved by: jmallett (mentor)
Sponsored by: Norse Corp, Inc.

8 years agoChange detection for the gnu_inline attribute.
pfg [Sat, 27 Jun 2015 15:13:14 +0000 (15:13 +0000)]
Change detection for the gnu_inline attribute.

According to the GCC documentation:
"This attribute is available in GCC 4.1.3 and later. It is available
if either of the preprocessor macros __GNUC_GNU_INLINE__ or
__GNUC_STDC_INLINE__ are defined."

We don't keep the gcc granularity up to the minor number so it's
better to use the documented way. Current clang defines both
macros.

Reference:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

8 years agoFix compilation without INET6 and without INET and INET6 after
bz [Sat, 27 Jun 2015 12:37:09 +0000 (12:37 +0000)]
Fix compilation without INET6 and without INET and INET6 after
offload support was introduced in r284746.

While here also fix the ioctl() handler for IPv4 added in r279819,
which was never compiled in given opt_inet.h was not included.

8 years agoHandle errors from background write of the cylinder group blocks.
kib [Sat, 27 Jun 2015 09:44:14 +0000 (09:44 +0000)]
Handle errors from background write of the cylinder group blocks.

First, on the write error, bufdone() call from ffs_backgroundwrite()
panics because pbrelvp() cleared bp->b_bufobj, while brelse() would
try to re-dirty the copy of the cg buffer.  Handle this by setting
B_INVAL for the case of BIO_ERROR.

Second, we must re-dirty the real buffer containing the cylinder group
block data when background write failed.  Real cg buffer was already
marked clean in ffs_bufwrite(). After the BV_BKGRDINPROG flag is
cleared on the real cg buffer in ffs_backgroundwrite(), buffer scan
may reuse the buffer at any moment. The result is lost write, and if
the write error was only transient, we get corrupted bitmaps.

We cannot re-dirty the original cg buffer in the
ffs_backgroundwritedone(), since the context is not sleepable,
preventing us from sleeping for origbp' lock.  Add BV_BKGDERR flag
(protected by the buffer object lock), which is converted into delayed
write by brelse(), bqrelse() and buffer scan.

In collaboration with: Conrad Meyer <cse.cem@gmail.com>
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation (kib),
  EMC/Isilon storage division (Conrad)
MFC after: 2 weeks

8 years agoMFi386: r278165
nyan [Sat, 27 Jun 2015 09:01:49 +0000 (09:01 +0000)]
MFi386: r278165

  Silence a coverity warning about ignoring a return value.

8 years agoMFi386: r284878
nyan [Sat, 27 Jun 2015 08:49:41 +0000 (08:49 +0000)]
MFi386: r284878

  Reduce warnings:

   - Add prototype for boot2 main()
   - Don't make assignment within if statement, split it into two.

8 years agoFix a vi-invoked typo.
gjb [Sat, 27 Jun 2015 05:18:08 +0000 (05:18 +0000)]
Fix a vi-invoked typo.

Submitted by: jkim (privately)
Sponsored by: The FreeBSD Foundation

8 years agoAdd the ntfs alias and support it with the MBR and GPT schemes
marcel [Sat, 27 Jun 2015 03:28:04 +0000 (03:28 +0000)]
Add the ntfs alias and support it with the MBR and GPT schemes
as DOSPTYP_NTFS and GPT_ENT_TYPE_MS_BASIC_DATA (resp).

8 years agoAdd initial support for automatically uploading GCE virtual
gjb [Sat, 27 Jun 2015 01:29:59 +0000 (01:29 +0000)]
Add initial support for automatically uploading GCE virtual
machine images to the Google Compute Engine platform.

By default, gcutil/gsutil requires an Oauth2 login generated
from a URL that must be opened in a browser, a verification
code copied back to the terminal from which it was invoked,
etc., etc., making it near impossible for automation.

I've hacked together an evil solution to work around this,
so unless GCE_LOGIN_SKIP is set to a non-empty value, this
Makefile will not do anything useful.

As a result of this commit, remove the gce-package.sh script
that was never, nor will ever be, used.

MFC after: 3 days
X-MFC-Note: (hopefully)
Sponsored by: The FreeBSD Foundation

8 years agoshort circuit install -l rs
bapt [Fri, 26 Jun 2015 23:55:02 +0000 (23:55 +0000)]
short circuit install -l rs

When requesting install(1) to only make relative symlinks, by pass all the
done to actually compute the relative symlink if the path given in argument is
already a relative path

8 years agoReduce warnings:
delphij [Fri, 26 Jun 2015 18:03:19 +0000 (18:03 +0000)]
Reduce warnings:

 - Add prototype for boot2 main()
 - Don't make assignment within if statement, split it into two.

No functional or binary change -- verified with sha256(1).

MFC after: 2 weeks

8 years agoverify_gla() needs to account for non-zero segment base addresses.
tychon [Fri, 26 Jun 2015 18:00:29 +0000 (18:00 +0000)]
verify_gla() needs to account for non-zero segment base addresses.

Reviewed by: neel

8 years agoPlug minor memory leak at r284765.
mav [Fri, 26 Jun 2015 16:14:00 +0000 (16:14 +0000)]
Plug minor memory leak at r284765.

Reported by: Coverity
CID: 1308401
MFC after: 3 days

8 years agoClarify the note about Thumb-2 kernel support.
gjb [Fri, 26 Jun 2015 13:33:46 +0000 (13:33 +0000)]
Clarify the note about Thumb-2 kernel support.

Submitted by: andrew
Sponsored by: The FreeBSD Foundation

8 years agoCounter part of mfi driver commit in mrsas
kadesai [Fri, 26 Jun 2015 12:00:51 +0000 (12:00 +0000)]
Counter part of mfi driver commit in mrsas

Switch from make_dev_alias to make_dev_alias_p since make_dev_alias_p can
gracefully fail if the /dev/megaraid_sas_ioctl_node symlink already exists.
This can happen if mfi(4) and mrsas(4) are both attached to cards and
providing Linux emulation support.  Let the first one win.  An equivalent
change has been done in mfi(4).  Extra credit would be to pass the
Linux emulation call to the other driver when appropriate.  This will
probably be a rare case and the user can manually change where the symlink
points to.

MFC after:  3 days

8 years agoKernel panic may be observed by user, if MR controller is under Chip reset (OCR)
kadesai [Fri, 26 Jun 2015 11:58:42 +0000 (11:58 +0000)]
Kernel panic may be observed by user, if MR controller is under Chip reset (OCR)
and there are some pending IOs at the time of OCR. This is mainly because of
recursive mutext in OCR and IO completion function call. Generic IO completion (from ISR) needs
sim_lock to be held before it calls completion to CAM (xpt_done), but in case of OCR path mrsas_ocr thread
itself take sim_lock, so this condition is now handled in this patch.

MFC after:  3 days

8 years agopc_curpmap is only in the armv6 pcpu data.
andrew [Fri, 26 Jun 2015 09:02:40 +0000 (09:02 +0000)]
pc_curpmap is only in the armv6 pcpu data.

8 years agoamd64: set the correct LMA values
royger [Fri, 26 Jun 2015 07:12:17 +0000 (07:12 +0000)]
amd64: set the correct LMA values

The current linker script generates program headers with VMA == LMA:

Entry point 0xffffffff802e7000
There are 6 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0xffffffff80200040 0xffffffff80200040
                 0x0000000000000150 0x0000000000000150  R E    8
  INTERP         0x0000000000000190 0xffffffff80200190 0xffffffff80200190
                 0x000000000000000d 0x000000000000000d  R      1
      [Requesting program interpreter: /red/herring]
  LOAD           0x0000000000000000 0xffffffff80200000 0xffffffff80200000
                 0x00000000010559b0 0x00000000010559b0  R E    200000
  LOAD           0x0000000001056000 0xffffffff81456000 0xffffffff81456000
                 0x0000000000132638 0x000000000052ecf8  RW     200000
  DYNAMIC        0x0000000001056000 0xffffffff81456000 0xffffffff81456000
                 0x00000000000000d0 0x00000000000000d0  RW     8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RWE    8

This is fine for the FreeBSD loader, because it completely ignores p_paddr
and instead uses p_vaddr with a hardcoded offset. Other loaders however
acknowledge p_paddr (like the Xen ELF loader), in which case they will try
to load the kernel at the wrong place. Fix this by adding an AT keyword to
the first section specifying the physical address, other sections will
follow suit, so it ends up looking like:

Entry point 0xffffffff802e7000
There are 6 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0xffffffff80200040 0x0000000000200040
                 0x0000000000000150 0x0000000000000150  R E    8
  INTERP         0x0000000000000190 0xffffffff80200190 0x0000000000200190
                 0x000000000000000d 0x000000000000000d  R      1
      [Requesting program interpreter: /red/herring]
  LOAD           0x0000000000000000 0xffffffff80200000 0x0000000000200000
                 0x00000000010559b0 0x00000000010559b0  R E    200000
  LOAD           0x0000000001056000 0xffffffff81456000 0x0000000001456000
                 0x0000000000132638 0x000000000052ecf8  RW     200000
  DYNAMIC        0x0000000001056000 0xffffffff81456000 0x0000000001456000
                 0x00000000000000d0 0x00000000000000d0  RW     8
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RWE    8

Tested on bare metal using the native FreeBSD loader and grub2 from TRUEOS.

Sponsored by: Citrix Systems R&D
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D2783

8 years agoSplit the DMAR unit domains and contexts. Domains carry address space
kib [Fri, 26 Jun 2015 07:01:29 +0000 (07:01 +0000)]
Split the DMAR unit domains and contexts.  Domains carry address space
and related data structures.  Contexts attach requests initiators to
domains.  There is still 1:1 correspondence between contexts and
domains on the running system, since only busdma currently allocates
them, using dmar_get_ctx_for_dev().

Large part of the change is formal rename of the ctx to domain, but
patch also reworks the context allocation and free to allow for
independent domain creation.

The helper dmar_move_ctx_to_domain() is introduced for future use, to
reassign request initiator from one domain to another.  The hard issue
which is not yet resolved with the context move is proper handling (or
reserving) RMRR entries in the destination domain as required by ACPI
DMAR table for moved context.

Tested by: pho
Sponsored by: The FreeBSD Foundation

8 years agoUn-static cpuset_which() - it's useful in other contexts, such as some
adrian [Fri, 26 Jun 2015 04:14:05 +0000 (04:14 +0000)]
Un-static cpuset_which() - it's useful in other contexts, such as some
CPU set operations in my upcoming NUMA work.

Tested/compiled:

* i386 (run)
* amd64 (run)
* mips (run)
* mips64 (run)
* armv6 (built)

Sponsored by: Norse Corp, Inc.

8 years agoRename seq_* to mseq_*, to avoid clashes with seq.h (namely, seq_read.)
adrian [Fri, 26 Jun 2015 04:12:06 +0000 (04:12 +0000)]
Rename seq_* to mseq_*, to avoid clashes with seq.h (namely, seq_read.)

8 years agoAdd support for additional architectures in ntp.
cy [Fri, 26 Jun 2015 03:29:23 +0000 (03:29 +0000)]
Add support for additional architectures in ntp.

Differential Revision: D2720
Reviewed by: jmg, reoberto, andrew, ian, imp

8 years agoAnother attempt to make this compile on more architectures after r284777.
bz [Thu, 25 Jun 2015 23:16:01 +0000 (23:16 +0000)]
Another attempt to make this compile on more architectures after r284777.

8 years agoRevert r284860. I was looking at the wrong files.
gjb [Thu, 25 Jun 2015 20:46:11 +0000 (20:46 +0000)]
Revert r284860.  I was looking at the wrong files.
Sigh.

Sponsored by: The FreeBSD Foundation

8 years agoIf INVARIANTS is specified, add ctor/dtor to junk memory if they are
jmg [Thu, 25 Jun 2015 20:44:46 +0000 (20:44 +0000)]
If INVARIANTS is specified, add ctor/dtor to junk memory if they are
unspecified...

Submitted by: Suresh Gumpula at Netapp
Differential Revision: https://reviews.freebsd.org/D2725