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
7
votes
1 answer
The address in Kernel
I have a question when I located the address in kernel. I insert a hello module in kernel, in this module, I put these things:
char mystring[]="this is my address";
printk("<1>The address of mystring is %p",virt_to_phys(mystring));
I think I can…

Alex
- 869
- 3
- 13
- 20
6
votes
0 answers
Linux kernel "BUG: bad page state in process .." understanding
I have some proprietary kernel module.
And suddenly my system crashed in kdb with such bug:
BUG: bad page state in process pfn:37751
page: count:-1 mapcount:0 mapping:00000000 index:0x0
...
page dumped because: nonzero…

budoattack
- 379
- 3
- 11
6
votes
3 answers
How to create proc entry under /proc/driver?
I want to create a file under a /proc/driver directory. I would like to use a macro like proc_root_driver (or something else provided) rather than use "driver/MODULE_NAME" explicitly. I use create_proc_entry :
struct proc_dir_entry…
Mustika_wiguna
6
votes
1 answer
How to use do_mmap() in kernel module
I would like to use do_mmap() in a kernel module. According to this question this should be possible.
Here is a minimal non-working example:
hp_km.c:
#include
#include
MODULE_LICENSE("GPL");
static int __init…

andreas
- 143
- 4
6
votes
4 answers
sound driver - snd-aloop kernel module setup issue with AWS EC2 ubuntu 16.04 instance
Unable to use snd-aloop audio driver in AWS EC2 ubuntu 16.04 instance
On running modprobe on snd-aloop
$modprobe snd-aloop
modprobe: FATAL: Module snd-aloop not found in directory /lib/modules/4.4.0-1052-aws
Kernels in AWS matchine are…

rahul
- 366
- 1
- 5
- 21
6
votes
2 answers
nfhook (netfilter) error: assignment from incompatible pointer type
I have seen this page with similar error message: Nf_hook_ops returns incompatible pointer when assigning to hook_func -C -Linux -Netfilter
However, it didn't give a clear answer to how to solve the issue. The author for that question says that he…

DataScienceExplorer
- 61
- 5
6
votes
2 answers
How do I access any kernel symbol in a kernel module?
I am wanting to use the function getname in my kernel module. It is not exported. Since I am running into this problem right now, I would like to know how to access and use any kernel symbol that is not exported. I figure that the steps necessary to…

Melab
- 2,594
- 7
- 30
- 51
6
votes
1 answer
What is the difference between T and t in /proc/kallsyms
This is a part of text file from System.map and /proc/kallsyms.
ffffffff8106c260 T leave_mm
ffffffff8106c340 t do_flush_tlb_all
ffffffff8106c390 t flush_tlb_func
ffffffff8106c510 T native_flush_tlb_others
ffffffff8106c540 T…

elsdy
- 69
- 1
- 3
6
votes
3 answers
Linux Kernel Programming: "Unable to handle kernel NULL pointer dereference"
I'm writing a Linux module and getting:
Unable to handle kernel NULL pointer dereference
What does it mean?

Daniel Silveira
- 41,125
- 36
- 100
- 121
6
votes
2 answers
How to use find_module?
How to use linux kernel's find_module() function?
The documentation says "must hold module_mutex".
Does that mean that I should acquire
a lock in my module code before
searching for a pointer to another?
When this mutex is locked by
non-module…

Basilevs
- 22,440
- 15
- 57
- 102
6
votes
1 answer
Intercept ELF loader in linux kernel: fs/binfmt_elf.c file via loadable kernel module
I am new to kernel coding and at present I am working with ELF files which have been modified a little bit for the security purposes for which I need to look at some of it's custom section headers and extract the unique code encryption key from it…

bawejakunal
- 1,678
- 2
- 25
- 54
6
votes
1 answer
Why compile Android kernel module with -fno-pic?
I often read that Android kernel modules have to be compiled with -fno-pic to work. Is this specific to the ARM architecture, or why don't/(when do) kernel modules for x86 need to be compiled with that flag?

jckuester
- 277
- 1
- 5
- 15
6
votes
3 answers
Linux Kernel - Where in the kernel are blocks of data physically written to specific disk partitions?
I'm modifying the Linux kernel and am trying to find where in the kernel source blocks of data are physically written to disk partitions such as ubd0. Where does this occur in kernel source? The actual physical write call? I cannot find this.…

SpdStr
- 61
- 2
6
votes
1 answer
Purpose of `#ifdef MODULE` around module_exit()?
I am currently looking through the code of a "third-party" driver in an attempt to figure out/learn how it functions. I've had a look at sites such as this one, so I sort of understand how the basic premise works, but I don't understand the purpose…

janneia
- 63
- 7
6
votes
3 answers
How to export a struct between two kernel modules using EXPORT_SYMBOL or equivalent?
I have a kernel module which has a structure like this:
struct test {
int a;
int b;
.....
}
I have created an array of instances of this struct as:
struct test foo[8];
I want to export this structure or the array "foo" using…

iqstatic
- 2,322
- 3
- 21
- 39