From: Laura Abbott <lauraa@codeaurora.org>
To: Rabin Vincent <rabin@rab.in>, linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, mitchelh@codeaurora.org
Subject: Re: [PATCH] arm: ftrace: work with CONFIG_DEBUG_SET_MODULE_RONX
Date: Wed, 02 Apr 2014 18:04:29 -0700 [thread overview]
Message-ID: <533CB39D.2030509@codeaurora.org> (raw)
In-Reply-To: <1396476619-15386-1-git-send-email-rabin@rab.in>
On 4/2/2014 3:10 PM, Rabin Vincent wrote:
> Make ftrace work with CONFIG_DEBUG_SET_MODULE_RONX by making module text
> writable around the place where ftrace does its work, like it is done on
> x86 in the patch which introduced CONFIG_DEBUG_SET_MODULE_RONX,
> 84e1c6bb38eb ("x86: Add RO/NX protection for loadable kernel modules").
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
> ---
> arch/arm/kernel/ftrace.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
> index 34e5664..70ce654 100644
> --- a/arch/arm/kernel/ftrace.c
> +++ b/arch/arm/kernel/ftrace.c
> @@ -14,6 +14,7 @@
>
> #include <linux/ftrace.h>
> #include <linux/uaccess.h>
> +#include <linux/module.h>
>
> #include <asm/cacheflush.h>
> #include <asm/opcodes.h>
> @@ -63,6 +64,18 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
> }
> #endif
>
> +int ftrace_arch_code_modify_prepare(void)
> +{
> + set_all_modules_text_rw();
> + return 0;
> +}
> +
> +int ftrace_arch_code_modify_post_process(void)
> +{
> + set_all_modules_text_ro();
> + return 0;
> +}
> +
> static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
> {
> return arm_gen_branch_link(pc, addr);
>
I think Mitch tested this on our internal targets. I'll let him reply with his Tested-by
Laura
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2014-04-03 1:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-02 22:10 [PATCH] arm: ftrace: work with CONFIG_DEBUG_SET_MODULE_RONX Rabin Vincent
2014-04-03 1:04 ` Laura Abbott [this message]
2014-04-03 16:26 ` Mitchel Humpherys
2014-04-04 23:55 ` Kees Cook
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=533CB39D.2030509@codeaurora.org \
--to=lauraa@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mitchelh@codeaurora.org \
--cc=rabin@rab.in \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox