[Bugme-new] [Bug 4343] New: Failure in System call madvise execution

bugme-daemon at osdl.org bugme-daemon at osdl.org
Tue Mar 15 02:37:42 PST 2005


http://bugme.osdl.org/show_bug.cgi?id=4343

           Summary: Failure in System call madvise execution
    Kernel Version: 2.6.11.3
            Status: NEW
          Severity: normal
             Owner: other_other at kernel-bugs.osdl.org
         Submitter: sharyathi at in.ibm.com
                CC: bnpoorni at in.ibm.com,sglass at us.ibm.com


Distribution: 
SLES 9 SP 1 
================================= 
Hardware Environment: 
/proc/meminfo 
MemTotal:      1554888 kB 
MemFree:        804040 kB 
Buffers:        341392 kB 
Cached:         112884 kB 
SwapCached:       6964 kB 
Active:         322868 kB 
Inactive:       171568 kB 
HighTotal:      655200 kB 
HighFree:       541248 kB 
LowTotal:       899688 kB 
LowFree:        262792 kB 
SwapTotal:     3200360 kB 
SwapFree:      3180020 kB 
Dirty:              16 kB 
Writeback:           0 kB 
Mapped:          40208 kB 
Slab:           245016 kB 
CommitLimit:   3977804 kB 
Committed_AS:   133768 kB 
PageTables:        740 kB 
VmallocTotal:   114680 kB 
VmallocUsed:     10172 kB 
VmallocChunk:   104288 kB 
HugePages_Total:     0 
HugePages_Free:      0 
Hugepagesize:     4096 kB 
 
/proc/cpuinfo 
processor       : 0 
vendor_id       : GenuineIntel 
cpu family      : 15 
model           : 2 
model name      : Intel(R) Xeon(TM) CPU 2.80GHz 
stepping        : 7 
cpu MHz         : 2795.860 
cache size      : 512 KB 
physical id     : 0 
siblings        : 2 
fdiv_bug        : no 
hlt_bug         : no 
f00f_bug        : no 
coma_bug        : no 
fpu             : yes 
fpu_exception   : yes 
cpuid level     : 2 
wp              : yes 
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr 
bogomips        : 5537.79 
 
processor       : 1 
vendor_id       : GenuineIntel 
cpu family      : 15 
model           : 2 
model name      : Intel(R) Xeon(TM) CPU 2.80GHz 
stepping        : 7 
cpu MHz         : 2795.860 
cache size      : 512 KB 
physical id     : 0 
siblings        : 2 
fdiv_bug        : no 
hlt_bug         : no 
f00f_bug        : no 
coma_bug        : no 
fpu             : yes 
fpu_exception   : yes 
cpuid level     : 2 
wp              : yes 
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr 
bogomips        : 5570.56 
 
processor       : 2 
vendor_id       : GenuineIntel 
cpu family      : 15 
model           : 2 
model name      : Intel(R) Xeon(TM) CPU 2.80GHz 
stepping        : 7 
cpu MHz         : 2795.860 
cache size      : 512 KB 
physical id     : 3 
siblings        : 2 
fdiv_bug        : no 
hlt_bug         : no 
f00f_bug        : no 
coma_bug        : no 
fpu             : yes 
fpu_exception   : yes 
cpuid level     : 2 
wp              : yes 
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr 
bogomips        : 5570.56 
 
processor       : 3 
vendor_id       : GenuineIntel 
cpu family      : 15 
model           : 2 
model name      : Intel(R) Xeon(TM) CPU 2.80GHz 
stepping        : 7 
cpu MHz         : 2795.860 
cache size      : 512 KB 
physical id     : 3 
siblings        : 2 
fdiv_bug        : no 
hlt_bug         : no 
f00f_bug        : no 
coma_bug        : no 
fpu             : yes 
fpu_exception   : yes 
cpuid level     : 2 
wp              : yes 
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr 
bogomips        : 5570.56 
================================= 
Software Environment: 
Linux x235b 2.6.11.3 #2 SMP Mon Mar 14 11:20:51 PST 2005 i686 i686 i386 
GNU/Linux 
================================= 
Problem Description: 
When you check with system call 'madvice' whether addresses in the specified 
range are not currently mapped, or are outside the address space of the 
process. System call returns success on execution instead of exiting with 
ENOMEM error.  
================================= 
Steps to reproduce: 
 
#include<stdio.h> 
#include<errno.h> 
#include<sys/types.h> 
#include<sys/stat.h> 
#include<unistd.h> 
#include<sys/mman.h> 
#include<string.h> 
#include<fcntl.h> 
 
int main() 
{ 
        int fd,pagesize,i; 
        char *file; 
        struct stat stat; 
        char *random_data="qwertyuiopasdfghjklzxcvbnm12345\n"; 
        int returnvalue; 
 
        if((fd=open("tmp_file", O_RDWR | O_CREAT,0664))<0) 
        { 
                printf("\Error opening the file"); 
                exit(errno); 
        } 
        //IN PUT 40K OF  DATA 
        for(i=0;i<1280;i++) 
                if((write(fd,random_data, strlen(random_data)))<0) 
                { 
                        printf("\n Error writing data \n"); 
                        exit(errno); 
                } 
 
        //GET THE FILE STAT 
        if(fstat(fd,&stat)<0) 
        { 
                printf("\n FSTAT failed"); 
                exit(errno); 
        } 
 
        //MAP THE FILE 
        if((file=(char *)mmap(NULL, stat.st_size, PROT_READ, MAP_SHARED,fd,0)) 
== (char *)-1) 
        { 
                printf("\n MMap Failed"); 
                exit(errno); 
        } 
 
 
        pagesize = getpagesize(); 
 
        #ifdef __ia64__ 
                        returnvalue = madvise(file,stat.st_size + 5 * 
pagesize,MADV_NORMAL); 
        #else 
                        //returnvalue = madvise(file,stat.st_size + 6144, 
MADV_NORMAL); 
                        returnvalue = madvise(file,stat.st_size + 4096, 
MADV_NORMAL); 
        #endif 
 
        printf("\n EXPECTED ERROR NO:%d", ENOMEM); 
        printf("\n ERROR NO GOT: %d", errno); 
        printf("\n"); 
 
}

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the Bugme-new mailing list