[Xen-devel] Where and How the P2M table and M2P table create?

2016-04-13 Thread Yunqiang Gao
Hi,alls, As we know,in xen ,when create shadow page table and EPT page table,we need the p2m and m2p.I want to know when are the p2m been created.Was it created at the time of the creation of the domainU?Or at the beginning is a empty table and in the subsequent gradually established? And how was

Re: [Xen-devel] [for-4.7] x86/emulate: synchronize LOCKed instruction emulation

2016-04-13 Thread Razvan Cojocaru
On 04/14/16 09:09, Juergen Gross wrote: > On 14/04/16 07:56, Razvan Cojocaru wrote: >> This indeed doesn't guard against LOCKed instructions being run in >> parallel with and without emulation, however that is a case that should >> almost never occur - at least not with introspection, where current

Re: [Xen-devel] [for-4.7] x86/emulate: synchronize LOCKed instruction emulation

2016-04-13 Thread Juergen Gross
On 14/04/16 07:56, Razvan Cojocaru wrote: > This indeed doesn't guard against LOCKed instructions being run in > parallel with and without emulation, however that is a case that should > almost never occur - at least not with introspection, where currently > all emulation happens as a result of EPT

Re: [Xen-devel] [for-4.7] x86/emulate: synchronize LOCKed instruction emulation

2016-04-13 Thread Razvan Cojocaru
On 04/14/16 07:35, Jan Beulich wrote: Razvan Cojocaru 04/13/16 7:53 PM >>> >> LOCK-prefixed instructions are currenly allowed to run in parallel >> in x86_emulate(), which can lead the guest into an undefined state. >> This patch fixes the issue. > > ... by ... (read: Too brief a description

[Xen-devel] [qemu-mainline test] 91206: regressions - FAIL

2016-04-13 Thread osstest service owner
flight 91206 qemu-mainline real [real] http://logs.test-lab.xenproject.org/osstest/logs/91206/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: test-amd64-i386-freebsd10-i386 10 guest-start fail REGR. vs. 86454 test-amd64-i386-fre

Re: [Xen-devel] [for-4.7] x86/emulate: synchronize LOCKed instruction emulation

2016-04-13 Thread Jan Beulich
>>> Razvan Cojocaru 04/13/16 7:53 PM >>> >LOCK-prefixed instructions are currenly allowed to run in parallel >in x86_emulate(), which can lead the guest into an undefined state. >This patch fixes the issue. ... by ... (read: Too brief a description) >--- a/xen/arch/x86/hvm/emulate.c >+++ b/xen/a

Re: [Xen-devel] [PATCH v6 04/16] x86/rtc: replace paravirt rtc check with platform legacy quirk

2016-04-13 Thread Juergen Gross
On 14/04/16 02:04, Luis R. Rodriguez wrote: > We have 4 types of x86 platforms that disable RTC: > > * Intel MID > * Lguest - uses paravirt > * Xen dom-U - uses paravirt > * x86 on legacy systems annotated with an ACPI legacy flag > > We can consolidate all of these into a platform specif

Re: [Xen-devel] [PATCH v2] xen: change the sizes of memory fields in the HVM start info to be 64bits

2016-04-13 Thread Jan Beulich
>>> Roger Pau Monne 04/12/16 6:12 PM >>> >At the moment the only consumer of this structure is x86, but other arches >might also use it, so make all the fields 64bits. On x86 Xen will still try >to place everything below the 4GiB boundary, but that might not be feasible >in other arches. > >Signed

Re: [Xen-devel] [PATCH v8.1 09/27] x86/mm: Introduce modify_xen_mappings()

2016-04-13 Thread Jan Beulich
>>> Konrad Rzeszutek Wilk 04/14/16 12:03 AM >>> >-/* If we are done with the L2E, check if it is now empty. */ >-if ( (v != e) && (l1_table_offset(v) != 0) ) >+/* >+ * If we not destroying mappings, or are not done with the L2E, >+ * skip

[Xen-devel] [linux-4.1 test] 91189: regressions - FAIL

2016-04-13 Thread osstest service owner
flight 91189 linux-4.1 real [real] http://logs.test-lab.xenproject.org/osstest/logs/91189/ Regressions :-( Tests which did not succeed and are blocking, including tests which could not be run: build-amd64-rumpuserxen 6 xen-build fail REGR. vs. 66399 build-i386-rumpuserxen

Re: [Xen-devel] [for-4.7 1/2] xen/bitops: Introduce macros to generate mask

2016-04-13 Thread Jan Beulich
>>> Julien Grall 04/13/16 6:01 PM >>> >--- a/xen/include/xen/bitops.h >+++ b/xen/include/xen/bitops.h >@@ -3,6 +3,17 @@ >#include > >/* >+ * Create a contiguous bitmask starting at bit position @l and ending at >+ * position @h. For example >+ * GENMASK_ULL(39, 21) gives us the 64bit vector 0x

[Xen-devel] [linux-3.14 baseline-only test] 44329: tolerable FAIL

2016-04-13 Thread Platform Team regression test user
This run is configured for baseline tests only. flight 44329 linux-3.14 real [real] http://osstest.xs.citrite.net/~osstest/testlogs/logs/44329/ Failures :-/ but no regressions. Regressions which are regarded as allowable (not blocking): build-amd64-rumpuserxen 6 xen-build

Re: [Xen-devel] HVMLite / PVHv2 - using x86 EFI boot entry

2016-04-13 Thread Konrad Rzeszutek Wilk
On Thu, Apr 14, 2016 at 12:23:17AM +0200, Luis R. Rodriguez wrote: > On Wed, Apr 13, 2016 at 05:08:01PM -0400, Konrad Rzeszutek Wilk wrote: > > On Wed, Apr 13, 2016 at 10:40:55PM +0200, Luis R. Rodriguez wrote: > > > On Wed, Apr 13, 2016 at 02:56:29PM -0400, Konrad Rzeszutek Wilk wrote: > > > > On

[Xen-devel] [PATCH v6 05/16] x86, ACPI: move ACPI_FADT_NO_CMOS_RTC check to ACPI boot code

2016-04-13 Thread Luis R. Rodriguez
This moves the ACPI specific check into the ACPI boot code, it also takes advantage of the x86_platform.legacy.rtc which is checked for already on the RTC initialization code. This lets us remove the nasty #ifdefery and consolidate the checks to use only one toggle to disable the RTC init code. Th

[Xen-devel] [PATCH v6 12/16] x86, ACPI: parse ACPI_FADT_LEGACY_DEVICES

2016-04-13 Thread Luis R. Rodriguez
ACPI 5.2.9.3 IA-PC Boot Architecture flag ACPI_FADT_LEGACY_DEVICES can be used to determine if a system has legacy devices LPC or ISA devices. The x86 platform already has a struct which lists known associated legacy devices, we start off careful only by disabling root devices we should not regress

[Xen-devel] [PATCH v6 07/16] tools/lguest: force disable tboot and apm

2016-04-13 Thread Luis R. Rodriguez
The paravirt_enabled() check is going away, the area tossed to the kernel on lguest is not zeroed out, so ensure lguest force disables tboot and apm just in case the kernel file being read might have this set for whatever reason. Acked-by: Rusty Russell Signed-off-by: Luis R. Rodriguez --- tool

[Xen-devel] [PATCH v6 05/16] x86, ACPI: move ACPI_FADT_NO_CMOS_RTC check to ACPI boot code

2016-04-13 Thread Luis R. Rodriguez
This moves the ACPI specific check into the ACPI boot code, it also takes advantage of the x86_platform.legacy.rtc which is checked for already on the RTC initialization code. This lets us remove the nasty #ifdefery and consolidate the checks to use only one toggle to disable the RTC init code. Th

[Xen-devel] [PATCH v6 15/16] x86/init: disable pnpbios for X86_SUBARCH_INTEL_MID

2016-04-13 Thread Luis R. Rodriguez
As per hpa Intel MID platforms can also disable pnpbios [0]. As per 0-day, this bumps the vmlinux size using i386-tinyconfig as follows: TOTAL TEXT init.text x86_early_init_platform_quirks() -8 -8 -8 -8 [0] http://lkml.kernel.org/r/5702b5c2.7070...@zytor.com v6: add 0-da

[Xen-devel] [PATCH v6 04/16] x86/rtc: replace paravirt rtc check with platform legacy quirk

2016-04-13 Thread Luis R. Rodriguez
We have 4 types of x86 platforms that disable RTC: * Intel MID * Lguest - uses paravirt * Xen dom-U - uses paravirt * x86 on legacy systems annotated with an ACPI legacy flag We can consolidate all of these into a platform specific legacy quirk set early in boot through i386_start_kernel(

[Xen-devel] [PATCH v6 05/16] x86, ACPI: move ACPI_FADT_NO_CMOS_RTC check to ACPI boot code

2016-04-13 Thread Luis R. Rodriguez
This moves the ACPI specific check into the ACPI boot code, it also takes advantage of the x86_platform.legacy.rtc which is checked for already on the RTC initialization code. This lets us remove the nasty #ifdefery and consolidate the checks to use only one toggle to disable the RTC init code. Th

[Xen-devel] [PATCH v6 00/16] x86: remove paravirt_enabled()

2016-04-13 Thread Luis R. Rodriguez
series is available on git here: https://git.kernel.org/cgit/linux/kernel/git/mcgrof/linux-next.git/log/?h=20160413-pv-disabled-v6 Luis R. Rodriguez (16): x86/boot: enumerate documentation for the x86 hardware_subarch x86/xen: use X86_SUBARCH_XEN for PV guest boots tools/lguest: make

[Xen-devel] [PATCH v6 16/16] x86/init: disable pnpbios and rtc for X86_SUBARCH_CE4100

2016-04-13 Thread Luis R. Rodriguez
As per hpa CE4100 platforms can also disable pnpbios [0]. Then Sebastian also recently noted that CE4100 also disables RTC probe, to do that Sebastian had long ago added the RTC of_have_populated_dt() check, he noted that it was meant to skip the RTC probe on all OF platforms but as of now, CE4100

[Xen-devel] [PATCH v6 13/16] x86/init: rename ebda code file

2016-04-13 Thread Luis R. Rodriguez
This makes it clearer what this is. Signed-off-by: Luis R. Rodriguez --- arch/x86/Makefile | 2 +- arch/x86/kernel/Makefile | 2 +- arch/x86/kernel/{head.c => ebda.c} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename arch/x86/kernel/{head.c => ebda.c} (100%

[Xen-devel] [PATCH v6 12/16] x86, ACPI: parse ACPI_FADT_LEGACY_DEVICES

2016-04-13 Thread Luis R. Rodriguez
ACPI 5.2.9.3 IA-PC Boot Architecture flag ACPI_FADT_LEGACY_DEVICES can be used to determine if a system has legacy devices LPC or ISA devices. The x86 platform already has a struct which lists known associated legacy devices, we start off careful only by disabling root devices we should not regress

[Xen-devel] [PATCH v6 09/16] x86/tboot: remove paravirt_enabled()

2016-04-13 Thread Luis R. Rodriguez
There is already a check for boot_params.tboot_addr prior to paravirt_enabled(). Both Xen and lguest, which are also the only ones that set paravirt_enabled to true, never set the boot_params.tboot_addr. The Xen folks are sure a force disable to 0 is not needed, we recently forced disabled this on

[Xen-devel] [PATCH v6 07/16] tools/lguest: force disable tboot and apm

2016-04-13 Thread Luis R. Rodriguez
The paravirt_enabled() check is going away, the area tossed to the kernel on lguest is not zeroed out, so ensure lguest force disables tboot and apm just in case the kernel file being read might have this set for whatever reason. Acked-by: Rusty Russell Signed-off-by: Luis R. Rodriguez --- tool

[Xen-devel] [PATCH v6 08/16] apm32: remove paravirt_enabled() use

2016-04-13 Thread Luis R. Rodriguez
There is already a check for apm_info.bios == 0, the apm_info.bios is set from the boot_params.apm_bios_info. Both Xen and lguest, which are also the only ones that set paravirt_enabled to true, never set the apm_bios.info. The Xen folks are sure force disable to 0 is not needed because apm_info l

[Xen-devel] [PATCH v6 14/16] x86/paravirt: remove paravirt_enabled()

2016-04-13 Thread Luis R. Rodriguez
That that paravirt_enabled() is replaced with proper x86 semantics we can remove it. Acked-by: Juergen Gross Signed-off-by: Luis R. Rodriguez --- arch/x86/include/asm/paravirt.h | 5 - arch/x86/include/asm/paravirt_types.h | 1 - arch/x86/include/asm/processor.h | 1 - arch/x86/k

[Xen-devel] [PATCH v6 01/16] x86/boot: enumerate documentation for the x86 hardware_subarch

2016-04-13 Thread Luis R. Rodriguez
Although hardware_subarch has been in place since the x86 boot protocol 2.07 it hasn't been used much. Enumerate current possible values to avoid misuses and help with semantics later at boot time should this be used further. These enums should only ever be used by architecture x86 code, and all t

[Xen-devel] [PATCH v6 03/16] tools/lguest: make lguest launcher use X86_SUBARCH_LGUEST explicitly

2016-04-13 Thread Luis R. Rodriguez
Be explicit and make use of X86_SUBARCH_LGUEST directly. Acked-by: Rusty Russell Signed-off-by: Luis R. Rodriguez --- tools/lguest/lguest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index 80159e6811c2..ff0aa580c6e1 1006

[Xen-devel] [PATCH v6 10/16] x86/cpu/intel: remove not needed paravirt_enabled() for f00f work around

2016-04-13 Thread Luis R. Rodriguez
The X86_BUG_F00F work around is responsible for fixing up the error generated on attempted F00F exploitation from an OOPS to a SIGILL. There is no reason why this code should not be allowed to run on PV guest on a F00F-affected CPU -- it would simply never trigger. The pv_enabled() check was there

[Xen-devel] [PATCH v6 06/16] x86/init: use a platform legacy quirk for ebda

2016-04-13 Thread Luis R. Rodriguez
This replaces the paravirt_enabled() check with a proper x86 legacy platform quirk. As per 0-day, this bumps the vmlinux size using i386-tinyconfig as follows: TOTAL TEXT init.text x86_early_init_platform_quirks() +39 +35+35 +25 That's a 4 byte total overhead, the rest is a

[Xen-devel] [PATCH v6 02/16] x86/xen: use X86_SUBARCH_XEN for PV guest boots

2016-04-13 Thread Luis R. Rodriguez
The use of subarch should have no current effect on Xen PV guests, as such this should have no current functional effects. Reviewed-by: David Vrabel Signed-off-by: Luis R. Rodriguez --- arch/x86/xen/enlighten.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/xen/enlighten.c b/arch/

[Xen-devel] [PATCH v6 11/16] pnpbios: replace paravirt_enabled() check with legacy device check

2016-04-13 Thread Luis R. Rodriguez
Since we are removing paravirt_enabled() replace it with a logical equivalent. Even though PNPBIOS is x86 specific we add an arch-specific type call, which can be implemented by any architecture to show how other legacy attribute devices can later be also checked for with other ACPI legacy attribut

Re: [Xen-devel] [libvirt] Fixing libvirt's libxl driver breakage -- where to define LIBXL_API_VERSION?

2016-04-13 Thread Jim Fehlig
On 04/13/2016 03:26 AM, Daniel P. Berrange wrote: > On Wed, Apr 13, 2016 at 10:09:16AM +0100, George Dunlap wrote: >> On Tue, Apr 12, 2016 at 10:31 PM, Jim Fehlig wrote: >>> Wei Liu wrote: Hi libvirt maintainers, >>> Sorry for the delay. Slowly catching up on mail after vacation... >>> X

[Xen-devel] [PATCH] libxl: use LIBXL_API_VERSION 0x040200

2016-04-13 Thread Jim Fehlig
To ensure the libvirt libxl driver will build with future versions of Xen where the libxl API may change in incompatible ways, explicitly use LIBXL_API_VERSION 0x040200. The libxl driver does use new libxl APIs that have been added since Xen 4.2, but currently it does not make use of any changes ma

Re: [Xen-devel] [PATCH v1 0/2] x86/init: extend quirk use

2016-04-13 Thread Luis R. Rodriguez
On Fri, Apr 08, 2016 at 05:22:39PM -0700, Luis R. Rodriguez wrote: > This extends use of the quirks to other platorms as hinted as possible > and confirmed by hpa [0]. This small series depends on the work that added > this functionality [1] [2] to replace the paravirt_enabled() hacks > which is cu

Re: [Xen-devel] [PATCH v1 1/2] x86/init: disable pnpbios for X86_SUBARCH_INTEL_MID

2016-04-13 Thread Luis R. Rodriguez
On Fri, Apr 08, 2016 at 05:22:40PM -0700, Luis R. Rodriguez wrote: > As per hpa Intel MID platforms can also disable pnpbios [0]. > > [0] http://lkml.kernel.org/r/5702b5c2.7070...@zytor.com > > Suggested-by: H. Peter Anvin > Signed-off-by: Luis R. Rodriguez As per 0-day this saves us 8 bytes o

Re: [Xen-devel] Fixing libvirt's libxl driver breakage -- where to define LIBXL_API_VERSION?

2016-04-13 Thread Jim Fehlig
On 04/13/2016 03:09 AM, George Dunlap wrote: > On Tue, Apr 12, 2016 at 10:31 PM, Jim Fehlig wrote: >> Wei Liu wrote: >>> Hi libvirt maintainers, >> Sorry for the delay. Slowly catching up on mail after vacation... >> >>> Xen's control library libxenlight (libxl) requires application >>> (libvirt i

Re: [Xen-devel] [PATCH v4 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk

2016-04-13 Thread Luis R. Rodriguez
On Thu, Apr 7, 2016 at 2:42 AM, David Vrabel wrote: > On 07/04/16 01:06, Luis R. Rodriguez wrote: >> We have 4 types of x86 platforms that disable RTC: >> >> * Intel MID >> * Lguest - uses paravirt >> * Xen dom-U - uses paravirt >> * x86 on legacy systems annotated with an ACPI legacy flag

Re: [Xen-devel] [PATCH v5 04/14] x86/rtc: replace paravirt rtc check with platform legacy quirk

2016-04-13 Thread Luis R. Rodriguez
On Tue, Apr 12, 2016 at 10:50:56PM +0200, Luis R. Rodriguez wrote: > On Mon, Apr 11, 2016 at 08:50:19AM +0200, Juergen Gross wrote: > > On 09/04/16 01:40, Luis R. Rodriguez wrote: > > > TOTAL TEXT init.textx86_early_init_platform_quirks() > > > +70 +62+62 +43 > > > > > > O

Re: [Xen-devel] HVMLite / PVHv2 - using x86 EFI boot entry

2016-04-13 Thread Luis R. Rodriguez
On Wed, Apr 13, 2016 at 05:08:01PM -0400, Konrad Rzeszutek Wilk wrote: > On Wed, Apr 13, 2016 at 10:40:55PM +0200, Luis R. Rodriguez wrote: > > On Wed, Apr 13, 2016 at 02:56:29PM -0400, Konrad Rzeszutek Wilk wrote: > > > On Wed, Apr 13, 2016 at 08:29:51PM +0200, Luis R. Rodriguez wrote: > > > > On

[Xen-devel] [PATCH v8.1 06/27] xen-xsplice: Tool to manipulate xsplice payloads

2016-04-13 Thread Konrad Rzeszutek Wilk
A simple tool that allows an system admin to perform basic xsplice operations: - Upload a xsplice file (with an unique name) - List all the xsplice payloads loaded. - Apply, revert, replace, or unload the payload using the unique name. - Do all two - upload, and apply the payload in one go

[Xen-devel] [PATCH v8.1 15/27] xsplice, symbols: Implement fast symbol names -> virtual addresses lookup

2016-04-13 Thread Konrad Rzeszutek Wilk
The current mechanism is geared towards fast virtual address -> symbol names lookup. This is fine for the normal use cases (BUG_ON, WARN_ON, etc), but for xSplice - where we need to find hypervisor symbols - it is slow. To understand this patch, a description of the existing method is explained fi

[Xen-devel] [PATCH v8.1 18/27] xsplice: Add support for exception tables.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for exception tables contained within xSplice payloads. If an exception occurs search either the main exception table or a particular active payload's exception table depending on the instruction pointer. Also we add an test-case to make sure we have an exception

[Xen-devel] [PATCH v8.1 04/27] xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op

2016-04-13 Thread Konrad Rzeszutek Wilk
The implementation does not actually do any patching. It just adds the framework for doing the hypercalls, keeping track of ELF payloads, and the basic operations: - query which payloads exist, - query for specific payloads, - check*1, apply*1, replace*1, and unload payloads. *1: Which of cour

[Xen-devel] [PATCH v8.1 01/27] Revert "libxc/libxl/python/xenstat/ocaml: Use new XEN_VERSION hypercall"

2016-04-13 Thread Konrad Rzeszutek Wilk
This reverts commit d275ec9ca8a86f7c9c213f3551194d471ce90fbd. As we prefer to still utilize the old XENVER_ hypercall. Signed-off-by: Konrad Rzeszutek Wilk --- tools/libxc/include/xenctrl.h | 32 +- tools/libxc/xc_core.c | 35 tools/libxc/x

[Xen-devel] [PATCH v8.1 24/27] xsplice: Stacking build-id dependency checking.

2016-04-13 Thread Konrad Rzeszutek Wilk
We now expect that the ELF payloads be built with the --build-id. Also the .xsplice.deps section has to have the contents of the hypervisor (or a preceding payload) build-id. We already have the code to verify the Elf_Note build-id so export parts of it. This dependency means the hypervisor MUST

[Xen-devel] [PATCH v8.1 22/27] XENVER_build_id/libxc: Provide ld-embedded build-id

2016-04-13 Thread Konrad Rzeszutek Wilk
If the hypervisor was built with build-ids we can expose the build-id value to the toolstack (if it is not built with it will just return -ENODATA). This is a priviligied operation so only the controlling stack is able to request this. Signed-off-by: Konrad Rzeszutek Wilk --- CC: Daniel De Graaf

[Xen-devel] [PATCH v8.1 20/27] build_id: Provide ld-embedded build-ids

2016-04-13 Thread Konrad Rzeszutek Wilk
This patch enables the Elf to be built with the build-id and provide in the Xen hypervisor the code to extract it. The man-page for ld --build-id says it is: "Request the creation of a ".note.gnu.build-id" ELF note section or a ".build-id" COFF section. The contents of the note are unique bits i

[Xen-devel] [PATCH v8.1 11/27] xsplice: Implement payload loading

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for loading xsplice payloads. This is somewhat similar to the Linux kernel module loader, implementing the following steps: - Verify the elf file. - Parse the elf file. - Allocate a region of memory mapped within a free area of [xen_virt_end, XEN_VIRT_END]. - Co

[Xen-devel] [PATCH v8.1 16/27] x86, xsplice: Print payload's symbol name and payload name in backtraces

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Naturally the backtrace is presented when an instruction hits an bug_frame or %p is used. The payloads do not support bug_frames yet - however the functions the payloads call could hit an BUG() or WARN(). The traps.c has logic to scan for it this - and eventually it will fi

[Xen-devel] [PATCH v8.1 25/27] xsplice/xen_replace_world: Test-case for XSPLICE_ACTION_REPLACE

2016-04-13 Thread Konrad Rzeszutek Wilk
With this third payload one can do: -bash-4.1# xen-xsplice load xen_hello_world.xsplice Uploading xen_hello_world.xsplice (10148 bytes) Performing check: completed Performing apply:. completed [xen_hello_world depends on hypervisor build-id] -bash-4.1# xen-xsplice load xen_bye_world.xsplice Uploa

[Xen-devel] [PATCH v8.1 12/27] xsplice: Implement support for applying/reverting/replacing patches.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Implement support for the apply, revert and replace actions. To perform and action on a payload, the hypercall sets up a data structure to schedule the work. A hook is added in the reset_stack_and_jump to check for work and execute it if needed (specifically we check an per

[Xen-devel] [PATCH v8.1 03/27] xsplice: Design document

2016-04-13 Thread Konrad Rzeszutek Wilk
A mechanism is required to binarily patch the running hypervisor with new opcodes that have come about due to primarily security updates. This document describes the design of the API that would allow us to upload to the hypervisor binary patches. This document has been shaped by the input from:

[Xen-devel] [PATCH v8.1 21/27] xsplice: Print build_id in keyhandler and on bootup.

2016-04-13 Thread Konrad Rzeszutek Wilk
As it should be an useful debug mechanism. Signed-off-by: Konrad Rzeszutek Wilk Acked-by: Jan Beulich Reviewed-by: Andrew Cooper -- Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan v2: s/char */const void * v5: s/ssize_t/unsigned int/ v6: Remove pointless initializers, use s

[Xen-devel] [PATCH v8.1 19/27] xsplice: Add support for alternatives

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for applying alternative sections within xsplice payload. At payload load time, apply an alternative sections that are found. Also we add an test-case exercising a rather useless alternative (patching a NOP with a NOP) - but it does exercise the code-path. Signe

[Xen-devel] [PATCH v8.1 23/27] libxl: info: Display build_id of the hypervisor.

2016-04-13 Thread Konrad Rzeszutek Wilk
If the hypervisor is built with we will display it. Signed-off-by: Konrad Rzeszutek Wilk --- CC: Ian Jackson CC: Wei Liu v2: Include HAVE_*, use libxl_zalloc, s/rc/ret/ v3: Retry with different size if 1020 is not enough. v4: Use VERSION_OP subops instead of the XENVER_ subops v5: Change it pe

[Xen-devel] [PATCH v8.1 07/27] arm/x86: Use struct virtual_region to do bug, symbol, and (x86) exception tables lookup.

2016-04-13 Thread Konrad Rzeszutek Wilk
During execution of the hypervisor we have two regions of executable code - stext -> _etext, and _sinittext -> _einitext. The later is not needed after bootup. We also have various built-in macros and functions to search in between those two swaths depending on the state of the system. That is e

[Xen-devel] [PATCH v8.1 17/27] xsplice: Add support for bug frames.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for handling bug frames contained with xsplice modules. If a trap occurs search either the kernel bug table or an applied payload's bug table depending on the instruction pointer. Signed-off-by: Ross Lagerwall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: A

[Xen-devel] [PATCH v8.1 13/27] x86/xen_hello_world.xsplice: Test payload for patching 'xen_extra_version'.

2016-04-13 Thread Konrad Rzeszutek Wilk
This change demonstrates how to generate an xSplice ELF payload. The idea here is that we want to patch in the hypervisor the 'xen_version_extra' function with an function that will return 'Hello World'. The 'xl info | grep extraversion' will reflect the new value after the patching. To generate

[Xen-devel] [PATCH v8.1 09/27] x86/mm: Introduce modify_xen_mappings()

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Andrew Cooper To simply change the permissions on existing Xen mappings. The existing destroy_xen_mappings() is altered to support a change the PTE permissions. A new destroy_xen_mappings() is introduced, as the special case of not passing _PAGE_PRESENT to modify_xen_mappings(). As clean

[Xen-devel] [PATCH v8.1 08/27] arm/x86/vmap: Add vmalloc_xen, vfree_xen and vm_init_type

2016-04-13 Thread Konrad Rzeszutek Wilk
For those users who want to use the virtual addresses that are in the hypervisor's code/data/ region address space - these three new functions allow that. Implementation wise the vmap API keeps track of two virtual address regions now: a) VMAP_VIRT_START b) Any provided virtual address space (ne

[Xen-devel] [PATCH v8.1 10/27] xsplice: Add helper elf routines

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add Elf routines and data structures in preparation for loading an xSplice payload. We make an assumption that the max number of sections an ELF payload can have is 64. We can in future make this be dependent on the names of the sections and verifying against a list, but for

[Xen-devel] [PATCH v8.1 26/27] xsplice: Prevent duplicate payloads from being loaded.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Signed-off-by: Ross Lagerwall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Andrew Cooper --- Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan v6: Drop recursive lock - also now the caller is holding the lock Move the code up in the code above.

[Xen-devel] [PATCH v8.1 05/27] libxc: Implementation of XEN_XSPLICE_op in libxc

2016-04-13 Thread Konrad Rzeszutek Wilk
The underlaying toolstack code to do the basic operations when using the XEN_XSPLICE_op syscalls: - upload the payload, - get status of an payload, - list all the payloads, - apply, check, replace, and revert the payload. Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Ross Lagerwall Ack

[Xen-devel] [PATCH v8.1 02/27] Revert "HYPERCALL_version_op. New hypercall mirroring XENVER_ but sane."

2016-04-13 Thread Konrad Rzeszutek Wilk
This reverts commit 2716d875379d538c1dfccad78a99ca7db2e09f90. As it was decided that the existing XENVER hypercall - while having grown organically over the years can still be expanded. Signed-off-by: Konrad Rzeszutek Wilk --- tools/flask/policy/policy/modules/xen/xen.te | 7 +- xen/arch/arm/

[Xen-devel] [PATCH v8.1 27/27] MAINTAINERS/xsplice: Add myself and Ross as the maintainers.

2016-04-13 Thread Konrad Rzeszutek Wilk
If you have a patch for xSplice send it our way! Signed-off-by: Ross Lagerwall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Andrew Cooper --- Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan v5: Sort them F: fields (Jan) v7: Added Andrew's Reviewed-by --- --- MAINTAINE

[Xen-devel] [PATCH v8.1] xSplice v1 design and implementation.

2016-04-13 Thread Konrad Rzeszutek Wilk
Hey! Changelog: v8: since http://lists.xen.org/archives/html/xen-devel/2016-04/msg01873.html - Posting the _RIGHT_ set of patches. v7: http://lists.xen.org/archives/html/xen-devel/2016-04/msg01476.html - Ingested newer version of x86/mm: Introduce modify_xen_mappings() - Implemented faster sym

[Xen-devel] [PATCH v8.1 14/27] xsplice, symbols: Implement symbol name resolution on address.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall If in the payload we do not have the old_addr we can resolve the virtual address based on the UNDEFined symbols. We also use an boolean flag: new_symbol to track symbols. The usual case this is used is by: * A payload may introduce a new symbol * A payload may override an e

Re: [Xen-devel] [PATCH v8] xSplice v1 design and implementation.

2016-04-13 Thread Konrad Rzeszutek Wilk
> > $#@@#A@! > > As you can see this cover letter has no relation to the patches! This > mentions 27 patches while this > patchbomb has 25. > > When I did git format-patch I did it in one directory while in another > shell I did git send-email (and of course in a different directory). > > My sincer

Re: [Xen-devel] [PATCH v8] xSplice v1 design and implementation.

2016-04-13 Thread Konrad Rzeszutek Wilk
> *Tools Maintainers* > > Since v7, two new patches, please review: > > XENVER_build_id/libxc: Provide ld-embedded build-id > libxl: info: Display build_id of the hypervisor. > > *Maintainers* > > Legend: > *- See below > R- Reviewed > R+ - Reviewed by two folks > A- Acked

[Xen-devel] [PATCH v8 13/25] xsplice, symbols: Implement fast symbol names -> virtual addresses lookup

2016-04-13 Thread Konrad Rzeszutek Wilk
The current mechanism is geared towards fast virtual address -> symbol names lookup. This is fine for the normal use cases (BUG_ON, WARN_ON, etc), but for xSplice - where we need to find hypervisor symbols - it is slow. To understand this patch, a description of the existing method is explained fi

[Xen-devel] [PATCH v8 08/25] xsplice: Add helper elf routines

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add Elf routines and data structures in preparation for loading an xSplice payload. We make an assumption that the max number of sections an ELF payload can have is 64. We can in future make this be dependent on the names of the sections and verifying against a list, but for

[Xen-devel] [PATCH v8 09/25] xsplice: Implement payload loading

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for loading xsplice payloads. This is somewhat similar to the Linux kernel module loader, implementing the following steps: - Verify the elf file. - Parse the elf file. - Allocate a region of memory mapped within a free area of [xen_virt_end, XEN_VIRT_END]. - Co

[Xen-devel] [PATCH v8 20/25] libxl: info: Display build_id of the hypervisor using XEN_VERSION_build_id

2016-04-13 Thread Konrad Rzeszutek Wilk
If the hypervisor is built with we will display it. Signed-off-by: Konrad Rzeszutek Wilk Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Stefano Stabellini Cc: Wei Liu v2: Include HAVE_*, use libxl_zalloc, s/rc/ret/ v3: Retry with different size if 1020 is not enough. v4: Use VERSION_OP subops in

[Xen-devel] [PATCH v8 16/25] xsplice: Add support for exception tables.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for exception tables contained within xSplice payloads. If an exception occurs search either the main exception table or a particular active payload's exception table depending on the instruction pointer. Also we add an test-case to make sure we have an exception

[Xen-devel] [PATCH v8 25/25] MAINTAINERS/xsplice: Add myself and Ross as the maintainers.

2016-04-13 Thread Konrad Rzeszutek Wilk
If you have a patch for xSplice send it our way! Signed-off-by: Ross Lagerwall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Andrew Cooper --- Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan v5: Sort them F: fields (Jan) v7: Added Andrew's Reviewed-by --- --- MAINTAINE

[Xen-devel] [PATCH v8 23/25] xsplice/xen_replace_world: Test-case for XSPLICE_ACTION_REPLACE

2016-04-13 Thread Konrad Rzeszutek Wilk
With this third payload one can do: -bash-4.1# xen-xsplice load xen_hello_world.xsplice Uploading xen_hello_world.xsplice (10148 bytes) Performing check: completed Performing apply:. completed [xen_hello_world depends on hypervisor build-id] -bash-4.1# xen-xsplice load xen_bye_world.xsplice Uploa

[Xen-devel] [PATCH v8 12/25] xsplice, symbols: Implement symbol name resolution on address.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall If in the payload we do not have the old_addr we can resolve the virtual address based on the UNDEFined symbols. We also use an boolean flag: new_symbol to track symbols. The usual case this is used is by: * A payload may introduce a new symbol * A payload may override an e

[Xen-devel] [PATCH v8 14/25] x86, xsplice: Print payload's symbol name and payload name in backtraces

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Naturally the backtrace is presented when an instruction hits an bug_frame or %p is used. The payloads do not support bug_frames yet - however the functions the payloads call could hit an BUG() or WARN(). The traps.c has logic to scan for it this - and eventually it will fi

[Xen-devel] [PATCH v8 02/25] xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op

2016-04-13 Thread Konrad Rzeszutek Wilk
The implementation does not actually do any patching. It just adds the framework for doing the hypercalls, keeping track of ELF payloads, and the basic operations: - query which payloads exist, - query for specific payloads, - check*1, apply*1, replace*1, and unload payloads. *1: Which of cour

[Xen-devel] [PATCH v8 17/25] xsplice: Add support for alternatives

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for applying alternative sections within xsplice payload. At payload load time, apply an alternative sections that are found. Also we add an test-case exercising a rather useless alternative (patching a NOP with a NOP) - but it does exercise the code-path. Signe

[Xen-devel] [PATCH v8 19/25] HYPERCALL_version_op: Add VERSION_build_id to retrieve build-id.

2016-04-13 Thread Konrad Rzeszutek Wilk
The VERSION hypercall provides the flexibility to expose the size of the build-id (so the callers can allocate the proper size before trying to retrieve it). It also allows in one nice swoop to retrieve the hypervisor build-id in the provided buffer. Signed-off-by: Konrad Rzeszutek Wilk Acked-by:

[Xen-devel] [PATCH v8 24/25] xsplice: Prevent duplicate payloads from being loaded.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Signed-off-by: Ross Lagerwall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: Andrew Cooper --- Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan v6: Drop recursive lock - also now the caller is holding the lock Move the code up in the code above.

[Xen-devel] [PATCH v8 18/25] build_id: Provide ld-embedded build-ids

2016-04-13 Thread Konrad Rzeszutek Wilk
This patch enables the Elf to be built with the build-id and provide in the Xen hypervisor the code to extract it. The man-page for ld --build-id says it is: "Request the creation of a ".note.gnu.build-id" ELF note section or a ".build-id" COFF section. The contents of the note are unique bits i

[Xen-devel] [PATCH v8 15/25] xsplice: Add support for bug frames.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Add support for handling bug frames contained with xsplice modules. If a trap occurs search either the kernel bug table or an applied payload's bug table depending on the instruction pointer. Signed-off-by: Ross Lagerwall Signed-off-by: Konrad Rzeszutek Wilk Reviewed-by: A

[Xen-devel] [PATCH v8 01/25] xsplice: Design document

2016-04-13 Thread Konrad Rzeszutek Wilk
A mechanism is required to binarily patch the running hypervisor with new opcodes that have come about due to primarily security updates. This document describes the design of the API that would allow us to upload to the hypervisor binary patches. This document has been shaped by the input from:

[Xen-devel] [PATCH v8] xSplice v1 design and implementation.

2016-04-13 Thread Konrad Rzeszutek Wilk
Hey! Changelog: v7: since http://lists.xen.org/archives/html/xen-devel/2016-04/msg01476.html - Ingested newer version of x86/mm: Introduce modify_xen_mappings() - Implemented faster symbol table lookup (NEW) - Carried out tests on large CPU machine (240CPUs) - Made the struct xsplice_patch_fun

[Xen-devel] [PATCH v8 22/25] xsplice: Stacking build-id dependency checking.

2016-04-13 Thread Konrad Rzeszutek Wilk
We now expect that the ELF payloads be built with the --build-id. Also the .xsplice.deps section has to have the contents of the hypervisor (or a preceding payload) build-id. We already have the code to verify the Elf_Note build-id so export parts of it. This dependency means the hypervisor MUST

[Xen-devel] [PATCH v8 11/25] x86/xen_hello_world.xsplice: Test payload for patching 'xen_extra_version'.

2016-04-13 Thread Konrad Rzeszutek Wilk
This change demonstrates how to generate an xSplice ELF payload. The idea here is that we want to patch in the hypervisor the 'xen_version_extra' function with an function that will return 'Hello World'. The 'xl info | grep extraversion' will reflect the new value after the patching. To generate

[Xen-devel] [PATCH v8 06/25] arm/x86/vmap: Add vmalloc_xen, vfree_xen and vm_init_type

2016-04-13 Thread Konrad Rzeszutek Wilk
For those users who want to use the virtual addresses that are in the hypervisor's code/data/ region address space - these three new functions allow that. Implementation wise the vmap API keeps track of two virtual address regions now: a) VMAP_VIRT_START b) Any provided virtual address space (ne

[Xen-devel] [PATCH v8 04/25] xen-xsplice: Tool to manipulate xsplice payloads

2016-04-13 Thread Konrad Rzeszutek Wilk
A simple tool that allows an system admin to perform basic xsplice operations: - Upload a xsplice file (with an unique name) - List all the xsplice payloads loaded. - Apply, revert, replace, or unload the payload using the unique name. - Do all two - upload, and apply the payload in one go

[Xen-devel] [PATCH v8 21/25] xsplice: Print build_id in keyhandler and on bootup.

2016-04-13 Thread Konrad Rzeszutek Wilk
As it should be an useful debug mechanism. Signed-off-by: Konrad Rzeszutek Wilk Acked-by: Jan Beulich Reviewed-by: Andrew Cooper -- Cc: Ian Jackson Cc: Jan Beulich Cc: Keir Fraser Cc: Tim Deegan v2: s/char */const void * v5: s/ssize_t/unsigned int/ v6: Remove pointless initializers, use s

[Xen-devel] [PATCH v8 10/25] xsplice: Implement support for applying/reverting/replacing patches.

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Ross Lagerwall Implement support for the apply, revert and replace actions. To perform and action on a payload, the hypercall sets up a data structure to schedule the work. A hook is added in the reset_stack_and_jump to check for work and execute it if needed (specifically we check an per

[Xen-devel] [PATCH v8 05/25] arm/x86: Use struct virtual_region to do bug, symbol, and (x86) exception tables lookup.

2016-04-13 Thread Konrad Rzeszutek Wilk
During execution of the hypervisor we have two regions of executable code - stext -> _etext, and _sinittext -> _einitext. The later is not needed after bootup. We also have various built-in macros and functions to search in between those two swaths depending on the state of the system. That is e

[Xen-devel] [PATCH v8 03/25] libxc: Implementation of XEN_XSPLICE_op in libxc

2016-04-13 Thread Konrad Rzeszutek Wilk
The underlaying toolstack code to do the basic operations when using the XEN_XSPLICE_op syscalls: - upload the payload, - get status of an payload, - list all the payloads, - apply, check, replace, and revert the payload. Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Ross Lagerwall Ack

[Xen-devel] [PATCH v8 07/25] x86/mm: Introduce modify_xen_mappings()

2016-04-13 Thread Konrad Rzeszutek Wilk
From: Andrew Cooper To simply change the permissions on existing Xen mappings. The existing destroy_xen_mappings() is altered to support a change the PTE permissions. A new destroy_xen_mappings() is introduced, as the special case of not passing _PAGE_PRESENT to modify_xen_mappings(). As clean

Re: [Xen-devel] HVMLite / PVHv2 - using x86 EFI boot entry

2016-04-13 Thread Konrad Rzeszutek Wilk
On Wed, Apr 13, 2016 at 10:40:55PM +0200, Luis R. Rodriguez wrote: > On Wed, Apr 13, 2016 at 02:56:29PM -0400, Konrad Rzeszutek Wilk wrote: > > On Wed, Apr 13, 2016 at 08:29:51PM +0200, Luis R. Rodriguez wrote: > > > On Mon, Apr 11, 2016 at 07:12:08AM +0200, Juergen Gross wrote: > > > > > > > What

Re: [Xen-devel] OCaml compilation issues (staging) under ARM32 (ocaml-4.01)

2016-04-13 Thread Andrew Cooper
On 13/04/2016 21:28, Konrad Rzeszutek Wilk wrote: > Hey, > > As I was testing xSplice I had compile issues to Andrew's CPUID work > which was easy to fix: > > diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c > b/tools/ocaml/libs/xc/xenctrl_stubs.c > index 5477df3..881f1b4 100644 > --- a/tools/ocam

  1   2   3   >