Bug 145338 - attach or detach during nanosleep in 32 bit process returns EINVAL instead of EINTR
attach or detach during nanosleep in 32 bit process returns EINVAL instead of...
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.0
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: Jason Baron
:
: 145337 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-17 11:26 EST by john yates
Modified: 2013-03-06 00:58 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 12:18:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
repro.c, Makefile and shell script to demonstrate correct 64-bit and errant 32-bit behavior (30.00 KB, application/x-tar)
2005-01-17 11:26 EST, john yates
no flags Details

  None (edit)
Description john yates 2005-01-17 11:26:08 EST
Description of problem:

(Component is just a guess)

Executing nanosleep from a 32-bit returns wrong value in errno when interrupted 
by a signal (EINVAL instead of EINTR).  For quick reference here is man page 
description:

====

In case of an error or exception, the nanosleep system call returns -1 instead 
of 0 and sets errno to one of the following values:

EINTR 
The pause has been interrupted by a non-blocked signal that was delivered to 
the process. The remaining sleep time has been written into *rem so that the 
process can easily call nanosleep again and continue with the pause. 

EINVAL 
The value in the tv_nsec field was not in the range 0 to 999 999 999 or tv_sec 
was negative. 
  

Version-Release number of selected component (if applicable):


How reproducible:

Run repro.sh from attached archive.

Actual results:

errno is EINVAL

Expected results:

errno should be EINTR

Additional info:
Comment 1 john yates 2005-01-17 11:26:08 EST
Created attachment 109867 [details]
repro.c, Makefile and shell script to demonstrate correct 64-bit and errant 32-bit behavior
Comment 2 Jakub Jelinek 2005-01-17 11:56:10 EST
*** Bug 145337 has been marked as a duplicate of this bug. ***
Comment 3 Jakub Jelinek 2005-01-17 12:12:15 EST
This is a kernel thing, glibc's nanosleep just issues the nanosleep syscall.
Comment 4 john yates 2005-01-17 17:31:10 EST
Earlier description is misleading.  The crux of the problem is that
our debugging methodology revolves around spinning in a loop that
pauses briefly in nanosleep so long as a given "spinfile" exists. 
This allows us to attach a debugger before a given context is lost.

The act of attach to a 32 bit process in one of these spin loops
exhibits a bug.  It appears that some aspect of the attach performs an
madvise with a bad 3rd argument (int advice).  This seems to leave an
corrupted errno containing EINVAL instead of the expected EINTR:

  madvise(0xffffda10, 4294957576, 0x6b1ff4) = -1 EINVAL (Invalid argument)
Comment 5 Jiri Pallich 2012-06-20 12:18:32 EDT
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.

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