Bug 279378 - exp-ptrcheck: the 'impossible' happened on mkfifo call
Summary: exp-ptrcheck: the 'impossible' happened on mkfifo call
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: sgcheck (show other bugs)
Version: unspecified
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-04 12:48 UTC by darthdragon
Modified: 2012-08-10 14:05 UTC (History)
1 user (show)

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 darthdragon 2011-08-04 12:48:52 UTC
Version:           unspecified
OS:                Linux

Using Valgrind-3.6.1 (compiled from source) on Linux squeeze 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686 GNU/Linux with gcc (Debian 4.4.5-10) 4.4.5

A simple mkfifo code crash.


Reproducible: Always

Steps to Reproduce:
$cat foo.c
#include <stdio.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
  int log_fifo_fd;
  char pathname[64];
  
  snprintf(pathname, 64, "/tmp/%s.log", argv[0]);
  if (mkfifo(pathname,S_IRWXU)<0 && errno!=EEXIST)
    {
      return -1;
    }
  
  log_fifo_fd=open(pathname,O_RDWR|O_NONBLOCK);
  if (log_fifo_fd<0)
    {
      return -2;
    }

  close(log_fifo_fd);
  return 0;
} /* main */

$gcc -g -O0 foo.c

$valgrind --tool=exp-ptrcheck ./a.out bar


Actual Results:  
==18544== exp-ptrcheck, a heap, stack and global array overrun detector
==18544== NOTE: This is an Experimental-Class Valgrind Tool
==18544== Copyright (C) 2003-2010, and GNU GPL'd, by OpenWorks Ltd et al.
==18544== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==18544== Command: ./a.out bar
==18544== 
sysno ==  14
exp-ptrcheck: the 'impossible' happened:
   unhandled syscall
==18544==    at 0x38014ACD: report_and_quit (m_libcassert.c:193)
==18544==    by 0x38014B26: panic (m_libcassert.c:277)
==18544==    by 0x38014B5F: vgPlain_tool_panic (m_libcassert.c:292)
==18544==    by 0x3800287A: h_post_syscall (h_main.c:2600)
==18544==    by 0x3805833C: vgPlain_post_syscall (syswrap-main.c:1729)
==18544==    by 0x38058F83: vgPlain_client_syscall (syswrap-main.c:1627)
==18544==    by 0x38055232: handle_syscall (scheduler.c:895)
==18544==    by 0x3805636E: vgPlain_scheduler (scheduler.c:1091)
==18544==    by 0x38084324: run_a_thread_NORETURN (syswrap-linux.c:94)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==18544==    at 0x40FB32E: _xmknod (xmknod.c:53)
==18544==    by 0x40FAFF7: mkfifo (mkfifo.c:29)
==18544==    by 0x80484E6: main (foo.c:14)


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.


Expected Results:  
No crash
Comment 1 Tom Hughes 2011-08-10 10:08:55 UTC
This is no longer an issue in the current code as exp-ptrcheck has been simplified and renamed as exp-sgcheck and no longer needs to monitor system calls. As a result the code containing this assertion no longer exists.