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

Re: [Xen-devel] [PATCH v6 11/24] x86/xen_hello_world.xsplice: Test payload for patching 'xen_extra_version'.



On 07/04/16 04:49, 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 (xen_hello_world_func.c).
>  - C code generating the .xsplice.funcs structure
>    (xen_hello_world.c)
>  - The address of the old code (xen_extra_version). We
>    retrieve it by  using 'nm --defined' on xen-syms.
>  - The size of the new and old code for which we use
>    nm --defined -S on our code and xen-syms respectively.
>
> There are two C files and one header files generated
> during build. One could make this one C file if the
> size of the newly patched function size was known in
> advance (or an random value was choosen).
>
> There is also a strict order of compiling:
>  1) xen_hello_world_func.c
>  2) config.h - extract the size of the new function,
>     the old function and the old function address.
>  3) xen_hello_world.c - which contains the .xsplice.funcs
>     structure.
>  4) Link the object files in an xen_hello_world.xsplice file.
>
> The use-case is simple:
>
> $xen-xsplice load /usr/lib/debug/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
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
>
> ---
> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
> Cc: Julien Grall <julien.grall@xxxxxxx>
> Cc: Keir Fraser <keir@xxxxxxx>
> Cc: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

_______________________________________________
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®.