[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 10/13] xen_hello_world.xsplice: Test payload for patching 'xen_extra_version'.



On Thu, Jan 14, 2016 at 04:47:08PM -0500, Konrad Rzeszutek Wilk wrote:
> 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 this ELF payload file we need:
>  - C code of the new code.
>  - C code generating the .xsplice.func structure.
>  - The address of the old code (xen_extra_version). We
>    do it by using 'nm' but that is a bit of hack.
> 
> The linker script file:
>  - Discards .debug* and .comments* sections.
>  - Changes the name of .data.local.xsplice_hello_world to
>    .xsplice.func
>  - Figures out the size of the new code.
> 
> Also if you are curious on the input/output sections
> magic the linker does, add these to the GCC line:
>   -Wl,-M  -Wl,-t -Wl,-verbose
> which are: print linking map, provide trace and be verbose.
> 
> The use-case is simple:
> 
> $xen-xsplice load /usr/lib/xen/bin/xen_hello_world.xsplice
> $xen-xsplice list
>  ID                                     | status
> ----------------------------------------+------------
> xen_hello_world                           APPLIED
> $xl info | grep extra
> xen_extra              : Hello World
> $xen-xsplice revert xen_hello_world
> Performing revert: completed
> $xen-xsplice unload xen_hello_world
> Performing unload: completed
> $xl info | grep extra
> xen_extra              : -unstable
> 
> Note that it does not build under a 32-bit toolstack as
> there is no access to the hypervisor (xen-syms).
> 
> We also force it to be built every time - as the hypervisor
> may have been rebuilt.
> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
>  docs/misc/xsplice.markdown   | 50 
> ++++++++++++++++++++++++++++++++++++++++++++
>  tools/misc/Makefile          | 25 +++++++++++++++++++++-
>  tools/misc/xen_hello_world.c | 15 +++++++++++++
>  tools/misc/xsplice.h         | 12 +++++++++++
>  tools/misc/xsplice.lds       | 11 ++++++++++

Please put the files of this test case into a dedicated directory.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.