Re: [PATCH v10 2/2] ARM: kprobes: enable OPTPROBES for ARM 32

From: Wang Nan
Date: Mon Dec 01 2014 - 04:00:01 EST



>>> +/*
>>> + * NOTE: the first sub and add instruction will be modified according
>>> + * to the stack cost of the instruction.
>>> + */
>>> +asm (
>>> + ".global optprobe_template_entry\n"
>>> + "optprobe_template_entry:\n"
>>> + " sub sp, sp, #0xff\n"
>>> + " stmia sp, {r0 - r14} \n"
>>
>> AEABI requires that the stack be aligned to a multiple of 8 bytes at
>> function call boundaries, however kprobes can be inserted in the middle
>> of functions where such alignment isn't guaranteed to be maintained.
>> Therefore, this trampoline code needs to make adjust SP if necessary to
>> ensure that alignment. See svc_entry in arch/arm/kernel/entry-armv.S for
>> an example of how this is done; though note, we can't use that exact
>> method because we can't change the flags value without saving them
>> first. (Exception handlers don't have to worry about that because the
>> flags are saved in spsr).
>>
>
> So I think we have to push a flag into stack for it.
>

By more thinking I found another method on it. Please see my version 11 patch:

http://lists.infradead.org/pipermail/linux-arm-kernel/2014-December/307562.html


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/