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

Bug#140100: marked as done (libc6: mprotect returns EFAULT instead of ENOMEM)



Your message dated Thu, 27 Feb 2003 01:07:21 +0900
with message-id <808yw3xbye.wl@oris.opensource.jp>
and subject line libc6: mprotect returns EFAULT instead of ENOMEM
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; 27 Mar 2002 03:02:49 +0000
>From joey@silk.kitenet.net Tue Mar 26 21:02:49 2002
Return-path: <joey@silk.kitenet.net>
Received: from pm3naxs3-113.access.naxs.com (silk.kitenet.net) [216.98.91.113] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 16q3i4-0003jK-00; Tue, 26 Mar 2002 21:02:49 -0600
Received: from joey by silk.kitenet.net with local (Exim 3.35 #1 (Debian))
	id 16q3jv-0003Zv-00; Tue, 26 Mar 2002 22:04:43 -0500
From: Joey Hess <joey@kitenet.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: libc6: mprotect returns EFAULT instead of ENOMEM
X-Mailer: reportbug 1.48
Date: Tue, 26 Mar 2002 22:04:43 -0500
Message-Id: <E16q3jv-0003Zv-00@silk.kitenet.net>
Sender: Joey Hess <joey@silk.kitenet.net>
Delivered-To: submit@bugs.debian.org

Package: libc6
Version: 2.2.5-3
Severity: normal

According to the documentation of the LSB test suite, 

  If _POSIX_MEMORY_PROTECTION is defined or the implemen-
  tation supports the mprotect() function as described in
  System Interfaces and Headers, Issue 5:
        A call to mprotect()  when  addresses  in  the  range
        [addr,addr+len] are outside the range allowed for the
        address space of a process shall return  -1  and  set
        errno to ENOMEM.

A test program that tries to mprotect a stupidly large amount of memory
(on i386 anyway) that is thus going to overflow out of the process's
address space sees a EFAULT instead of the expected ENOMEM.

The man page for mprotect does note that "The SVr4 error conditions don't
map neatly onto Linux's." There is no mprotect documentation in the glibc
info page, oddly enough.

It's possible that this test will be waived in the LSB test suite, but I'm
filing this bug for tracking purposes. 

My test program is below. Note that it does not mmap() the space. The test
program in the lsb test suite does use mmap(), with identical results.


       #include <stdio.h>
       #include <stdlib.h>
       #include <errno.h>
       #include <sys/mman.h>

       #include <limits.h>    /* for PAGESIZE */
       #ifndef PAGESIZE
       #define PAGESIZE 4096
       #endif

       int
       main(void)
       {
           char *p;
           p = malloc(1024+PAGESIZE-1);
           p = (char *)(((int) p + PAGESIZE-1) & ~(PAGESIZE-1));

           mprotect(p, PAGESIZE * 524300, PROT_READ);
           printf("exit value: %i (expected ENOMEM: %i)\n", errno, ENOMEM);
       }

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux silk 2.4.18 #1 Tue Feb 26 00:23:37 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C


---------------------------------------
Received: (at 140100-done) by bugs.debian.org; 26 Feb 2003 16:07:25 +0000
>From gotom@debian.or.jp Wed Feb 26 10:07:24 2003
Return-path: <gotom@debian.or.jp>
Received: from oris.opensource.jp (oris.opensource.gr.jp) [218.44.239.73] (postfix)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18o45b-0004Jr-00; Wed, 26 Feb 2003 10:07:23 -0600
Received: from oris.opensource.jp (oris.opensource.jp [218.44.239.73])
	by oris.opensource.gr.jp (Postfix) with ESMTP
	id CE596C33C8; Thu, 27 Feb 2003 01:07:21 +0900 (JST)
Date: Thu, 27 Feb 2003 01:07:21 +0900
Message-ID: <808yw3xbye.wl@oris.opensource.jp>
From: GOTO Masanori <gotom@debian.or.jp>
To: Joey Hess <joeyh@debian.org>
Cc: GOTO Masanori <gotom@debian.or.jp>, 140100-done@bugs.debian.org
Subject: Re: libc6: mprotect returns EFAULT instead of ENOMEM
In-Reply-To: <[🔎] 20030226152851.GA31327@dragon.kitenet.net>
References: <[🔎] 80bs0zxoel.wl@oris.opensource.jp>
	<[🔎] 20030226152851.GA31327@dragon.kitenet.net>
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: 140100-done@bugs.debian.org
X-Spam-Status: No, hits=-1.8 required=4.0
	tests=IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01,
	      USER_AGENT
	version=2.44
X-Spam-Level: 

At Wed, 26 Feb 2003 10:28:51 -0500,
Joey Hess wrote:
> 
> [1  <text/plain; us-ascii (quoted-printable)>]
> GOTO Masanori wrote:
> > I checked with glibc 2.3.1-14 on kernel 2.4.19, your test program
> > returns ENOMEM.  It's fixed.  BTW, is it really glibc problem?
> > I think it's kernel problem.  Look using with strace:
> > 
> > 	mprotect(0x804a000, 2147532800, PROT_READ) = -1 ENOMEM (Cannot allocate memory)
> > 
> > Could I close this bug?
> 
> I suppose so.

Thanks, I close this bug.

-- gotom



Reply to: