LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile
User Name
Password
Linux - Mobile This forum is for the discussion of all topics relating to Mobile Linux. This includes Android, Tizen, Sailfish OS, Replicant, Ubuntu Touch, webOS, and other similar projects and products.

Notices


Closed Thread
  Search this Thread
Old 05-26-2011, 01:41 AM   #1
pavan8085
LQ Newbie
 
Registered: May 2011
Location: Bangalore, India
Distribution: Ubuntu
Posts: 13

Rep: Reputation: 8
Lightbulb /dev/mem permissions


Hi All,

I've a set of questions regarding /dev/mem-

1. Many articles on the net, seem to refer /dev/mem as the gateway to "Physical RAM". But if I am right, /dev/mem is the gateway to the "Physical Address Space" of the processor which might include control registers of many HW peripherals and not just the RAM? Please correct me if I am wrong!

2. In order to prevent attackers from misusing /dev/mem and altering kernel memory, a flag CONFIG_STRICT_DEVMEM needs to be enabled which will prevent user apps from accessing physical address space beyond 1MB. I checked the config file on my PC ( Ubuntu ) and found that CONFIG_STRICT_DEVMEM = y. And I wrote a program which tries to read to physical memory beyond 1 MB and I was able to read!! No segmentation fault or any operation permitted error. How is this possible?
(
My program roughly looks like this-
fd=open ( "/dev/mem", O_RDWR);
ptr=(int*)mmap(0,MAP_SIZE,PROT_READ, fd, myAddress & (~MAP_MASK));
printf("%d",*ptr);
)
 
Old 05-26-2011, 01:51 AM   #2
pavan8085
LQ Newbie
 
Registered: May 2011
Location: Bangalore, India
Distribution: Ubuntu
Posts: 13

Original Poster
Rep: Reputation: 8
Sorry for posting it in "Linux Mobile" forum. I should have posted it in "Linux Kernel" forum. I am unable to find any option to change forum, So I am re-posting it in "Linux Kernel" forum too!
 
Old 05-26-2011, 01:59 AM   #3
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Just click the report button on your own post next time and ask a moderator to move it for you. This way you don't have multiple threads for the same question which would only confuse both you and us. Report it now please for closure so you can keep your conversation in one place.

Kind regards,

Eric
 
Old 05-27-2011, 07:35 AM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Continue here:
http://www.linuxquestions.org/questi...ssions-882771/
 
  


Closed Thread



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
Proper use of /dev/mem? RogueWarrior65 Programming 1 11-22-2010 11:29 AM
[SOLVED] Stupidly ran "cat /dev/urandom > /dev/mem", worried I broke firmware crosstalk Linux - Hardware 2 10-25-2010 05:27 PM
What would happen if I where to cat /dev/mem > /dev/null Joey.Dale Linux - General 11 07-26-2009 12:46 PM
Startx Permission problems on /dev/null and /dev/mem on freshly compiled 2.6.22.1 Eric_Cartman Linux - Kernel 2 09-09-2007 01:42 AM
decoding /dev/mem EkantoApon Programming 2 02-10-2006 10:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Mobile

All times are GMT -5. The time now is 07:10 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration