public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Re: Testing insn.block probe point uncovers possible utrace bug
       [not found] <49D2ADB2.3030304@us.ibm.com>
@ 2009-04-01  0:36 ` Roland McGrath
  0 siblings, 0 replies; only message in thread
From: Roland McGrath @ 2009-04-01  0:36 UTC (permalink / raw)
  To: Maynard Johnson; +Cc: systemtap, utrace-devel

The bug is in your module's unconditional use of UTRACE_*STEP.
It's documented that it's invalid to use them unless arch_has_*_step()
has returned true.  (The utrace_resume_action description refers you 
to utrace_control(), where this is documented.)

It's a bug to use these at all when the corresponding arch_has_*_step()
check returns false.  utrace_control() helps you out with this a bit more
by using WARN_ON, and returns -EOPNOTSTUPP if even single-step is not
there.  The warning spew is there to make sure you know this is a bug in
your module and it's just being overly extra nice not to crash on you.
(You would be entirely wrong to expect this return value and think it
was ever valid to make this call.)

There is no place for post-callback processing to return an error.  I've
now made it use WARN_ON there consistent with what utrace_control() does.
For UTRACE_BLOCKSTEP, you'll get the WARN_ON spew and then it will fall
back to treating it as UTRACE_SINGLESTEP.  (This is what utrace_control()
always did.)

What your module needs to do is check arch_has_*_step() correctly.  When
the feature you want is not there, gracefully tell your users you can't do
it.  Your module today is wrong on every architecture, even 32-bit x86
where it happens to work on every chip you are likely to test.

As to the powerpc implementation, that is a subject for the powerpc
maintainers (linuxppc-dev@ozlabs.org et al) and is orthogonal to utrace.
Take it up with them.  I gave them a patch long ago and it got stalled
waiting for them to figure out which chips really have the feature so the
arch_has_block_step() definition could be made perfect.


Thanks,
Roland

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-04-01  0:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <49D2ADB2.3030304@us.ibm.com>
2009-04-01  0:36 ` Testing insn.block probe point uncovers possible utrace bug Roland McGrath

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