I would like to call a ioctl function from a program launched with a low-privilege user.
Is it possible and, if so, how should i perform this ?
Here is my ioctl action :
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
I'm creating a usb device driver that needs to be able to read from two different endpoints. I couldn't see any way of having two read functions in the driver, so I got round this by reading from one of the endpoints with read, and the other with ioctl.
I have written one kernel module which implements hooking of system calls. In the hooked system call, I just printk input parameters passed to that function and in case of ioctl, I get
fd=21, cmd=3222823425 and arg=3198662648
After decoding, I get to know that it's mmap2 system call being made through ioctl.
And in syscalls.h file, there is unmap sys call but not mmap.
I have mapped the pci memory in user space like
fs = open("/dev/mem",O_RDWR | O_SYNC);
mmap_src = mmap(NULL, BUFF_COUNT, PROT_READ | PROT_WRITE, MAP_SHARED, fs, 0xe0000000);
0xe0000000 is the addressof pci memory device.
lsmod , /proc/modules and slabinfo , /proc/meminfo
does NOT give how much memory my kernel module is using
is there a way to find this out ?
btw, I wrote a small test program basically, a device driver that takes ioctl call to alloc 1MB and I send this ioctl message every second from my application so my drive does kmalloc every second.
I am just confused like how can I break cmd=3222823425 value into different parts to figure out what this command means actually in the Linux kernel.
I am just confused like how can I break cmd=3222823425 value into different parts to figure out what this command means actually in the Linux kernel.
First of all, is it possible to call ioctl from a kernel module?
Can anyone provide an example of how it's used?
My research is how to get a Permission set of the android application(.apk file) using android API calls for resources, and get another list of the Permission set used by application (in android manifest file).