Bug 16894 - SIGSEGV upon using stap -c commands with ||, &&, etc...
Summary: SIGSEGV upon using stap -c commands with ||, &&, etc...
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Jonathan Lebon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-01 20:59 UTC by Jonathan Lebon
Modified: 2014-05-02 14:24 UTC (History)
2 users (show)

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 Jonathan Lebon 2014-05-01 20:59:54 UTC
The following causes a SIGSEGV:

$ stap -e 'probe process.function("main") { next }' -c 'ls || true'
Segmentation fault (core dumped)
$

Please fix.
Comment 1 Jonathan Lebon 2014-05-02 14:24:07 UTC
Fixed in these commits:

eb94071 2014-05-01 Jonathan Lebon cmd_file(): properly free the words array
1dfff0a 2014-05-01 Jonathan Lebon cmd_file(): only free words if succeeded

Added testcase systemtap.base/wordexp.exp as a basic sanity check so something like this doesn't happen again.

Also improved error message on failure:

BEFORE:

$ stap -e 'probe process.function("foo") { next }' -c 'ls || true'
semantic error: while resolving probe point: identifier 'process' at <input>:1:7
        source: probe process.function("foo") { next }
                      ^

semantic error: process probe is invalid without a -c COMMAND
Pass 2: analysis failed.  [man error::pass2]
$
$ stap -e 'probe process.function("foo") { next }'
semantic error: while resolving probe point: identifier 'process' at <input>:1:7
        source: probe process.function("foo") { next }
                      ^

semantic error: process probe is invalid without a -c COMMAND
Pass 2: analysis failed.  [man error::pass2]
$

AFTER:

$ stap -e 'probe process.function("foo") { next }' -c 'ls || true'
semantic error: while resolving probe point: identifier 'process' at <input>:1:7
        source: probe process.function("foo") { next }
                      ^

semantic error: invalid -c command for unspecified process probe [man stapprobes]
semantic error: command contains illegal characters
Pass 2: analysis failed.  [man error::pass2]
$
$ stap -e 'probe process.function("foo") { next }'
semantic error: while resolving probe point: identifier 'process' at <input>:1:7
        source: probe process.function("foo") { next }
                      ^

semantic error: unspecified process probe is invalid without a -c COMMAND [man stapprobes]
Pass 2: analysis failed.  [man error::pass2]
$