Skip to contentSkip to conversation

Mapping non-page aligned data to user

DISCUSSION Vira 2 participants 3 messages Feb 6, 2009

lore
Share & tools
lore

Vira

author
#0 lore raw

Hi,

Is there a way to map a non-page aligned kernel physical address to user virtual address? remap_pfn_range and vm_insert_page operate only on page-aligned physical addresses.

If there is no such support, would it be too complicated to try out writing something on my own to map non-page aligned addresses (the data size is under my control - so I can make that a multiple of page size)?

Any suggestions appreciated.

Thanks
-- Vira

#1 lore raw
Quoted 9 lines · Vira

Hi,

Is there a way to map a non-page aligned kernel physical address to user virtual address? remap_pfn_range and vm_insert_page operate only on page-aligned physical addresses.

If there is no such support, would it be too complicated to try out writing something on my own to map non-page aligned addresses (the data size is under my control - so I can make that a multiple of page size)?

Any suggestions appreciated.

The CPU, and therefore the kernel, couldn't ensure that the user doesn't write outside the mapped region of kernel memory if it's not page aligned (the access control is page granularity only). That seems like it would be a show-stopper in most cases.

What exactly is it you're trying to achieve with this?

author
#2 lore raw

I am trying to map DMAed packets directly to contiguous user buffer (avoiding the copy)- thinking of how to skip the packet headers here.

Thx,
-- vira

Quoted 36 lines · Robert Hancock

From: Robert Hancock <[email protected]>
Subject: Re: Mapping non-page aligned data to user
To: [email protected]
Cc: [email protected]
Date: Thursday, February 5, 2009, 4:27 PM

Quoted 2 lines · Vira

Hi,
Is there a way to map a non-page aligned kernel

physical address to user virtual address? remap_pfn_range and vm_insert_page operate only on page-aligned physical addresses.

Quoted 2 lines

If there is no such support, would it be too

complicated to try out

Quoted 1 line

writing something on my own to map non-page aligned

addresses (the data

Quoted 1 line

size is under my control - so I can make that a

multiple of page size)?

Quoted 2 lines

Any suggestions appreciated.

The CPU, and therefore the kernel, couldn't ensure that the user doesn't write outside the mapped region of kernel memory if it's not page aligned (the access control is page granularity only). That seems like it would be a show-stopper in most cases.

What exactly is it you're trying to achieve with this?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/