LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
LinkBack Search this Thread
Old 01-08-2013, 01:10 PM   #1
MarkASatterfield
LQ Newbie
 
Registered: Jan 2013
Posts: 2

Rep: Reputation: Disabled
Accessing kalloc memory from userspace


There are some posts for this item but I can't see any examples. I am trying to kalloc a page in kernel and then mmap it in userspace but I don't believe the memory is mapped correctly. Do I need to allocate userspace memory and then use mmap to map the kernel page to the userspace memory?
 
Old 01-09-2013, 04:56 PM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,039

Rep: Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952Reputation: 952
The problem here is that kernel memory is, by design, inaccessible to user-land processes. Whereas it is possible for the kernel to transfer data to-and-from userland memory relatively easily.

What I would do is to create some easy-to-use rendezvous mechanism ... perhaps a virtual-device ... cabbage ideas freely (say...) from the /proc pseudo-filesystem. Something that a user-land process can very easily call and work with, such that when it does so, you're comfortably in kernel-mode and can move the data to/from where it needs to go.

Actum Ne Agas: Do Not Do A Thing Already Done. Find the closest existing well-known kernel facility that's reasonably close to what you require, and unabashedly "cabbage" it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does it say that an userspace address can point to kernel memory dspjm Programming 6 11-11-2012 09:31 AM
mapping device memory to userspace in embeded environment in coldfire processor clnbabu Linux - Kernel 5 10-03-2011 02:17 PM
[SOLVED] the same story, userspace accees error for a memory mapped control register pardis Linux - Embedded & Single-board computer 2 07-21-2010 06:49 AM
How to retrieve CPU, Disk and Memory utilization in linux userspace code NilesBor Linux - Kernel 2 06-17-2009 08:27 AM
accessing userspace libraries in lkm raj.aprilfool Programming 3 08-07-2008 12:06 AM


All times are GMT -5. The time now is 04:54 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration