All of lore.kernel.org
 help / color / mirror / Atom feed
From: masami.hiramatsu.pt@hitachi.com (Masami Hiramatsu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols
Date: Mon, 06 Jul 2015 20:56:59 +0900	[thread overview]
Message-ID: <559A6D0B.9040201@hitachi.com> (raw)
In-Reply-To: <20150706104815.GA17305@dhcppc13.redhat.com>

On 2015/07/06 19:48, Pratyush Anand wrote:
> On 06/07/2015:10:03:24 AM, Will Deacon wrote:
>> On Mon, Jul 06, 2015 at 06:03:21AM +0100, Pratyush Anand wrote:
>>> Add all function symbols which are called from do_debug_exception under
>>> NOKPROBE_SYMBOL, as they can not kprobed.
>>
>> It's a shame this has to be so manual, but I suppose it's done on a
>> best-effort basis to catch broken probe placement.
>>
>> If we miss a function and somebody probes it, do we just get stuck in a
>> recursive exception, or could we print something suggesting that a symbol
>> be annotated as NOKPROBE?
> 
> In some cases we land into a recursive reenter_kprobe:
> 
> echo "p kfree" > /sys/kernel/debug/tracing/kprobe_events
> echo "p single_step_handler" >> /sys/kernel/debug/tracing/kprobe_events
> echo 1 >  /sys/kernel/debug/tracing/events/enable
> 
> [  116.904194] BUG: failure at
> .../arch/arm64/kernel/kprobes.c:288/reenter_kprobe()!
> 
> In some other 
> echo "p kfree" > /sys/kernel/debug/tracing/kprobe_events
> echo "p el0_sync" >> /sys/kernel/debug/tracing/kprobe_events
> echo 1 >  /sys/kernel/debug/tracing/events/enable
> 
> Infinite loop of:
> [  142.731336] Unexpected kernel single-step exception at EL1
> 
> In 1st case currently only address is printed.
> pr_warn("Unrecoverable kprobe detected at %p.\n", p->addr);
> So, while in 1st case we may also print name of symbol, we can not do
> much in second case.

Ah, that's a good point of aarch64 :)

> Now, I am running some test with all the symbols in /proc/kallsyms and
> I noticed that there might be few more symbols which may not allow
> kprobing. So, may be I will resend this series with updates.

Sounds good to me :)

Thank you for testing!

-- 
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

WARNING: multiple messages have this Message-ID (diff)
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Pratyush Anand <panand@redhat.com>, Will Deacon <will.deacon@arm.com>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"wcohen@redhat.com" <wcohen@redhat.com>,
	"dave.long@linaro.org" <dave.long@linaro.org>,
	"steve.capper@linaro.org" <steve.capper@linaro.org>
Subject: Re: Re: [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols
Date: Mon, 06 Jul 2015 20:56:59 +0900	[thread overview]
Message-ID: <559A6D0B.9040201@hitachi.com> (raw)
In-Reply-To: <20150706104815.GA17305@dhcppc13.redhat.com>

On 2015/07/06 19:48, Pratyush Anand wrote:
> On 06/07/2015:10:03:24 AM, Will Deacon wrote:
>> On Mon, Jul 06, 2015 at 06:03:21AM +0100, Pratyush Anand wrote:
>>> Add all function symbols which are called from do_debug_exception under
>>> NOKPROBE_SYMBOL, as they can not kprobed.
>>
>> It's a shame this has to be so manual, but I suppose it's done on a
>> best-effort basis to catch broken probe placement.
>>
>> If we miss a function and somebody probes it, do we just get stuck in a
>> recursive exception, or could we print something suggesting that a symbol
>> be annotated as NOKPROBE?
> 
> In some cases we land into a recursive reenter_kprobe:
> 
> echo "p kfree" > /sys/kernel/debug/tracing/kprobe_events
> echo "p single_step_handler" >> /sys/kernel/debug/tracing/kprobe_events
> echo 1 >  /sys/kernel/debug/tracing/events/enable
> 
> [  116.904194] BUG: failure at
> .../arch/arm64/kernel/kprobes.c:288/reenter_kprobe()!
> 
> In some other 
> echo "p kfree" > /sys/kernel/debug/tracing/kprobe_events
> echo "p el0_sync" >> /sys/kernel/debug/tracing/kprobe_events
> echo 1 >  /sys/kernel/debug/tracing/events/enable
> 
> Infinite loop of:
> [  142.731336] Unexpected kernel single-step exception at EL1
> 
> In 1st case currently only address is printed.
> pr_warn("Unrecoverable kprobe detected at %p.\n", p->addr);
> So, while in 1st case we may also print name of symbol, we can not do
> much in second case.

Ah, that's a good point of aarch64 :)

> Now, I am running some test with all the symbols in /proc/kallsyms and
> I noticed that there might be few more symbols which may not allow
> kprobing. So, may be I will resend this series with updates.

Sounds good to me :)

Thank you for testing!

-- 
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@hitachi.com

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

Thread overview: 26+ 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 ` Pratyush Anand
2015-07-06  5:03 ` [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols Pratyush Anand
2015-07-06  5:03   ` Pratyush Anand
2015-07-06  9:03   ` Will Deacon
2015-07-06  9:03     ` Will Deacon
2015-07-06 10:48     ` Pratyush Anand
2015-07-06 10:48       ` Pratyush Anand
2015-07-06 11:56       ` Masami Hiramatsu [this message]
2015-07-06 11:56         ` Masami Hiramatsu
2015-07-06 11:37     ` Masami Hiramatsu
2015-07-06 11:37       ` Masami Hiramatsu
2015-07-06 14:42       ` William Cohen
2015-07-06 14:42         ` William Cohen
2015-07-06 11:11   ` Masami Hiramatsu
2015-07-06 11:11     ` Masami Hiramatsu
2015-07-06 11:49     ` Pratyush Anand
2015-07-06 11:49       ` Pratyush Anand
2015-07-09 13:53       ` 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  5:03   ` Pratyush Anand
2015-07-06 11:03   ` Masami Hiramatsu
2015-07-06 11:03     ` Masami Hiramatsu
2015-07-06 11:54     ` Pratyush Anand
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=559A6D0B.9040201@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.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.