Re: Detecting illegal memory access
From: Jan Engelhardt
Date: Tue Apr 11 2006 - 07:55:41 EST
>
>A user program can trap EFAULT.
There are no syscalls involved. It is a [arch-dependent] stack backtrace
that walks up EBP. But object files compiled with -fomit-frame-pointer have
random values in %ebp. So when doing
ebp = *(void **)ebp;
it either succeeds or throws SIGSEGV. Catching signals is catchy because
the backtrace might be done in a threaded application. Does *jmp() work
with threads?
>However, you need to use siglongjmp()
>to get back into your program and continue, plus you need to do very
>careful coding to mask and unmask the appropriate signals though it
>all. Since protection is on a per-page basis, one could make a program
>that attempts to R/W from virtual page 0 on up, recoding success or
>failure for each page.
Jan Engelhardt
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/