linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: susharma@in.ibm.com
Cc: linux-mm@kvack.org
Subject: Re: [Bug 2995] New: madvise runs sucessfully for non-file mapped pages
Date: Fri, 2 Jul 2004 14:42:47 -0700	[thread overview]
Message-ID: <20040702144247.21233498.akpm@osdl.org> (raw)
In-Reply-To: <200407011338.i61DcD1B011203@fire-2.osdl.org>

Unless this is very new behaviour, I don't think we can fix this until 2.7.  Changing
madvise's behaviour against anonymous memory addresses could break existing
applications.

bugme-daemon@osdl.org wrote:
>
> http://bugme.osdl.org/show_bug.cgi?id=2995
> 
>            Summary: madvise runs sucessfully for non-file mapped pages.
>     Kernel Version: 2.6.5-7.81
>             Status: NEW
>           Severity: high
>              Owner: akpm@digeo.com
>          Submitter: susharma@in.ibm.com
> 
> 
> Distribution: SLES-9 [RC-2] 
> Hardware Environment: x330, 2-Way, 1.0 GHz, 1.2 GB RAM 
> Software Environment: SLES-9 [RC-2], Kernel - 2.6.5-7.81 
> Problem Description: When you call madvise for a memory mapped area (allocated using 
> malloc) which is not part of any file, it gets PASSED without giving EBADF error. 
>  
> Steps to reproduce: 
> 1. Write a small program, in which allocate some memory (eg. 5 pages) like this :- 
>  
> 	char *ptr=NULL; 
> 	ptr = (char *) malloc(5 * PAGE_SIZE); 
>  
>   Now, call madvise for this malloced memory area (which is a part of any file) :- 
>  
> 	ptr = (char *)(((int) ptr + PAGE_SIZE-1) & ~(PAGE_SIZE-1)); // Alignment 
> 	if (madvise(ptr, 5 * PAGE_SIZE, MADV_NORMAL) < 0) 
> 	{ 
> 		perror("madvise failed"); 
> 	} 
> 	else 
> 	{ 
> 		printf("madvise passed\n"); 
> 	} 
>  
> Here, if you run this code you will find that madvise is getting PASSED even when you have 
> passed a memory area which is nowhere a part of file-mapped area. Actually, it should give 
> error with error code EBADF. 
>  
> Additional Information : Please refer to the manpage of madvise for the condition when EBADF 
> error code should be generated.
> 
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

           reply	other threads:[~2004-07-02 21:42 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <200407011338.i61DcD1B011203@fire-2.osdl.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040702144247.21233498.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-mm@kvack.org \
    --cc=susharma@in.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox