This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tapsets/11269] New: syscall.mmap decoding $fd incorrectly with MAP_ANONYMOUS


The user side of mmap is defined like this:

void *mmap(void *addr, size_t length, int prot, int flags,               
            int fd, off_t offset);

The kernel side is defined like this:

long sys_mmap(unsigned long addr, unsigned long len,                          
          unsigned long prot, unsigned long flags,                             
          unsigned long fd, unsigned long off)

Notice that on the user side, 'fd' is a signed integer, while on the kernel side
it is an unsigned long.

The mmap manpage says this about the MAP_ANONYMOUS flag:

MAP_ANONYMOUS                                                            
      The mapping is not backed by any file; its contents are initial-  
      ized to zero.  The fd and offset arguments are ignored; however,  
      some  implementations require  fd to be -1 if MAP_ANONYMOUS (or  
      MAP_ANON) is specified, and portable applications should ensure  
      this.
              
Here's the problem.  When MAP_ANONYMOUS is used and fd is set to -1, the
syscall.mmap probe treats $fd as an unsigned long, so -1 looks like 4294967295
(on x86_64).

-- 
           Summary: syscall.mmap decoding $fd incorrectly with MAP_ANONYMOUS
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tapsets
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: dsmith at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11269

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]