linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [Bug 2995] New: madvise runs sucessfully for non-file mapped pages
       [not found] <200407011338.i61DcD1B011203@fire-2.osdl.org>
@ 2004-07-02 21:42 ` Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2004-07-02 21:42 UTC (permalink / raw)
  To: susharma; +Cc: linux-mm

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>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-02 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <200407011338.i61DcD1B011203@fire-2.osdl.org>
2004-07-02 21:42 ` [Bug 2995] New: madvise runs sucessfully for non-file mapped pages Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox