Questions tagged [kernel-module]

A kernel module is a run-time loadable object file that is loaded into operating system kernel to add functionality to a running kernel. Examples include device drivers and other kernel items.

2228 questions
0
votes
0 answers

How can I make IOCTL calls from a driver to another driver Linux

Is it possible to use ioctl inside a kernel module? Or is there any good solutions for this
0
votes
0 answers

I'm trying to hook arbitrary Linux kernel functions at runtime, why is it not working?

I'm trying to hook arbitrary Linux kernel functions at runtime with a support of an LKM, and extract parameters passed to them. Here's the userspace part that does the whole orchestration:…
jafarlihi
  • 50
  • 1
  • 4
  • 15
0
votes
1 answer

Which kernel function does on-demand module loading triggered by accessing a non-existent device node under /dev?

In /usr/lib/modules/$(uname -r)/modules.devname, the first line is a comment: # Device nodes to trigger on-demand module loading. Assuming what it means is that the first time a device file under /dev is accessed, a module which populates that file…
QnA
  • 1,035
  • 10
  • 25
0
votes
1 answer

kernel module doesn't search for include library when -I is used

I want to build a basic main.c, that is actually a kernel module written in C. I have include header files that are in include/. I want to use GCC -I to make GCC search for the include headers in -Iinclude. However, GCC doesn't seem to understand…
0
votes
0 answers

Need a faster way to build and debug Linux kernel

I'm trying to debug my hardware, compile latest Linux kernel (5.19.0-rc5) using regular steps. make oldconfig make -j16 bzImage make -j16 modules make modules_install && make install New kernel is working almost fine, Except my SPI amplifiers. I'm…
Hereblur
  • 2,084
  • 1
  • 19
  • 22
0
votes
0 answers

Why is dump_stack() function empty in linux kernel 5.14.0?

I'm trying to learn about linux kernel module development, and I see in several resources the use of dump_stack defined in linux/printk.h. I tried it, and it doesn't do anything, so I go to look in the header files included with linux 5.14…
0
votes
0 answers

How to compile the kernel modules step by step (Preprocessing - compiler - assembler - linker)?

I want to write a step compiler Linux kernel module driver method. But I don't know how to write the Makefile. I want to implement Makefile functionality like this: create files: driver.i driver.S Because I want to know how the kernel macros…
sky
  • 1
0
votes
0 answers

How to change a Process' Privilege Level inside of a Windows File Filter Driver (minifilter driver)?

What Windows kernel API calls are available from a Windows File System Filter Driver (minifilter driver) that allow the driver to change the privilege level to/from SYSTEM/Administrator for a process that was intercepted by the File System Filter…
0
votes
0 answers

linux-xlnx kernel updating from 3.17.0 to 5.15.0, get_fs(), set_fs() macros

I am new to kernel driver development and I am trying update kernel version of a legacy project. Example code is below #include struct file *file_open(const char *path, int flags, int rights) { struct file *filptr = NULL; …
0
votes
1 answer

Enable event tracing upon kernel module load

I want to use Ftrace event tracer for my kernel module. It is important to me that I'll be able to trace right when the module loads- in similar fashion to enabling events during boot via the kernel command line. I had no success with it, I did saw…
user2063776
  • 201
  • 1
  • 2
  • 4
0
votes
1 answer

How to edit a bio write request

I'm writing a device-mapper which has to edit incoming writes, for example: Incoming bio request contains a biovec with a page full of 0s, and I want to change it to all 1s. I tried using bvec_kmap_local() to get the page address, and then I can…
Jasper
  • 302
  • 3
  • 11
0
votes
0 answers

How to read/write "/sys/bus/pci/devices/.../resource2" in linux kernel or kernel module?

I am a green hand in linux kernel writing. I have two kvm virtual machines in qemu. I add a ivshmem for each, and they can use open and mmap function to read/write /sys/bus/pci/devices/0000:00:05.0/resource2 to sync memory. Here is a reference:…
0
votes
2 answers

binfmt_misc kernel module not used

I am evaluating an NXP iMX.8 based (which is arm64v8) board. The eval kit came with a 5.10.72 Linux kernel but did not have binfmt_misc kernel module. After contacting the vendor, they provided the needed module which matches the kernel version. I…
Paul Grinberg
  • 1,184
  • 14
  • 37
0
votes
0 answers

windows kernel: reading/splitting command-line arguments from processes

I'm working on a windows kernel driver that reports the command-line arguments of started processses. While getting the command-line string is easy, I'm having trouble interpreting it as separate arguments. I'm using ProcessNotifyExCallback which…
maja
  • 17,250
  • 17
  • 82
  • 125
0
votes
1 answer

Linux kernel v5.15 - how to read and write from /proc file by python

I created a kernel module and I want to communicate using a /proc file between the module and a script in python. I am using the Ubuntu 22.04 kernel version v5.15. I tried to create the /proc file in my module below: #include…