How can I safely build the full path of a struct dentry * in an eBPF (LSM)...
I'm writing a Linux Security Module (LSM) eBPF program using the hook lsm.s/inode_rename, and I want to capture the full path of the renamed file or directory. I'm using CO-RE and Cilium's...
View Articlehow to use ftrace to trace static functions for loadable kernel module
I'm wondering how I would go about tracing static functions from loadable modules. Let's say I wanted to record zram_init. If I do:# echo zram_init > set_graph_functionbash: echo: write error:...
View ArticleHow does clock_gettime actually work in the kernel?
uint64_t getTimeLatencyNs() { struct timespec ts1; struct timespec ts2; clock_gettime(CLOCK_MONOTONIC_RAW, &ts1); clock_gettime(CLOCK_MONOTONIC_RAW, &ts2); return ((ts2.tv_sec - ts1.tv_sec) *...
View ArticleHow to find out physical slot number of a PCI(E) device with system calls?
I'd like to find a way to figure out physical slot of a PCI-E device from the bus address. I would like to use to modify a driver/kernel module, so it would enumerate the devices (with the same ID) and...
View ArticleC (linux) setting a stack variable char test[-some large number] - causes...
Im learning C so if you guys could explain the answers Id appreciate itIm building a P2P content distribution system and as part of that system there is a section of code which reads the network. To...
View ArticleProper data race protection between ndo_start_xmit and NAPI tx
Assuming I run TX completions (i.e. release transmitted skbs) for a given TX queue in a NAPI context, what would be a correct way to ensure there's absolutely no data race between the ndo_start_xmit...
View ArticleLinux PCI pcibios_window_alignment() not working as intended after kernel...
Currently I've been working and stuck on the job of upgrading Linux Kernel from 4.19 to 5.15.There's source code that in kernel/arch/.../our_pci.c, my former coworker left pcibios_window_alignment() in...
View ArticleHow can I update `devm_ioremap_nocache` based kernel module
I am trying to understand this linux DMA driverI am compiling it for this kernelOn compilation, I am getting the error:drivers/dma/msgdma/msgdma.c:342:25: error: implicit declaration of function...
View ArticleCan't open mmc as block device when driver is on built-in
I have a module who open mmc blockdevice, inspired of block2mtd.c driver on linux 5.1.It works successfully when my driver is as module and "modprobe" after kernel started.But it fail when my driver is...
View ArticleKASAN based on MTE on Android Pixel 8 does not work
I am working on a Pixel 8 device running CalyxOS. uname -a: Linux localhost 5.15.137-android14-11-gbc062a78e195-ab12057991 #1 SMP PREEMPT Mon Jul 8 12:34:46 UTC 2024 aarch64 Toybox.The device supports...
View ArticleHow booting Linux on x86 is different from booting Linux on ARM
I am trying to understand the linux boot process on x86 and ARM architecture and wanted to know the difference between booting linux on x86 and booting linux on ARM.I have gone through the linux boot...
View ArticleReverse Map to PTEs from a page frame
Currently, I am going through Linux Memory Management. And I am trying to modify a page table entry of a process. I got to know that there is a Reverse Mapping from a page frame (struct page)to a list...
View ArticleHow to avoid modem initialization with USB gadgetfs CDC driver
I have an embedded device with the USB gadgetfs CDC_ACM driver. Especially, I do:echo "0x0525"> idVendorecho "0xa4a7"> idProductln -s functions/acm.GS0 configs/c.1The OS running on this embedded...
View ArticleUnable to Debug following kernel crash triggered via SysRq
I am getting following Oops message while testing on a device which is running on Linux Kernel 3.4.5 and ARM processor.I am unable to trace the issue.If you look at call stack , you would see it...
View Articlekzalloc(32, GFP_KERNEL) failed, but kzalloc(64, GFP_KERNEL) success,
I'm new to Linux kernel development and need help understanding a memory allocation issue. I defined a structure in my driver like this:typedef struct MyStruct { int a; int b; int c; struct list_head...
View ArticleHow to query disk cache settings inside Linux vm? Specifically if the disk...
I am running a RHEL VM on azure with multiple disks having different cache settings (ReadOnly, ReadWrite).OS details:Source image publisher : RedhatSource image offer : RHELSource image plan :...
View ArticleMaking/Building a kernel module inside a docker container
I currently have my host system running Mac OS with docker. I have my Mac OS host system spawning a docker container.The spawned docker container is currently running ubuntu:19.10I am trying to build a...
View ArticleOpen File Description Locks confusion(EDIT)
As in GNU C Library documentationfcntl(F_OFD_SETLK) locks on an open file table entry, (usually obtained by open()). Easy to understand.But in the next example in same documentation:In the example...
View ArticleERROR in emulator start after aosp build Andorid Emulator I tried running
After successfully compiling the AOSP build from the repo tried starting the emulator with the command provided in the documentation$launch_cvd --daemonbut encountered the following error log:06-03...
View ArticleLInux kernel log
I'm running embedded Linux (Angstrom distribution, for Atmel). I would like to read the kernel message log during shutdown, same stuff I'd get with dmesg. Basically I'm exploring a few issues I have by...
View ArticleUnable to build linux kernel 6.12.32-64 on i636 linux versions? [closed]
I always build both the i686 and x64 kernel on my VM which has changed through the years from debian (several distros) to now devuan-chimaera (couple years now). Last build was 6.6.x but now jumping to...
View ArticleWhich direction does memory-mapped segment of a process's virtual address...
I'm currently going through the code that loads an ELF from disk to memory, which corresponds to the function load_elf_binary() in Linux kernel.Such function sets up the addresses of different segments...
View ArticleLinux kernel source not configured - missing > version.h. when intall a driver
I'm trying to install a intel e1000 ethernet card driver on ubuntu 12.04 LTS.When i type make installThe following error occur:Makefile:111: * Linux kernel source not configured - missing version.h....
View ArticleAddress ranges in virtual memory for a process in a current 2025 Linux [closed]
According to several sources (1. stack overflow, 2. stack overflow, 3. stack overflow, 4. slides for a lecture and 5. kernel references from 2002) the virtual memory for a process should use 48 bit for...
View ArticleWhat is the thought process behind the implementation of manual padding in...
I'm attempting to manually map out a struct rtentry (as implemented below) in x64 ASM, but I've become perplexed as to how I should handle the padding memory incorporated into the struct before...
View ArticleNDK toolchain aarch64-linux-android folder not found
Hello guys I am newbie and I want to compile a android 4.19 kernel in ubuntu but after I download NDK toolchain zip for linux and after extract I didn't find the aarch64-linux-andoid folder please...
View Articleirq type mismatch on MCP23008 device in Linux 5.10 kernel
I'm trying to configure an MCP23008 gpio expander in the Linux kernel (5.10) so that, using libgpiod v2.1, I can watch for events on the GPIO pins of the MCP23008.This devicetree snippet would seem to...
View Articlex86-64 Kernel Interrupt Handler: Preserving GPRs when Transferring Control to...
I was asked in a course to make a custom handler for invalid opcode interrupt. There is a function I call in the handler, which if it returns zero I am supposed to pass control back to the original...
View ArticleExtract vmlinux from vmlinuz or bzImage
I want to generate System.map from vmlinuz,cause most of machines don't have the file System.map.In fact,vmlinuz are compressed to vmlinuz or bzImage.It's any tool or script can do this?I tried:dd...
View ArticleUnable to Create a VM in Hyper-V Using a Debian ISO Patched with the Xenomai...
I am unable to create a VM in Hyper-V using a Debian linux ISO file that has been patched with the Xenomai real-time kernel.From the boot logs, it appears that the Linux kernel is successfully loading,...
View Article