Commit Graph
27653 Commits
Author SHA1 Message Date
Ian Campbell db92b1ac55 xen/arm: do not relocate Xen outside of visible RAM
Since we do not handle non-contiguous banks of memory lets avoid relocating
Xen into such a bank. Avoids issues such as free_init_memory releasing pages
which are outside of the frametable.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-26 16:21:33 +01:00
Ian Campbell c883eed77a xen/arm: Reserve FDT via early module mechanism
This will stop us putting any heaps or relocating Xen itself over the FDT.

The devicetree will be copied to allocated memory in setup_mm and the
original copy will be freed by discard_initial_modules.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-26 16:21:27 +01:00
Ian Campbell 1fbb3b146c xen/arm: DOMHEAP_SECOND_PAGES is arm32 specific
since 5263507b1b "xen: arm: Use a direct mapping of RAM on arm64"

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-26 16:21:25 +01:00
Ian Campbell 4cfdb1210c xen/arm: ensure the xenheap is 32MB aligned
My patch 08693f5948 "xen: arm: reduce the size of the xen heap to max 1/8
RAM size" unintentionally violated the constraint that the xenheap must be
32MB aligned, since we only explicitly align the end of the heap and
xenheap_pages was not a multiple of 32 pages.

Round xenheap pages up to a 32MB boundary.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-26 16:21:20 +01:00
Julien Grall f042e3280b xen/arm: Don't dump stack when the VCPU is offline
When a VCPU is not yet online, the registers contain garbagge. This will
result to call randomly BUG() in show_guest_stack.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 16:18:41 +01:00
Ian Campbell 856107eca8 xen: arm: use new 64-bit zImage magic numbers for Xen binary
Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up
changing the zImage magic (which was actually the initial branch instructio
encoding!). The new header has a proper magic number at a fixed location.

Switch Xen itself to using this format. Neither the bootwrapper nor the
models care about this header themselves and real bootloaders are not widely
used, so now is as good a time as any to switch (as upstream have proven)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-26 15:47:17 +01:00
Ian Campbell 53059bda06 xen: arm: handle new 64-bit zImage magic numbers
Upstream commit 4370eec05a88 "arm64: Expand arm64 image header" ended up
changing the zImage magic (which was actually the initial branch instruction
encoding!). The new header has a proper magic number at a fixed location. Support that as well as the original magic.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-26 15:46:40 +01:00
Olaf Hering 2f69f8bf8b docs: fix syntax error in xl.cfg.pod
man/xl.cfg.pod.5 around line 1193: '=item' outside of any '=over'
POD document had syntax errors at /usr/bin/pod2man line 71.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:46:04 +01:00
Julien Grall 7b86846827 xen/arm: Use the hardware ID to boot correctly secondary cpus
Secondary CPUs will spin in head.S until their MPIDR[23:0] correspond to
the smp_up_cpu. Actually Xen will set the value with the logical CPU ID
which is wrong. Use the cpu_logical_map to get the correct CPU ID.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:44:58 +01:00
Julien Grall ff9b41bb34 xen/arm: Dissociate logical and hardware CPU ID
Introduce cpu_logical_map to associate a logical CPU ID to an hardware CPU ID.
This map will be filled during Xen boot via the device tree. Each CPU node
contains a "reg" property which contains the hardware ID (ie MPIDR[0:23]).

Also move /cpus parsing later so we can use the dt_* API.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:44:58 +01:00
Julien Grall a22a8e48ee xen/arm: Fix assert in send_SGI_one
The GIC can handle maximum 8 cpus (0...7). The CPU id 7 is still valid.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:44:58 +01:00
Julien Grall 1113482036 xen/arm: gic: Use the correct CPU ID
The GIC mapping of CPU interfaces does not necessarily match the logical
CPU numbering.

When Xen wants to send an SGI to specific CPU, it needs to use the GIC CPU
ID.  It can be retrieved from ITARGETSR0, in fact when this field is read,
the GIC will return a value that corresponds only to the processor reading
the register.  So Xen can use the PPI 0 to initialize the mapping.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:44:46 +01:00
Julien Grall c9760939c0 xen/arm: Initialize correctly IRQ routing
When Xen initialize the GIC distributor, we need to route all the IRQs to
the boot CPU. The CPU ID can differ between Xen and the GIC.

When ITARGETSR0 is read, each field will return a value that corresponds
only to the processor reading the register. So Xen can use the PPI 0 to
initialize correctly the routing.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:44:45 +01:00
Julien Grall d4e681a59b xen/arm: use cpumask_t to describe cpu mask in gic_route_dt_irq
Replace by cpumask_t to take advantage of cpumask_* helpers.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:44:45 +01:00
Julien Grall f70263755a xen/arm: Introduce init_info structure
This structure will gather all information to boot a secondary cpus.
For now it just contains the initial stack.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-26 15:41:50 +01:00
Jan Beulich ec206e8ee4 x86: fix compat guest handling of XENPF_enter_acpi_sleep
Rather than blindly defining the native name to the compat one, when
we want to pass the compat structure to a native function we ought to
verify that their layouts match. With a respective xlat.lst entry
there's then also no need anymore to do such aliasing.

While cleaaning up that file I also noticed that the Cx and Px
interface handling here has quite a few unnecessary #define-s - delete
them.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
2013-09-26 10:23:39 +02:00
Daniel De Graaf 07344c0f33 fix DOMID_IO mapping permission checks (try 2)
When the permission checks for memory mapping were moved from
get_pg_owner to xsm_mmu_update in aaba7a677, the exception for DOMID_IO
was not taken into account. This will cause IO memory mappings by PV
domains (mini-os in particular) to fail when XSM/FLASK is not being
used. This patch reintroduces the exception for DOMID_IO; the actual
restrictions on IO memory mappings have always been checked separately
using iomem_access_permitted, so this change should not break existing
access control.

Reported-by: Eduardo Peixoto Macedo <epm@cin.ufpe.br>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-09-26 10:15:47 +02:00
Andrew Cooper f12c1f0b09 x86/crash: Indicate how well nmi_shootdown_cpus() managed to do
Having nmi_shootdown_cpus() report which pcpus failed to be shot down is a
useful debugging hint as to what possibly went wrong (especially when the
crash logs seem to indicate that an NMI timeout occurred while waiting for one
of the problematic pcpus to perform an action).

This is achieved by swapping an atomic_t count of unreported pcpus with a
cpumask.  In the case that the 1 second timeout occurs, use the cpumask to
identify the problematic pcpus.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-26 10:14:51 +02:00
Jan Beulich 573fd5bd2d x86: fix rdrand asm()
Just learned the hard way that at least for non-volatile asm()s gcc
indeed does what the documentation says: It may move it across jumps
(i.e. ahead of the cpu_has() check). While the documentation claims
that this can also happen for volatile asm()s, if that was the case
we'd have many more problems in our code (and e,g, Linux would too).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-26 10:11:00 +02:00
Jan Beulich 7099bd90e1 Revert "fix DOMID_IO mapping permission checks"
This reverts commit 145ae98bfa.
2013-09-25 18:13:06 +02:00
Zhu Yanhai e435ac69be xm-test: add a missing %s
Obviously we need a %s here.

Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:23 +01:00
Matthew Daley f220279c14 xenstore: check socket path length before copying it
Coverity-ID: 1055997
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:12 +01:00
Matthew Daley 07fa854a43 xenstored: fix faulty check for bad handle in domain_init
Coverity-ID: 1054975
Coverity-ID: 1055196
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:12 +01:00
Matthew Daley b865bda00f xenstored: handle unlikely failure better in ask_parents
Coverity-ID: 1055277
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 13:23:12 +01:00
Matthew Daley 1a0f10a8c8 libxl: fix file open failure check in libxl__file_reference_map
Coverity-ID: 1055567
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:56:08 +01:00
Matthew Daley 6b2b15ead2 libxl: fix typo in libxl__hotplug_nic error checking
Coverity-ID: 1055945
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:56:05 +01:00
Matthew Daley 2e979531e5 libxl: only free console reader if it was allocated in main_dmesg
Coverity-ID: 1055304
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:56:00 +01:00
Matthew Daley 96c0061c01 libxl: fix out-of-memory check in parse_global_config
Coverity-ID: 1055174
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:49:15 +01:00
Matthew Daley 2989ef9042 libxl: fix leak of rune in main_remus
Coverity-ID: 1087194
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:49:12 +01:00
Matthew Daley 7737ecb20c libxl: fix leak of config_data in main_cpupoolcreate
Coverity-ID: 1087193
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:49:01 +01:00
Matthew Daley 12eaa1b4d2 libxl: fix leak of corename in handle_domain_death
Coverity-ID: 1087192
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:45:39 +01:00
Matthew Daley 736491d155 libxl: fix dispose without init of disk in cd_insert
Coverity-ID: 1056078
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:44:24 +01:00
Matthew Daley b0be2b126e libxl: fix libxl_string_list_length and its only caller
The wrong amount of indirections were being taken in
libxl_string_list_length, and its only caller was miscounting the amount
of initial non-list arguments, seemingly since the initial commit
(599c784).

This has been seen and reported in the wild (##xen):
< Trixboxer> Hi, any idea why would I get
< Trixboxer> xl: libxl_bootloader.c:42: bootloader_arg: Assertion `bl->nargs < bl->argsspace' failed.
< Trixboxer> 4.2.2-23.el6

Coverity-ID: 1054954
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:42:02 +01:00
Matthew Daley 3b8782d95d libxc: fix memory leak in load_p2m_frame_list error handling
Coverity-ID: 1055885
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 12:35:24 +01:00
Daniel De Graaf 145ae98bfa fix DOMID_IO mapping permission checks
When the permission checks for memory mapping were moved from
get_pg_owner to xsm_mmu_update in aaba7a677, the exception for DOMID_IO
was not taken into account. This will cause IO memory mappings by PV
domains (mini-os in particular) to fail when XSM/FLASK is not being
used. This patch reintroduces the exception for DOMID_IO; the actual
restrictions on IO memory mappings have always been checked separately
using iomem_access_permitted, so this change should not break existing
access control.

Reported-by: Eduardo Peixoto Macedo <epm@cin.ufpe.br>
Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
2013-09-25 10:48:20 +02:00
Andrew Cooper ae7c6b64c0 x86/hap: Remove bogus assertion in hap_free_p2m_page()
Coverity ID: 1055622

Coverity correctly points out that this ASSERT() is unconditionally true as an
unsigned integer is always >= 0.

Judging from the shadow counterpart and p2m callsites, there is nothing
invalid about freeing the final p2m page.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
2013-09-25 10:45:53 +02:00
Andrew Cooper 688eeb878c ns16550: Use correct #define symbol for HAS_IOPORTS
CID 1091471, Regression caused by 7c1de00388

This appears to be a typo which causes check_existence() to unconditionally
return 1 in all cases.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-25 10:44:21 +02:00
Jan Beulich 63a75ba0de x86/xsave: initialize extended register state when guests enable it
Till now, when setting previously unset bits in XCR0 we wouldn't touch
the active register state, thus leaving in the newly enabled registers
whatever a prior user of it left there, i.e. potentially leaking
information between guests.

This is CVE-2013-1442 / XSA-62.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2013-09-25 10:41:25 +02:00
Jan Beulich 5fc2176d9b VMX: drop memory clobbers from vmread/vmwrite wrappers
All effects are properly being described by the asm() constraints.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
2013-09-23 17:37:50 +02:00
Jan Beulich 36291997b6 VMX: also use proper instruction mnemonic for VMREAD
... when assembler supports it, following commit cfd54835 ("VMX: use
proper instruction mnemonics if assembler supports them"). This merely
got split off from the earlier change becase of the significant number
of call sites needing to be changed.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jun Nakajima <jun.nakajima@intel.com>
2013-09-23 17:37:00 +02:00
Jan Beulich 14fcce2fa8 x86/HVM: refuse doing string operations in certain situations
We shouldn't do any acceleration for
- "rep movs" when either side is passed through MMIO or when both sides
  are handled by qemu
- "rep ins" and "rep outs" when the memory operand is any kind of MMIO

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-23 09:55:14 +02:00
Jan Beulich 7f12732670 x86/HVM: linear address must be canonical for the whole accessed range
... rather than just for the first byte.

While at it, also
- make the real mode case at least dpo a wrap around check
- drop the mis-named "gpf" label (we're not generating faults here)
  and use in-place returns instead

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-23 09:53:55 +02:00
Jan Beulich a2e2df452e x86_emulate: fix wrap around handling for repeated string instructions
For one, repeat count clipping for MOVS must be done taking into
consideration both source and destination addresses.

And then we should allow a wrap on the final iteration only if either
the wrap is a precise one (i.e. the access itself doesn't wrap, just
the resulting index register value would) or if there is just one
iteration. In all other cases we should do a bulk operation first
without hitting the wrap, and then issue an individual iteration. If
we don't do it that way,
- the last iteration not completing successfully will cause the whole
  operation to fail (i.e. registers not get updated to the failure
  point)
- hvmemul_virtual_to_linear() may needlessly enforce non-repeated
  operation

Additionally with the prior implementation there was a case
(df=1, ea=~0, reps=~0, bytes_per_rep=1) where we'd end up passing zero
reps back to the caller, yet various places assume that there's at
least on iteration.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
2013-09-23 09:52:29 +02:00
Matthew Daley 6c1bfef445 gdbsx: clear sockaddr before using it
...so that sin_zero is actually zero.

Coverity-ID: 1056070
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2013-09-21 16:43:13 +01:00
Matthew Daley 6ea4840923 mini-os: fix various memory leaks in various locations
Coverity-ID: 1055827
Coverity-ID: 1055828
Coverity-ID: 1055829
Coverity-ID: 1055830
Coverity-ID: 1055831
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:43:04 +01:00
Matthew Daley c2849d8fab mini-os: fix various memory leaks in consfront
Coverity-ID: 1055816
Coverity-ID: 1055817
Coverity-ID: 1055818
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:42 +01:00
Matthew Daley a384c17325 mini-os: fix various memory leaks in pcifront
Coverity-ID: 1055834-1055840
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:31 +01:00
Matthew Daley 927c43c82b mini-os: fix various memory leaks in netfront
Coverity-ID: 1055832
Coverity-ID: 1055833
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:20 +01:00
Matthew Daley 00f502ebfe mini-os: fix various memory leaks in {fb, kbd}front
Coverity-ID: 1055819-1055826
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:42:07 +01:00
Matthew Daley 74ca2b1375 mini-os: fix various memory leaks in blkfront
Coverity-ID: 1055814
Coverity-ID: 1055815
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2013-09-21 16:41:55 +01:00