Andrew Cooper [Tue, 19 Jul 2016 13:58:46 +0000 (14:58 +0100)]
pv: Honour test_wants_user_mappings
32bit PV guests start on supervisor mappings, and previously unilaterally
switched to user mappings. Now, only switch to user mappings if a test has
opted in.
64bit PV guests run at cpl3, must use user mappings and architecturally have
no choice in the matter.
This change is best reviewed with `git show --ignore-all-space`
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 19 Jul 2016 13:51:04 +0000 (14:51 +0100)]
Introduce a per-test opt-in for using user mappings
The choice of user or supervisor mappings is currently chosen for the
test, and is inflexible for a test needing to run in situations where
Xen leaks SMEP/SMAP into the guest, or where the test specifically wants
to use SMEP/SMAP itself.
As it turns out, fewer tests require user mappings than not. For the
tests which don't require user mappings, allowing them to run on
supervisor mappings is quicker to set up, and allows the test to run
even if Xen leaks paging state.
Introduce test_wants_user_mappings and default it to false. Tests which
want user mappings can opt-in by overriding the weak reference to true.
Explicit set the opt-in for the three tests which currently require
them.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 27 May 2016 07:53:53 +0000 (08:53 +0100)]
Helpers to retrieve %ss and %esp from cpu_regs
In 32bit, if not stack switch occurs, this information isn't present in an
exception frame. As a result, regs->sp and regs->ss may actually alias the
interrupted stack frame. To avoid accidental incorrect use, prefix the names
in cpu_regs with an underscore.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 7 Jun 2016 17:08:10 +0000 (18:08 +0100)]
xtf-runner: Extend test selection to run multiple tests at once
A caller may now specify a test name (in which case all environments will be
run), an environment (in which case every test supporting that environment
will be run), or a category (in which case all tests in that category will be
run).
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 7 Jun 2016 13:25:38 +0000 (14:25 +0100)]
xtf-runner: Support listing tests
Without parameters, all tests will be returned.
Alternatively, specific environments or categories can be specified, to filter
the results. A special input of "host" will query Xen for the available
environments, and filter accordingly.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Roger Pau Monne [Thu, 19 May 2016 13:43:30 +0000 (15:43 +0200)]
Remove setting ROOT path in common.mk
Since it might be included from different paths that have different levels
of nestedness. Also all makefiles that include common.mk already define ROOT
on their own.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 6 May 2016 16:40:02 +0000 (17:40 +0100)]
Extend exception table support to include custom handlers
Provide additional documentation, and a selftest. Introduce __used to
indicate to the compiler that an object is referenced, even if the reference
isn't visible.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:57:17 +0000 (19:57 +0100)]
Annotate hvm pagetables as data
Introduce PAGETABLE_{START,END}() helpers which wrap the appropriate
directives. Fix a copy&paste bug from c/s 3382222 "Introduce the hvm32pse
environment" which stated the size of pse_l1_identmap twice, and omitted
pse_l2_identmap.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:49:32 +0000 (19:49 +0100)]
Avoid generating *UND* symbols in object files
The swint-emulation test contains hand-generated asm stubs which use arbitrary
identifiers just for their mnemonic properties. Unfortunately, their use in
the .if statements generate *UND* symbols listed in the object files export
table.
Use .ifc rather than .if, which explicit interprets its parameters as strings
rather than expressions. Unfortunately, there is no .elseifc directive.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:47:42 +0000 (19:47 +0100)]
Annotate hypercall stubs as functions
Move DECLARE_HYPERCALL() from asm_macros.h to being local, as it is not useful
elsewhere. Link hypercall_page in .data rather than .text, to avoid polluting
the disassembly. Annotate hypercall_page itself as data.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Fri, 22 Apr 2016 18:36:15 +0000 (19:36 +0100)]
Fix XSA-168 PoC on Gen1 AMD hardware
We care simply that the vulnerability is fixed, rather than the architectural
correctness of the emulation of `invlpg`. Correctness should be implemented
by a functional test.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Tue, 23 Feb 2016 11:47:03 +0000 (11:47 +0000)]
Introduce the hvm32pse environment
This uses 32bit paging, along with the PSE extension.
Regular 32bit paging and PSE paging differ only in whether the PSE bit may be
set, to create 4M superpages. Since PSE is available on all hardware Xen will
now run on, forgo the `hvm32pg` environment to avoid the overhead of requiring
small pages for all mappings.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Sun, 6 Mar 2016 21:19:05 +0000 (21:19 +0000)]
Correct the generation of the `cd 03` instruction
Some assemblers "helpfully" turn the two-byte `int $3` into its one-byte form
`int3`. This defeats the purpose of the test case, so hand-roll the
instrucion.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Sun, 6 Mar 2016 20:26:12 +0000 (20:26 +0000)]
Reintroduce the test_NULL_unmapped() selftest
c/s f571b0b "Implement the hvm32 environment" introduced a guard to the
test_NULL_unmapped() selftest, as it is inapplicable in an unpaged
environment.
However, CONFIG_PAGING wasn't ever defined (it disappeared during
development), causing the selftest to be unconditionally omitted even in paged
environments.
Reintroduce the check, based on CONFIG_PAGING_LEVELS being non-zero.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 22 Feb 2016 18:04:28 +0000 (18:04 +0000)]
Alter xtf_success() to take a string to print
... to be consistent with the rest of the reporting interface. Every
reporting function is modified to accept NULL if there is nothing interesting
to print.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Mon, 18 Jan 2016 10:48:53 +0000 (10:48 +0000)]
Rework config.h and head_hvm.S for better paging separation
config.h is modified to turn CONFIG_ENV_$foo into the finer grain
CONFIG_{PV,HVM}, CONFIG_PAGING_LEVELS and possibly CONFIG_PAGING_PAE. It then
undefines the CONFIG_ENV_$foo #define, to prevent mistakes in regular code.
Generation of environment_description is also moved into config.h, and it is
extended to include paging information.
head_hvm.S is then modified to use the finer grain #defines. Specifically,
CR4.PAE is only set if CONFIG_PAGING_PAE, and CR3 and CR0.PG are only set if
CONFIG_PAGING_LEVELS is greater than 0.
The existing setting of CR0.PE is removed, as it is guaranteed always to be
set.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>