From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1460 Path: news.gmane.org!not-for-mail From: Yoran Heling Newsgroups: gmane.linux.lib.musl.general Subject: Bug with fcntl() on mipsel Date: Wed, 8 Aug 2012 14:46:20 +0200 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1344429993 11258 80.91.229.3 (8 Aug 2012 12:46:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Aug 2012 12:46:33 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1461-gllmg-musl=m.gmane.org@lists.openwall.com Wed Aug 08 14:46:33 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Sz5ej-0003kR-Bh for gllmg-musl@plane.gmane.org; Wed, 08 Aug 2012 14:46:33 +0200 Original-Received: (qmail 23674 invoked by uid 550); 8 Aug 2012 12:46:32 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 23666 invoked from network); 8 Aug 2012 12:46:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=8yk+6DmbrkMGASatNZDqBt6Rqbt1vVJ6h31I3tC168I=; b=UGXOuI0NIPB5Wu5eItlqe8/VoXM3Aaavw8ZxgtkSzRwUgEtF2vYtK1QR76mCHKosMp SLfDUbIiIavQdXWgUSLaj/RHfUwqsYNotX3wRP+85gzN3kdwMmH+MTaxt9Z9ERjZ8JNT fA0O4Gkuf2liy8qtCAhjQV5K0R2rMFbYh/R/KW0omACAu5i/cJcDNVPo8Qzx30T4/eRp LOWdW01IlI8PeVSiI8O3yVPH89NExpoRb7jWQ0DNefC3m1l4ugQlljqCc5kJV6EyvPX4 unVEHzP2mbZLm71vvNb6RIjw57z2Zl5aVFB3OVlEj5egQh+BCR+izfj5wse4ga67Ag1+ UqQw== Original-Sender: yorhel@gmail.com X-Google-Sender-Auth: SBpYGMCwG_WyxpOYXqe7hsQoEEc Xref: news.gmane.org gmane.linux.lib.musl.general:1460 Archived-At: Hi, I've been playing around a bit with the mips support in the new 0.9.3 release, but stumbled upon something that looks like a bug. This is on debian-mipsel 6.0.5 running within qemu. The problem is with the fcntl64() call, visible in the strace output below. It looks like anything after the first argument is garbage. Yoran. $ cat test.c #include #include #include #include #include #include int main() { int fd = open("some_random_file", O_RDWR|O_CREAT, 0600); assert(fd > 0); struct flock lck; lck.l_type = F_WRLCK; lck.l_whence = SEEK_SET; lck.l_start = 0; lck.l_len = 0; int r = fcntl(fd, F_SETLK, &lck); printf("fcntl() = %d, errno = %d, strerror = %s\n", r, errno, strerror(errno)); } $ musl-gcc -static -D_FILE_OFFSET_BITS=64 test.c -o test-musl $ gcc -D_FILE_OFFSET_BITS=64 test.c -o test-native $ strace ./test-musl execve("./test-musl", ["./test-musl"], [/* 14 vars */]) = 0 open("some_random_file", O_RDWR|O_CREAT|O_LARGEFILE, 0600) = 3 fcntl64(3, 0xd /* F_??? */, 0x7f901390) = -1 EINVAL (Invalid argument) ioctl(1, TIOCNXCL, 0x7f900ea0) = -1 ENOTTY (Inappropriate ioctl for device) writev(1, [{"fcntl() = -1, errno = 22, strerr"..., 53}, {"\n", 1}], 2fcntl() = -1, errno = 22, strerror = Invalid argument ) = 54 exit_group(54) = ? stdout: fcntl() = -1, errno = 22, strerror = Invalid argument $ strace ./test-native execve("./test-native", ["./test-native"], [/* 14 vars */]) = 0 [...snip some ld.so loading and memory stuff..] open("some_random_file", O_RDWR|O_CREAT|O_LARGEFILE, 0600) = 3 fcntl64(3, F_SETLK64, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}, 0x7fb74398) = 0 fstat64(1, {st_mode=S_IFREG|0644, st_size=1942, ...}) = 0 old_mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ac5e000 write(1, "fcntl() = 0, errno = 0, strerror"..., 43fcntl() = 0, errno = 0, strerror = Success ) = 43 exit_group(43) = ? stdout: fcntl() = 0, errno = 0, strerror = Success