Bug 243884 - exp-ptrcheck: the 'impossible happened: unhandled syscall sysno = 277 (mq_open)
Summary: exp-ptrcheck: the 'impossible happened: unhandled syscall sysno = 277 (mq_open)
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: sgcheck (show other bugs)
Version: 3.6 SVN
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-07 20:59 UTC by David Fenger
Modified: 2012-08-10 14:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Fenger 2010-07-07 20:59:17 UTC
Version:           3.6 SVN (using Devel) 
OS:                Linux

Despite support for mq_open (and all of mqueue.h) in Valgrind core, exp-ptrcheck does not handle mq_open, mq_unlink, etc.

This is due to the way that setup_post_syscall_table explicitly adds all the syscalls to be handled.

To allow programs using mq_* to work, add the following block anywhere in setup_post_syscall_table (in exp-ptrcheck/h_main.c) (I added at line 2480, at the end of the ADD(0,*) block)

#     if defined(__NR_mq_open)
      ADD(0, __NR_mq_open);
      ADD(0, __NR_mq_unlink);
      ADD(0, __NR_mq_timedsend);
      ADD(0, __NR_mq_timedreceive);
      ADD(0, __NR_mq_notify);
      ADD(0, __NR_mq_getsetattr);
#     endif

As far as I understand, the leading 0 is appropriate to all the mq_ calls, as none return a pointer.



Reproducible: Didn't try

Steps to Reproduce:
Run valgrind --tool=exp-ptrcheck on any executable that calls mq_open().

Actual Results:  
The tool terminates, printing sysno = 277 (in the case of mq_open) before dumping a stack trace.

Expected Results:  
Expected to be able to test a program using mq_open and related calls.

The above code-block solves the problem on my system
(Linux ubuntu-df 2.6.31-22-generic #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010 i686 GNU/Linux)

I think the #ifdef makes it suitably generic, but have no practical means to test that.
Comment 1 Julian Seward 2010-10-06 13:25:18 UTC
Committed, r11396.  Thanks.