Skip to content

Commit

Permalink
Fix regression tests (#737)
Browse files Browse the repository at this point in the history
* Whitespace diffs.

Committing separate from other changes.

* Ensure PT_CHARBUF extracts set length.

Ensure that all PT_CHARBUF filtercheck extracts set the length of the
string they return. Although the strings they return are usually
null-terminated, they may not always be null terminated, which causes
problems in the chisel api when returning the strings to lua.

This is half of the fix for #736.

* Don't rely on PT_CHARBUFs being null terminated.

Use lua_pushlstring to return extracted PT_CHARBUFs to lua. This way,
even if a charbuf isn't null terminated it won't go past the end of the buffer.

This is half of the fix for #736.

* Properly initialize clone_ts.

Initialize clone_ts when using a stack-residing scap_threadinfo to read
from a proclist. Otherwise, when reading from an old trace file the
initial clone_ts could be invalid, causing this difference in the
proc_exec_time chisel:

diff -r /tmp/sysdig.NzoD98EsyQ/results/proc_exec_time/wordpress.scap.output /tmp/sysdig.NzoD98EsyQ/baseline/proc_exec_time/wordpress.scap.output
3d2
< 1425066765.22 sleep        0.1
  • Loading branch information
mstemm committed Jan 26, 2017
1 parent 4931ac6 commit 386f6b8
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 65 deletions.
1 change: 1 addition & 0 deletions userspace/libscap/scap_savefile.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ static int32_t scap_read_proclist(scap_t *handle, gzFile f, uint32_t block_lengt
tinfo.filtered_out = 0;
tinfo.root[0] = 0;
tinfo.sid = -1;
tinfo.clone_ts = 0;

while(((int32_t)block_length - (int32_t)totreadsize) >= 4)
{
Expand Down
Loading

0 comments on commit 386f6b8

Please sign in to comment.