Bug#570603: libc6: fallocate and posix_fallocate do weird system calls

2010-02-20 Thread Aurelien Jarno
retitle strace: don't 
reassign 570603 strace: wrong arguments for fallocate on 64-bit architectures
thanks

On Fri, Feb 19, 2010 at 08:35:59PM -0600, Drake Wilson wrote:
 Package: libc6
 Version: 2.10.2-6
 Severity: normal
 
 Two C source files are attached.  One of them uses Linux fallocate()

They are not.

 and one uses posix_fallocate() from POSIX:2001.  Both are ostensibly
 supported by eglibc.  I'm running a stock kernel from unstable (some
 background text removed):
 
   $ uname -r
   2.6.29-1-amd64
   $ dpkg -l linux-image-2.6.29-1-amd64
   ii  linux-image-2.6.29-1-amd64  2.6.29-3  Linux 2.6.29 image on AMD64
 
 Each of the C programs will attempt to open and truncate a file named
 file, then allocate one MiB of space for it, changing its size.
 Here's what happens instead:
 
   $ strace ./linux
   [...]
   open(file, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
   fallocate(3, 0, 4503599627370496, 6895618648722965280) = -1 EOPNOTSUPP 
 (Operation not supported)
The hexadecimal representations of those two numbers are
  0x0010 and 0x5fb228a05fb10320. 

strace considers that the values are passed using 2 32-bit values, while
on a 64-bit architecture there are directly passed as a 64-bit value.

 And:
 
   $ strace ./posix
   open(file, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
   fallocate(3, 0, 4503599627370496, 1048576) = -1 EOPNOTSUPP (Operation not 
 supported)
This is followed by an emulation of posix_fallocate using one-byte
  pwrites.  Jesus. 

Your filesystem does not support fallocate, so the glibc is emulating it
with a pwrite.

 This is obviously bogus.
 
 This feels like libc screwing up the system call parameters, which is
 why I'm reporting it here, but I'm not certain of that.  It could also
 potentially be strace or the kernel, in which case please reassign as
 necessary, as usual.

Reassigning.

-- 
Aurelien Jarno  GPG: 1024D/F1BCDB73
aurel...@aurel32.net http://www.aurel32.net



-- 
To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100220103822.gn9...@hall.aurel32.net



Bug#570603: libc6: fallocate and posix_fallocate do weird system calls

2010-02-20 Thread Drake Wilson
Quoth Aurelien Jarno aurel...@aurel32.net, on 2010-02-20 11:38:22 +0100:
 On Fri, Feb 19, 2010 at 08:35:59PM -0600, Drake Wilson wrote:
  Two C source files are attached.  One of them uses Linux fallocate()
 
 They are not.

D'oh.  Sorry!  *brown paper bag*

Let's try that again, then.  *attach*

 Your filesystem does not support fallocate, so the glibc is emulating it
 with a pwrite.

That makes a certain amount of sense in this context; I originally
assumed I couldn't trust the return value of the syscall due to the
strange parameters (and didn't think ext2 might not have fallocate).

 Reassigning.

Thank you for the attention, and sorry for the initial incorrectness.

   --- Drake Wilson
#define _GNU_SOURCE
#include unistd.h
#include fcntl.h

int 
main(int argc, char *argv[])
{
	int const fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
	if (fd == -1) return 1;
	int const err = fallocate(fd, 0, 0, (off_t)(1  20));
	if (err == -1) return 1;
	return 0;
}
#define _XOPEN_SOURCE 600
#include unistd.h
#include fcntl.h

int 
main(int argc, char *argv[])
{
	int const fd = open(file, O_WRONLY | O_CREAT | O_TRUNC, 0666);
	if (fd == -1) return 1;
	int const err = posix_fallocate(fd, 0, (off_t)(1  20));
	if (err == -1) return 1;
	return 0;
}


Processed: reassign 570603 to strace

2010-02-20 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

 reassign 570603 strace
Bug #570603 [libc6] libc6: fallocate and posix_fallocate do weird system calls
Bug reassigned from package 'libc6' to 'strace'.
Bug No longer marked as found in versions eglibc/2.10.2-6.
 thanks
Stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)


-- 
To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.1293747597.transcr...@bugs.debian.org



Bug#570674: libc6-dev: gcc-2.95: bits/pthreadtypes.h: unnamed struct/union warning

2010-02-20 Thread Bill Allombert
Package: libc6-dev
Version: 2.10.2-6
Severity: minor
Tags: patch

Hello GNU Libc Maintainers,

When using gcc 2.95, gcc report a warning:

%gcc-2.95 -Wno-main foo.c -c
In file included from /usr/include/sys/types.h:270,
 from /usr/include/stdlib.h:320,
 from foo.c:1:
/usr/include/bits/pthreadtypes.h:99: warning: unnamed struct/union that defines
no instances

  I know gcc-2.95 is totally outdated, but it is useful for regression testing
of old version of software that were only tested with it, this warning cause
lots of noise, and there is no way to disable it in gcc 2.95.

  Fixing this warning is trivial. Please see the attached patch.
This is the only instance I found where gcc-2.95 report a warning from the
headers file.

Cheers,
-- 
Bill. ballo...@debian.org

Imagine a large red swirl here. 
--- /sid/usr/include/bits/pthreadtypes.h2010-01-09 20:56:32.0 
+0100
+++ /usr/include/bits/pthreadtypes.h2010-02-20 15:01:27.0 +0100
@@ -92,7 +92,7 @@
 # define __PTHREAD_MUTEX_HAVE_PREV 1
 #else
 unsigned int __nusers;
-__extension__ union
+__extension__ union pthread_mutex_have_prev_u
 {
   int __spins;
   __pthread_slist_t __list;


Processed: forcibly merging 475839 570674

2010-02-20 Thread Debian Bug Tracking System
Processing commands for cont...@bugs.debian.org:

 forcemerge 475839 570674
Bug#475839: libc6-dev: pthread_mutex_t definition contains a nameless union
Bug#570674: libc6-dev: gcc-2.95: bits/pthreadtypes.h: unnamed struct/union 
warning 
Forcibly Merged 475839 570674.

 thanks
Stopping processing here.

Please contact me if you need assistance.

Debian bug tracking system administrator
(administrator, Debian Bugs database)


-- 
To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/handler.s.c.126670604814447.transcr...@bugs.debian.org



Bug#473812: libc6: calloc returns non-zero memory areas when mlockall is being used

2010-02-20 Thread Adrien Kunysz
Upstream bug: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6958
This is the commit that was used to fix Red Hat bug 405781:
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=4cd4c5d6a28c4fbdc86651c4578f4c4f24efce08

Using your test case, I confirm I can reproduce the issue with glibc 
2.7-18lenny2 x86_64.
With your test case, I cannot reproduce the issue with Red Hat Enterprise Linux
glibc-2.5-24.x86_64 which includes the above patch:

# ./debbug473812 
test the calloc bug..
test , n=1000
test , n=1000
test , n=1000
test , n=1000
test , n=1000
test , n=1000
test , n=1000
test , n=1000
test , n=1000
test , n=1000
Memory locked
Memory locked
Memory locked
Memory locked
Memory locked
test finished
allocated 32502000 bytes

This suggest the above patch indeeds fixes this issue although upstream bug
is still open and madvise() return value is still not checked.





-- 
To UNSUBSCRIBE, email to debian-glibc-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20100220234508.ge7...@baltika