My Linux kernel module is not receiving the correct User-space Application PID
I am developing Linux kernel module which is communicating with my user-space C application. In this module, I am creating a thread. Besides, I need to know the pid of the user space process, so I am...
View ArticleHow do I know a spin lock or other locks like mutex or semaphore is already...
In my project, program flow always hangs at one place. When I debugged it, I found a few complex locking mechanisms are used. Kind of spinlock and mutex.How can I identify that number of spin locks or...
View ArticleDo I need to create my own virtual ttys with n_gsm line discipline?
There are a few "how to" pages that give instructions on using n_gsm line discipline, including this one, which comes from the tome of Linux kernel knowledge. On that page, step 4 give instructions on...
View ArticleCould a custom syscall access another process' memory?
For educational purposes, I've managed to create a custom syscall that just prints a message in the kernel's log.What I was thinking about now is to create a "cross-process memcpy" syscall that...
View ArticleDoes Linux get_user_pages guarantee pages will not be swapped?
Suppose I called get_user_pages on a buffer from user space. I know that this will essentially "fault" all the pages to make sure they are present in RAM.However, does this guarantee that they will...
View ArticleHow do "pinned" pages in Linux present (or actually "pin") themselves
I am using get_user_pages in a Linux kernel driver to pin memory for the purposes of [hardware] DMA. It all seems to work fine - but I am having a hard time proving that the "pinning" is doing the...
View ArticleAsymmetric multiprocessing in Linux
I'm currently working on a project that using multiprocessing and I want to know about methodologies of how can I convert Linux OS into an asymmetric multiprocessing OS or automatically allocate...
View ArticleHow to read temperature for driver/thermal file wich i created?
For learning purpose I have created a driver under driver/thermal ( xyz_thermal.c) which can read a temperature (just passing dummies value).But how can I read this value from user space. I tried...
View Article`/sys/fs/cgroup/pids/user.slice/user-1000.slice/pids.max` changed in reboot
I want to edit /sys/fs/cgroup/pids/user.slice/user-1000.slice/pids.max. the file reset every time I reboot the machine. I can create a script that edits the file and run it on reboot. but, is there a...
View ArticleHow do I link a static library when building a kernel module?
I want to build a Linux kernel module foo.ko from an existing file foo.c and a static library support.a. The library support.a is compiled from Rust so there is no support.c.I've used the following...
View ArticleCapture all packages in kernel module with netfilter hooks after v4.13.x
I have written a kernel module for my routers running OpenWrt to modify user-agent in all forwarded HTTP packages. It works well in kernel v4.9, but cannot capture packages which dest port is less than...
View Article`/sys/fs/cgroup/pids/user.slice/user-1000.slice/pids.max` changed after re...
I want to edit /sys/fs/cgroup/pids/user.slice/user-1000.slice/pids.max. the file reset every time I exit the machine. is there a proper way to keep the changes without run script during boot as root?...
View ArticleHow to recompile just a single kernel module?
Usually kernel source are stored in /usr/src/linux-2.6.x/. To avoid to recompile the entire kernel if I modify a module's source, how can I recompile just that module?
View ArticleCan we have a docker container without a shell?
Can we build a docker container that doesn't have any shell in that container ? Is it possible to create a container without a shell ?
View ArticleSysctls namespacing roadmap
Is there any particular docs (discussions, design proposals, etc.) reflecting further plans for sysctls namespacing on the kernel side? I'm particularly interested in vm.max_map_count.What factors in...
View ArticleIn Linux, is it possible that all pages belonged to a user-mode process or a...
I am developing a kernel mode module which reads the whole pages that are available in RAM. I am wondering if I get the list of processes and kernel modules from the RAM image I have created, is it...
View ArticleHow to get swapper_pg_dir address from an ARM64 program with kernel...
I have a program that can read and write to kernel memory and I want to get the address of swapper_pg_dir. The device in question is running Android with ARM64 architecture and has kASLR...
View Articlelinux kernel process current->pid=-1
I learned how to modify linux kernel just a few days ago. (linux kernel version : 3.10.104 ubuntu version : 16.04) I want to fork a process and see its virtual memory address.I think I need to find the...
View ArticleUnderstanding how Linux kernel modules work
I'm new to Linux development. I have three processes P, TH_1, TH_2. The initial status of the system's and user's stack is the following:I would like to indicate the current state of the processes...
View ArticleRebuild linux kernel module for another architecture
Suppose I have x86-64 machine with some version of Linux kernel. And I have directory with kernel sources of another version. The kernel was built for arm arch and loaded to the appropriate device. Now...
View Article