This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Kernel livepatching support in GCC


On 05/28/2015 11:16 AM, Maxim Kuvyrkov wrote:
>> On May 28, 2015, at 11:59 AM, Richard Biener <richard.guenther@gmail.com> wrote:
...
>> Maybe follow s390 -mhotpatch instead?
> 
> Regarding implementation of the option, it will follow what s390 is doing with function attributes to mark which functions to apply nop-treatment to (using attributes will avoid problems with [coming] LTO builds of the kernel).  The new option will set value of the attribute on all functions in current compilation unit, and then nops will be generated from the attribute specification.
> 
> On the other hand, s390 does not generate a section of descriptor entries of NOP pads, which seems like a useful (or necessary) option.  A more-or-less generic implementation should, therefore, combine s390's attributes approach to annotating functions and x86's approach to providing information in an ELF section about NOP entries.  Or can we record value of a function attribute in ELF in a generic way?

I agree that would be useful. The only reason we didn't implement that was that our kernel guys were
confident enough to be able to detect patchable functions without it. We discussed two solutions to
that:

1. Add special relocations pointing to the patchable areas.
2. Add a special section listing all patchable areas. I think systemtap is doing something similiar
for their probes.

> Whatever the specifics, implementation of livepatch support should be decoupled from -pg/mcount dependency as I don't see any real need in overloading mcount with livepatching stuff.

Agreed.

For user space hotpatching we also needed hotpatching areas *before* the function label to emit
trampolines there.  This perhaps should be covered by a generic approach as well.

-Andreas-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]