Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1400130 > unrolled thread
| Started by | James Morse <james.morse@arm.com> |
|---|---|
| First post | 2016-05-12 17:00 +0200 |
| Last post | 2016-05-26 17:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v12 06/10] arm64: Treat all entry code as non-kprobe-able James Morse <james.morse@arm.com> - 2016-05-12 17:00 +0200
Re: [PATCH v12 06/10] arm64: Treat all entry code as non-kprobe-able David Long <dave.long@linaro.org> - 2016-05-20 07:30 +0200
Re: [PATCH v12 06/10] arm64: Treat all entry code as non-kprobe-able David Long <dave.long@linaro.org> - 2016-05-26 17:30 +0200
| From | James Morse <james.morse@arm.com> |
|---|---|
| Date | 2016-05-12 17:00 +0200 |
| Subject | Re: [PATCH v12 06/10] arm64: Treat all entry code as non-kprobe-able |
| Message-ID | <ry0fM-80O-19@gated-at.bofh.it> |
Hi David, Pratyush
On 27/04/16 19:53, David Long wrote:
> From: Pratyush Anand <panand@redhat.com>
>
> Entry symbols are not kprobe safe. So blacklist them for kprobing.
>
> Signed-off-by: Pratyush Anand <panand@redhat.com>
> diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
> index dfa1b1f..6a1292b 100644
> --- a/arch/arm64/kernel/kprobes.c
> +++ b/arch/arm64/kernel/kprobes.c
> @@ -29,6 +29,7 @@
> #include <asm/system_misc.h>
> #include <asm/insn.h>
> #include <asm/uaccess.h>
> +#include <asm-generic/sections.h>
>
> #include "kprobes-arm64.h"
>
> @@ -514,6 +515,15 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
> return 1;
> }
>
> +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) ||
> + !!search_exception_tables(addr);
> +}
> +
Looking at __kvm_hyp_vector, we don't have support for handling breakpoints at
EL2, so we should forbid kprobing these address ranges too:
__hyp_text_start -> __hyp_text_end
__hyp_idmap_text_start -> __hyp_idmap_text_end
These can probably be guarded with is_kernel_in_hyp_mode(), if this is true then
we are running with VHE where this code runs at the same exception level as the
rest of the kernel, so we can probe them. (In this case you may want to add
'eret' to aarch64_insn_is_branch() in patch 2)
Probing things in the kernel idmap sounds dangerous! Lets blacklist that too:
__idmap_text_start -> __idmap_text_end
Thanks,
James
[toc] | [next] | [standalone]
| From | David Long <dave.long@linaro.org> |
|---|---|
| Date | 2016-05-20 07:30 +0200 |
| Message-ID | <rALax-1qG-11@gated-at.bofh.it> |
| In reply to | #1400130 |
On 05/12/2016 10:49 AM, James Morse wrote:
> Hi David, Pratyush
>
> On 27/04/16 19:53, David Long wrote:
>> From: Pratyush Anand <panand@redhat.com>
>>
>> Entry symbols are not kprobe safe. So blacklist them for kprobing.
>>
>> Signed-off-by: Pratyush Anand <panand@redhat.com>
>
>> diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
>> index dfa1b1f..6a1292b 100644
>> --- a/arch/arm64/kernel/kprobes.c
>> +++ b/arch/arm64/kernel/kprobes.c
>> @@ -29,6 +29,7 @@
>> #include <asm/system_misc.h>
>> #include <asm/insn.h>
>> #include <asm/uaccess.h>
>> +#include <asm-generic/sections.h>
>>
>> #include "kprobes-arm64.h"
>>
>> @@ -514,6 +515,15 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
>> return 1;
>> }
>>
>> +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) ||
>> + !!search_exception_tables(addr);
>> +}
>> +
>
> Looking at __kvm_hyp_vector, we don't have support for handling breakpoints at
> EL2, so we should forbid kprobing these address ranges too:
> __hyp_text_start -> __hyp_text_end
> __hyp_idmap_text_start -> __hyp_idmap_text_end
>
> These can probably be guarded with is_kernel_in_hyp_mode(), if this is true then
> we are running with VHE where this code runs at the same exception level as the
> rest of the kernel, so we can probe them. (In this case you may want to add
> 'eret' to aarch64_insn_is_branch() in patch 2)
>
OK.
>
> Probing things in the kernel idmap sounds dangerous! Lets blacklist that too:
> __idmap_text_start -> __idmap_text_end
>
OK.
>
>
> Thanks,
>
> James
>
[toc] | [prev] | [next] | [standalone]
| From | David Long <dave.long@linaro.org> |
|---|---|
| Date | 2016-05-26 17:30 +0200 |
| Message-ID | <rD5ou-86j-13@gated-at.bofh.it> |
| In reply to | #1400130 |
On 05/12/2016 10:49 AM, James Morse wrote:
> Hi David, Pratyush
>
> On 27/04/16 19:53, David Long wrote:
>> From: Pratyush Anand <panand@redhat.com>
>>
>> Entry symbols are not kprobe safe. So blacklist them for kprobing.
>>
>> Signed-off-by: Pratyush Anand <panand@redhat.com>
>
>> diff --git a/arch/arm64/kernel/kprobes.c b/arch/arm64/kernel/kprobes.c
>> index dfa1b1f..6a1292b 100644
>> --- a/arch/arm64/kernel/kprobes.c
>> +++ b/arch/arm64/kernel/kprobes.c
>> @@ -29,6 +29,7 @@
>> #include <asm/system_misc.h>
>> #include <asm/insn.h>
>> #include <asm/uaccess.h>
>> +#include <asm-generic/sections.h>
>>
>> #include "kprobes-arm64.h"
>>
>> @@ -514,6 +515,15 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
>> return 1;
>> }
>>
>> +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) ||
>> + !!search_exception_tables(addr);
>> +}
>> +
>
> Looking at __kvm_hyp_vector, we don't have support for handling breakpoints at
> EL2, so we should forbid kprobing these address ranges too:
> __hyp_text_start -> __hyp_text_end
> __hyp_idmap_text_start -> __hyp_idmap_text_end
>
> These can probably be guarded with is_kernel_in_hyp_mode(), if this is true then
> we are running with VHE where this code runs at the same exception level as the
> rest of the kernel, so we can probe them. (In this case you may want to add
> 'eret' to aarch64_insn_is_branch() in patch 2)
>
>
> Probing things in the kernel idmap sounds dangerous! Lets blacklist that too:
> __idmap_text_start -> __idmap_text_end
>
I've made these changes. I noticed there's no include file definitions
for these symbols so I've added local extern declarations in
arch_within_kprobe_blacklist().
Thanks,
-dl
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web