public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: masami.hiramatsu.pt@hitachi•com (Masami Hiramatsu)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/2] arm64: Make all entry code as non-kprobe-able
Date: Mon, 06 Jul 2015 20:03:17 +0900	[thread overview]
Message-ID: <559A6075.5070502@hitachi.com> (raw)
In-Reply-To: <683f80cef9b2b778be868e77b01a245585448a86.1436158027.git.panand@redhat.com>

On 2015/07/06 14:03, Pratyush Anand wrote:
> Entry symbols are not kprobe safe. So blacklist them for kprobing.

As I've said, you can also use _ASM_NOKPROBE().
This patch itself looks good to me, but I'd like to ask arm64
maintainers' opinion, whether they accept introducing entry-text
section only for this purpose or not.

Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi•com>

Thank you,

> 
> Signed-off-by: Pratyush Anand <panand@redhat•com>
> ---
>  arch/arm64/kernel/entry.S       | 3 +++
>  arch/arm64/kernel/kprobes.c     | 9 +++++++++
>  arch/arm64/kernel/vmlinux.lds.S | 1 +
>  3 files changed, 13 insertions(+)
> 
> diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
> index a7691a378668..2ea24f6bc06b 100644
> --- a/arch/arm64/kernel/entry.S
> +++ b/arch/arm64/kernel/entry.S
> @@ -202,6 +202,7 @@ tsk	.req	x28		// current thread_info
>   * Exception vectors.
>   */
>  
> +	.section ".entry.text", "ax"
>  	.align	11
>  ENTRY(vectors)
>  	ventry	el1_sync_invalid		// Synchronous EL1t
> @@ -737,3 +738,5 @@ ENTRY(sys_rt_sigreturn_wrapper)
>  	mov	x0, sp
>  	b	sys_rt_sigreturn
>  ENDPROC(sys_rt_sigreturn_wrapper)
> +
> +	.section ".text", "ax"
> diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
> index 6c9f8b5f04ce..9bc02c151f7f 100644
> --- a/arch/arm64/kernel/kprobes.c
> +++ b/arch/arm64/kernel/kprobes.c
> @@ -28,6 +28,7 @@
>  #include <asm/debug-monitors.h>
>  #include <asm/system_misc.h>
>  #include <asm/insn.h>
> +#include <asm-generic/sections.h>
>  
>  #include "kprobes.h"
>  #include "kprobes-arm64.h"
> @@ -661,6 +662,14 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p)
>  	return 0;
>  }
>  
> +bool arch_within_kprobe_blacklist(unsigned long addr)
> +{
> +	return  (addr >= (unsigned long)__kprobes_text_start &&
> +		 addr < (unsigned long)__kprobes_text_end) ||
> +		(addr >= (unsigned long)__entry_text_start &&
> +		 addr < (unsigned long)__entry_text_end);
> +}
> +
>  int __init arch_init_kprobes(void)
>  {
>  	return 0;
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> index 1fa6adc7aa83..11fb2b0117d0 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
> @@ -97,6 +97,7 @@ SECTIONS
>  			*(.exception.text)
>  			__exception_text_end = .;
>  			IRQENTRY_TEXT
> +			ENTRY_TEXT
>  			TEXT_TEXT
>  			SCHED_TEXT
>  			LOCK_TEXT
> 


-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt at hitachi.com

  reply	other threads:[~2015-07-06 11:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06  5:03 [PATCH 0/2] arm64: some symbols blacklisted for kprobing Pratyush Anand
2015-07-06  5:03 ` [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols Pratyush Anand
2015-07-06  9:03   ` Will Deacon
2015-07-06 10:48     ` Pratyush Anand
2015-07-06 11:56       ` Masami Hiramatsu
2015-07-06 11:37     ` Masami Hiramatsu
2015-07-06 14:42       ` William Cohen
2015-07-06 11:11   ` Masami Hiramatsu
2015-07-06 11:49     ` Pratyush Anand
2015-07-09 13:53       ` Pratyush Anand
2015-07-06  5:03 ` [PATCH 2/2] arm64: Make all entry code as non-kprobe-able Pratyush Anand
2015-07-06 11:03   ` Masami Hiramatsu [this message]
2015-07-06 11:54     ` Pratyush Anand

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=559A6075.5070502@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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