tracking usage of a driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Is there a way to determine all processes that reference a driver at a moment (i.e. that have a file descriptor open, which points to a file structure that refers to the
driver's device special file).

>From the point of view of the driver, the open() file operation you registered is called each time a new file structure referring to a device special file with the
driver's major number is created. However, as far as I know there is no way to be notified, when a new file descriptor points to an already existing file structure
referring to such a device special file (following a call to dup() or to fork()), so you can't maintain a list of processes referring to the driver?

Is there any 'hook' within the VFS, such as 'list of all processes referring to one file structure', that would allow you to find the processes that have access to the
driver at a given moment.

-----------

The use case behind my question is the following:

I have a driver managing a hardware device. Processes access the driver by opening a character
special file to subsequently use the hardware device. 'Using the hardware device' includes
- calling ioctl(), read(), write() on the device special file (which triggers appropriate actions by
the device driver)
- calling mmap() on the device special file to map memory that was allocated by the driver into the processes virtual address space
- calling mmap() on the device special file to map I/O memory of the hardware device into the the processes virtual address space
- performing read/write access to both types of memory after it has been mmaped into the process address space.

Now in some (severe) error cases the driver should stop all operation of the hardware device, prevent the processes to access the device in any way and free the kernel
memory it may have allocated. For this purpose it would be convenient to kill all processes that currently reference the device driver by having a file descriptor pointing
to a file structure that references a device special file with the driver's major number.

regards
Martin
--
Supercomputing System AG          email: maletinsky@scs.ch
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10
CH-8005 Zurich


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux