[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#156697: marked as done (libc6: posix_memalign() uses its arguments incorrectly)



Your message dated Wed, 30 Jun 2004 09:32:50 +0900
with message-id <81u0wtkhql.wl@omega.webmasters.gr.jp>
and subject line Bug#156697: libc6: posix_memalign() uses its arguments incorrectly
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

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

--------------------------------------
Received: (at submit) by bugs.debian.org; 14 Aug 2002 17:58:47 +0000
>From wsl@fruit.eu.org Wed Aug 14 12:58:47 2002
Return-path: <wsl@fruit.eu.org>
Received: from 17dyn28.ztm.casema.net (fruit.eu.org) [213.17.32.28] (qmailr)
	by master.debian.org with smtp (Exim 3.12 1 (Debian))
	id 17f2Pu-0005oW-00; Wed, 14 Aug 2002 12:58:47 -0500
Received: (qmail 1376 invoked from network); 14 Aug 2002 17:58:42 -0000
Received: from unknown (10.1.3.4)
  by thunk.pooh.oi with QMQP; 14 Aug 2002 17:58:42 -0000
Message-ID: <20020814175842.6096.qmail@bzzrt>
Subject: libc6: posix_memalign() uses its arguments incorrectly
From: "Wessel Dankers" <wsl@fruit.eu.org>
To: "Debian Bug Tracking System" <submit@bugs.debian.org>
X-Mailer: reportbug 1.99.50
Date: Wed, 14 Aug 2002 19:58:40 +0200
Delivered-To: submit@bugs.debian.org

Package: libc6
Version: 2.2.5-13
Severity: normal

When I invoke posix_memalign() like this (pagesize == 4096, BUFSIZE == 12M):

	char *s;
	posix_memalign(&s, pagesize, BUFSIZE)

It fails, but does not set errno with a reason. However, when I invoke
it like this:

	posix_memalign(&s, BUFSIZE, pagesize)

It succeeds, and allocates a suitable memory region (if I decrease
BUFSIZE below what my application really needs, it segfaults just as
one would expect). However, the allocated region is aligned to the size
of the allocated memory region (if I decrease BUFSIZE, the alignment
also becomes more lax).

The documentation states:

	Function: int posix_memalign (void **memptr, size_t alignment, size_t size) 

...which means (I think( that the first thing I tried was the correct one.
These are the versions of gcc I tried:

gcc version 2.95.4 20011002 (Debian prerelease)
gcc version 3.0.4
gcc version 3.1.1
gcc version 3.2 20020809 (Debian prerelease)

I suspect that the fix is trivial :)

-- System Information:
Debian Release: unstable
Architecture: i386
Kernel: Linux bzzrt 2.4.19-wsl #1 Tue Aug 6 04:13:00 CEST 2002 i686
Locale: LANG=C, LC_CTYPE=C

-- no debconf information


---------------------------------------
Received: (at 156697-done) by bugs.debian.org; 30 Jun 2004 00:32:52 +0000
>From gotom@debian.or.jp Tue Jun 29 17:32:52 2004
Return-path: <gotom@debian.or.jp>
Received: from omega.webmasters.gr.jp (webmasters.gr.jp) [218.44.239.78] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1BfT1v-0002KH-00; Tue, 29 Jun 2004 17:32:52 -0700
Received: from omega.webmasters.gr.jp (localhost [127.0.0.1])
	by webmasters.gr.jp (Postfix) with ESMTP
	id A4D75DEB58; Wed, 30 Jun 2004 09:32:50 +0900 (JST)
Date: Wed, 30 Jun 2004 09:32:50 +0900
Message-ID: <81u0wtkhql.wl@omega.webmasters.gr.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: "Wessel Dankers" <wsl@fruit.eu.org>, 156697-done@bugs.debian.org
Subject: Re: Bug#156697: libc6: posix_memalign() uses its arguments incorrectly
In-Reply-To: <20020814175842.6096.qmail@bzzrt>
References: <20020814175842.6096.qmail@bzzrt>
User-Agent: Wanderlust/2.9.9 (Unchained Melody) SEMI/1.14.3 (Ushinoya)
 FLIM/1.14.3 (=?ISO-8859-4?Q?Unebigory=F2mae?=) APEL/10.3 Emacs/21.2
 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI)
MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya")
Content-Type: text/plain; charset=US-ASCII
Delivered-To: 156697-done@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_03_25 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=-6.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER 
	autolearn=no version=2.60-bugs.debian.org_2004_03_25
X-Spam-Level: 

At Wed, 14 Aug 2002 19:58:40 +0200,
Wessel Dankers wrote:
> When I invoke posix_memalign() like this (pagesize == 4096, BUFSIZE == 12M):
> 
> 	char *s;
> 	posix_memalign(&s, pagesize, BUFSIZE)
> 
> It fails, but does not set errno with a reason. However, when I invoke

If it's failed, posix_memalign returns error, instead of setting errno.

> it like this:
> 
> 	posix_memalign(&s, BUFSIZE, pagesize)
> 
> It succeeds, and allocates a suitable memory region (if I decrease
> BUFSIZE below what my application really needs, it segfaults just as
> one would expect). However, the allocated region is aligned to the size
> of the allocated memory region (if I decrease BUFSIZE, the alignment
> also becomes more lax).
> 
> The documentation states:
> 
> 	Function: int posix_memalign (void **memptr, size_t alignment, size_t size) 
> 
> ...which means (I think( that the first thing I tried was the correct one.
> These are the versions of gcc I tried:
> 
> gcc version 2.95.4 20011002 (Debian prerelease)
> gcc version 3.0.4
> gcc version 3.1.1
> gcc version 3.2 20020809 (Debian prerelease)

I confirmed the latest glibc 2.3.2.ds1-13 + gcc 3.3.x should
work correctly.

gotom@moog:~/debian/glibc/bugs/156697> cat posix_memalign.c
#include <stdlib.h>
#include <stdio.h>

int main(void)
{
        size_t pagesize = 4096;
        size_t BUFSIZE = 12 * 1024 * 1024;                   
        char *s;
        int err;

        sleep(10);
        err = posix_memalign(&s, pagesize, BUFSIZE);
        printf("%d\n", err);
        sleep(10);
	return 0;
}
gotom@moog:~/debian/glibc/bugs/156697> gcc -o posix_memalign posix_memalign.c
gotom@moog:~/debian/glibc/bugs/156697> ./posix_memalign
^Z
gotom@moog:~/debian/glibc/bugs/156697> ps auxw | grep posix
gotom    17976  0.0  0.0  1368  248 pts/169  T    09:36   0:00 ./posix_memalign
gotom@moog:~/debian/glibc/bugs/156697> fg
./posix_memalign
0
^Z
gotom@moog:~/debian/glibc/bugs/156697> ps auxw | grep posix
gotom    17976  0.0  0.0 13668  332 pts/169  T    09:36   0:00 ./posix_memalign


I close this bug.

Regards,
-- gotom



Reply to: