]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
9 years agoUse V_IRQ, V_INTR_VECTOR and V_TPR to offload APIC interrupt delivery to the
neel [Tue, 16 Sep 2014 03:31:40 +0000 (03:31 +0000)]
Use V_IRQ, V_INTR_VECTOR and V_TPR to offload APIC interrupt delivery to the
processor. Briefly, the hypervisor sets V_INTR_VECTOR to the APIC vector
and sets V_IRQ to 1 to indicate a pending interrupt. The hardware then takes
care of injecting this vector when the guest is able to receive it.

Legacy PIC interrupts are still delivered via the event injection mechanism.
This is because the vector injected by the PIC must reflect the state of its
pins at the time the CPU is ready to accept the interrupt.

Accesses to the TPR via %CR8 are handled entirely in hardware. This requires
that the emulated TPR must be synced to V_TPR after a #VMEXIT.

The guest can also modify the TPR via the memory mapped APIC. This requires
that the V_TPR must be synced with the emulated TPR before a VMRUN.

Reviewed by: Anish Gupta (akgupt3@gmail.com)

9 years agoSet the 'vmexit->inst_length' field properly depending on the type of the
neel [Sun, 14 Sep 2014 04:39:04 +0000 (04:39 +0000)]
Set the 'vmexit->inst_length' field properly depending on the type of the
VM-exit and ultimately on whether nRIP is valid. This allows us to update
the %rip after the emulation is finished so any exceptions triggered during
the emulation will point to the right instruction.

Don't attempt to handle INS/OUTS VM-exits unless the DecodeAssist capability
is available. The effective segment field in EXITINFO1 is not valid without
this capability.

Add VM_EXITCODE_SVM to flag SVM VM-exits that cannot be handled. Provide the
VMCB fields exitinfo1 and exitinfo2 as collateral to help with debugging.

Provide a SVM VM-exit handler to dump the exitcode, exitinfo1 and exitinfo2
fields in bhyve(8).

Reviewed by: Anish Gupta (akgupt3@gmail.com)
Reviewed by: grehan

9 years agoBug fixes.
neel [Sat, 13 Sep 2014 23:48:43 +0000 (23:48 +0000)]
Bug fixes.

- Don't enable the HLT intercept by default. It will be enabled by bhyve(8)
  if required. Prior to this change HLT exiting was always enabled making
  the "-H" option to bhyve(8) meaningless.

- Recognize a VM exit triggered by a non-maskable interrupt. Prior to this
  change the exit would be punted to userspace and the virtual machine would
  terminate.

9 years agostyle(9): insert an empty line if the function has no local variables
neel [Sat, 13 Sep 2014 22:45:04 +0000 (22:45 +0000)]
style(9): insert an empty line if the function has no local variables

Pointed out by: grehan

9 years agoAMD processors that have the SVM decode assist capability will store the
neel [Sat, 13 Sep 2014 22:16:40 +0000 (22:16 +0000)]
AMD processors that have the SVM decode assist capability will store the
instruction bytes in the VMCB on a nested page fault. This is useful because
it saves having to walk the guest page tables to fetch the instruction.

vie_init() now takes two additional parameters 'inst_bytes' and 'inst_len'
that map directly to 'vie->inst[]' and 'vie->num_valid'.

The instruction emulation handler skips calling 'vmm_fetch_instruction()'
if 'vie->num_valid' is non-zero.

The use of this capability can be turned off by setting the sysctl/tunable
'hw.vmm.svm.disable_npf_assist' to '1'.

Reviewed by: Anish Gupta (akgupt3@gmail.com)
Discussed with: grehan

9 years agostyle(9): indent the switch, don't indent the case, indent case body one tab.
neel [Thu, 11 Sep 2014 06:17:56 +0000 (06:17 +0000)]
style(9): indent the switch, don't indent the case, indent case body one tab.

9 years agoRepurpose the V_IRQ interrupt injection to implement VMX-style interrupt
neel [Thu, 11 Sep 2014 02:37:02 +0000 (02:37 +0000)]
Repurpose the V_IRQ interrupt injection to implement VMX-style interrupt
window exiting. This simply involves setting V_IRQ and enabling the VINTR
intercept. This instructs the CPU to trap back into the hypervisor as soon
as an interrupt can be injected into the guest. The pending interrupt is
then injected via the traditional event injection mechanism.

Rework vcpu interrupt injection so that Linux guests now idle with host cpu
utilization close to 0%.

Reviewed by: Anish Gupta (earlier version)
Discussed with: grehan

9 years agoAllow intercepts and irq fields to be cached by the VMCB.
neel [Wed, 10 Sep 2014 03:13:40 +0000 (03:13 +0000)]
Allow intercepts and irq fields to be cached by the VMCB.

Provide APIs svm_enable_intercept()/svm_disable_intercept() to add/delete
VMCB intercepts. These APIs ensure that the VMCB state cache is invalidated
when intercepts are modified.

Each intercept is identified as a (index,bitmask) tuple. For e.g., the
VINTR intercept is identified as (VMCB_CTRL1_INTCPT,VMCB_INTCPT_VINTR).
The first 20 bytes in control area that are used to enable intercepts
are represented as 'uint32_t intercept[5]' in 'struct vmcb_ctrl'.

Modify svm_setcap() and svm_getcap() to use the new APIs.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoMove the VMCB initialization into svm.c in preparation for changes to the
neel [Wed, 10 Sep 2014 02:35:19 +0000 (02:35 +0000)]
Move the VMCB initialization into svm.c in preparation for changes to the
interrupt injection logic.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoMove the event injection function into svm.c and add KTR logging for
neel [Wed, 10 Sep 2014 02:20:32 +0000 (02:20 +0000)]
Move the event injection function into svm.c and add KTR logging for
every event injection.

This in in preparation for changes to SVM guest interrupt injection.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoRemove a bogus check that flagged an error if the guest %rip was zero.
neel [Wed, 10 Sep 2014 01:46:22 +0000 (01:46 +0000)]
Remove a bogus check that flagged an error if the guest %rip was zero.

An AP begins execution with %rip set to 0 after a startup IPI.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoMake the KTR tracepoints uniform and ensure that every VM-exit is logged.
neel [Wed, 10 Sep 2014 01:37:32 +0000 (01:37 +0000)]
Make the KTR tracepoints uniform and ensure that every VM-exit is logged.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoAllow guest read access to MSR_EFER without hypervisor intervention.
neel [Wed, 10 Sep 2014 01:10:53 +0000 (01:10 +0000)]
Allow guest read access to MSR_EFER without hypervisor intervention.

Dirty the VMCB_CACHE_CR state cache when MSR_EFER is modified.

9 years agoRemove gratuitous forward declarations.
neel [Tue, 9 Sep 2014 23:39:43 +0000 (23:39 +0000)]
Remove gratuitous forward declarations.
Remove tabs on empty lines.

9 years agoDo proper ASID management for guest vcpus.
neel [Sat, 6 Sep 2014 19:02:52 +0000 (19:02 +0000)]
Do proper ASID management for guest vcpus.

Prior to this change an ASID was hard allocated to a guest and shared by all
its vcpus. The meant that the number of VMs that could be created was limited
to the number of ASIDs supported by the CPU. It was also inefficient because
it forced a TLB flush on every VMRUN.

With this change the number of guests that can be created is independent of
the number of available ASIDs. Also, the TLB is flushed only when a new ASID
is allocated.

Discussed with: grehan
Reviewed by: Anish Gupta (akgupt3@gmail.com)

9 years agoMerge svm_set_vmcb() and svm_init_vmcb() into a single function that is called
neel [Fri, 5 Sep 2014 03:33:16 +0000 (03:33 +0000)]
Merge svm_set_vmcb() and svm_init_vmcb() into a single function that is called
just once when a vcpu is initialized.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoRemove unused header file.
neel [Thu, 4 Sep 2014 06:07:32 +0000 (06:07 +0000)]
Remove unused header file.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoConsolidate the code to restore the host TSS after a #VMEXIT into a single
neel [Thu, 4 Sep 2014 06:00:18 +0000 (06:00 +0000)]
Consolidate the code to restore the host TSS after a #VMEXIT into a single
function restore_host_tss().

Don't bother to restore MSR_KGSBASE after a #VMEXIT since it is not used in
the kernel. It will be restored on return to userspace.

Discussed with: Anish Gupta (akgupt3@gmail.com)

9 years agoIFC @r269962
neel [Tue, 2 Sep 2014 04:22:42 +0000 (04:22 +0000)]
IFC @r269962

Submitted by: Anish Gupta (akgupt3@gmail.com)

9 years agoAn exception is allowed to be injected even if the vcpu is in an interrupt
neel [Mon, 25 Aug 2014 00:58:20 +0000 (00:58 +0000)]
An exception is allowed to be injected even if the vcpu is in an interrupt
shadow, so move the check for pending exception before bailing out due to
an interrupt shadow.

Change return type of 'vmcb_eventinject()' to a void and convert all error
returns into KASSERTs.

Fix VMCB_EXITINTINFO_EC(x) and VMCB_EXITINTINFO_TYPE(x) to do the shift
before masking the result.

Reviewed by:    Anish Gupta (akgupt3@gmail.com)

9 years agoUse the max guest memory address when creating its iommu domain.
neel [Thu, 14 Aug 2014 05:00:45 +0000 (05:00 +0000)]
Use the max guest memory address when creating its iommu domain.

Also, assert that the GPA being mapped in the domain is less than its maxaddr.

Reviewed by: grehan
Pointed out by: Anish Gupta (akgupt3@gmail.com)

9 years agoBump version because challenge buffer size changed
ache [Thu, 14 Aug 2014 04:42:09 +0000 (04:42 +0000)]
Bump version because challenge buffer size changed

MFC after:      1 week

9 years agoAdd AIC to at91sam9260 support, now that it is needed for multipass to
imp [Thu, 14 Aug 2014 04:21:31 +0000 (04:21 +0000)]
Add AIC to at91sam9260 support, now that it is needed for multipass to
work. This gets my AT91SAM9260-based boards almost booting with
current in multi pass. The MCI driver is broken, but it is equally
broken before multi-pass.

9 years agoAdd support for multipass to Atmel, for both FDT and !FDT cases.
imp [Thu, 14 Aug 2014 04:21:25 +0000 (04:21 +0000)]
Add support for multipass to Atmel, for both FDT and !FDT cases.

9 years agoStart to add FDT support.
imp [Thu, 14 Aug 2014 04:21:20 +0000 (04:21 +0000)]
Start to add FDT support.

9 years agoAdd support for FDT and !FDT configs on Atmel, though FDT isn't
imp [Thu, 14 Aug 2014 04:21:14 +0000 (04:21 +0000)]
Add support for FDT and !FDT configs on Atmel, though FDT isn't
working yet.
Bump rev on arm Makefile since files.at91 uses new '!' operator.

9 years agoFrom https://sourceware.org/ml/newlib/2014/msg00113.html
imp [Thu, 14 Aug 2014 04:20:13 +0000 (04:20 +0000)]
From https://sourceware.org/ml/newlib/2014/msg00113.html
By Richard Earnshaw at ARM
>
>GCC has for a number of years provides a set of pre-defined macros for
>use with determining the ISA and features of the target during
>pre-processing.  However, the design was always somewhat cumbersome in
>that each new architecture revision created a new define and then
>removed the previous one.  This meant that it was necessary to keep
>updating the support code simply to recognise a new architecture being
>added.
>
>The ACLE specification (ARM C Language Extentions)
>(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.set.swdev/index.html)
>provides a much more suitable interface and GCC has supported this
>since gcc-4.8.
>
>This patch makes use of the ACLE pre-defines to map to the internal
>feature definitions.  To support older versions of GCC a compatibility
>header is provided that maps the traditional pre-defines onto the new
>ACLE ones.

Stop using __FreeBSD_ARCH_armv6__ and switch to __ARM_ARCH >= 6 in the
couple of places in tree. clang already implements ACLE. Add a define
that says we implement version 1.1, even though the implementation
isn't quite complete.

9 years agoStop telling people to directly report llvm or clang bugs upstream,
dim [Wed, 13 Aug 2014 21:38:29 +0000 (21:38 +0000)]
Stop telling people to directly report llvm or clang bugs upstream,
point them to the FreeBSD bug tracker instead, since we use our own
patches.

MFC after: 3 days

9 years agoUse "NO NAME" as the default unnamed label.
pfg [Wed, 13 Aug 2014 21:18:31 +0000 (21:18 +0000)]
Use "NO NAME" as the default unnamed label.

Microsoft recommends avoiding the use of spaces in the
string structures for FAT. Unfortunately they do just
that by default in the case of unlabeled filesystems.

Follow the default MS behavior to avoid confusion in
common tools like file(1). This was actually the
default behavior before r203868.

Obtained from: NetBSD (CVS rev. 1.39)
MFC after: 3 days

9 years agoRemove trailing whitespace
emaste [Wed, 13 Aug 2014 19:55:14 +0000 (19:55 +0000)]
Remove trailing whitespace

9 years agoMake the libbsdstat useful again.
adrian [Wed, 13 Aug 2014 19:43:22 +0000 (19:43 +0000)]
Make the libbsdstat useful again.

9 years agoCopy country-code .iso syscons keymaps for vt(4)
emaste [Wed, 13 Aug 2014 19:06:29 +0000 (19:06 +0000)]
Copy country-code .iso syscons keymaps for vt(4)

Existing syscons ISO 8859-1 keymaps (??.iso.kbd) are usable without
change as Unicode keymaps for vt(4).

Sponsored by: The FreeBSD Foundation

9 years agoSupplement r259111 by also using correct casts in gcc's emmintrin.h for
dim [Wed, 13 Aug 2014 16:42:44 +0000 (16:42 +0000)]
Supplement r259111 by also using correct casts in gcc's emmintrin.h for
the first argument of the following builtin function:

* __builtin_ia32_psrlqi128() takes __v2di instead of __v4si

This should fix the following errors when building the graphics/webp
port with base gcc:

lossless_sse2.c:403: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'
lossless_sse2.c:404: error: incompatible type for argument 1 of '__builtin_ia32_psrlqi128'

Reported by: Jos Chrispijn <ports@webrz.net>
MFC after: 3 days

9 years agoAdd support for the SCTP_PR_STREAM_STATUS and SCTP_PR_ASSOC_STATUS
tuexen [Wed, 13 Aug 2014 15:50:16 +0000 (15:50 +0000)]
Add support for the SCTP_PR_STREAM_STATUS and SCTP_PR_ASSOC_STATUS
socket options. This includes managing the correspoing stat counters.
Add the SCTP_DETAILED_STR_STATS kernel option to control per policy
counters on every stream. The default is off and only an aggregated
counter is available. This is sufficient for the RTCWeb usecase.

MFC after: 1 week

9 years agoFixed ENOMEM description.
pluknet [Wed, 13 Aug 2014 14:49:51 +0000 (14:49 +0000)]
Fixed ENOMEM description.

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

9 years agoAdd a knob LIBPTHREAD_BIGSTACK_MAIN, which instructs libthr to leave
kib [Wed, 13 Aug 2014 05:53:41 +0000 (05:53 +0000)]
Add a knob LIBPTHREAD_BIGSTACK_MAIN, which instructs libthr to leave
the whole RLIMIT_STACK-sized region of the kernel-allocated stack as
the stack of main thread.

By default, the main thread stack is clamped at 2MB (4MB on 64bit
ABIs) and the rest is used for other threads stack allocation.  Since
there is no programmatic way to adjust the size of the main thread
stack, pthread_attr_setstacksize() is too late, the knob allows user
to manage the main stack size both for single-threaded and
multi-threaded processes with the rlimit.

Reported by: "Ivan A. Kosarev" <ivan@ivan-labs.com>
Tested by: dim
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 years agoStyle.
kib [Wed, 13 Aug 2014 05:47:49 +0000 (05:47 +0000)]
Style.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

9 years agoIf vm_page_grab() allocates a new page, the page is not inserted into
kib [Wed, 13 Aug 2014 05:44:08 +0000 (05:44 +0000)]
If vm_page_grab() allocates a new page, the page is not inserted into
page queue even when the allocation is not wired.  It is
responsibility of the vm_page_grab() caller to ensure that the page
does not end on the vm_object queue but not on the pagedaemon queue,
which would effectively create unpageable unwired page.

In exec_map_first_page() and vm_imgact_hold_page(), activate the page
immediately after unbusying it, to avoid leak.

In the uiomove_object_page(), deactivate page before the object is
unlocked.  There is no leak, since the page is deactivated after
uiomove_fromphys() finished.  But allowing non-queued non-wired page
in the unlocked object queue makes it impossible to assert that leak
does not happen in other places.

Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

9 years agoAdd missing BSD.tests.dist entry for lib/libutil to unbreak installworld with
ngie [Wed, 13 Aug 2014 05:15:28 +0000 (05:15 +0000)]
Add missing BSD.tests.dist entry for lib/libutil to unbreak installworld with
MK_TESTS == no

Phabric: D555
X-MFC with: r269904
Approved by: jmmv (mentor, implicit)
Pointyhat to: ngie

9 years agoIntegrate lib/libutil into the build/kyua
ngie [Wed, 13 Aug 2014 04:56:27 +0000 (04:56 +0000)]
Integrate lib/libutil into the build/kyua

Remove the .t wrappers

Rename all of the TAP test applications from test-<test> to
<test>_test to match the convention described in the TestSuite
wiki page

humanize_number_test.c:

- Fix -Wformat warnings with counter variables
- Fix minor style(9) issues:
-- Header sorting
-- Variable declaration alignment/sorting in main(..)
-- Fit the lines in <80 columns
- Fix an off by one index error in the testcase output [*]
- Remove unnecessary `extern char * optarg;` (this is already provided by
  unistd.h)

Phabric: D555
Approved by: jmmv (mentor)
MFC after: 2 weeks
Obtained from: EMC / Isilon Storage Division [*]
Submitted by: Casey Peel <cpeel@isilon.com> [*]
Sponsored by: EMC / Isilon Storage Division

9 years agoPort date/bin/tests to ATF
ngie [Wed, 13 Aug 2014 04:43:29 +0000 (04:43 +0000)]
Port date/bin/tests to ATF

Phabric: D545
Approved by: jmmv (mentor)
Submitted by: keramida (earlier version)
MFC after: 2 weeks
Sponsored by: Google, Inc
Sponsored by: EMC / Isilon Storage Division

9 years agoConvert bin/sh/tests to ATF
ngie [Wed, 13 Aug 2014 04:14:50 +0000 (04:14 +0000)]
Convert bin/sh/tests to ATF

The new code uses a "test discovery mechanism" to determine
what tests are available for execution

The test shell can be specified via:

  kyua test -v test_suites.FreeBSD.bin.sh.test_shell=/path/to/test/sh

Sponsored by: EMC / Isilon Storage Division
Approved by: jmmv (mentor)
Reviewed by: jilles (maintainer)

9 years agoMinor style tweaks.
pfg [Wed, 13 Aug 2014 03:44:30 +0000 (03:44 +0000)]
Minor style tweaks.

Obtained from: OpenBSD (CVS rev. 1.7)
MFC after: 3 days

9 years agoMake sure the DTrace header files are built before depend and before
rpaulo [Wed, 13 Aug 2014 01:27:51 +0000 (01:27 +0000)]
Make sure the DTrace header files are built before depend and before
the build starts.

This adds a new variable DHDRS that contains a list of all DTrace
header files.  Then, we use the beforedepend hook to make sure the
heaeder files are built.

Introduce a beforebuild dependency (from projects/bmake) based on
feedback from Simon J. Gerraty.  This lets us generate the header
files without running make depend.

Reviewed by: sjg, imp
MFC after: 3 days

9 years agoFix typo when displaying the HPET timer unit number.
neel [Wed, 13 Aug 2014 00:18:16 +0000 (00:18 +0000)]
Fix typo when displaying the HPET timer unit number.

9 years agoMinor cleanup:
neel [Wed, 13 Aug 2014 00:14:26 +0000 (00:14 +0000)]
Minor cleanup:
- Set 'pirq_cold' to '0' on the first PIRQ allocation.
- Make assertions stronger.

Reviewed by: jhb
CR: https://phabric.freebsd.org/D592

9 years agoTruncate the ctfmerge command line, like we do with SYSTEM_LD.
imp [Tue, 12 Aug 2014 23:48:37 +0000 (23:48 +0000)]
Truncate the ctfmerge command line, like we do with SYSTEM_LD.

9 years agoFix a typo in a comment: s/interprete/interpret/
gjb [Tue, 12 Aug 2014 19:37:49 +0000 (19:37 +0000)]
Fix a typo in a comment: s/interprete/interpret/

Submitted by: Sam Fourman Jr.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

9 years agoCorrect a comment brought over from amd64. i386 doesn't use long
jhb [Tue, 12 Aug 2014 18:22:57 +0000 (18:22 +0000)]
Correct a comment brought over from amd64.  i386 doesn't use long
mode.

9 years agoComplete the usr.bin/yacc kyua integration work I originally
ngie [Tue, 12 Aug 2014 17:51:26 +0000 (17:51 +0000)]
Complete the usr.bin/yacc kyua integration work I originally
submitted via r268811

- Install the Kyuafile by adding FILES to FILESGROUPS
- Run the testcases with an unprivileged user

  Some of the testcases depend upon behavior that's broken when
  run as root on FreeBSD because of how permissions are treated
  with access(2) vs eaccess(2), open(2), etc

- Simplify the test driver to just inspect the exit code from
  run_test because it now exits with 0 if successful and exits
  with !0 if unsuccessful
- Don't do ad hoc temporary directory creation/deletion; let Kyua
  handle that
- Add entries for files removed in r268811 to
  OptionalObsoleteFiles.inc

PR: 191020
X-MFC with: r268811
Approved by: jmmv (mentor)
Reviewed by: bapt
Sponsored by: EMC / Isilon Storage Division

9 years ago(belatedly) Document FreeBSD 9.3-R
marck [Tue, 12 Aug 2014 16:51:37 +0000 (16:51 +0000)]
(belatedly) Document FreeBSD 9.3-R

MFC after: 1 week

M    misc/bsd-family-tree

9 years agoAdd Dan Langille (myself) to committers-ports.dot file with mat and wg as mentors.
dvl [Tue, 12 Aug 2014 14:37:33 +0000 (14:37 +0000)]
Add Dan Langille (myself) to committers-ports.dot file with mat and wg as mentors.

Approved by: wg (mentor)

9 years agoAccording to opie code and even direct mention in opie(4) challenge buffer
ache [Tue, 12 Aug 2014 13:28:46 +0000 (13:28 +0000)]
According to opie code and even direct mention in opie(4) challenge buffer
size must be OPIE_CHALLENGE_MAX + 1, not OPIE_CHALLENGE_MAX

Reviewed by:    des
MFC after:      1 week

9 years agoChange SCTP sysctl from auth_disable to auth_enable. This is
tuexen [Tue, 12 Aug 2014 13:13:11 +0000 (13:13 +0000)]
Change SCTP sysctl from auth_disable to auth_enable. This is
consistent with other similar sysctl variable used in SCTP.

9 years agoFix broken pointer overflow check ns_name_unpack()
ume [Tue, 12 Aug 2014 13:09:32 +0000 (13:09 +0000)]
Fix broken pointer overflow check ns_name_unpack()

Many compilers may optimize away the overflow check `msg + l < msg',
where `msg' is a pointer and `l' is an integer, because pointer
overflow is undefined behavior in C.

Use a safe precondition test `l >= eom - msg' instead.

Reference:
https://android-review.googlesource.com/#/c/50570/

Requested by: pfg
Obtained from: NetBSD (CVS rev. 1.10)

9 years agoClarify descriptions of pthread_cond_wait() and pthread_cond_timedwait()
gavin [Tue, 12 Aug 2014 12:44:52 +0000 (12:44 +0000)]
Clarify descriptions of pthread_cond_wait() and pthread_cond_timedwait()

Requested by: Malcolm Douglas via freebsd-doc
Reviewed by: jhb
MFC after: 1 week

9 years agoUpdate our stub resolver to final version of libbind.
ume [Tue, 12 Aug 2014 12:36:06 +0000 (12:36 +0000)]
Update our stub resolver to final version of libbind.

Obtained from: ISC

9 years agoBring the md5 functions into libc for internal use only.
ume [Tue, 12 Aug 2014 12:25:56 +0000 (12:25 +0000)]
Bring the md5 functions into libc for internal use only.
It is required to support ID randomization for our stub
resolver.

9 years ago- Fix radix tree memory leakage when unloading modules using radix
hselasky [Tue, 12 Aug 2014 11:45:57 +0000 (11:45 +0000)]
- Fix radix tree memory leakage when unloading modules using radix
trees. This happens because the logic inserting items into the radix
tree is allocating empty radix levels, when index zero does not
contain any items.
- Add proper error case handling, so that the radix tree does not end
up in a bad state, if memory cannot be allocated during insertion of
an item.
- Add check for inserting NULL items into the radix tree.
- Add check for radix tree getting too big.

MFC after: 1 week
Sponsored by: Mellanox Technologies

9 years agoAdd support for the SCTP_AUTH_SUPPORTED and SCTP_ASCONF_SUPPORTED
tuexen [Tue, 12 Aug 2014 11:30:16 +0000 (11:30 +0000)]
Add support for the SCTP_AUTH_SUPPORTED and SCTP_ASCONF_SUPPORTED
socket options. Add also a sysctl to control the support of ASCONF.

MFC after: 1 week

9 years agoTurn off kern.geom.part.mbr.enforce_chs by default.
ae [Tue, 12 Aug 2014 10:31:31 +0000 (10:31 +0000)]
Turn off kern.geom.part.mbr.enforce_chs by default.

9 years agoRemove duplicate entry.
ae [Tue, 12 Aug 2014 09:34:53 +0000 (09:34 +0000)]
Remove duplicate entry.

9 years agoRevision r269457 removed the Giant around mount and unmount code, but
kib [Tue, 12 Aug 2014 09:33:00 +0000 (09:33 +0000)]
Revision r269457 removed the Giant around mount and unmount code, but
r269533, which was tested before r269457 was committed, implicitely
relied on the Giant to protect the manipulations of the softdepmounts
list.  Use softdep global lock consistently to guarantee the list
structure now.

Insert the new struct mount_softdeps into the softdepmounts only after
it is sufficiently initialized, to prevent softdep_speedup() from
accessing bare memory.  Similarly, remove struct mount_softdeps for
the unmounted filesystem from the tailq before destroying structure
rwlock.

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

9 years agoAdd sysctl and loader tunable kern.geom.part.mbr.enforce_chs that is set
ae [Tue, 12 Aug 2014 09:10:13 +0000 (09:10 +0000)]
Add sysctl and loader tunable kern.geom.part.mbr.enforce_chs that is set
by default. It can be used to disable automatic alignment to CHS geometry,
that GEOM_PART_MBR does.

Reviewed by: wblock
MFC after: 1 week

9 years agoUpdate sqlite-3.7.17 -> 3.8.5
peter [Tue, 12 Aug 2014 02:09:00 +0000 (02:09 +0000)]
Update sqlite-3.7.17 -> 3.8.5

9 years agoRevert r269839.
rpaulo [Mon, 11 Aug 2014 22:43:44 +0000 (22:43 +0000)]
Revert r269839.

This doesn't work like I expected and the if clause is never matched.
It turns out that the problem with the older make is unrelated.

MFC after: 3 days

9 years agoAdd .d files to the reverse matching pattern in bsd.dep.mk to account
rpaulo [Mon, 11 Aug 2014 21:42:06 +0000 (21:42 +0000)]
Add .d files to the reverse matching pattern in bsd.dep.mk to account
for source file dependencies.

This follows the .y and .l behaviour.

MFC after: 3 days

9 years agoFix another typoe in the definition of DTrace SOBJS.
rpaulo [Mon, 11 Aug 2014 21:14:08 +0000 (21:14 +0000)]
Fix another typoe in the definition of DTrace SOBJS.

MFC after: 3 days

9 years agobsd.dep.mk: use the empty() function with the check for .d files.
rpaulo [Mon, 11 Aug 2014 20:44:57 +0000 (20:44 +0000)]
bsd.dep.mk: use the empty() function with the check for .d files.

Seems to work better with the old make.

MFC after: 3 days

9 years agoFix an error in the dependency of the DTrace object file.
rpaulo [Mon, 11 Aug 2014 20:41:14 +0000 (20:41 +0000)]
Fix an error in the dependency of the DTrace object file.

MFC after: 3 days

9 years agoUpdate serf-1.3.6 -> 1.3.7
peter [Mon, 11 Aug 2014 19:41:01 +0000 (19:41 +0000)]
Update serf-1.3.6 -> 1.3.7
Update subversion-1.8.9 -> 1.8.10

Security: CVE-2014-3504, CVE-2014-3522, CVE-2014-3528

9 years agoImport svn-1.8.10
peter [Mon, 11 Aug 2014 19:19:17 +0000 (19:19 +0000)]
Import svn-1.8.10

9 years agoadd myself as opencrypto maintainer as I'm doing some work in the
jmg [Mon, 11 Aug 2014 19:03:20 +0000 (19:03 +0000)]
add myself as opencrypto maintainer as I'm doing some work in the
area...

Note that documentation is requires for commits to what I maintain...

9 years agoFix a typo.
jhb [Mon, 11 Aug 2014 18:26:57 +0000 (18:26 +0000)]
Fix a typo.

PR: 192294
Submitted by: Conrad Meyer <conrad.meyer@isilon.com>

9 years agoChange {_,}pmap_allocpte() so that they look for the flag PMAP_ENTER_NOSLEEP
alc [Mon, 11 Aug 2014 17:45:41 +0000 (17:45 +0000)]
Change {_,}pmap_allocpte() so that they look for the flag PMAP_ENTER_NOSLEEP
instead of M_NOWAIT/M_WAITOK when deciding whether to sleep on page table
page allocation.  (The same functions in the i386/xen and mips pmap
implementations already use PMAP_ENTER_NOSLEEP.)

X-MFC with: r269728
Sponsored by: EMC / Isilon Storage Division

9 years agoSimilar to r250143, optimize MODULES_OVERRIDE such that SUBDIR isn't
ngie [Mon, 11 Aug 2014 17:04:04 +0000 (17:04 +0000)]
Similar to r250143, optimize MODULES_OVERRIDE such that SUBDIR isn't
automatically defined if MODULES_OVERRIDE is defined

Approved by: jmmv (mentor)
Reviewed by: imp
Phabric: D578
Sponsored by: EMC / Isilon Storage Division

9 years agoIn arm/release.sh, continue if 'xdev-links' target fails
gjb [Mon, 11 Aug 2014 16:31:28 +0000 (16:31 +0000)]
In arm/release.sh, continue if 'xdev-links' target fails
where the target is not valid (stable/10), instead of doing
per-branch evaluation on if xdev-links needs to be invoked.

Sponsored by: The FreeBSD Foundation

9 years agoAdd otp-sha
ache [Mon, 11 Aug 2014 15:41:55 +0000 (15:41 +0000)]
Add otp-sha

MFC after:      1 week

9 years agoblkfront: add support for unmapped IO
royger [Mon, 11 Aug 2014 15:37:02 +0000 (15:37 +0000)]
blkfront: add support for unmapped IO

Using unmapped IO is really beneficial when running inside of a VM,
since it avoids IPIs to other vCPUs in order to invalidate the
mappings.

This patch adds unmapped IO support to blkfront. The following tests
results have been obtained when running on a Xen host without HAP:

PVHVM
     3165.84 real      6354.17 user      4483.32 sys
PVHVM with unmapped IO
     2099.46 real      4624.52 user      2967.38 sys

This is because when running using shadow page tables TLB flushes and
range invalidations are much more expensive, so using unmapped IO
provides a very important performance boost.

Sponsored by: Citrix Systems R&D
Tested by: robak
MFC after: 1 week
PR: 191173

dev/xen/blkfront/blkfront.c:
 - Add and announce support for unmapped IO.

9 years agoMove KASSERT into locked region.
glebius [Mon, 11 Aug 2014 15:06:07 +0000 (15:06 +0000)]
Move KASSERT into locked region.

Submitted by: kib

9 years agoRemove dependence on source tree options. Move all kernel module
imp [Mon, 11 Aug 2014 14:50:49 +0000 (14:50 +0000)]
Remove dependence on source tree options. Move all kernel module
options into kern.opts.mk and change all the places where we use
src.opts.mk to pull in the options. Conditionally define SYSDIR and
use SYSDIR/conf/kern.opts.mk instead of a CURDIR path. Replace all
instances of CURDIR/../../etc with STSDIR, but only in the affected
files.

As a special compatibility hack, include bsd.owm.mk at the top of
kern.opts.mk to allow the bare build of sys/modules to work on older
systems. If the defaults ever change between 9.x, 10.x and current for
these options, however, you'll wind up with the host OS' defaults
rather than the -current defaults. This hack will be removed when
we no longer need to support this build scenario.

Reviewed by: jhb
Differential Revision: https://phabric.freebsd.org/D529

9 years agoLast '/' for program name, not first one
ache [Mon, 11 Aug 2014 14:46:09 +0000 (14:46 +0000)]
Last '/' for program name, not first one

MFC after:      1 week

9 years agoLink otp-sha1 to match real challenge prompt, not otp-sha
ache [Mon, 11 Aug 2014 14:37:57 +0000 (14:37 +0000)]
Link otp-sha1 to match real challenge prompt, not otp-sha

MFC after:      1 week

9 years agoWhen sha1 support was added, they forget to increase OPIE_HASHNAME_MAX
ache [Mon, 11 Aug 2014 13:36:02 +0000 (13:36 +0000)]
When sha1 support was added, they forget to increase OPIE_HASHNAME_MAX

MFC after:      1 week

9 years agoUse M_WAITOK in sf_buf_init().
glebius [Mon, 11 Aug 2014 13:12:18 +0000 (13:12 +0000)]
Use M_WAITOK in sf_buf_init().

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

9 years agoProvide sf_buf_ref() to optimize refcounting of already allocated
glebius [Mon, 11 Aug 2014 12:59:55 +0000 (12:59 +0000)]
Provide sf_buf_ref() to optimize refcounting of already allocated
sendfile(2) buffers.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.

9 years agoFix too long (seed length >12 chars) challenge handling.
ache [Mon, 11 Aug 2014 12:26:48 +0000 (12:26 +0000)]
Fix too long (seed length >12 chars) challenge handling.
1) " ext" length should be included into OPIE_CHALLENGE_MAX (as all places
of opie code expects that).
2) Overflow check in challenge.c is off by 1 even with corrected
OPIE_CHALLENGE_MAX
3) When fallback to randomchallenge() happens and rval is 0 (i.e.
challenge is too long), its value should be set to error state too.

To demonstrate the bug, run opiepasswd with valid seed:
opiepasswd -s 1234567890123456
and notice that it falls back to randomchallenge() (i.e. no
1234567890123456 in the prompt).

PR:             191511
Submitted by:   mitsururike@gmail.com (partially)
MFC after:      1 week

9 years ago- Remove unneeded include.
araujo [Mon, 11 Aug 2014 03:04:16 +0000 (03:04 +0000)]
- Remove unneeded include.

Phabric: D563
Reviewed by: kevlo
Approved by: kevlo

9 years agoAdd some more OS_MARK() probes to the AR9300 HAL.
adrian [Mon, 11 Aug 2014 00:03:50 +0000 (00:03 +0000)]
Add some more OS_MARK() probes to the AR9300 HAL.

9 years agoFix two files forgotten in r269783 (vt_generate_cons_palette)
dumbbell [Sun, 10 Aug 2014 22:24:14 +0000 (22:24 +0000)]
Fix two files forgotten in r269783 (vt_generate_cons_palette)

Reported by: bz
MFC after: 1 week
MFC with: 269783

9 years agoDocument the use of the vfs.nfsd sysctls that control the size of
rmacklem [Sun, 10 Aug 2014 20:05:13 +0000 (20:05 +0000)]
Document the use of the vfs.nfsd sysctls that control the size of
the NFS server's DRC for TCP.
This is a content change.

MFC after: 1 week

9 years agovt(4): Colors are indexed against a console palette, not a VGA palette
dumbbell [Sun, 10 Aug 2014 17:04:10 +0000 (17:04 +0000)]
vt(4): Colors are indexed against a console palette, not a VGA palette

Rename vt_generate_vga_palette() to vt_generate_cons_palette() and
change it to build a palette where the color index is the same than in
terminal escape codes, not the VGA index. That's what TCHAR_CREATE()
uses and passes to vt(4).

The main differences between both orders are:
    o  Blue and red are swapped (1 <-> 4)
    o  Yellow and cyan are swapped (3 <-> 6)

The problem remained unnoticed, because the RGB bit indexes passed to
vt_generate_vga_palette() were reversed. This inversion was cancelled
by the colors inversions in the generated palette. For instance, red
(0xff0000) and blue (0x0000ff) have bytes in opposite order, but were
swapped in the palette. But after changing the value of blue (see last
paragraph), the modified color was in fact the red one.

This commit includes a fix to creator_vt.c, submitted by Nathan
Whitehorn: fb_cmsize is set to 16. Before this, the generated palette
would be overwritte. This fixes colors on sparc64 with a Creator3D
adapter.

While here, tune the palette to better match console colors and improve
the readability (especially the dark blue).

Submitted by: nwhitehorn (fix to creator_vt.c)
MFC after: 1 week

9 years agoOn sparc64, do not keep mappings for the destroyed sf_bufs. Sparc64
kib [Sun, 10 Aug 2014 16:59:39 +0000 (16:59 +0000)]
On sparc64, do not keep mappings for the destroyed sf_bufs.  Sparc64
pmap, unlike i386, and similar to i386/xen pv, does not tolerate
abandoned mappings for the freed pages.

Reported and tested by: dumbbell
Diagnosed and reviewed by: alc
Sponsored by: The FreeBSD Foundation

9 years agovt(4): Add vtbuf_dirty*_locked() to lock vtbuf once, not twice
dumbbell [Sun, 10 Aug 2014 15:02:51 +0000 (15:02 +0000)]
vt(4): Add vtbuf_dirty*_locked() to lock vtbuf once, not twice

In several functions, vtbuf_putchar() in particular, the lock on vtbuf
is acquired twice:
    1. once by the said functions;
    2. once in vtbuf_dirty().

Now, vtbuf_dirty_locked() and vtbuf_dirty_cell_locked() allow to
acquire that lock only once.

This improves the input speed of vt(4). To measure the gain, a
50,000-lines file was displayed on the console using cat(1). The time
taken by cat(1) is reported below:
    o  On amd64, with vt_vga:
        - before: 1.0"
- after:  0.5"
    o  On sparc64, with creator_vt:
        - before: 13.6"
- after:  10.5"

MFC after: 1 week

9 years agofbd: Fix a bug where vt_fb_attach() success would be considered a failure
dumbbell [Sun, 10 Aug 2014 14:55:39 +0000 (14:55 +0000)]
fbd: Fix a bug where vt_fb_attach() success would be considered a failure

vt_fb_attach() currently always returns 0, but it could return a code
defined in errno.h. However, it doesn't return a CN_* code. So checking
its return value against CN_DEAD (which is 0) is incorrect, and in this
case, a success becomes a failure.

The consequence was unimportant, because the caller (drm_fb_helper.c)
would only log an error message in this case. The console would still
work.

Approved by: nwhitehorn

9 years agoUndo r195846 for now - allow raw frame transmit in monitor mode.
adrian [Sun, 10 Aug 2014 08:35:42 +0000 (08:35 +0000)]
Undo r195846 for now - allow raw frame transmit in monitor mode.

The original commit was supposed to stop the ability to do raw frame
injection in monitor mode to arbitrary channels (whether supported
by regulatory or not) however it doesn't seem to have been followed
by any useful way of doing it.

Apparently AHDEMO is supposed to be that way, but it seems to require
too much fiddly things (disable scanning, set a garbage SSID, etc)
for it to actually be useful for spoofing things.

So for now let's just disable it and instead look to filter transmit
in the output path if the channel isn't allowed by regulatory.
That way monitor RX works fine but TX will be blocked.

I don't plan on MFC'ing this to -10 until the regulatory enforcement
bits are written.

9 years agoFix string length argument passed to "sysctl_handle_string()" so that
hselasky [Sun, 10 Aug 2014 07:51:55 +0000 (07:51 +0000)]
Fix string length argument passed to "sysctl_handle_string()" so that
the complete string is returned by the function and not just only one
byte.

PR: 192544
MFC after: 2 weeks

9 years agoRemove the BROKEN_LIBELF section.
rpaulo [Sun, 10 Aug 2014 06:56:43 +0000 (06:56 +0000)]
Remove the BROKEN_LIBELF section.

This problem was fixed by Kai Wang in 2011.

MFC after: 3 days

9 years agoFix a few problems with the USDT probes:
rpaulo [Sun, 10 Aug 2014 06:43:40 +0000 (06:43 +0000)]
Fix a few problems with the USDT probes:

* Include OBJDIR to make sure the generated file is found;
* Simplify the definition of OBJS;
* Add targets for shared objects and for profiled objects.

MFC after: 3 days

9 years agoFix paths.
adrian [Sun, 10 Aug 2014 03:09:35 +0000 (03:09 +0000)]
Fix paths.