Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 877193

Summary: Strace has unknown return value for shmat syscall.
Product: Red Hat Enterprise Linux 6 Reporter: Joe Mario <jmario>
Component: straceAssignee: Jeff Law <law>
Status: CLOSED ERRATA QA Contact: Michael Petlan <mpetlan>
Severity: low Docs Contact: Dayle Parker <dayleparker>
Priority: medium    
Version: 6.5CC: jmario, law, mcermak, mnewsome, mpetlan, ohudlick, perfbz
Target Milestone: rcKeywords: Rebase
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
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.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:26:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1153397    
Attachments:
Description Flags
Patch which seems to fix the problem. none

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 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.

https://rhn.redhat.com/errata/RHBA-2015-1308.html