How the user process can access the character device loaded by my module


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How the user process can access the character device loaded by my module
# 1  
Old 10-04-2011
How the user process can access the character device loaded by my module

I am trying to load into the kernel a system-call dynamically (without restarting the kernel and compailing it) in an attempt to (once in kernel mode) write to user process's memory.

(I know there is a way to do this with the ptrace interface but it is not an option.)

I know the only way to do this is to load a module. In order to allow the user communicating with it, i was told to use a character device (which is supposed to be in /dev/, right?). I loaded one successfully. My problem is that i don't know how the user process access it without an system call. (i was told to use ioctl) Could anyone show how a user process can call ioctl for example that was loaded by my module?

Thanks, Shai
# 2  
Old 10-04-2011
Code:
int val;
int fd=open("/dev/mydev", O_RDWR);
ioctl(fd, some_ioctl, &val);

If you need more detail than that, I'll need more detail from you. I don't even know what operating system you're on, let alone what your driver's doing...

Last edited by Corona688; 10-04-2011 at 06:00 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HTTP::DAV module errors - can't access URL

Hello, I am attempting to use the HTTP/DAV module in perl, and I have a script that transfers files to a website. However, I get the following error message: "Couldn't open https://www.thisismyurl.com/DAV: The URL "https://www.thisismyurl.com/DAV" is not DAV enabled or not accessible." ... (0 Replies)
Discussion started by: Scatterbrain26
0 Replies

2. Linux

HTTPD process user to access NIS

Hi, I have a machine A with a web server apache2 running. By default, apache2 user is wwwrun. Problem is that this user is local. Instead, I would like apache2 user to be able to login via NIS server so it can access NFS resources of two NIS different groups, let's say group1..groupN... (2 Replies)
Discussion started by: asanchez
2 Replies

3. UNIX for Advanced & Expert Users

Access a File as a Device?

I backed up my 320GB hard drive to a file with dd: dd if=/dev/sda of=dev_sda.17-Mar-2012 bs=1048576The main idea was to be able to be able to completely replace my hard drive from this backup if necessary, but I'd also like to be able to restore individual files. I realize I could use this dd... (20 Replies)
Discussion started by: Matt Miller
20 Replies

4. UNIX for Advanced & Expert Users

AIX Dependent Module could not be loaded

I am encountering the above error , even after setting the environment variables correctly AFAIK. I've found sources that say LIBPATH is the shared library variable , and others that say LIB_PATH, so I set both: ========================= root@lipossrp01ga: # echo $gtm_dist ... (6 Replies)
Discussion started by: Clovis_Sangrail
6 Replies

5. Fedora

Is Kernel module is the same as a device driver?

I have been reading prep questions for my second unix academy exam, and there's a nuance, I'm not sure I understand it correctly. I've been under impression from my readings of book by Evi Nemeth and from unix academy DVDs I've been watching, that kernel's modules are drivers. I think of it, as... (25 Replies)
Discussion started by: newlinuxuser1
25 Replies

6. SCO

module loaded during the start up

hi Howto find out which driver (module) were loaded during the startup of SCO 5.0.6? (5 Replies)
Discussion started by: ccc
5 Replies

7. Homework & Coursework Questions

The pseudo-device provides a “backdoor” for gaining root access for a particular user.

Problem statement. In this part of the assignment, delegates will create a pseudo-device and write a device driver for it. The pseudo-device provides a “backdoor” for gaining root access for a particular user. Instead of compiling the device driver into the kernel, delegate will create a module.... (1 Reply)
Discussion started by: nyjilgeorge1
1 Replies

8. Solaris

mcrypt module is not initially loaded with php

Hi I'm trying to do an upgrade for one application and whenever I run the upgradre the program shows the error that mcrypt module is not initially loaded with php. My server is running xampp 0.9 and I know this library of mcrypt is already installed. I changed the php.ini file in order to... (0 Replies)
Discussion started by: dahr
0 Replies

9. UNIX for Dummies Questions & Answers

controll access to a device

Hello everyone, I write a program (Linux & Solaris) that will run as non-root user, but the program must have rw access to a device /dev/ipmi (on linux) or /dev/bmc (on solaris). What is the standard way of granting such access? Linux: chmod on /dev/ipmi ? suid root my program? Solaris:... (1 Reply)
Discussion started by: Pavel.Bures
1 Replies

10. UNIX for Advanced & Expert Users

Can kernel process access user address space ?

Can kernel process access user address space ? (2 Replies)
Discussion started by: subhotech
2 Replies
Login or Register to Ask a Question