The attached patch implements EFAULT detection in linux-user. It is suprising how much software "relies" on the kernel returning EFAULT instead of just crashing. This patch can be broken down into 3 parts: exec.c: Add page_check_range(), which uses the page map of the target to determine wether an address and range are valid.EFAULT is returned when an invalid address is detected. linux-user/qemu.h: Add lock_and_check_user_struct(), wich is similar to lock_user_struct(), but adds a call to page_check_range() to detect bad addresses. Once all occurrances of lock_user_struct() have been converted over to this new function, the new function could be renamed back to lock_user_struct() to shorten it slightly. linux-user/syscall.s: This is where lock_and_check_user_struct() is used. It is used to perform the mapping from target to host addresses. Generally, calls to lock_user_struct() have been replaced with calls to lock_and_check_user_struct(). For example - lock_user_struct(target_tv, target_addr, 0); + if( (ret=lock_and_check_user_struct(&target_tv,target_addr, sizeof(*target_tv),0,PAGE_WRITE)) != 0 ) return -ret; These changes permit many of the tests in LTP for error conditions to now pass. Stuart Stuart R. Anderson anderson@netsweng.com Network & Software Engineering http://www.netsweng.com/ 1024D/37A79149: 0791 D3B8 9A4C 2CDC A31F BD03 0A62 E534 37A7 9149