What's the use of do while(0) when we define a macro? [duplicate]
Possible Duplicates:Do-While and if-else statements in C/C++ macrosdo { … } while (0) — what is it good for?I'm reading the linux kernel and I found many macros like this:#define INIT_LIST_HEAD(ptr) do...
View ArticlePagefault due to read access to exsisting page
Read in professional Linux kernel architecture by wolfgangMauerer"In the event of a read access to an existing page , the fault must be a permission fault detected by the hardware. Execution then...
View ArticleHow does "get_user_pages" work (For linux driver)
Working on a Linux PCI driver, now I'm trying to write codes for DMA using scatter/gather.For now, I've learned that to access to DMA datas directly from User space, we need to pin user space pages to...
View ArticleHow to get the username of the user who lastly modified a particular file in...
I want to get the username who modified a file in watched directory in LINUX operating system (UBUNTU).I am getting notification of modified file in watched directory through inotify, but I didn't get...
View ArticleLinux Kernel task_struct void *stack
What is the void *stack declaration in task_struct in sched.h?Is it the pointer to the process image (stack, heap, .bss, data, text) stack? If so, where are the pointers to the rest of the process image?
View Article#ifdef SIOCSHWTSTAMP not found
I want to take hardware timestamps on the network card. I found some example code from Solarflare which checks whether the following label is defined:#ifdef SIOCSHWTSTAMP struct ifreq ifr; struct...
View ArticleNot able to write in /dev/mem
The issue that I am experimenting is not related with open() or mmap() function, which are executed properly. I have disabled CONFIG_STRICT_DEVMEM in the kernel so I can read from /dev/mem without...
View ArticleFtrace "function" enabling fails with resource busy
I am trying to enable "function" tracer in ftrace after going...
View ArticleKernel module crash when reading system call table function address
I am studying rootkits and trying to hook the system call table. As i can already dynamically retrieve the table's address from /boot/System.map-$(uname -r), i traced and isolated the problematic part...
View ArticleIs it possible for a userland program to create a node in the linux sysfs...
I'd like to find a way for my userland program to create a node in the sysfs tree in order to integrate a piece of custom h/w, or virtual device the program manages with lmsensors framework.How do I...
View ArticleKali Linux 2019 and missing release file [closed]
I have Kali linux 2019 version. When I try to run 'sudo apt-get update' command it's showing this following error:E: The repository 'http://ppa.launchpad.net/morphis/anbox-support/ubuntu lucid Release'...
View ArticleWould .target hook and .destroy hook meet "critical section problem" about...
I'm writting a customized netfilter target and suddenly realize that I will kmalloc memory in .target hook function and finally free them in .destroy hook function.Would it happend when it was...
View ArticleThe Linux Kernel container_of macro and generic containers in C90
Is it possible to implement the container_of macro in pure C90? I'm not sure how to do it as the Kernel implementation depends on GCC Hacks such as the typeof operator.I'm asking because I would like...
View ArticleFinding out address of SMBIOS Entry point from command line
From https://wiki.osdev.org/System_Management_BIOSThe SMBIOS Entry Point Table is located somewhere between the addresses 0xF0000 and 0xFFFFF, and must be on a 16-byte boundary. To find the specific...
View ArticleGet user stackpointer from task_struct
I have kcore and I want to get userspace backtrace from kcore. Because some one from our application is making lot of munmap and making the system hang(CPU soft lockup 22s!). I looked at some macro but...
View ArticleKernel module crash when writing to system call table function address
I understand that this module could not use the system call table address in /boot/System.map-$(uname -r) because of KASLR. By booting with nokaslr, the module worked. With that solved, i moved on to...
View ArticleWhy can't the address of sys_call_table be derived using that of system_wq in...
After trying the suggested solution for deriving the KASLR offset shift on a previous question on this topic, i realized that the run time address of system_wq is different from that in...
View ArticleImplementing a Docker Container based Serverless Computing using low latency...
When reading Serverless concepts i had an understanding that there are fast bootable linux kernals ideally used for Serverless computing. Whenever a request comes in this kernal is booted up, serve the...
View ArticleWhy ksm in linux scans virtual memory instead of physical page
The question is about mm/ksm.c in Linux Kernel source code. In Linux Kernel, KSM scans for virtual memory per progress instead of physical pages directly. But I think scan for physical page can work...
View ArticleAndroid Kernel - Unable to activate CONFIG_USB_ETH=y in the kernel dot config
I am trying to configure Android Kernel (msm-4.4)to have USB-CDC Ethernet Support in order to implement USB tethering in the low level. What I want to do is to migrate what's done in the following link...
View Article