Bug 7045 - user-space probe x86 on x86-64 host
Summary: user-space probe x86 on x86-64 host
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-24 15:57 UTC by Frank Ch. Eigler
Modified: 2009-03-27 17:04 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Ch. Eigler 2008-11-24 15:57:52 UTC
Current checks in tapsets.cxx:validate_module_elf do not consider
the valid possibility of probing an x86 binary on an x86-64 kernel,
and unfairly rejects debuginfo/elf processing for them.

(The same problem probably exists on ppc.)
Comment 1 Wenji Huang 2008-12-03 08:47:27 UTC
sorry, don't catch it well. I tried simple test on FC9-64 bits.
gcc -m32 -o /tmp/test /tmp/test.c
/tmp/test&
stap -vvve 'probe process("/tmp/test").syscall{}' 

Everything is OK. And validate_module_elf wasn't be called neither.

Could you elaborate it a little or provide some test cases? 
Comment 2 Frank Ch. Eigler 2008-12-05 17:06:41 UTC
(In reply to comment #1)
> Could you elaborate it a little or provide some test cases? 

On my fc9 x86-64 machine, I get this.  Maybe your 'gcc -m32' doesn't work?

[12:03:46] % cat > hello.c
int main () {
}

[12:04:30] % gcc -g -m32 hello.c -o hello

[12:04:33] % file hello
hello: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically
linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

[12:04:34] % sudo ./stap -e 'probe process("./hello").function("*").call {}' -vwt
Pass 1: parsed user script and 47 library script(s) in 160usr/20sys/178real ms.
semantic error: ELF machine i?86 (code 3) mismatch with target x86_64 in
'/home/fche/Private/DEVEL/DEVEL-systemtap/git/BUILD/hello'
semantic error: no match while resolving probe point
process("./hello").function("*").call
semantic error: no probes found
Pass 2: analyzed script: 0 probe(s), 0 function(s), 0 embed(s), 0 global(s) in
0usr/0sys/3real ms.
Pass 2: analysis failed.  Try again with another '--vp 01' option.
Comment 3 Jim Keniston 2008-12-05 20:39:01 UTC
It's broken as described by FChE on my x86_64 system, too.  powerpc was
similarly broken (PR 6946), but I fixed it.  Unfortunately, that fix won't work
for the x86 problem.
Comment 4 Wenji Huang 2008-12-08 03:24:21 UTC
Yeah
stap -e 'probe process("./hello").function("*").call {}'  failed due to
mismatched elf.
But 
stap -e 'probe process("./hello").syscall {}'  gets rid of the checking  elf.

Comment 5 David Smith 2008-12-08 15:33:55 UTC
(In reply to comment #4)
> Yeah
> stap -e 'probe process("./hello").function("*").call {}'  failed due to
> mismatched elf.
>
> But 
> stap -e 'probe process("./hello").syscall {}'  gets rid of the checking  elf.

Here's a small clarification of the last example above (the ".syscall" one). 
That example doesn't check the debuginfo because it doesn't need debuginfo
(internally that example uses utrace which doesn't require debuginfo).  So, the
fact that the .syscall probe doesn't check matching debuginfo is by design.
Comment 6 Frank Ch. Eigler 2009-03-27 17:04:05 UTC
commit 756c946