Bug 450514 - times does not set errno adn return -1 for EFAULT
times does not set errno adn return -1 for EFAULT
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
i386 Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-06-09 07:36 EDT by Martin Suesskraut
Modified: 2008-06-09 07:49 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-06-09 07:49:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
C code to demonstrate bug. (190 bytes, text/plain)
2008-06-09 07:36 EDT, Martin Suesskraut
no flags Details

  None (edit)
Description Martin Suesskraut 2008-06-09 07:36:12 EDT
Description of problem:
Calling function times with some invalid non-NULL pointer, does not return -1
and set errno to EFAULT.

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

How reproducible:
Compile attached C-code and run it.

Steps to Reproduce:
1. Compile attached C-file with "gcc times.c -o times -Wall"
2. run ./times
Actual results:
"times: -14 errno: 0"

Expected results:
times: -1 errno: 14

Additional info:
It seams, that the wrapper for the times-syscall passes the return value of the
kernel directly to the caller instead of testing for an error.
Comment 1 Martin Suesskraut 2008-06-09 07:36:12 EDT
Created attachment 308676 [details]
C code to demonstrate bug.
Comment 2 Jakub Jelinek 2008-06-09 07:49:27 EDT
That's because kernel returns the same return value when the argument is valid,
but clock_t is -14L.  rawhide glibc has more complicated wrapper that will
segfault if the argument is invalid.  No matter what, relying on -1/EFAULT is
just wrong.

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