-----Original Message-----
From: Daniel Baluta [mailto:[email protected]] 
Sent: Saturday, October 15, 2011 3:34 AM
To: Philip Anil-QBW348
Cc: [email protected]
Subject: Re: Getting 'bad file number' error writing to device driver

On Sat, Oct 15, 2011 at 2:42 AM, Philip Anil-QBW348
<[email protected]> wrote:
> I am calling the driver from an Android program (OMAP4/Blaze). It calls a
> c++ program via JNI which then calls the device driver.
> Someone suggested it might be a permissions problem - the program is running
> in user mode.
>
> on Blaze board, /system/bin
> # ls -l
> -rwxrwxrwx system   system       7636 2011-09-30 03:53 mydriver
>
> Will strace still be useful?
> In general, in Linux, how does one enable a user program to call a custom
> device driver?

Please don't top post! :)

strace will be useful to check the parameters for open, write system calls.

EBADF  fd is not a valid file descriptor or is not open for writing.
Ok, so either open fails, or you don't have the permission to write
into /dev/mydriver file.

------
I apologize for 'top-posting' (I did not know that was undesirable - most email 
clients and also Google newsgroups put one's reply at the top.).
Yes, the /dev/mydriver had permissions 600. I did a chmod to 666 and it worked.
I am performing security testing and want to see if a program running in user 
mode can elevate its privileges to call the device driver which has permissions 
600.
Any ideas how it can?
Anil 

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to