2,305 questions
-4
votes
0
answers
79
views
Custom board based on i.MX soc: custom driver module crashes after Linux update
Introduction: I'm using a custom board based on an i.MX6q SoC that communicates with an FPGA on the EIM bus: this communication is managed via custom driver module. The DTACK signal and memory WDOG ...
1
vote
0
answers
27
views
Raspberry Pi 5 PMUs return 0 when configured manually from EL1
I am working on a Raspberry Pi 5 (aarch64).
uname -a:
Linux rpi5 6.8.0-1036-raspi #40-Ubuntu SMP PREEMPT_DYNAMIC Mon Aug 18 09:50:42 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
I load a kernel module I ...
0
votes
1
answer
131
views
A test app calling WinAPI ReadFile to a device driver always returns error code 87 (The parameter is incorrect)
Intro
I have this solution.
MNWE - (Minimum Non-Working Example)
ChatGPT gave me the following test app:
#include <windows.h>
#include <stdio.h>
#define DEVICE_PATH "\\\\.\\...
3
votes
2
answers
227
views
How to compile Linux Kernel module from several files?
I am having an issue with my module compilation written in C for Kernel and I even can't find documentation which would be helpful.
My issue looks like following. There are several files written in C ...
1
vote
1
answer
274
views
How can I update `devm_ioremap_nocache` based kernel module
I am trying to understand this linux DMA driver
I am compiling it for this kernel
On compilation, I am getting the error:
drivers/dma/msgdma/msgdma.c:342:25: error: implicit declaration of function ‘...
1
vote
0
answers
65
views
disabling HW-prefetcher on an android Pixel 8
I am writing a kernel module which makes some low level experiments, and I've noticed that the HW prefetcher is intrupting them. I want to disable it while the experiemnts run.
I am running on Pixel 8 ...
2
votes
1
answer
233
views
dma_alloc_coherent() memory remap to userspace via mmap
I'm working on a Linux kernel driver that allocates memory with dma_alloc_coherent() and maps it to userspace using mmap.
This works perfectly on kernel 4.18 (tested on 4.18.0-553.47.1.el8_10.x86_64), ...
0
votes
0
answers
118
views
Kernel module compilation error: Undefined references to __asan_register_globals and __asan_unregister_globals
I am trying to build "Hello, World" kernel module on Ubuntu 22.04 with Linux Kernel 6.1.25. However, when I run make, I encounter the following errors related to AddressSanitizer (ASan):
...
2
votes
0
answers
110
views
Linux Kernel Crypto API aead callback function doesn't work
I have a kernel module that does encryption/decryption using Linux Kernel Crypto API.
This is my encryption function.
int aes_enc(char *plaintext, int len, char *_key, char *_iv, int type)
{
...
0
votes
1
answer
58
views
Threads and spin_lock Soft Lockup
I have a kernel module that is processing packets.
I have one tasklet that is running and will read from a list that has a spin_lock.
There is a workqueue that is also reading from the same list.
...
2
votes
1
answer
103
views
Linking Linux kernel's object file built with `-mcmodel=kernel` into userspace application: what to do with GS segment used instead of FS?
I have an out-of-tree Linux kernel module (for Intel x86_64). Its source code files are compiled into .o object files, which are then linked into the kernel .ko loadable file using the standard ...
1
vote
0
answers
60
views
aarch64 allocate executable page in kernel
I am writing a krenel module that allocates some virtual executable memory.
The module should write some code into the allocated page, call it, and afterwards return to my code. I am working on a ...
0
votes
0
answers
263
views
How to solve disagrees about version of symbols?
I am working on a kernel module, after insmod I got such errors in dmesg:
[ 5839.116224] mcswap: disagrees about version of symbol rdma_leave_multicast
[ 5839.116234] mcswap: Unknown symbol ...
0
votes
1
answer
432
views
Use reserved-memory and understand memremap() function
I try to implement my own Linux driver for a reserved-memory area. I following on this description: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841683/Linux+Reserved+Memory
The memory ...
0
votes
0
answers
43
views
CPU: 6 PID: 112 Comm: kswapd0 Tainted: G OE 6.5.1 #69 when using do_madvise()
I tried to use do_madvice() and MADV_FREE in the Linux Kernel module, but sometimes the following errors were reported. I want to know:
whether I used the function correctly in this way?
how to avoid ...
1
vote
0
answers
66
views
Forwarding traffic from ethernet to wlan
Requirement is to have eth0 to wlan0 forwarding, so that eth0-connected device has Internet connection.
I have enabled the forwarding, did the nat and iptables setup and ping from eth0 to Internet ...
0
votes
1
answer
170
views
How can I update the symbols list exported from common area for the vendor and other areas of a gki kernel?
I'm developing a module in the common area of the kernel, but from the vendor area (module) I need to access some registering functions in the common area. I saw that the functions from common area ...
0
votes
1
answer
266
views
Handling io_uring submissions in kernel
I need a fast async channel to transfer data from my kernel module to a userspace app. I tried IO_URING. As far as I am concerned, the way its submissions are handled in the kernel is a black box, ...
1
vote
0
answers
100
views
Linux Kernel Module: how to allocate a buffer (meant to be used by mmap) with kzalloc and GFP_DMA?
Linux Kernel Module: how to allocate a buffer (meant to be used by mmap) with kzalloc and GFP_DMA?
On kzalloc, the doc is skinny: https://www.kernel.org/doc/html/v5.0/core-api/mm-api.html#c.kzalloc.
I ...
1
vote
0
answers
47
views
Can a Linux Kernel Module read safely a user space command (i.e. user buffer)?
Can a Linux Kernel Module read safely a user space command (i.e. user buffer)?
I know kernel and user space are different: user memory can not be executed from kernel space and vice-versa.
I wrote ...
2
votes
1
answer
527
views
How to make CLion recognize linux/init.h and other linux kernel headers?
I am trying to do some Linux Kernel programming with CLion. I observe that some headers, like <linux/kernel.h> and <linux/module.h> are correctly recognized, but some others, like <...
0
votes
0
answers
34
views
How to compile a kernel module so that the *.ko file can work on different versions of the kernel? [duplicate]
I want to implement a feature through a kernel module, and I hope to achieve this functionality only by providing the *.ko file, making it effective on machines with different kernel versions through ...
0
votes
1
answer
552
views
Getting a reference to thermal_zone0 always returns an error pointer
I am trying to write a simple Linux kernel module to read the temperature from the thermal_zone0 of my RaspberryPi 4B running RaspberryPi OS 64-bit. I can always do cat /sys/class/thermal/...
1
vote
0
answers
69
views
How to create a page aligned variable in a kernel module?
So I want to have a buffer in my kernel module that I created like that:
static char buf[BUF_LEN];
My problem is that the start address of this buffer is not necessarily page aligned. To give a bit ...
2
votes
1
answer
204
views
How to clear the receive buffer in a serial bus (SERDEV) kernel driver
I'm writing a very simple linux kernel driver for my serial keyboard, employing serdev. The driver works and the function
static size_t serdev_keyboard_recv(struct serdev_device *serdev,
...