All of lore.kernel.org
 help / color / mirror / Atom feed
From: wangnan0@huawei.com (Wang Nan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v10 2/2] ARM: kprobes: enable OPTPROBES for ARM 32
Date: Mon, 1 Dec 2014 16:59:42 +0800	[thread overview]
Message-ID: <547C2DFE.7010005@huawei.com> (raw)
In-Reply-To: <547BC490.9020806@huawei.com>


>>> +/*
>>> + * 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

WARNING: multiple messages have this Message-ID (diff)
From: Wang Nan <wangnan0@huawei.com>
To: "Jon Medhurst (Tixy)" <tixy@linaro.org>
Cc: <masami.hiramatsu.pt@hitachi.com>, <linux@arm.linux.org.uk>,
	<will.deacon@arm.com>, <taras.kondratiuk@linaro.org>,
	<ben.dooks@codethink.co.uk>, <cl@linux.com>, <rabin@rab.in>,
	<davem@davemloft.net>, <lizefan@huawei.com>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v10 2/2] ARM: kprobes: enable OPTPROBES for ARM 32
Date: Mon, 1 Dec 2014 16:59:42 +0800	[thread overview]
Message-ID: <547C2DFE.7010005@huawei.com> (raw)
In-Reply-To: <547BC490.9020806@huawei.com>


>>> +/*
>>> + * 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



  reply	other threads:[~2014-12-01  8:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21  6:35 [PATCH v10 0/2] ARM: kprobes: enable OPTPROBES for ARM32 Wang Nan
2014-11-21  6:35 ` Wang Nan
2014-11-21  6:35 ` [PATCH v10 1/2] kprobes: Pass the original kprobe for preparing optimized kprobe Wang Nan
2014-11-21  6:35   ` Wang Nan
2014-11-21  6:35 ` [PATCH v10 2/2] ARM: kprobes: enable OPTPROBES for ARM 32 Wang Nan
2014-11-21  6:35   ` Wang Nan
2014-11-27 14:36   ` Jon Medhurst (Tixy)
2014-11-27 14:36     ` Jon Medhurst (Tixy)
2014-11-28  3:12     ` Masami Hiramatsu
2014-11-28  3:12       ` Masami Hiramatsu
2014-11-28 10:08       ` Jon Medhurst (Tixy)
2014-11-28 10:08         ` Jon Medhurst (Tixy)
2014-11-28 10:43         ` Masami Hiramatsu
2014-11-28 10:43           ` Re: " Masami Hiramatsu
2014-11-28 11:13         ` Russell King - ARM Linux
2014-11-28 11:13           ` Russell King - ARM Linux
2014-11-28 11:17           ` Jon Medhurst (Tixy)
2014-11-28 11:17             ` Jon Medhurst (Tixy)
2014-11-29  1:28     ` Wang Nan
2014-11-29  1:28       ` Wang Nan
2014-12-01  1:29     ` Wang Nan
2014-12-01  1:29       ` Wang Nan
2014-12-01  8:59       ` Wang Nan [this message]
2014-12-01  8:59         ` Wang Nan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=547C2DFE.7010005@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.