All of lore.kernel.org
 help / color / mirror / Atom feed
From: panand@redhat.com (Pratyush Anand)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols
Date: Mon, 6 Jul 2015 17:19:20 +0530	[thread overview]
Message-ID: <20150706114920.GB17305@dhcppc13.redhat.com> (raw)
In-Reply-To: <559A6257.60608@hitachi.com>

On 06/07/2015:08:11:19 PM, Masami Hiramatsu wrote:
> On 2015/07/06 14:03, Pratyush Anand wrote:
> > Add all function symbols which are called from do_debug_exception under
> > NOKPROBE_SYMBOL, as they can not kprobed.
> 
> Could you tell me how you checked that? from the code?

Well.. I found out that some of the symbol like single_step_handler
does not allow kprobing, and then it seemed logical to me that we
should not allow kprobing of any symbols which are called in the path
of do_debug_exception. So, manually :( I reviewed the code and put
NOKPROBE_SYMBOL across all those.

However, now I am doing some more tests  and as I said in previous
reply, there are still few symbols like (_mcount) which is creating
problem with following simple test and I need to look into that. In
case of _mcount, I do not see any print and its complete freeze.

#!/bin/sh
grep ' [tT] ' /proc/kallsyms | fgrep -v '[' | awk '{print $3}' > syms.list
count=0
for i in `cat syms.list`;
do
	if [ $count == 0 ]
	then
    		echo 0 > /sys/kernel/debug/tracing/events/enable
		echo > /sys/kernel/debug/tracing/kprobe_events
		cat /sys/kernel/debug/tracing/kprobe_events
	fi
	count=`expr $count + 1`;
	echo "p $i" >> /sys/kernel/debug/tracing/kprobe_events ;
	echo $i $count;
	if [ $count == 100 ]
	then
		cat /sys/kernel/debug/tracing/kprobe_events
		echo 1 >  /sys/kernel/debug/tracing/events/enable
		sleep 1
		cat /sys/kernel/debug/tracing/trace
		count=0
	fi
done

I understand that above test does not make sure that kprobed function
is called during test. Since at present this basic test is not
running, so I am not doing anything to exercise more and more kernel
paths.  May be I will do that as second step..In fact at present, no
idea how can be done that extensively.

~Pratyush

WARNING: multiple messages have this Message-ID (diff)
From: Pratyush Anand <panand@redhat.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
	catalin.marinas@arm.com, will.deacon@arm.com,
	linux-kernel@vger.kernel.org, wcohen@redhat.com,
	dave.long@linaro.org, steve.capper@linaro.org
Subject: Re: [PATCH 1/2] arm64: Blacklist non-kprobe-able symbols
Date: Mon, 6 Jul 2015 17:19:20 +0530	[thread overview]
Message-ID: <20150706114920.GB17305@dhcppc13.redhat.com> (raw)
In-Reply-To: <559A6257.60608@hitachi.com>

On 06/07/2015:08:11:19 PM, Masami Hiramatsu wrote:
> On 2015/07/06 14:03, Pratyush Anand wrote:
> > Add all function symbols which are called from do_debug_exception under
> > NOKPROBE_SYMBOL, as they can not kprobed.
> 
> Could you tell me how you checked that? from the code?

Well.. I found out that some of the symbol like single_step_handler
does not allow kprobing, and then it seemed logical to me that we
should not allow kprobing of any symbols which are called in the path
of do_debug_exception. So, manually :( I reviewed the code and put
NOKPROBE_SYMBOL across all those.

However, now I am doing some more tests  and as I said in previous
reply, there are still few symbols like (_mcount) which is creating
problem with following simple test and I need to look into that. In
case of _mcount, I do not see any print and its complete freeze.

#!/bin/sh
grep ' [tT] ' /proc/kallsyms | fgrep -v '[' | awk '{print $3}' > syms.list
count=0
for i in `cat syms.list`;
do
	if [ $count == 0 ]
	then
    		echo 0 > /sys/kernel/debug/tracing/events/enable
		echo > /sys/kernel/debug/tracing/kprobe_events
		cat /sys/kernel/debug/tracing/kprobe_events
	fi
	count=`expr $count + 1`;
	echo "p $i" >> /sys/kernel/debug/tracing/kprobe_events ;
	echo $i $count;
	if [ $count == 100 ]
	then
		cat /sys/kernel/debug/tracing/kprobe_events
		echo 1 >  /sys/kernel/debug/tracing/events/enable
		sleep 1
		cat /sys/kernel/debug/tracing/trace
		count=0
	fi
done

I understand that above test does not make sure that kprobed function
is called during test. Since at present this basic test is not
running, so I am not doing anything to exercise more and more kernel
paths.  May be I will do that as second step..In fact at present, no
idea how can be done that extensively.

~Pratyush

  reply	other threads:[~2015-07-06 11:49 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
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 [this message]
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=20150706114920.GB17305@dhcppc13.redhat.com \
    --to=panand@redhat.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.