The itf is actually addr variable . That was a typo while formatting
code in the mail.
Regards,
Asim
On 7/15/08, Asim <[EMAIL PROTECTED]> wrote:
> 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 <[EMAIL PROTECTED]> wrote:
>> Can you be a bit more specific ?
>>
>> On Tue, Jul 15, 2008 at 9:55 PM, Asim <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
>>> 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 [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ