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

Linux Kernel Module : Invalid output in the file for kernel_write function

I'm printing a sample string using kernel_write function and getting the output but I'm not sure about the format that it's printing in the file Here is my code: char* res = "xyz"; char* buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); …
0
votes
0 answers

Understanding Linux kernel semaphore

My understanding of semaphore is: count cannot go below 0 : if tried block the task. count cannot go above the value given during sema_init(). First case is always honoured. However as you can see from below code, I can increase the count of…
MankPan
  • 79
  • 6
0
votes
0 answers

Writing an I2C kernel driver for a particular architecture

If we have a particular ARM-based SOC which has a physical I2C controller included on it, and the intention is to run Embedded Linux on this SOC. Now we have a separate off-board I2C slave chip connected to this I2C bus from the SOC. For argument's…
0
votes
0 answers

insmod: ERROR: could not insert module bin/hello.ko: Invalid module format

I have kernel version 5.4.0-132-generic (from uname output). And I've installed 4.15.0-23-generic headers. I compiled my kernel module for 4.15.0-23-generic. I am trying to insert the module after compiling and getting the above error. Can you…
Venu Aditya
  • 11
  • 1
  • 4
0
votes
1 answer

how to perform arithmetic on fractions in a Linux module

I want to perform arithmetic on fractions, and I know that you can't perform floating-point arithmetic in kernel code, and I understand the reasons why the kernel doesn't allow that. What I am trying to do exactly is to load a module and calculate…
th3plus
  • 161
  • 2
  • 11
0
votes
0 answers

how pass data from kernel space to user space - copy_to_user()

im trying to write module linux that monitor all system calls, and send system call log (data struct) to my program in user space. information such as who PID call syscall, what arguments passed and etc. i trying to write this feature by IOCTL,…
0
votes
0 answers

how to change linux kernel module loading order

I am using Ubuntu 18.04 in virtual box. I want to set device mapper at /dev/sdb4, so I added boot arguments via: GRUB_CMDLINE_LINUX=dm-mod.create="\"dm-verity,,,ro,0 839680 verity 1 /dev/sdb4 /dev/sdb3 512 512 839680 1 sha256…
0
votes
0 answers

ZwSetIniformationFile and FileRenameInformation

I am trying to rename files from kernel. with this api https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-zwsetinformationfile NTSTATUS Files::RenameFile(WCHAR* OriginalName, WCHAR* NewName) { // msdn says driver must be at…
0
votes
2 answers

Is there a Buildroot setting for making kernel source available to compile against?

I've been given a .zip file containing source for a proprietary kernel module. Once unzip'd, there is an install script that needs to be run. The install script untar's the actual source and builds the kernel module. It requires kernel headers to…
Paul Woods
  • 21
  • 3
0
votes
1 answer

Trying to run make menuconfig to manually configure the kernel, but gets an error

I downloaded the linux operating system kernel source 4.15.1 from the kernel website, installed the required packages: kernel-package, libncurses5 and libncurses5-dev. Unpacked the tar archive and navigated to the resulting directory. I wanted to…
BeWorld
  • 3
  • 2
0
votes
1 answer

In the latest linux kernel is it possible to write a loadable Linux Security Module (LSM), which can be loaded and unloaded using insmod and rmmod?

I am a beginner in the field of Linux kernel programming. I was studying Linux Security Modules (LSM). The references which I have seen (recent ones) especially this video here, bakes the module written into the kernel itself, and then the entire…
0
votes
0 answers

Efficient kernel/userspace communication for Linux kernel module

I’ve got a Linux kernel module (a qdisc / network traffic scheduler, but this shouldn’t matter) which needs efficient communication between kernel and user space. For the communication from kernel to user space, I found relayfs over debugfs very…
mirabilos
  • 5,123
  • 2
  • 46
  • 72
0
votes
0 answers

Nvidia NVML Driver/library version mismatch: dkms, modules, drivers and modinfo versions

I have the Nvidia NVML Driver/library version mismatch error, for which I recommend reading the following answers: https://stackoverflow.com/a/67105064/1782553 https://stackoverflow.com/a/71672261/1782553 However, after purging and re-installing…
Jav
  • 1,445
  • 1
  • 18
  • 47
0
votes
0 answers

Set system clock from module kernel

I'm trying to set up the system clock from module of kernel in a embedded system. I need correct the time when the interrupt from a gpio happen. That is my code, but i not be able to link the clock_settime. #include #define…
0
votes
0 answers

Linux driver debugging NULL pointer usage

Im learning to develop and backport drivers and Im new to this. I am wondering how to debug this issue. I found that there is some usage of NULL pointer but I dont know how to find it. This debug trace doesn't shows me where it is in the driver…