kernel BUG at mm/mmap.c:1990
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Helge Deller
Maybe someone has an idea ?
The "adjtimex02" test from the Linux Test Project (http://ltp.sf.net) seems to pass all test, but triggers a kernel BUG in
mm/mmap.c:1990when exiting. strace is attached below.kernel BUG at
mm/mmap.c:1990!
8< (snip)
I posted a reduced testcase to trigger this several months ago, if that would be useful to you. I don't have it handy, though.
Signature · 1 line
Jeff Bailey - http://www.raspberryginger.com/jbailey/
Quoted 5 lines · Helge Deller
Maybe someone has an idea ?
The "adjtimex02" test from the Linux Test Project (http://ltp.sf.net) seems to pass all test, but triggers a kernel BUG in
mm/mmap.c:1990when exiting. strace is attached below.
iirc this only bites on 32bit kernels.
This is what Jeff is referring to:
/*
* Testcase reduced from ltp, adjtimex02
*
* 1) adjtimex(2) fails with errno set to EFAULT if buf does
* not point to writable memory
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/timex.h>
intmain()
{
int x;
struct timex *buffp = (struct timex *) -1;
/* Check whether we are root */
if (geteuid() != 0) {
fprintf(stderr, "This needs to run as root.\n");
return(-1);
}
/* Call adjtimex(2) */
x = adjtimex(buffp);
return x;
}_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
A message that is not in the archive (sent off-list or not yet received): [email protected]
Helge Deller
maintainerRe: [parisc-linux] kernel BUG at mm/mmap.c:1990 [PATCH attached]
Quoted 8 lines · Kyle McMartin
Quoted 4 lines · Helge Deller
Maybe someone has an idea ?
The "adjtimex02" test from the Linux Test Project (http://ltp.sf.net) seems to pass all test, but triggers a kernel BUG in
mm/mmap.c:1990when exiting. strace is attached below.iirc this only bites on 32bit kernels.
Quoted 8 lines
This is what Jeff is referring to:
/*
* Testcase reduced from ltp, adjtimex02
*
* 1) adjtimex(2) fails with errno set to EFAULT if buf does
* not point to writable memory
*/
[...]
The following patch is a first draft which fixes the LTP crashes. It still includes debugging info... I assume the main problem is, that get_user() and put_user() does not do any memory region checking at all. I think this is wrong (although the fault handler may have catched most of the wrong ones).
I know my implementation of the function access_ok() is wrong.
I tried and looked at the other arch implementations, but I didn't found an easy one. But I'm sure there is one, and hopefully someone here can point me to a better/correct implementation...?
Comments ?
Helge
arch/parisc/lib/memcpy.c +16 -6
@@ -488,20 +488,30 @@ handle_store_error:#ifdef __KERNEL__unsigned long copy_to_user (void __user *dst,const void *src,unsigned long len) { -mtsp (get_kernel_space (),1 ); -mtsp (get_user_space (),2 ); -return pa_memcpy ((void __force *)dst, src, len); +BUG_ON ((long ) len <0 ); +if (access_ok (VERIFY_WRITE , dst, len)) { +mtsp (get_kernel_space (),1 ); +mtsp (get_user_space (),2 ); + len =pa_memcpy ((void __force *)dst, src, len); + }; +return len; }unsigned long copy_from_user (void *dst,const void __user *src,unsigned long len) { -mtsp (get_user_space (),1 ); -mtsp (get_kernel_space (),2 ); -return pa_memcpy (dst, (void __force *)src, len); +BUG_ON ((long ) len <0 ); +if (access_ok (VERIFY_READ , src, len)) { +mtsp (get_user_space (),1 ); +mtsp (get_kernel_space (),2 ); + len =pa_memcpy (dst, (void __force *)src, len); + }else +memset (dst,0 , len); +return len; }unsigned long copy_in_user (void __user *dst,const void __user *src,unsigned long len) { +BUG_ON ((long ) len <0 );mtsp (get_user_space (),1 );mtsp (get_user_space (),2 );return pa_memcpy ((void __force *)dst, (void __force *)src, len);
include/asm-parisc/uaccess.h +46 -56
170 lines not on this page · raw message
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux