Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 01-08-2013, 02:10 PM   #1
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, 05:56 PM   #2
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,986

Rep: Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444Reputation: 1444
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.


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

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 10:31 AM
mapping device memory to userspace in embeded environment in coldfire processor clnbabu Linux - Kernel 5 10-03-2011 03: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 07:49 AM
How to retrieve CPU, Disk and Memory utilization in linux userspace code NilesBor Linux - Kernel 2 06-17-2009 09:27 AM
accessing userspace libraries in lkm raj.aprilfool Programming 3 08-07-2008 01:06 AM

All times are GMT -5. The time now is 08:58 AM.

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