What is the rationale behind using an union in DECLARE_KFIFO
I am looking at the <linux/kfifo.h>, specifically the DECLARE_KFIFO macro, and I can't figure out why use an union.#define DECLARE_KFIFO(name, size) \union { \ struct kfifo name; \ unsigned char...
View ArticleLSM-Howto: Kernelmodule with non exported functions
I'm currently writing a Linux Kernel module which depends on the Linux Security Modules (LSM) at the moment it is nothing really, I just wanted to print out a simple message whenever a file is opened....
View ArticleHow to build kernel debug info as separate file?
When we share custom built kernel, It is common to give without debug info. Similar to sudo apt-get install linux-image-$(uname -r)-dbgsym, I would like to create separate debug info file for custom...
View ArticleHow can I test crypto api samples in The Linux Documentation?
I want to use crypto API and I found linux kernel documentation about it.https://www.kernel.org/doc/html/latest/crypto/api-samples.htmlI tried to run second example and here is my code.I don't know...
View ArticleLinux Kernel: manually modify page table entry flags
I am trying to manually mark a certain memory region of a userspace process as non-cacheable (for educational purposes, not intended to be used in production code) by setting a flag in the respective...
View ArticleUsing XSETBV to write to XCR0 creates a general protection fault
I am trying to write to Extended Control Register 0 (xcr0) on an x86_64 Debian v7 virtual machine. My approach to doing so is through a kernel module (so CPL=0) with some inline assembly. However, I...
View ArticleWhy is there this barrier() in KCOV code in Linux kernel?
In KCOV code, why is this barrier placed?/* * There is some code that runs in interrupts but for which * in_interrupt() returns false (e.g. preempt_schedule_irq()). * READ_ONCE()/barrier() effectively...
View ArticleSPL is not coming up from flash but is coming up from RAM in linux?
Presently we are trying to boot up our firmware.When we load the spl and uboot from RAM using some tool, then the SPL is coming up.BUt when we load it from flash, the SPL is not coming up. Can anyone...
View ArticleWhy do we have to use another kernel source from the Internet when...
I'm trying to add a system call to my OS and when I read the online tutorials, it always starts with downloading and extracting a kernel source code from the Internet. For example:$ wget...
View ArticleHow to properly port the "dynamic ftrace wtih registers" support to the Pixel...
I'm currently working to integrate the ARM64 ftrace patches to enable the full support to "dynamic ftrace with registers". Specifically I'm working on the 4.9.200 kernel version for the Pixel 3a...
View ArticleHow to use MPTCP included in linux kernel 5.6.x?
I am trying to use MPTCP that is included in linux-5.6.x. I assume this is a version of https://www.multipath-tcp.org/ but it does not seem to be the same.Does the in-kernel MPTCP correspond to any...
View ArticleTrying to use LZ4 compression for rootfile system [closed]
I am trying to boot Beaglebone Black using kernel 4.4.26 and customized root file system. I am using LZ4 algorithm to compresse kernel image and root file system. LZ4 configuration inside defconfig as...
View Articlehow to change cpu frequency governor type in code
I want to change CPU governor type (currently ondemand) to interactive.I know how to change it using sysfs (echo to "scaling_governors").But I want to change it in code. How/Where can I do...
View ArticleWhy does compiling the Linux kernel require a lot of storage space?
I'm trying to implement a system call on a custom Linux kernel as described in this tutorial here.My questions are: Why do we have to compile a new custom kernel when implementing a new system call? Is...
View ArticleHow does min_free_kbytes impact page cache? [closed]
We're tuning performance in centos6 servers. We have quite a continuous large pressure of write and we were always having quite high consumption of memory(mostly for page caching).We changed the value...
View ArticleWhat is the kernel module responsible for /sys/class/power_supply/BAT0?
After twiddling LEDs with /sys/class/leds/, I'm now trying to understand how to control the battery in my computer with linux kernel power supply attributes, specifically CHARGE_CONTROL_LIMIT. However,...
View ArticleIs there a way to make the kernel treat a block device like it has a larger...
Harkening back to this question, which is now 4 years old...Bypassing 4KB block size limitation on block layer/deviceI'm a kernel newbie, so I don't know too much which is why I'm asking here.I know...
View ArticleReducing AOSP kernel image size
I am trying to build an AOSP kernel, but I can't make the resulting boot.img small enough to flash and boot it. It contains the compressed kernel with appended dtbs and the initramfs. My intention is...
View ArticleUsing XSETBV to write to XCR0 creates a general protection fault in a VM on...
I am trying to write to Extended Control Register 0 (xcr0) on an x86_64 Debian v7 virtual machine. My approach to doing so is through a kernel module (so CPL=0) with some inline assembly. However, I...
View ArticleAndroid run script at boot using init.rc not working
I'm trying to run a script that exectues when the device has finished booting. This particular device does not support running scripts from an init.d directory, which is why I am using init.rc.The...
View Article