Bug 877193 - Strace has unknown return value for shmat syscall.
Summary: Strace has unknown return value for shmat syscall.
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: strace
Version: 6.5
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Jeff Law
QA Contact: Michael Petlan
Dayle Parker
Depends On:
Blocks: 1153397
TreeView+ depends on / blocked
Reported: 2012-11-15 22:31 UTC by Joe Mario
Modified: 2015-07-22 06:26 UTC (History)
7 users (show)

Fixed In Version: strace-4.8-9.el6
Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
shmat() system calls improved in the strace tool Previously, when debugging with the strace tool, running a shmat() system call returned a '?' value instead of reporting the attached shared memory segment address. strace has been improved so that shmat() system calls now return the correct address of the attached shared memory segment.
Clone Of:
Last Closed: 2015-07-22 06:26:47 UTC

Attachments (Terms of Use)
Patch which seems to fix the problem. (1.18 KB, patch)
2012-11-16 22:54 UTC, Jeff Law
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1308 normal SHIPPED_LIVE strace bug fix and enhancement update 2015-07-20 17:53:42 UTC

Description Joe Mario 2012-11-15 22:31:01 UTC
Description of problem:
The strace delivered in the RHEL 6.4, 6.3 (and possibly earlier) releases does not report the return value for the shmat.  It incorrectly returns a "?" (question mark) instead of the address that the segment was attached to.

Version-Release number of selected component (if applicable):
# strace -V
strace -- version 4.5.19

# uname -a
Linux perf82.lab.bos.redhat.com 2.6.32-330.el6.x86_64 #1 SMP Thu Oct 11 15:37:45 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:
The simple reproducer .c file and command is listed below

Steps to Reproduce:

Compile the following .c file and run it with strace.  The steps are listed below:

# cat shm_example.c 
#include <stdio.h> 
#include <sys/shm.h> 
#include <sys/stat.h> 

int main () 
  int seg_id; 
  char* shm_ptr; 
  int segment_size; 
  const int seg_siz = 1024*1024; 

  seg_id = shmget (IPC_PRIVATE, seg_siz , IPC_CREAT | S_IRUSR | S_IWUSR ); 
  shm_ptr = (char*) shmat (seg_id, 0, 0); 
  shmdt (shm_ptr); 
  shmctl (seg_id, IPC_RMID, 0); 
  return 0; 

# gcc shm_example.c -o ./a.out
# strace -etrace=shmat ./a.out
shmat(294912, 0, 0)                     = ?

Actual results:
# strace -etrace=shmat ./a.out
shmat(294912, 0, 0)                     = ?

Expected results:
# strace -etrace=shmat ./a.out
shmat(294912, 0, 0)                     = <the_attached_address>

Additional info:
I've confirmed that this is fixed in the upstream strace 4.7 version.  It would be really useful to make this fix available in the RHEL 6.x release stream.

Comment 2 Jeff Law 2012-11-16 22:53:37 UTC
Realistically too late for RHEL 6.4; retargetting for consideration in RHEL 6.5.

Comment 3 Jeff Law 2012-11-16 22:54:46 UTC
Created attachment 646650 [details]
Patch which seems to fix the problem.

Comment 5 RHEL Product and Program Management 2013-10-14 00:15:40 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unable to address this
request at this time.

Red Hat invites you to ask your support representative to
propose this request, if appropriate, in the next release of
Red Hat Enterprise Linux.

Comment 13 Stephen Gilson 2015-04-16 18:53:18 UTC
Product Management, Engineering, and have determined that this bug should be described in the RHEL 6.7 Release Notes. Please update the Doc Text field with a summary feature description by April 22.

Comment 18 errata-xmlrpc 2015-07-22 06:26:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.