Andrew Cooper [Fri, 29 Jul 2016 15:31:26 +0000 (15:31 +0000)]
runner: Introduce TestInfo to wrap the raw test json
The constructor now performs appropriate verification on the json
configuration, rather than open-coding it in get_all_test_info(). Users of
the dictionary-like json are altered to use attributes.
An all_instances() method is added to return test instances for all suitable
environments, optionally with a subset filter. This is used in preference to
three open-coded loops, generating instance names.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Thu, 28 Jul 2016 11:54:26 +0000 (11:54 +0000)]
runner: Cache the combined test json
To avoid rereading the same data from the disk. Later it will be needed on
several paths. Additionally, rename 'test_info' to 'info_file' to make its
use more clear.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Andrew Cooper [Wed, 20 Jul 2016 17:43:13 +0000 (18:43 +0100)]
Correct the usage of $(DESTDIR) and $(PREFIX)
The GNU coding standards expect $(DESTDIR) to be the root of everything
installed, and for $(PREFIX) to then be added to the path. This is not how
XTF previously behaved.
XTF is not a typical package, and doesn't meet the usual semantics; it expects
to arrange all files under a single directory. Drop the use of $(PREFIX)
entirely (to avoid the expectation that it behaves as $(prefix) usually
behaves) and introduce $(xtfdir) instead.
$(DESTDIR) now works as intended for staged installes, and $(xtfdir) is the
single selected directy containing all installed content.
The intended way to install XTF now:
$ make install DESTDIR=/path/to/staging/area xtfdir=/local/scratch/xtf
Reported-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Andrew Cooper [Sun, 17 Jul 2016 16:45:33 +0000 (17:45 +0100)]
pv32pae: Probe for leaked SMEP/SMAP before switching to user mappings
This allows XTF to panic() with a useful error message, rather than crashing
with an obscure error on the hypervisor console because of Xen failing to
create a bounce frame on the (now-user) stack.
Update the documentation, as Xen 4.7 no longer leaks SMEP/SMAP into guests.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
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>