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
1 answer

Hooking to system call in ubuntu 22.04(The kernel version is 5.15)

i tried to create kernel module that make hooking to system call of "bind"(sys_bind).the module: #include #include #include #include #include #include…
daniel
  • 25
  • 7
0
votes
1 answer

.ko file not being built when building kernel modules

I am currently trying to learn how to make kernel modules from the 'Linux Device Drivers' book. I have the basic example typed out as follows: #include #include MODULE_LICENSE("Dual BSD/GPL"); static int…
finlay morrison
  • 225
  • 1
  • 5
0
votes
0 answers

initialization from incompatible pointer type nf_hook_ops

I have written a pre route hook function in my LKM. When I try to compile it, it gives me below warning /home/sample/kmod-sample/kernel/kmod_sample.h:159:9: warning: initialization from incompatible pointer type [enabled by default] .hook …
Vandan
  • 1
  • 3
0
votes
0 answers

My Kernel code not recognizing USB port when plugged or unplugged

Hi I am learning linux kernel and wrote a simple function as below and this is the USB port I want to know whether it is plugged in or unplugged. However when I print it out I don't see any relevant information. What am I doing wrong ? #include…
takanoha
  • 183
  • 4
  • 17
0
votes
1 answer

What's the difference between register_chrdev() and register_chrdev_region()?

I'm currently studying Linux device drivers and am confused between two similar static device registration functions: register_chrdev() register_chrdev_region() These functions both statically register device drivers. The first function registers…
Izzo
  • 4,461
  • 13
  • 45
  • 82
0
votes
1 answer

beegfs-client fails to build due to missing kernel source

I'm trying to set up a Centos 7 server with the Beegfs-client. As part of the setup, I need to rebuild the client based on the kernel I'm running, however beegfs-client does not find the kernel sources: After installing…
Jarmund
  • 3,003
  • 4
  • 22
  • 45
0
votes
1 answer

Linux Proc kernel hello world program

make -C /lib/modules/5.13.0-37-generic/build M=/home/a1085551/osc10e/ch2 modules make[1]: Entering directory '/usr/src/linux-headers-5.13.0-37-generic' CC [M] /home/a1085551/osc10e/ch2/hello.o /home/a1085551/osc10e/ch2/hello.c: In function…
Hasta
  • 3
  • 1
0
votes
0 answers

calling mprotect in kernel module

I have a kernel module where I need to call mprotect for the current user process. I was thinking of making a direct call to do_mprotect_pkey but the function is marked as static. If not, is there any other way like going through a system call or…
ruke
  • 55
  • 5
0
votes
1 answer

Hijacking page fault handler

I have a process PID that access a memory region that it's not allowed to, the CPU creates a trap into the kernel which calls do_page_fault() which will send SIGSEGV to the user process. The user process has a custom signal handler that has some…
0
votes
0 answers

Write string to /proc/module from kernel module

I am writing a string from my kernel module to /proc and trying to read in the user space but getting an error. What am I doing wrong in the below code? Writing just an integer or a hardcoded string works fine, but writing a string variable gives an…
tarun14110
  • 940
  • 5
  • 26
  • 57
0
votes
0 answers

Calling a function in a external kernel module from a internal module

I have built an external kernel module with exported functions which builds and loads fine, including showing the exported functions in the /proc/kallsyms with a "T" when loaded. I now want to call those functions from a existing kernel module that…
0
votes
0 answers

Kernel panic on simple loadable kernel module

I`m trying to create an elementary loadable kernel module to embedded OpenWRT system on the Ralink 3050 SOC (processor MIPS 24KEs). The target system built with MODULES=y and CONFIG_MODULE_UNLOAD=y options. I work under Ubuntu 20 X86…
0
votes
1 answer

modprobe fails to insert beegfs after installing mellanox drivers

I have a storage cluster that has been churning along for a few years. It's based around a pretty stock Centos 7.6 setup, using beegfs. In an effort to increase throughput I've decided to do a test-upgrade of the network, from 10gig to 40gig.…
Jarmund
  • 3,003
  • 4
  • 22
  • 45
0
votes
0 answers

PCIe multiple child-devices

I am writing a Linux kernel driver (kernel 4.9) for our custom setup. We do use a ARM64 based board with a PCIe interface. Connected to the interface we have an extension board with a FPGA on it. At this moment I succeed at creating a device that…
0
votes
0 answers

How to know the control flow during transition in state-machine?

I've been studying spaghetti-based state-machine, meaning that it's composed of a bunch of if-else statements scattered everywhere, in large kernel module recently in order to port this module to other platform. To understand how control flow goes…
Andy Lin
  • 397
  • 1
  • 2
  • 21