public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: David Long <dave.long@linaro.org>, systemtap@sourceware.org
Cc: Pratyush Anand <panand@redhat.com>
Subject: Re: Recent aarch64 kprobes and uprobes patch systemtap testing
Date: Fri, 11 Dec 2015 20:59:00 -0000	[thread overview]
Message-ID: <566B3949.2090900@redhat.com> (raw)
In-Reply-To: <5669EABE.7040507@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 4811 bytes --]

On 12/10/2015 04:12 PM, David Long wrote:
> On 12/10/2015 03:24 PM, William Cohen wrote:

>> The fslatency-nd and fsslower-nd tests need further investigation:
>>
>> PASS: ./systemtap.examples/lwtools/fslatency-nd build
>> meta taglines 'test_installcheck: stap fslatency-nd.stp 1 1' tag 'test_installcheck' value 'stap fslatency-nd.stp 1 1'
>> attempting command stap fslatency-nd.stp 1 1
>> OUT ERROR: read fault [man error::fault] at 0x0000000000000034 (addr) near operator '@cast' at fslatency-nd.stp:66:15
>> Tracing FS sync reads and writes... Output every 1 secs.
>> WARNING: Number of errors: 1, skipped probes: 1
>> WARNING: /root/systemtap_write/install/bin/staprun exited with status: 1
>> Pass 5: run failed.  [man error::pass5]
>> child process exited abnormally
>> RC 1
>> FAIL: ./systemtap.examples/lwtools/fslatency-nd run
>>
>> PASS: ./systemtap.examples/lwtools/fsslower-nd build
>> meta taglines 'test_installcheck: stap fsslower-nd.stp -c "sleep 1"' tag 'test_installcheck' value 'stap fsslower-nd.stp -c "sleep 1"'
>> attempting command stap fsslower-nd.stp -c "sleep 1"
>> OUT ERROR: read fault [man error::fault] at 0x0000000000000034 (addr) near operator '@cast' at fsslower-nd.stp:68:15
>> Tracing FS sync reads and writes slower than 10 ms... Hit Ctrl-C to end.
>> TIME     PID    COMM             FUNC           SIZE     LAT(ms)
>> WARNING: Number of errors: 1, skipped probes: 1
>> WARNING: /root/systemtap_write/install/bin/staprun exited with status: 1
>> Pass 5: run failed.  [man error::pass5]
>> child process exited abnormally
>> RC 1
>> FAIL: ./systemtap.examples/lwtools/fsslower-nd run

> 
> Cool. Wish I could make sense of systemtap error messages.
> 
>  At Will Deacon's suggested I tested probing the instruction in __copy_to_user that can cause a captured kernel exception when an application passes in a bad buffer address.  Unfortunately the result was a hang.  So copy_to/from user is going to have to be blacklisted for now, unless there turns out to be a simple fix. I'm worried there might be other places in the kernel where an otherwise probeable instruction might be expected to generate an exception.
> 
> -dl
> 
> 
> 

Hi Dave and Pratyush,

I did some more experimentation with the fslatency-nd and fsslow-nd tests to see what is going on.  The problem seems to be related to the return probes.  I have a small reproducer attached which runs fine on x86_64 machine.  However on aarch64 it has the bogus read because some of the argument registers have changed value

# ../install/bin/stap ./aarch64_retkprobe_issue2.stp 
ERROR: read fault [man error::fault] at 0x0000000000000034 (addr) near operator '@cast' at ./aarch64_retkprobe_issue2.stp:13:7
pc : [<fffffe000021e37c>] lr : [<fffffe000021eb64>] pstate: 80000145
sp : fffffe00bad7be30
x29: fffffe00bad7be30 x28: fffffe00bad78000 
x27: fffffe0000912000 x26: 000000000000003f 
x25: 000000000000011d x24: 0000000000000015 
x23: 0000000080000000 x22: 000003fff82b9760 
x21: fffffe00bad7bec8 x20: 0000000000002004 
x19: fffffe01b716e100 x18: 000003fff82b8160 
x17: 000003ff849bf0a0 x16: fffffe000021f4a0 
x15: 0000000000000004 x14: 000003fff82bb910 
x13: 0000000000000001 x12: 000003ff7d75f200 
x11: 00000000003d0f00 x10: 000003ff849b7af4 
x9 : 0000000000000028 x8 : 0000000000000020 
x7 : fffffe00bc5c3600 x6 : 0000000000000000 
x5 : 0000000000000000 x4 : 0000000000000000 
x3 : fffffe00bad7bec8 x2 : 0000000000002004 
x1 : 000003fff82b9760 x0 : fffffe01b716e100 

pc : [<fffffe000021e37c>] lr : [<fffffe000009fbe0>] pstate: 60000145
sp : fffffe00bad7be30
x29: fffffe00bad7be30 x28: fffffe00bad78000 
x27: fffffe0000912000 x26: 000000000000003f 
x25: 000000000000011d x24: 0000000000000015 
x23: 0000000080000000 x22: 000003fff82b9760 
x21: fffffe00bad7bec8 x20: 0000000000002004 
x19: fffffe01b716e100 x18: 000003fff82b8160 
x17: 000003ff849bf0a0 x16: fffffe000021f4a0 
x15: 0000000000000004 x14: 000003fff82bb910 
x13: 0000000000000001 x12: 000003ff7d75f200 
x11: 00000000003d0f00 x10: 000003ff849b7af4 
x9 : 0000000000000028 x8 : 0000000000000020 
x7 : fffffe00bc5c3600 x6 : 000003fff82b976c 
x5 : 000003fff82b976c x4 : 0000000000000000 
x3 : 0000000000000000 x2 : 0000000000000000 
x1 : 0000000000000000 x0 : 000000000000000c 

WARNING: Number of errors: 1, skipped probes: 1
WARNING: /root/systemtap_write/install/bin/staprun exited with status: 1
Pass 5: run failed.  [man error::pass5]

Comment the return probe with a '#' at the beginning of the line with "kprobe.function("__vfs_read").return," and the script runs fine.  The systemtap pointer_arg() doesn't take into account that the register might be used as a scratch register and the value changed after entry into the function.  This is an issue with the systemtap scripts. I have patched the systemtap scripts to addresss this issue..

-Will

[-- Attachment #2: aarch64_retkprobe_issue2.stp --]
[-- Type: text/plain, Size: 473 bytes --]

# The return probe appears to cause this reproducer to crash
# kprobe.function("__vfs_read").return causes a read fault
# comment out the kprobe.function("__vfs_read").return and the
# script runs without error
probe
      kprobe.function("__vfs_read").return,
      kprobe.function("__vfs_read")
{
	# Skip the call if new_sync_read() wouldn't be called.
	file = pointer_arg(1)
	if (file) {
		print_regs();
 		if(@cast(file, "file")->f_op->read) {
			next
		}
	}
	exit()
}

  parent reply	other threads:[~2015-12-11 20:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 20:24 William Cohen
2015-12-10 21:12 ` David Long
2015-12-11  4:19   ` Pratyush Anand
2015-12-11  4:43     ` David Long
2015-12-11 17:02   ` William Cohen
2015-12-16  5:22     ` Pratyush Anand
2015-12-16 13:14       ` William Cohen
2015-12-17  0:53         ` Pratyush Anand
2015-12-11 20:59   ` William Cohen [this message]
2015-12-16 11:55     ` Pratyush Anand
2015-12-16 13:10       ` William Cohen
2015-12-10 21:17 ` David Long
2015-12-11 17:23 ` David Smith

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=566B3949.2090900@redhat.com \
    --to=wcohen@redhat.com \
    --cc=dave.long@linaro.org \
    --cc=panand@redhat.com \
    --cc=systemtap@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).