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.
Questions tagged [kernel-module]
2228 questions
8
votes
5 answers
printk() doesn't print in /var/log/messages
My OS Ubuntu 12.04. I wrote this Kernel Module and i use insmod and rmmod command but there isn't anything in /var/log messages. how can i fix this problem?
/*
* hello-1.c - The simplest kernel module.
*/
#include /* Needed by…

amiref
- 3,181
- 7
- 38
- 62
8
votes
1 answer
Linux stuck in CPU soft lockup?
My system is a CentOS 6.3 (running Kernel version 2.6.32-279.el6.x86_64).
I have a loadable kernel module which is a driver that manages a PCIe card.
If I manually insert the driver using insmod while the OS is up and running, the driver loads…

Ahmed A
- 3,362
- 7
- 39
- 57
8
votes
2 answers
unable to "rmmod" the module
I'm working with a large embedded software (ARM processor, embedded linux 2.6.31, busybox) involving both kernel and user space code. There's a kernel module normally loaded first, and daemon establishing netlink socket with the module.
The issue…

Mark
- 6,052
- 8
- 61
- 129
8
votes
2 answers
Changing file permissions in kernel
I am writing kernel module(C in Linux) and I want to change the permission of the other files in it.
any solution?
since I am in kernel I can't use chmod syscall and ...
thanks for your help
This is my Makefile:
> obj-m += ca.o
>
> all:
> …

Mehrdad
- 83
- 1
- 6
8
votes
1 answer
Best linux distribution to do Kernel Module programming
I want to do kernel module programming. But, all sources tell that linux distributions patch the original kernel and that module codes might not run on them. If this is true, what should i do.I tried making lfs using ubuntu but errors cropped up at…

AvinashK
- 3,309
- 8
- 43
- 94
8
votes
1 answer
Relocation Error when Inserting External Cross-Compiled SPARC Linux Module
First off: I am not an expert, so please excuse any mistakes I make trying to explain myself.
I am trying to cross-compile an external Linux module for a SPARC machine using Sparc-Linux-GCC-4.4.2. The version of the Linux kernel is…

Stuart
- 1,733
- 4
- 21
- 34
7
votes
1 answer
Linux: How to assign USB driver to device
This question is two-fold:
1- How do you manually detach a driver from a USB device and attach a different one? For example, I have a device that when connected automatically uses the usb-storage driver.
// usbview output
Vendor Id: xxxx
Product…

linsek
- 3,334
- 9
- 42
- 55
7
votes
2 answers
Compile linux kernel (2.6) module including non kernel headers
Is it possible to compile a linux kernel(2.6) module that includes functionality defined by non-kernel includes?
For example:
kernelmodule.h
#include
#include
#include // printk()
// ...
#include…

Mike Hamer
- 1,155
- 11
- 22
7
votes
2 answers
Communication between Linux kernel and user space program
I'm currently writing a Linux kernel module, and have problems implementing its communication with user space programs.
This kernel module needs to receive tasks issued by a user space program, and send results back to user space program after…

Santa Zhang
- 884
- 8
- 13
7
votes
3 answers
Getting kernel version from linux kernel module at runtime
how can I obtain runtime information about which version of kernel is running from inside linux kernel module code (kernel mode)?

Bogi
- 2,274
- 5
- 26
- 34
7
votes
1 answer
Handling an undefined instruction in the kernel
So I'm playing around with reading system registers in the kernel and I've recently run into a bit of a roadblock.
In ARM64, certain system registers (e.g. OSECCR_EL1) are not always implemented. If they are implemented, then trying an mrs…

Roguebantha
- 814
- 4
- 19
7
votes
0 answers
Executing rdmsr / wrmsr with secure boot on?
I'm trying to undervolt my CPU on a Intel Skylake machine running Ubuntu 18.04 / kernel 4.18.0-16 in Secure Boot mode and need to read/write MSR 0x150. I have signed and loaded the msr.ko kernel module, but can't run the executables rdmsr and wrmsr…

Bim
- 1,008
- 1
- 10
- 29
7
votes
1 answer
What is the purpose of class and class device?
I followed some tutorials that explained how to write Linux kernel modules and I am a bit confused. Even after reading the official "documentation", I have poor understanding of the concepts.
After creating a character device (register_chrdev), I…

Artium
- 5,147
- 8
- 39
- 60
7
votes
1 answer
Linux Kernel - How to match a jprobe to kretprobe?
I am writing a kernel module to monitor a few syscalls wanting to return the function arguments to user-land (via netlink socket) if the call was successful.
jprobe.kp.symbol_name = "rename";
jprobe.entry = rename_handler;
kretprobe.kp.symbol_name…

rvk
- 737
- 3
- 9
- 23
7
votes
1 answer
Why printk doesn't print message in kernel log(dmesg)
I wrote small kernel module code as mentioned below,
I am testing it in ubuntu 14.04
#include
#include
#include
#include
int init_mod_func(void)
{
printk(KERN_INFO "My module…

ART
- 1,509
- 3
- 29
- 47