[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201104212136.38017.arnd@arndb.de>
Date: Thu, 21 Apr 2011 21:36:37 +0200
From: Arnd Bergmann <arnd@...db.de>
To: brace@...rdog.cce.hp.com
Cc: scameron@...rdog.cce.hp.com, linux-kernel@...r.kernel.org
Subject: Re: How to create a kernel virtual mapping for physical addresses.
On Thursday 21 April 2011 20:46:00 brace@...rdog.cce.hp.com wrote:
> Thanks for your reply.
>
> I have a block of highmem that I want to map into my 32bit driver.
> This block is 256M in size.
If you have highmem enabled, there probably is not enough space
to map all of this at once into the vmalloc area. If you had
that much virtual address space, you would not need highmem ;-)
> I get the physical address and want to create a contiguous virtual buffer.
> I have been investigating vmap() as a possible solution.
>
> I build up an array of pages as follows.
> pfn = physical_address >> PAGE_SHIFT
> for (i = 0; i < num_pages; i++) {
> page = pfn_to_page(pfn);
> page_array[i] = page;
> ++pfn
> }
>
> map = vmap(page_array, num_pages, VM_IOREMAP, PAGE_KERNEL);
>
> Using the above method, I can memset the block of memory using
> map as my virtual address.
>
> However, later, I get the following error message:
>
> kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
> BUG: unable to handle kernel paging request at virtual address c5000840
>
> The address 0xc5000840 is within the range of vmap()ed memory.
Maybe you have overwritten a kernel module and the kernel now
tries to execute within the mapped area?
> What should I be doing instead?
It's not clear at all what you are actually trying to do. Which driver
is this? If it's out-of-tree code, please post it here.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists