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

Bug#140100: libc6: mprotect returns EFAULT instead of ENOMEM



> 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.

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?

Regards,
-- gotom



Reply to: