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

Re: Regarding general fault protection



Thanks Peter,

I messed up slightly  in handling the pointers.
Its working fine now.

-Tarani

On Sun, Nov 2, 2008 at 9:40 PM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
linux kernel classify all kernel address that is "NOT PRESENT" as
general protection fault:

In arch/x86/mm/fault.c:do_page_fault():

               tsk->thread.cr2 = address;
               /* Kernel addresses are always protection faults */
               tsk->thread.error_code = error_code | (address >= TASK_SIZE);
               tsk->thread.trap_no = 14;
               force_sig_info_fault(SIGSEGV, si_code, address, tsk);

Ie, so long as the ptr (which is pointing into the kernel range: ">=
TASK_SIZE") is not a valid memory address (__PAGE_PRESENT flag set to
0 for the page's PTE) - it is illegitimate and will fault.

On Mon, Nov 3, 2008 at 6:31 AM, taraniteja vishwanatha
<taraniteja@xxxxxxxxx> wrote:
> Hey,
>
> when do we get a general fault protection  in the kernel?  I am trying to
> lookup in for some data pointer and when its not present , I return 0.
> I am getting this error.
>
> Can anybody help??
>
> -Tarani
>



--
Regards,
Peter Teoh