* i/o opening error for PCI access
@ 2011-04-03 17:11 Sengottuvelan S
2011-04-03 22:47 ` Prasad Joshi
0 siblings, 1 reply; 4+ messages in thread
From: Sengottuvelan S @ 2011-04-03 17:11 UTC (permalink / raw)
To: kernelnewbies
Hi All,
I am trying to access /dev/mem in my user process. I could not access
because not a privileged access. I tried to use iopl(3) call in linux 2.6,
but i am getting unresolved symbol for this. Is any other way to get access
in user process. I am not sure how to solve this. Can you someone throw some
light on this.
if(iopl(3)){
fprintf(stderr, "Cannot get I/O permissions (being root helps)");
return -1;
}
if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {
fprintf(stderr, "Failed to open /dev/mem");
return -1;
}
--
Regards,
S. Sengottuvelan.
--
Regards,
S. Sengottuvelan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110403/1fb65255/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* i/o opening error for PCI access
2011-04-03 17:11 i/o opening error for PCI access Sengottuvelan S
@ 2011-04-03 22:47 ` Prasad Joshi
2011-04-04 0:19 ` Sengottuvelan S
0 siblings, 1 reply; 4+ messages in thread
From: Prasad Joshi @ 2011-04-03 22:47 UTC (permalink / raw)
To: kernelnewbies
On Sun, Apr 3, 2011 at 6:11 PM, Sengottuvelan S
<sengottuvelan.s@gmail.com> wrote:
> Hi All,
>
> I am trying to access /dev/mem in my user process. I could not access
> because not a privileged access. I tried to use iopl(3) call in linux 2.6,
I am not sure, but after reading the manpage, it looks like iopl will
give access to the IO ports not the files.
> but i am getting unresolved symbol for this.? Is any other way to get access
> in user process. I am not sure how to solve this. Can you someone throw some
> light on this.
>
> ?? if(iopl(3)){
> ??????? fprintf(stderr, "Cannot get I/O permissions (being root helps)");
> ??????? return -1;
> ??? }
> ? if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {
> ??????? fprintf(stderr, "Failed to open /dev/mem");
> ??????? return -1;
> ??? }
If you look at the file permission, you will notice only root has
permission to write the /dev/mem
$ ls -l /dev/mem
crw-r----- 1 root kmem 1, 1 2011-04-03 08:42 /dev/mem
Opening it for read/write will surely fail.
Thanks and Regards,
Prasad
>
> --
> Regards,
> S. Sengottuvelan.
>
> --
> Regards,
> S. Sengottuvelan.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* i/o opening error for PCI access
2011-04-03 22:47 ` Prasad Joshi
@ 2011-04-04 0:19 ` Sengottuvelan S
2011-04-04 6:25 ` Mulyadi Santosa
0 siblings, 1 reply; 4+ messages in thread
From: Sengottuvelan S @ 2011-04-04 0:19 UTC (permalink / raw)
To: kernelnewbies
Hi Prasad,
question is: anyother way to access like iopl(3) function?.
FYI, With iopl it is possible. But in my kernel i could not locate iopl
function. Is there any similar function like iopl so that i will set the
permission as root id.
On Sun, Apr 3, 2011 at 3:47 PM, Prasad Joshi <prasadjoshi124@gmail.com>wrote:
> On Sun, Apr 3, 2011 at 6:11 PM, Sengottuvelan S
> <sengottuvelan.s@gmail.com> wrote:
> > Hi All,
> >
> > I am trying to access /dev/mem in my user process. I could not access
> > because not a privileged access. I tried to use iopl(3) call in linux
> 2.6,
>
> I am not sure, but after reading the manpage, it looks like iopl will
> give access to the IO ports not the files.
>
> > but i am getting unresolved symbol for this. Is any other way to get
> access
> > in user process. I am not sure how to solve this. Can you someone throw
> some
> > light on this.
> >
> > if(iopl(3)){
> > fprintf(stderr, "Cannot get I/O permissions (being root helps)");
> > return -1;
> > }
> > if ((fd = open("/dev/mem", O_RDWR | O_SYNC)) < 0) {
> > fprintf(stderr, "Failed to open /dev/mem");
> > return -1;
> > }
>
> If you look at the file permission, you will notice only root has
> permission to write the /dev/mem
>
> $ ls -l /dev/mem
> crw-r----- 1 root kmem 1, 1 2011-04-03 08:42 /dev/mem
>
> Opening it for read/write will surely fail.
>
> Thanks and Regards,
> Prasad
>
> >
> > --
> > Regards,
> > S. Sengottuvelan.
> >
> > --
> > Regards,
> > S. Sengottuvelan.
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
> >
>
--
Regards,
S. Sengottuvelan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110403/df3a61b6/attachment-0001.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* i/o opening error for PCI access
2011-04-04 0:19 ` Sengottuvelan S
@ 2011-04-04 6:25 ` Mulyadi Santosa
0 siblings, 0 replies; 4+ messages in thread
From: Mulyadi Santosa @ 2011-04-04 6:25 UTC (permalink / raw)
To: kernelnewbies
On Mon, Apr 4, 2011 at 07:19, Sengottuvelan S <sengottuvelan.s@gmail.com> wrote:
> Hi Prasad,
>
> question is:? anyother way to access like iopl(3) function?.
libcap?
http://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.4/capfaq-0.2.txt
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-04 6:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-03 17:11 i/o opening error for PCI access Sengottuvelan S
2011-04-03 22:47 ` Prasad Joshi
2011-04-04 0:19 ` Sengottuvelan S
2011-04-04 6:25 ` Mulyadi Santosa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).