Bug 5576 - close(-1) segfaults on mips64 systems
Summary: close(-1) segfaults on mips64 systems
Status: RESOLVED WORKSFORME
Alias: None
Product: uClibc
Classification: Unclassified
Component: stdio (show other bugs)
Version: 0.9.33.2
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-24 19:22 UTC by mail
Modified: 2014-07-24 21:16 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mail 2012-09-24 19:22:07 UTC
Hi,

following test code segfaults on mips64 systems:
                                                                                qemu-system-mips64, big endian, n64
lemote yeelong, little endian,n32 
                                                   

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main() {  
 int n;
 n=open("/dev/nul", O_RDWR); 
 close(n);
 return(0);
}

I don't know how to debug this further.

Thanks for any hints.

best regards
 Waldemar
Comment 1 Mike Frysinger 2012-11-18 10:25:00 UTC
does it only segfault under qemu ?  or does it crash on native hardware ?

the close() code is a pure syscall to the kernel, so i can't see how it'd be crashing inside of uClibc.
Comment 2 Bernhard Reutner-Fischer 2014-07-24 21:16:41 UTC
I don't see how this would crash in uClibc, so i suppose you meanwhile fixed this on mips for good.

open("/dev/nul", O_RDWR)                = -1 ENOENT (No such file or directory)
close(-1)                               = -1 EBADF (Bad file descriptor)
exit_group(0)                           = ?