]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
8 years agoSort the ARM atomic functions to be in alphabetical order.
andrew [Sun, 19 Jul 2015 13:10:47 +0000 (13:10 +0000)]
Sort the ARM atomic functions to be in alphabetical order.

Sponsored by: ABT Systems Ltd

8 years agoRevert bit of the r285627, locore.s does not need include of
kib [Sun, 19 Jul 2015 10:45:58 +0000 (10:45 +0000)]
Revert bit of the r285627, locore.s does not need include of
opt_kstack_pages.h.  The asm gets the right KSTACK_PAGES from the
assym.s.

Reported by: bz
Sponsored by: The FreeBSD Foundation

8 years agoAdd support to the jail framework to be able to mount linsysfs(5) and
araujo [Sun, 19 Jul 2015 08:52:35 +0000 (08:52 +0000)]
Add support to the jail framework to be able to mount linsysfs(5) and
linprocfs(5).

Differential Revision: D2846
Submitted by: Nikolai Lifanov <lifanov@mail.lifanov.com>
Reviewed by: jamie

8 years ago- Record dependencies of gdb/gdbtui/kgdb on binutils/lib{bfd,iberty,opcodes},
marius [Sun, 19 Jul 2015 00:38:19 +0000 (00:38 +0000)]
- Record dependencies of gdb/gdbtui/kgdb on binutils/lib{bfd,iberty,opcodes},
  fixing parallel builds.
- Don't build gdb/gdbtui/kgdb or libreadline when MK_BINUTILS is "no" for
  obvious reasons.

MFC after: 3 days

8 years agomove the prototype to the lib.h header.. This makes more sense, and
jmg [Sat, 18 Jul 2015 22:47:46 +0000 (22:47 +0000)]
move the prototype to the lib.h header..  This makes more sense, and
it's an API between boot2.c and arm_init.S which calls it..

8 years agoother fixes to make boot2 compile for IXP... Properly end the asm
jmg [Sat, 18 Jul 2015 20:21:25 +0000 (20:21 +0000)]
other fixes to make boot2 compile for IXP...  Properly end the asm
sections, and for some reason, main needs a prototype... If someone
has a better fix, I'm all ears...

Pointed out by: Berislav Purgar

8 years agorevert r278579, this is in a different compile environment than the
jmg [Sat, 18 Jul 2015 20:19:51 +0000 (20:19 +0000)]
revert r278579, this is in a different compile environment than the
kernel, and needs to be named cpu_id...

Pointed out by: Berislav Purgar

8 years agoFurther cleanup after r285607.
kib [Sat, 18 Jul 2015 19:59:29 +0000 (19:59 +0000)]
Further cleanup after r285607.

Remove useless release semantic for some stores to it_need.  For
stores where the release is needed, add a comment explaining why.

Fence after the atomic_cmpset() op on the it_need should be acquire
only, release is not needed (see above).  The combination of
atomic_cmpset() + fence_acq() is better expressed there as
atomic_cmpset_acq().

Use atomic_cmpset() for swi' ih_need read and clear.

Discussed with: alc, bde
Reviewed by: bde
Comments wording provided by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoAdd support for two workarounds for known issues booting GPT in legacy mode on some...
allanjude [Sat, 18 Jul 2015 18:49:44 +0000 (18:49 +0000)]
Add support for two workarounds for known issues booting GPT in legacy mode on some hardware

For Lenovo laptops with buggy bios (x220, t420, t520):
Write the 0xee entry into the second slot in the pmbr instead of the first

For some Dell and HP models:
The BIOS gives a warning message when booting in legacy mode from a GPT partitioned disk where the 0xee partition in the pmbr is not flagged active
For models known to have this problem, mark the pmbr active during installation

Use smbios data to identify machines known to be affected by any of the above, and offer the user the option to apply the workaround

In bsdinstall's ufs auto mode (autopart partition wizard):
Allow users to select which type of partition table to use
Keep current defaults: MBR for BIOS, GPT for UEFI
This allows users to choose GPT for legacy boot if they wish

PR: 184910
PR: 194359
Reviewed by: Michael Dexter
Approved by: marcel
MFC after: 3 days
X-MFC-With: r285594
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3091

8 years agoDeselect the sd card before re-selecting it when working around a problem
ian [Sat, 18 Jul 2015 16:56:51 +0000 (16:56 +0000)]
Deselect the sd card before re-selecting it when working around a problem
with some cards that causes them to become deselected after probing for
switch capabilities.  The old workaround fixes the behavior with some cards,
but causes problems with the cards the behave correctly and don't become
deselected.  Forcing a deselect then reselect appears to work correctly
with all cards in initial testing.

8 years agofix a typo in a comment
luigi [Sat, 18 Jul 2015 15:28:32 +0000 (15:28 +0000)]
fix a typo in a comment

8 years agoExpand sysctl descriptions in iscsi(4) and ctl(4).
trasz [Sat, 18 Jul 2015 15:27:12 +0000 (15:27 +0000)]
Expand sysctl descriptions in iscsi(4) and ctl(4).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

8 years agoRemove a comment in the wrong place.
trasz [Sat, 18 Jul 2015 12:25:47 +0000 (12:25 +0000)]
Remove a comment in the wrong place.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agoDocument suspend/resume notification in devd.conf(5).
trasz [Sat, 18 Jul 2015 12:24:54 +0000 (12:24 +0000)]
Document suspend/resume notification in devd.conf(5).

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agoAdd CARP events description to devd.conf(5).
trasz [Sat, 18 Jul 2015 12:17:59 +0000 (12:17 +0000)]
Add CARP events description to devd.conf(5).

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

8 years agofstyp(8) ships with 10.2.
trasz [Sat, 18 Jul 2015 12:03:51 +0000 (12:03 +0000)]
fstyp(8) ships with 10.2.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agouefisign(8) ships with 10.2.
trasz [Sat, 18 Jul 2015 12:03:17 +0000 (12:03 +0000)]
uefisign(8) ships with 10.2.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

8 years agoThe si_status field of the siginfo_t, provided by the waitid(2) and
kib [Sat, 18 Jul 2015 09:02:50 +0000 (09:02 +0000)]
The si_status field of the siginfo_t, provided by the waitid(2) and
SIGCHLD signal, should keep full 32 bits of the status passed to the
_exit(2).

Split the combined p_xstat of the struct proc into the separate exit
status p_xexit for normal process exit, and signalled termination
information p_xsig.  Kernel-visible macro KW_EXITCODE() reconstructs
old p_xstat from p_xexit and p_xsig.  p_xexit contains complete status
and copied out into si_status.

Requested by: Joerg Schilling
Reviewed by: jilles (previous version), pho
Tested by: pho
Sponsored by: The FreeBSD Foundation

8 years agoSince the IETF has redefined the meaning of the tos field to accommodate
kevlo [Sat, 18 Jul 2015 06:48:30 +0000 (06:48 +0000)]
Since the IETF has redefined the meaning of the tos field to accommodate
a set of differentiated services, set IPTOS_PREC_* macros using
IPTOS_DSCP_* macro definitions.

While here, add IPTOS_DSCP_VA macro according to RFC 5865.

Differential Revision: https://reviews.freebsd.org/D3119
Reviewed by: gnn

8 years agoFix the !KDTRACE_HOOKS build.
markj [Sat, 18 Jul 2015 04:38:11 +0000 (04:38 +0000)]
Fix the !KDTRACE_HOOKS build.

X-MFC-With: r285664

8 years agoFix contraction spotted by igor(1) and remove 2 .Ed spotted by mandoc(1).
araujo [Sat, 18 Jul 2015 03:14:49 +0000 (03:14 +0000)]
Fix contraction spotted by igor(1) and remove 2 .Ed spotted by mandoc(1).
Also, don't capitalize "module" and remove a redundant phrase introduced
in my previous commit.

Differential Revision: D3112
Reviewed by: wblock
Sponsored by: gandi.net

8 years agoPass the lock object to lockstat_nsecs() and return immediately if
markj [Sat, 18 Jul 2015 00:57:30 +0000 (00:57 +0000)]
Pass the lock object to lockstat_nsecs() and return immediately if
LO_NOPROFILE is set. Some timecounter handlers acquire a spin mutex, and
we don't want to recurse if lockstat probes are enabled.

PR: 201642
Reviewed by: avg
MFC after: 3 days

8 years agoModify lockstat_nsecs() to just return unless lockstat probes are actually
markj [Sat, 18 Jul 2015 00:22:00 +0000 (00:22 +0000)]
Modify lockstat_nsecs() to just return unless lockstat probes are actually
enabled. The cost of a timecounter read can be quite significant, and the
problem became more apparent after r284297, since that change resulted in
a call to lockstat_nsecs() for each acquisition of an rwlock read lock.

PR: 201642
Reviewed by: avg
Tested by: Jason Unovitch
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D3073

8 years agoMerge driver for PMC Sierra's range of SAS/SATA HBAs.
benno [Fri, 17 Jul 2015 23:30:43 +0000 (23:30 +0000)]
Merge driver for PMC Sierra's range of SAS/SATA HBAs.

Submitted by: Achim Leubner <Achim.Leubner@pmcs.com>
Reviewed by: scottl

8 years agoUndo r285656.
ed [Fri, 17 Jul 2015 22:26:45 +0000 (22:26 +0000)]
Undo r285656.

It turns out that the CDDL sources already introduce a function called
thread_create(). I'll investigate what we can do to make these functions
coexist.

Reported by: Ivan Klymenko

8 years agoEnable pms module on amd64 for now.
benno [Fri, 17 Jul 2015 20:30:30 +0000 (20:30 +0000)]
Enable pms module on amd64 for now.

8 years agoDisable debugging.
benno [Fri, 17 Jul 2015 20:29:47 +0000 (20:29 +0000)]
Disable debugging.

Submitted by: Vasanthalakshmi Tharmarajan <Vasanthalakshmi.Tharmarajan@pmcs.com>
Reviewed by: scottl

8 years agomake ctdladm(8) return 0 is everything was ok.
bapt [Fri, 17 Jul 2015 19:10:43 +0000 (19:10 +0000)]
make ctdladm(8) return 0 is everything was ok.

retval is used to test the return of XML_Parse function which is ok if 1 is
returned and retval it directly returned to the main function and used as an
exit value.

if all the parsing part is done reset retval to 0 so that the command return 0
if everything ok

Differential Revision: https://reviews.freebsd.org/D3102
Reviewed by: trasz
MFC after: 3 days
Sponsored by: gandi.net

8 years agoCheck TCP timestamp option flag so that the automatic receive buffer
pkelsey [Fri, 17 Jul 2015 17:36:33 +0000 (17:36 +0000)]
Check TCP timestamp option flag so that the automatic receive buffer
scaling code does not use an uninitialized timestamp echo reply value
from the stack when timestamps are not enabled.

Differential Revision: https://reviews.freebsd.org/D3060
Reviewed by: hiren
Approved by: jmallett (mentor)
MFC after: 3 days
Sponsored by: Norse Corp, Inc.

8 years agoAdd an API for easily creating userspace threads in kernelspace.
ed [Fri, 17 Jul 2015 16:34:01 +0000 (16:34 +0000)]
Add an API for easily creating userspace threads in kernelspace.

This change refactors the existing create_thread() function to be more
generic. It replaces almost all of its arguments by a callback that can
be used to extract the thread ID and copy it out to the right place, but
also to perform additional initialization steps, such as setting the
trapframe. This also makes the difference between thr_new() and
thr_create() more clear in my opinion.

This function is going to be used by the CloudABI compatibility layer.

Reviewed by: kib
MFC after: 1 month

8 years agoFix possible coherency issues between PEs related to I-cache
zbb [Fri, 17 Jul 2015 14:33:47 +0000 (14:33 +0000)]
Fix possible coherency issues between PEs related to I-cache

Basing on B.2.3.4:
Synchronization and coherency issues between data and
instruction accesses.

To ensure that modified instructions are visible to all PEs
(Processing Elements) in a shareability domain one need to
perform following sequence:
    1. Clean D-cache
    2. Ensure the visibility of data cleaned from cache
    3. Invalidate I-cache
    4. Ensure completion
    5. In SMP system PE must issue isb to ensure execution of the
       modified instructions

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3106

8 years agoFix secondary stacks calculation on ARM64
zbb [Fri, 17 Jul 2015 14:08:08 +0000 (14:08 +0000)]
Fix secondary stacks calculation on ARM64

Secondary stack calculation is modified to provide
stack_top = secondary_stacks + (cpu_id) * PAGE_SIZE * KSTACK_PAGES
because on ARM64 the stack grows to lower memory addresses.

Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3107

8 years agoIncrease DMAP (Direct Map) size on ARM64
zbb [Fri, 17 Jul 2015 13:58:00 +0000 (13:58 +0000)]
Increase DMAP (Direct Map) size on ARM64

Previous DMAP size was too small for systems with more than 64GB
of RAM. Increase it to 128GB to support ThunderX CRB.

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3113

8 years agoImplement CloudABI memory management system calls.
ed [Fri, 17 Jul 2015 09:00:38 +0000 (09:00 +0000)]
Implement CloudABI memory management system calls.

Add support for the <sys/mman.h> functions by wrapping around our own
implementations. There are no kern_*() variants of these system calls,
but we also don't need them in this case. It is sufficient to just call
into the sys_*() functions.

Differential Revision: https://reviews.freebsd.org/D3033
Reviewed by: brooks

8 years agoMove assignments around to avoid a false-positive uninitialized variable
des [Fri, 17 Jul 2015 08:37:13 +0000 (08:37 +0000)]
Move assignments around to avoid a false-positive uninitialized variable
warning which broke the sparc64 build.

PR: 201585
MFC after: 3 weeks

8 years agocxgbe(4): Ask the firmware for the start of the RSS slice for a port and
np [Fri, 17 Jul 2015 06:46:18 +0000 (06:46 +0000)]
cxgbe(4): Ask the firmware for the start of the RSS slice for a port and
save it for later.  This enables direct manipulation of the indirection
tables (although the stock driver doesn't do that right now).

MFC after: 1 month

8 years agoDescribe how to load gmultipath at boot time.
araujo [Fri, 17 Jul 2015 06:34:46 +0000 (06:34 +0000)]
Describe how to load gmultipath at boot time.

Differential Revision: D3112
Reviewed by: allanjude, bapt
Sponsored by: gandi.net

8 years agoMention the dd-like recoverdisk(1) to help folks find this great BSD command.
obrien [Thu, 16 Jul 2015 23:38:12 +0000 (23:38 +0000)]
Mention the dd-like recoverdisk(1) to help folks find this great BSD command.

8 years agosqlite: clean a couple of invocations of memcpy(3)
pfg [Thu, 16 Jul 2015 22:07:13 +0000 (22:07 +0000)]
sqlite: clean a couple of invocations of memcpy(3)

Found almost accidentally by our native gcc when enhanced with
FORTIFY_SOURCE.

Submitted by: Oliver Pinter
Sponosored by: Google Inc. GSoC 2015

8 years agoWhen checking for the valid value of the frame pointer, verify that it
kib [Thu, 16 Jul 2015 19:40:18 +0000 (19:40 +0000)]
When checking for the valid value of the frame pointer, verify that it
belongs to the kernel stack address range for the thread.  Right now,
code checks that new frame is not farther then KSTACK_PAGES pages from
the current frame, which allows the address to point past the top of
the stack.

Reviewed by: andrew, emaste, markj
Differential revision: https://reviews.freebsd.org/D3108
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agossh: canonicize the host name before looking it up in the host file
vangyzen [Thu, 16 Jul 2015 18:44:18 +0000 (18:44 +0000)]
ssh: canonicize the host name before looking it up in the host file

Re-apply r99054 by des in 2002.  This was accidentally dropped
by the update to OpenSSH 6.5p1 (r261320).

This change is actually taken from r387082 of
ports/security/openssh-portable/files/patch-ssh.c

PR: 198043
Differential Revision: https://reviews.freebsd.org/D3103
Reviewed by: des
Approved by: kib (mentor)
MFC after: 3 days
Relnotes: yes
Sponsored by: Dell Inc.

8 years agoAdd a sysentvec for CloudABI on x86-64.
ed [Thu, 16 Jul 2015 18:24:06 +0000 (18:24 +0000)]
Add a sysentvec for CloudABI on x86-64.

Summary:
For CloudABI we need to put two things on the stack of new processes:
the argument data (a binary blob; not strings) and a startup data
structure. The startup data structure contains interesting things such
as a pointer to the ELF program header, the thread ID of the initial
thread, a stack smashing protection canary, and a pointer to the
argument data.

Fetching system call arguments and setting the return value is similar
to FreeBSD. The only differences are that system call 0 does not exist
and that we call into cloudabi_convert_errno() to convert the error
code. We also need this function in a couple of other places, so we'd
better reuse it here.

Reviewers: dchagin, kib

Reviewed By: kib

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D3098

8 years agoDocument r285550, w(1) now displays the full IPv6 address of a remote
gjb [Thu, 16 Jul 2015 17:48:37 +0000 (17:48 +0000)]
Document r285550, w(1) now displays the full IPv6 address of a remote
connected host.

Sponsored by: The FreeBSD Foundation

8 years agoAdd an adapter CORE lock in the DDB hook em_dump_queue to avoid WITNESS
sbruno [Thu, 16 Jul 2015 16:32:57 +0000 (16:32 +0000)]
Add an adapter CORE lock in the DDB hook em_dump_queue to avoid WITNESS
panic in em_init_locked() while debugging.

MFC after: 2 weeks
Sponsored by: Limelight Networks

8 years agoOptimise the DWC OTG host mode driver's transmit path:
hselasky [Thu, 16 Jul 2015 16:08:40 +0000 (16:08 +0000)]
Optimise the DWC OTG host mode driver's transmit path:

1) Use the TX FIFO empty interrupts to poll the transmit FIFO usage,
instead of using own software counters and waiting for SOF
interrupts. Assume that enough FIFO space is available to execute one
USB OUT transfer of any kind when the TX FIFO is empty.

2) Use the host channel halted event to asynchronously wait for host
channels to be disabled instead of waiting for SOF interrupts. This
results in less turnaround time for re-using host channels and at the
same time increases the performance.

The network transmit performance measured by "iperf" for the "RPi-B v1
2011/12" board, increased from 45MBit/s to 65Mbit/s after applying the
changes above.

No regressions seen using:
 - High Speed (BULK, CONTROL, INTERRUPT)
 - Full Speed (All transfer types)
 - Low Speed (Control and Interrupt)

MFC after: 1 month
Submitted by: Daisuke Aoyama <aoyama@peach.ne.jp>

8 years agoFix a small typo: "the the".
ed [Thu, 16 Jul 2015 15:43:55 +0000 (15:43 +0000)]
Fix a small typo: "the the".

Spotted by: wblock

8 years agofd: partially deduplicate fdescfree and fdescfree_remapped
mjg [Thu, 16 Jul 2015 15:26:37 +0000 (15:26 +0000)]
fd: partially deduplicate fdescfree and fdescfree_remapped

This also moves vrele of cdir/rdir/jdir vnodes earlier, which should not
matter.

8 years agoGet rid of lim_update_thread and cred_update_thread.
mjg [Thu, 16 Jul 2015 14:30:11 +0000 (14:30 +0000)]
Get rid of lim_update_thread and cred_update_thread.

Their primary use was in thread_cow_update to free up old resources.
Freeing had to be done with proc lock held and _cow_ funcs already knew
how to free old structs.

8 years agovfs: implement v_holdcnt/v_usecount manipulation using atomic ops
mjg [Thu, 16 Jul 2015 13:57:05 +0000 (13:57 +0000)]
vfs: implement v_holdcnt/v_usecount manipulation using atomic ops

Transitions 0->1 and 1->0 (which decide e.g. on putting the vnode on the free
list) of either counter are still guarded with vnode interlock.

Reviewed by: kib (earlier version)
Tested by: pho

8 years agoSplit out the arm and armv6 parts of atomic.h to new files. While here use
andrew [Thu, 16 Jul 2015 13:33:03 +0000 (13:33 +0000)]
Split out the arm and armv6 parts of atomic.h to new files. While here use
__ARM_ARCH to determine which revision of the architecture is applicable.

Sponsored by: ABT Systems Ltd

8 years agoAdd a -s option which adds a column listing the connection state if
des [Thu, 16 Jul 2015 13:09:21 +0000 (13:09 +0000)]
Add a -s option which adds a column listing the connection state if
applicable (currently only for TCP).

PR: 201585
MFC after: 3 weeks

8 years agoFix warnings about unused functions for UP build.
kib [Thu, 16 Jul 2015 12:16:42 +0000 (12:16 +0000)]
Fix warnings about unused functions for UP build.

Sponsored by: The FreeBSD Foundation

8 years agoActually recognize all Intel Lynx Point devices we have device IDs for.
brueffer [Thu, 16 Jul 2015 11:14:59 +0000 (11:14 +0000)]
Actually recognize all Intel Lynx Point devices we have device IDs for.

PR: 195851
Submitted by: ftigeot@wolfpond.org
MFC after: 1 week

8 years agoFix KSTACK_PAGES issue when the default value was changed in KERNCONF
zbb [Thu, 16 Jul 2015 10:46:52 +0000 (10:46 +0000)]
Fix KSTACK_PAGES issue when the default value was changed in KERNCONF

If KSTACK_PAGES was changed to anything alse than the default,
the value from param.h was taken instead in some places and
the value from KENRCONF in some others. This resulted in
inconsistency which caused corruption in SMP envorinment.

Ensure all places where KSTACK_PAGES are used the opt_kstack_pages.h
is included.

The file opt_kstack_pages.h could not be included in param.h
because was breaking the toolchain compilation.

Reviewed by:   kib
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3094

8 years agoSet-up proper TCR values for memory related to Translation Table Walking
zbb [Thu, 16 Jul 2015 10:22:57 +0000 (10:22 +0000)]
Set-up proper TCR values for memory related to Translation Table Walking

This commit adds proper cache and shareability attributes to
the TCR register.
Set memory attributes to Normal, outer and inner cacheable WBWA.
Set shareability to inner and outer shareable when SMP is enabled.

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3093

8 years agoFix typo in register definition.
kevlo [Thu, 16 Jul 2015 08:03:23 +0000 (08:03 +0000)]
Fix typo in register definition.

Submitted by: James Hung
Reviewed by: sbruno

8 years agoImplement CloudABI's exec() call.
ed [Thu, 16 Jul 2015 07:05:42 +0000 (07:05 +0000)]
Implement CloudABI's exec() call.

Summary:
In a runtime that is purely based on capability-based security, there is
a strong emphasis on how programs start their execution. We need to make
sure that we execute an new program with an exact set of file
descriptors, ensuring that credentials are not leaked into the process
accidentally.

Providing the right file descriptors is just half the problem. There
also needs to be a framework in place that gives meaning to these file
descriptors. How does a CloudABI mail server know which of the file
descriptors corresponds to the socket that receives incoming emails?
Furthermore, how will this mail server acquire its configuration
parameters, as it cannot open a configuration file from a global path on
disk?

CloudABI solves this problem by replacing traditional string command
line arguments by tree-like data structure consisting of scalars,
sequences and mappings (similar to YAML/JSON). In this structure, file
descriptors are treated as a first-class citizen. When calling exec(),
file descriptors are passed on to the new executable if and only if they
are referenced from this tree structure. See the cloudabi-run(1) man
page for more details and examples (sysutils/cloudabi-utils).

Fortunately, the kernel does not need to care about this tree structure
at all. The C library is responsible for serializing and deserializing,
but also for extracting the list of referenced file descriptors. The
system call only receives a copy of the serialized data and a layout of
what the new file descriptor table should look like:

    int proc_exec(int execfd, const void *data, size_t datalen, const int *fds,
              size_t fdslen);

This change introduces a set of fd*_remapped() functions:

- fdcopy_remapped() pulls a copy of a file descriptor table, remapping
  all of the file descriptors according to the provided mapping table.
- fdinstall_remapped() replaces the file descriptor table of the process
  by the copy created by fdcopy_remapped().
- fdescfree_remapped() frees the table in case we aborted before
  fdinstall_remapped().

We then add a function exec_copyin_data_fds() that builds on top these
functions. It copies in the data and constructs a new remapped file
descriptor. This is used by cloudabi_sys_proc_exec().

Test Plan:
cloudabi-run(1) is capable of spawning processes successfully, providing
it data and file descriptors. procstat -f seems to confirm all is good.
Regular FreeBSD processes also work properly.

Reviewers: kib, mjg

Reviewed By: mjg

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D3079

8 years agoFix formatting.
jhibbits [Thu, 16 Jul 2015 05:14:20 +0000 (05:14 +0000)]
Fix formatting.

8 years agoFix userland program exception handling for powerpc64.
jhibbits [Thu, 16 Jul 2015 05:13:08 +0000 (05:13 +0000)]
Fix userland program exception handling for powerpc64.

It appears that the linker will not handle 64-bit relocations at addresses that
are not aligned to 8-byte boundaries.  Prior to this change the line:

  .llong generictrap

was aligned to a 4-byte address, and the linker replaced that with an 8-byte
0x0.  Aligning that address to 8 bytes caused the linker to generate the proper
relocation.  As a follow-through, the dblow from trap_subr33.S used the code
sequence 'lwz %r1, TRAP_GENTRAP(0)', so this reproduces the analogue of that for
64-bit.

8 years agoIf uart interrupts are not functioning then schedule the callout to do the
neel [Thu, 16 Jul 2015 04:15:22 +0000 (04:15 +0000)]
If uart interrupts are not functioning then schedule the callout to do the
polling at device attach time [1].

Add tunables 'debug.uart_force_poll' and 'debug.uart_poll_freq' to control
uart polling.

Submitted by: Aleksey Kuleshov (rndfax@yandex.ru) [1]

8 years agoFix a warning spotted by gcc4.9: dereferencing type-punned pointer will break
araujo [Thu, 16 Jul 2015 02:34:22 +0000 (02:34 +0000)]
Fix a warning spotted by gcc4.9: dereferencing type-punned pointer will break
strict-aliasing rules.

Declare some variables as statics as well as some functions that are internal
helpers. Update the function broadcast_result() to a post-K&R definition.

Differential Revision: D2690
Reviewed by: rodrigc, dim

8 years agoComment out usr/sbin/mailwrapper removal
ache [Thu, 16 Jul 2015 02:08:54 +0000 (02:08 +0000)]
Comment out usr/sbin/mailwrapper removal
because for no mailwrapper case we have:
/usr/sbin/sendmail -> /usr/sbin/mailwrapper
/usr/sbin/mailwrapper -> /usr/libexec/sendmail/sendmail
Add comment explaining it.

8 years agoDo not use atomic_swap_int(9), it is not available on all
kib [Wed, 15 Jul 2015 21:44:16 +0000 (21:44 +0000)]
Do not use atomic_swap_int(9), it is not available on all
architectures.  Atomic_cmpset_int(9) is a direct replacement, due to
loop.  The change fixes arm, arm64, mips an sparc64, which lack
atomic_swap().

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agofix the docs, the number of frags per inode (NFPI) changed in r228794
jmg [Wed, 15 Jul 2015 21:35:09 +0000 (21:35 +0000)]
fix the docs, the number of frags per inode (NFPI) changed in r228794
to 2 from 4, but the man page didn't get updated...

other minor changes to make igor happy...

MFC after: 3 days

8 years agoFix trimming spaces writing at index -1 if an empty string is passed
bapt [Wed, 15 Jul 2015 18:49:15 +0000 (18:49 +0000)]
Fix trimming spaces writing at index -1 if an empty string is passed

Submitted by: Gennady Proskurin <gprspb@mail.ru>

8 years agoReset non-zero it_need indicator to zero atomically with fetching its
kib [Wed, 15 Jul 2015 17:36:35 +0000 (17:36 +0000)]
Reset non-zero it_need indicator to zero atomically with fetching its
current value.  It is believed that the change is the real fix for the
issue which was covered over by the r252683.

With the current code, if the interrupt handler sets it_need between
read and consequent reset, the update could be lost and
ithread_execute_handlers() would not be called in response to the lost
update.

The r252683 could have hide the issue since at the moment of commit,
atomic_load_acq_int() did locked cmpxchg on the variable, which puts
the cache line into the exclusive owned state and clears store
buffers.  Then the immediate store of zero has very high chance of
reusing the exclusive state of the cache line and make the load and
store sequence operate as atomic swap.

For now, add the acq+rel fence immediately after the swap, to not
disturb current (but excessive) ordering.  Acquire is needed for the
ih_need reads after the load, while release does not serve a useful
purpose [*].

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

8 years agoStyle. Remove excessive brackets. Compare non-boolean with zero.
kib [Wed, 15 Jul 2015 17:14:05 +0000 (17:14 +0000)]
Style.  Remove excessive brackets.  Compare non-boolean with zero.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

8 years agoFix an infinite loop when a node doesn't have an interrupt-parent property.
andrew [Wed, 15 Jul 2015 13:28:25 +0000 (13:28 +0000)]
Fix an infinite loop when a node doesn't have an interrupt-parent property.

Submitted by: Aleksey Kuleshov <rndfax@yandex.ru>
Differential Revision: https://reviews.freebsd.org/D3041

8 years agoMULTI_ID supported does not mean it is used.
mav [Wed, 15 Jul 2015 12:04:12 +0000 (12:04 +0000)]
MULTI_ID supported does not mean it is used.

8 years agoImplement the trivial socket system calls: shutdown() and listen().
ed [Wed, 15 Jul 2015 11:27:34 +0000 (11:27 +0000)]
Implement the trivial socket system calls: shutdown() and listen().

8 years agoAdd identify_cpu() to ARM64 init_secondary routine
zbb [Wed, 15 Jul 2015 09:24:45 +0000 (09:24 +0000)]
Add identify_cpu() to ARM64 init_secondary routine

Identify current CPU. This is necessary to setup
affinity registers and to provide support for
runtime chip identification.

Reviewed by:   andrew
Obtained from: Semihalf
Sponsored by:  The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3095

8 years agoMake posix_fallocate() and posix_fadvise() work.
ed [Wed, 15 Jul 2015 09:14:06 +0000 (09:14 +0000)]
Make posix_fallocate() and posix_fadvise() work.

We can map these system calls directly to the FreeBSD counterparts. The
other filesystem related system calls will be sent out for review
separately, as they are a bit more complex to get right.

8 years agofix error message... errx since errno may not be set (if we didn't
jmg [Wed, 15 Jul 2015 06:14:04 +0000 (06:14 +0000)]
fix error message...  errx since errno may not be set (if we didn't
parse the full field), and err and errx add their own newline at the
end...

Sponsored by: Netflix, Inc.

8 years agoAdd a new option to gpart(8) to fix Lenovo BIOS boot issue
allanjude [Wed, 15 Jul 2015 02:23:55 +0000 (02:23 +0000)]
Add a new option to gpart(8) to fix Lenovo BIOS boot issue

PR: 184910
Reviewed by: ae, wblock
Approved by: marcel
MFC after: 3 days
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3065

8 years agoRevert inadvertent change to amd64/GENERIC.
pkelsey [Wed, 15 Jul 2015 01:04:54 +0000 (01:04 +0000)]
Revert inadvertent change to amd64/GENERIC.

8 years agoAdd netmap support for ixgbe SRIOV VFs (that is, to if_ixv).
pkelsey [Wed, 15 Jul 2015 01:02:01 +0000 (01:02 +0000)]
Add netmap support for ixgbe SRIOV VFs (that is, to if_ixv).

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

8 years agoRemove FreeBSD version check for deprecated M_FLOWID.
hiren [Wed, 15 Jul 2015 01:01:17 +0000 (01:01 +0000)]
Remove FreeBSD version check for deprecated M_FLOWID.

Reviewed by:     erj
Sponsored by:     Limelight Networks

8 years agoFix igxbe SRIOV VF (if_ixv) initialization bugs. The MAC address for
pkelsey [Wed, 15 Jul 2015 00:35:50 +0000 (00:35 +0000)]
Fix igxbe SRIOV VF (if_ixv) initialization bugs.  The MAC address for
an if_ixv instance can now set at creation time, and the receive ring
tail pointer is correctly initialized (previously, things still worked
because the receive ring tail pointer was being fixed up as a side
effect of other activity).

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

8 years agoRemove the r282727 entry for now, pending refinement based
gjb [Tue, 14 Jul 2015 23:41:13 +0000 (23:41 +0000)]
Remove the r282727 entry for now, pending refinement based
on feedback from andrew@ and ian@.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r279824, dtb module for AM335x systems.
gjb [Tue, 14 Jul 2015 21:45:51 +0000 (21:45 +0000)]
Document r279824, dtb module for AM335x systems.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r278340, rpi.dtb installed into /boot/dtb for the
gjb [Tue, 14 Jul 2015 21:45:48 +0000 (21:45 +0000)]
Document r278340, rpi.dtb installed into /boot/dtb for the
Raspberry Pi by default.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r278338, rpi.dtb module.
gjb [Tue, 14 Jul 2015 21:45:46 +0000 (21:45 +0000)]
Document r278338, rpi.dtb module.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r283514, sfxge(4) 7XXX-series NIC support.
gjb [Tue, 14 Jul 2015 21:45:43 +0000 (21:45 +0000)]
Document r283514, sfxge(4) 7XXX-series NIC support.
Add Solarflare Communications to sponsors.ent.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r282215, SIFTR kernel configuration option.
gjb [Tue, 14 Jul 2015 21:45:40 +0000 (21:45 +0000)]
Document r282215, SIFTR kernel configuration option.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r281495, PAE_TABLES option.
gjb [Tue, 14 Jul 2015 21:45:37 +0000 (21:45 +0000)]
Document r281495, PAE_TABLES option.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r273849, timeo, actimeo, noac, proto mount_nfs(8) options.
gjb [Tue, 14 Jul 2015 21:45:35 +0000 (21:45 +0000)]
Document r273849, timeo, actimeo, noac, proto mount_nfs(8) options.

Sponsored by: The FreeBSD Foundation

8 years agoFix the build after breaking it in r285549.
ed [Tue, 14 Jul 2015 20:45:24 +0000 (20:45 +0000)]
Fix the build after breaking it in r285549.

I performed the commit on a different system as where I wrote the
change. After pulling in the change from Phabricator, I didn't notice
that a single chunk did not apply.

Approved by: secteam (implicit, as intended change was approved)
Pointy hat to: me

8 years agoReword the r282731 entry.
gjb [Tue, 14 Jul 2015 20:10:16 +0000 (20:10 +0000)]
Reword the r282731 entry.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r279950, bzipfs support in EFI loader.
gjb [Tue, 14 Jul 2015 20:10:14 +0000 (20:10 +0000)]
Document r279950, bzipfs support in EFI loader.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r282731, ubldr is relocatable.
gjb [Tue, 14 Jul 2015 20:10:12 +0000 (20:10 +0000)]
Document r282731, ubldr is relocatable.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r282727, support for booting relocatable kernels extended
gjb [Tue, 14 Jul 2015 20:10:09 +0000 (20:10 +0000)]
Document r282727, support for booting relocatable kernels extended
beyond non-EFI systems.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r277962, support for booting relocatable PowerPC kernels.
gjb [Tue, 14 Jul 2015 20:10:07 +0000 (20:10 +0000)]
Document r277962, support for booting relocatable PowerPC kernels.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r277644, AUDMUX, SDMA, SSI support.
gjb [Tue, 14 Jul 2015 20:10:04 +0000 (20:10 +0000)]
Document r277644, AUDMUX, SDMA, SSI support.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r268838, support for Toradex Apalis i.MX6 board.
gjb [Tue, 14 Jul 2015 20:10:02 +0000 (20:10 +0000)]
Document r268838, support for Toradex Apalis i.MX6 board.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r266943, r267390: Support for Exynos 5420 and
gjb [Tue, 14 Jul 2015 20:09:59 +0000 (20:09 +0000)]
Document r266943, r267390: Support for Exynos 5420 and
SMP enabled by default.

Sponsored by: The FreeBSD Foundation

8 years agoDocument r277042, support to poweroff the BeagleBone Black via
gjb [Tue, 14 Jul 2015 20:09:57 +0000 (20:09 +0000)]
Document r277042, support to poweroff the BeagleBone Black via
shutdown(8) and poweroff(8) added.

Sponsored by: The FreeBSD Foundation

8 years agoMake bsdinstall's zfsboot script align partitions to 4k/1m when the user requests it
allanjude [Tue, 14 Jul 2015 19:57:10 +0000 (19:57 +0000)]
Make bsdinstall's zfsboot script align partitions to 4k/1m when the user requests it

PR: 195174
Reviewed by: darius
Approved by: brueffer
MFC after: 3 days
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3062

8 years agomdoc: minor Xr fixes
joel [Tue, 14 Jul 2015 19:45:35 +0000 (19:45 +0000)]
mdoc: minor Xr fixes

8 years agomdoc: add missing .El
joel [Tue, 14 Jul 2015 19:43:10 +0000 (19:43 +0000)]
mdoc: add missing .El

8 years agoSet a mountpoint on the root of the pool so user-created datasets have a mountpoint...
allanjude [Tue, 14 Jul 2015 19:42:40 +0000 (19:42 +0000)]
Set a mountpoint on the root of the pool so user-created datasets have a mountpoint to inherit

Reviewed by: darius
Approved by: brueffer
MFC after: 3 days
Relnotes: yes
Sponsored by: ScaleEngine Inc.
Differential Revision: https://reviews.freebsd.org/D3063