Retrieve TCP MSS value from Socket Buffer
I am filtering packets on kernel level through LKM/netfilter using attributes from headers (TCP/IP) [linux tcp.h and ip.h].Follows an example of the code:static unsigned int Filter(void *priv, struct...
View ArticleUnable to hook sys_open() via ftrace in linux kernel module
I tried to extend the code from gitub @ilammy/ftrace_hook to hook another system call: sys_open(). Clone() and execve() are able to hook but I failed to hook open(). There was no error happened, but...
View Articleis netlink synchronous or asynchronous protocol?
I was reading various resources about netlink, and they all say that the netlink communication protocol is asynchronous (example:...
View ArticleNew prctl option's macro definition isn't working in user space code
I added a new option to the prctl(2) system call in the Linux kernel v5.6. After compiling the kernel with my changes, I am able to trigger the new option's effects on a process from user space when I...
View ArticleHow does the list_add function for linux kernel linked lists work? [closed]
I've been trying to figure out how the __list_add function works in the linux kernel implementation of a linked list.Here are the macros and data structures:#define LIST_HEAD_INIT(name) { &(name),...
View ArticleLinux kernel_write function returns EFBIG when appending data to big file
The task is to write simple character device that copies all the data written to the device to tmp a file.I use kernel_write function to write data to file and its work fine most of the cases. But when...
View ArticleUnix create multiple files with same name in a directory
I am looking for some kind of logic in linux where I can place files with same name in a directory or file system.For e.g. i create a file abc.txt, so the next time if any process creates abc.txt it...
View Articledifference between update_rq_clock and update_rq_clock_task
I understand the notion of update_rq_clock as it updates the run queue clock on system tick periodically. But this function calls update_rq_clock_task(). What is the purpose behind this function?
View ArticleHow to load Linux kernel modules from C code?
I have an application that has both two external kernel modules and a userspace daemon. I want to load the modules from the daemon code, written in C, at startup, and unload them on clean exit. Can I...
View Articlewhy do my various user programs terminate abruptly without an error message?
I do a variety of different kinds of data analysis and numerical simulation on my custom-built Ubuntu machine using custom-written programs that sometimes must run for days or even weeks. Some of those...
View ArticleCalling DRM_IOCTL_MODE_GETRESOURCES from ioctl returns zero connector count
My goal is to figure out how to do fast screen capture. One way to do that is utilize the GPU to grab the frame (and then later encode it quickly on the GPU).I am trying to do this on Linux and using...
View ArticleHow to figure out usb dev path on linux
I've been trying to use the monsoon power monitor on my linux machine using this script : https://android.googlesource.com/platform/cts/+/master/tools/utils/monsoon.py. The script assumes that the...
View ArticleHow can code read or set the real time clock in a kernel module (without ioctl)?
I know I can use ioctl() to do this when writing userland code. But how do I do this in kernel land by using the module called rtc?
View ArticleWhat is the relationship of DMA ring buffer and TX/RX ring for a network card?
I know that for a network card, OS must allocate tx/rx rings for it so that when OS wants to receive/transmit packets, the network card will know where the packets are and which packets are to be...
View ArticleIntercepting RDTSC instruction in KVM
I am trying to debug a rootkit in a virtual environment. From reversing I know that it uses super simple CPU timing checks, that look something like this (source pafish):static inline unsigned long...
View Articledevice file usage tracking in kernel space
we have usb device connected to embedded system and user space application opens the device and access the usb device.when we remove and connect usb device then kernel is creating new device file as...
View ArticleEmbedded Linux: Kernel Freezes on Boot with No Messages/Where to Start Debug
I am trying to build a kernel for ARM Cortex A-9 for Cyclone V SoC. I was using a particular defconfig from Intel to build the kernel...
View ArticleHow to load and use encryption keys in linux kernel?
I am revising a Linux kernel module in Openwrt (mac80211 specifically).I need to use some encryption keys which are provided before the system is installed and run.The first question is what is the...
View ArticleCalling task_tick_fair in CFS algorithm
Why is there a for_each_sched_entity macro in task_tick_fair function called on system tick? According to me, only the run time characteristics of the current task should be updated. Why does it call...
View Articleusing mmap for sharing memory between application and driver
I am facing some problem while trying to share memory between an application and driver using mmap().Background:I have an application and a corresponding driver for a deviceI call mmap() for x-mega...
View Article