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

Re: [Xen-devel] [PATCH] tools/livepatch: recognize functions in livepatch.ignore.functions

On 12/12/2017 05:54 AM, elena.ufimtseva@xxxxxxxxxx wrote:
From: Elena Ufimtseva <elena.ufimtseva@xxxxxxxxxx>

It is expected that the symbol has type STT_FUNC in livpatch.ignore.functions
sections, but it is incorrect and results in functions not to be ignored.
To actually ignore functions in livepatch.ignore.functions section, attempt to
find the symbol of type STT_FUNC by its name.

Hi Elena,

I suspect you might have got the wrong idea about how it is meant to be used (or I misunderstood your patch). It is expected that the relocation points to a symbol that has type STT_FUNC. This is subtly different from having a symbol with type STT_FUNC in .livepatch.ignore.functions.

The correct way to use it is to declare a pointer stored in .livepatch.ignore.functions that points to the function you want to ignore.

For example, place this at the end of arch/x86/mm/p2m.c to ignore changes to map_domain_gfn: void *__lp_ignore_func_map_domain_gfn __section(.livepatch.ignore.functions) = map_domain_gfn;

The code in livepatch-build-tools is based on kpatch and they have a macro to do this in a more friendly way [1]. If you want, it would be great if you could port this to Xen LivePatch.

[1] https://github.com/dynup/kpatch/blob/f4c0f3209e8e856d93622344560c8794cd8d8a45/kmod/patch/kpatch-macros.h#L39

As an aside, much of the code in livepatch-build-tools comes from kpatch, so patches are ideally sent there first. We do intend eventually to merge the tools to avoid code duplication and kpatch's build tool was recently refactored to make this easier.

Ross Lagerwall

Xen-devel mailing list



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