Re: Kernel Executable Pages

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

 



I'm allocation some function pointers and they were not executable. I
wanted to make them executable. I was able to fix my problem. Let me
know if there is any bug in what I did.

my_array_of _fn_pointers = kmalloc(sizeof
your_favourite_fn_ptr_struct_here, GFP_KERNEL);

 addr = my_array_of _fn_pointers ;
 addr_end = (unsigned long) my_array_of _fn_pointers + (unsigned long)
sizeof(your_favourite_fn_ptr_struct_here);

  /* Make the memory allocated executable. */
  for (; addr < addr_end; addr += PAGE_SIZE)
    change_page_attr(virt_to_page(itf), 1, PAGE_KERNEL_EXEC);

  printk ("Making the pages executable.\n");
  global_flush_tlb();

It seems to work fine so far.

Regards,
Asim Kadav

On 7/15/08, Sandeep K Sinha <sandeepksinha@xxxxxxxxx> wrote:
> Can you be a bit more specific ?
>
> On Tue, Jul 15, 2008 at 9:55 PM, Asim <linkasim@xxxxxxxxx> wrote:
>> Hi,
>>
>> I try to allocate memory to generate some executable code in memory.
>> But when i try to execute - I get the following error "kernel tried to
>> execute NX-protected page - exploit attempt? (uid: 0)". Is there some
>> different way to allocate executable memory (and not data). Kindly
>> help.
>>
>> Regards,
>> Asim
>>
>> --
>> To unsubscribe from this list: send an email with
>> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>
>>
>
>
>
> --
> Regards,
> Sandeep.
>
>
>
>
>
>
> "To learn is to change. Education is a process that changes the learner."
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux