Kernel Questions
Ad
How to access containing structure from a member in C?
I'm working with a few kernel modules (4.19.97) and i allocate struct my_sock like the following. struct my_target {
Does libdrm talk to kernel DRM/graphics card via ioctl()?
This can be a silly question as i do not know much about this topic at all... it seems that user applications can talk directly to gpu to render
modprobe/insmod - ERROR: could not insert module Operation not permitted installing a kernel space module with root privileges
So, i was trying to install a hello world kernel shown the book "linux device drivers" by corbet, jonathan. this is the code for
What is the use of the type userptr_t in os161?
I'm trying to complete an assignment for an operating systems course,
How to printk value of specific memory adrress?
I want to print 12byte from specific memory address in kernel. following is my hard coding. void *unique_id = 0x5c000234;
when i edit the linux kernel code, what is the process of building and running the modified kernel?
I am learning how to write some code in the linux kernel, and i would like to start practicing writing code in the kernel, but my question is what
Having a problem about C pointers and how they work in memory
pword exported_ordinalstable = (pword)((ulong64)kernel_module_base + p_export_dir->addressofnameordinals); pdword
Linux SocketCAN behaviour of recvmsg
I'm writing a can logger program. the way i log the data is similar to the way the candump-tool is doing it when invoking
What is the use of the argument num in this code?
The "os161" operating system contains the following code. specifically, where the syscalls are defined: ...
How is #define S64_MIN defined in linux data types?
I am trying to understand the definition of a linux macro s64_min used in the following else condition i.e. draw
Ad
Helping with Linux kernel dump crash: Unable to handle kernel NULL pointer dereference at virtual address 00000001
I'm a newbie in linux driver field.now, i has just done with writing linux driver and i'm testing the accuracy of the function of this driver. the
Can the Pagemap folder of processes in the Linux kernel be read(64bit per read) a finite number of times?
I'm trying to keep track of the number of writes per physical page in the file "proc/pid/pagemap".but the file is binary, and the size
What kernel module function gets called, when I say "cat myfile > /dev/sda"
I've skimmed through the linux kernel module programming guide, but
kstrtol causing looping within class attribute
I have a simple kernel module which creates a sysfs node under /sys/class and adds a test attribute to the class. the test attribute has a store
Learning kernel hacking and embedded development at home?
I was always attracted to the world of kernel hacking and embedded systems. has anyone got good tutorials (+easily available hardware) on
Kernel to userspace application communication
I am trying to make kernel (android, kernel 4.9.59) communicate with userspace applications. i found a solution using netlink sockets:
ctypes, GetErrorCode 6, LoadLibrary and Modulehandle returning None?
I am currently learning more about ctypes and its functions and what i'm trying to do is to create a script to
How to integrate device driver in MDSS (MIPI-DSI) subsystem for a MIPI-LVDS bridge?
We need to connect a lvds screen to an apq8096 platform so a mipi-dsi/lvds bridge has been chosen to convert mipi bus to lvds. the bridge used is
Missing Kernel DTB after creating signed Android images
I'm porting android to a display device, and have nearly completed this. the device use the freescale/nxp i.mx6 dual lite soc. the android version
How to access members of nested struct and assign them the values read from device tree?
Following is my device tree: can anybody correct this code, i'm new to c and driver development, how to access members of a nested struct
Can't understand statement (void)(x == y) and 1; in linux typecheck macro
In linux 5.4.21 source code include/linux/irqflags.h, #define raw_local_save_flags(flags) \ do {
Ad
undefined reference to `cnss_get_platform_cap'
I am compiling android kernel 3.18. i am getting this error drivers/built-in.o: in function `enable_extldo':
How to monitor processes on linux
When an executable is running on linux, it generates processes, threads, i/o ... etc, and uses libraries from languages like c/c++, sometimes
Proper way of getting address of sys_call_table
I'm currently working on a lkm to intercept some syscalls for printing statistics about them system-wide. i've come across different ways
How to install SageMath kernel in Anaconda?
I'm trying to use sage in anaconda 3 but it looks that the libraries are not imported. i firstly created a new environment 'ipykernel_py2'
timer_create function returning EINVAL
I am writing a sample program where my main() will create a thread and then it will start a timer. when the timer expires, the thread should get
Does asmlinkage mean stack or register?
In most languages, c included the stack is used for function calls. that's why you get a "stack overflow" error if you are not careful in
Intercepting 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
How does the list_add function for linux kernel linked lists work?
I've been trying to figure out how the __list_add function works in the linux kernel implementation of a linked list. here are
How to enable SIGINT signal for system() call in a pthread in C?
The below manual on system() says it blocks sigint and sigquit signal for any binary program run through system() call.
How does addr2line work with virtual addresses for kernel space debugging?
I was trying my hands on addr2line to convert a "pc" register value from a kernel oops
How does the AF_PACKET socket work in Linux?
I am trying to write a c sniffer for linux, and understand the actions happening in the kernel while sniffing. i am having troubles finding
Ad
Questions on scull_follow function in linux device drivers 3rd edition
I never found the definition for scull_follow in the book, so i'm trying to understand it based off a github
Linux crashes after calling inet_csk_reqsk_queue_drop_and_put()
I modified the linux kernel code so it drops the first tcp connection request if the syn backlog contains more than 9 connection requests as shown
liburing / IORING_OP_PROVIDE_BUFFERS - wrong buffer assigned to read op
I am playing with liburing and io_uring, the former is built from the master branch and for the latter i am using the kernel 5.8.0-rc3. i
How to invert spin_lock_init
I'm trying to understand how to use the linux kernel spinlocks. from reading the header, i think i have to first declare one and initialize it
Weird behavior when passing strings to kernel module via IOCTL
I am passing a string to the ioctl function using a pointer to a userspace struct with the parameters. my struct contains a pointer to the string,
Lumen custom middleware in Console lifecycle
I am trying to create a logging middleware for when my commands run. the logger is working when a user makes an http request but i can't figure
Calling LdrLoadDll from APC gives access violation
I have been making a kernel-level dll injector for about two weeks. i have fought through a ton of bugs and learned a lot from them, but i am
Custom kernel not reading global variables and char*
I have a custom bootloader booting into a custom kernel. i'm writing in c now the assembly is out of the way. so far, local
OpenCL kernel does not return character data to the host program
I am new to opencl and learn it from
Unknown symbol when loading a kernel module
I tried to redo the code of the kernel module found in this topic
Cross-compiling c kernel from x64 system to x32 binary
I'm trying to create an os kernel in educational purposes. using
Ad
Does atomic_inc_return() guarantee atomic return value?
Imagine the following use-case: static atomic_t ref_counter = atomic_init(0); void
Linux kernel module Makefile can't include relative paths
I'm trying to build linux kernel module: kbuild_extra_symbols := ../../module.symvers kbuild_extra_symbols :=
How does 'passing file descriptors between processes' work?
I read stevens' example on passing descriptors between processes. to summarize, his main program forks a child which exec another program, which
Linux syscalls: PTRACE_O_TRACECLONE causes indefinite hanging
I have a binary from which i need to intercept a certain syscall--in this case unlinkat--and make it do nothing. i have the following
How does a thread in NPTL exit?
I'm curious how a single nptl thread exits, from implementation perspective. what i understand about glibc-2.30's implementation
What is the difference between do_execve() and execve() in Linux?
In the following link i have the following
Make file error when compiling kernel module
Hello i am trying to compile my first kernel module but i am receiving an error message. the hello.c program for my module is shown below:
How to add a new device to board init code linux kernel
Hi im am customizing linux kernel with version 2.22.19 and it do not support device tree. so i must use board init code to describe the
Why thread_info should be the first element in task_struct?
When reading linux kernel source code, i find one thing makes me confused. in task_struct, it says like this
Incomplete definition and forward declaration of type 'struct mnt_namespace' using BPF tools?
What i want: to add a network namespace option to execsnoop bcc tool to trace only the logs with specified
Why does `nanosleep` need the argument of `req` while kernel has the chance to restart the system call again internally(`-ERESTARTSYS`)?
As per the documentation(https://lwn.net/articles/17744/), which says
Ad
hotplug vga(drm radeon) turns disconnected to connected, but is still disabled from sys
Here is my graphic card: 03:00.0 vga compatible controller: advanced micro devices, inc. [amd/ati] caicos [radeon hd
Pairing acquire / release operations between user and kernel space
I am trying to ensure proper synchronization over a piece of memory shared between a user thread and another thread running in kernel mode on
How to avoid quotes ("...") in shortcut-ed printk Macros inside Linux Kernel Modules
I have created a set of shortcut macros for linux kernel
How are parameters passed to Linux system call ? Via register or stack?
I trying to understand the internals of the linux kernel by reading
Invalid access to packet even though check made before access
I get invalid access to packet from the ebpf verifier even though i'm performing a check before accessing a byte from a packet. the
How do I specify which of two kernel modules to compile with a Makefile?
I have a makefile that compiles two linux kernel modules (mod1.c and mod2.c). obj-m = mod1.o mod2.o
Porting LKM to LSM - Unexpected behavior
I have a linux kernel module that checks for the presence of a specific usb device and performs a printk upon a match. this code works fine and
Where is run_node defined in the sched_fair.c of Linux 2.6.33?
I am reading robert love's
How to know or set a PCI/PCIe device address map?
I'm trying to understand how to instruct the cpu to instruct a pci device to map its memory to the physical address of the cpu. i've read
How can I test crypto api samples in The Linux Documentation?
I want to use crypto api and i found linux kernel documentation about it.
Debugging a driver with WinDbg - How set a breakpoint at DriverEntry?
I have a driver which is, for some unknown reasons causing a bugcheck 0x0000003b. so i decided to set up a hyper-v vm and use kernel
Ad
Initialization from incompatible pointer type when assigning struct file_operations fields
I'm writing a linux device drive and i'm confused as to why i'm getting this warning. error: initialization from incompatible
How can I prohibit other Linux Kernel modules to get access to some regular files?
The problem is to prohibit access to some files (files from my "blacklist"). it implies that nobody besides me (my own kernel module) can either
How to print linux workqueue worker's printk immediately into dmesg?
I have a question about linux workqueue. i found example kernel module using workqueue and tested it. here is the code. #include
Is there a way to check whether a given pid matches any process in kernel space?
Is there a way to check whether a given pid matches any process in kernel space? i am building a system call that changes the weight of
Interrupt handler: request_irq returns error code -16
I am writing a simple driver, which could register an interrupt and handle it. i am using the request_irq function but it returns
Why can't I see the full Linux kernel panic inside my terminal in display, but can through the COM-port?
There are some cases when it is needed to see the full log of linux kernel panic. but it often can't be done through the regular terminal in
Linux kernel development, how to get physical core id?
I am totally beginning in linux kernel development. i am trying to learn about processes and scheduling (i know what i want to do is not "useful"
Correct way to exit init in Linux User Mode
I compiled linux kernel 5.6 in user mode with my custom initrd, created with following method: mkdir initrd cd initrd mkdir bin
Why do we need both read and write barriers?
Why do we need to define two types of barriers with the same implementation?
copy_from_user() error: destination size is to small
I'm writing ioctls handler for kernel module and i want to copy data from user space. when i'm compiling code with disabled optimizations
Why is membase adress different each time kernel module is loaded?
I've been building a rtdm uart driver by using the linux version as an example. the uart base address is supposed to be 0x80070000,
Ad
Dereferencing pointer to incomplete type ‘const struct cred’
I want to understand this error. printing uid of a process, code: printk(kern_info "user id = %d\n", (task)->cred->uid);
Compile multiple Kernel modules that share code
I whish to compile two kernel modules (out of tree) that share a common library : module1.c uses functions from library.c and module2.c also uses
Round and curly bracket block of code in C
Can anyone explain what this macro evaluates to: #define memcpy(dest,src,n) ({ \ void * _res = dest; \ __asm__ ("cld;rep;movsb" \
How to get correct global variable initialization in C?
I'm currently writing a custom kernel. i've remarked that none of my declared global variables gets initialized to the correct values. here's an
How can this function do "write" operation without writing in "Transmitter Register"?
Here's the code from rt_imx_uart.c : static ssize_t rt_imx_uart_write(struct rtdm_fd *fd, const void *buf,
ioctl call flow in linux kernel
I am trying to understand the call flow of the ioctl call in linux kernel and i have a question - when we call ioctl from userspace, which
Setting a C array as a new call stack (ESP) from inline asm?
As hinted from my title, i am interested if it would be possible to allocate a c array, and make it behave like a stack by pointing esp register
Fixed 64 bit integer in Linux Kernel
I want to have a fixed size integer of 64 bits in linux kernel. my questions: if i use unsigned long, then it
Why more memory (than being required) is allocated to a struct with flexible array member in cfg80211 scan request?
I am learning linux wifi drivers, and was exploring the code in cfg80211 subsytem for a scan request. i can't understand why
How does this enumeration work in this driver?
As i was studying the code of the mxs-auart.c driver i noticed the following declaration: enum mxs_auart_type {
Unable to create directories in /proc from a custom kernel module
In the /proc directory a custom module should create two directories lkm and mem to get a hierarchy like /proc/lkm/mem.
Ad
C - time() in time.h updates its value every 128 seconds
I've wrote a simple code to test the function time() from time.h: // time-test.c #include
Writing my own kernel - global variables not working
I'm writing my own kernel (using multiboot2) and have followed this
How to use the kernel hashtable API?
I'm trying to understand and use the kernel
how to get physical memory including reserved memory from linux kernel?
From linux's proc.txt: memtotal: total usable ram (i.e. physical ram minus a few reserved but how to get the
How can I tell the compiler/CPU to execute instructions back to back in kernel space's code?
How can i tell the compiler not to optimize and not to add any other instructions in between, and force the cpu to execute them back to back?
How to send and receive a struct through netlink?
I'm trying to send a struct from user-space to my module in kernel space using netlink, my struct in the user-space is: struct
Linux kernel module read from process VMA
I'm trying to build a small demonstration kernel module for linux which finds a specific process and reads a value from that process' memory.
Why is a function defined in a .h file redefined in a .c file?
I am reading through linux v3.19's implementation of pid namespaces and in pid_namespace.h there are functions defined that are
Linux kernel function call flow
Is there a way to get to know what kernel functions are called during a certain event. for example, if i press any key on keyboard, i want
Right way to delete kthread waiting while semaphore will be upped
I write a kernel module that uses kernel threads and semaphores. i call up(...) function for semaphore from interrupt handler
OS X kernel lock virtual address space into physical memory
To allocate memory i do like that: uint64_t _addr = 0x00; kern_return_t err = mach_vm_allocate(mach_task_self(), &_addr,
Ad
What is the difference between kmemdup_nul() and kstrndup() in Linux?
They are similar functions, but what is the exact difference between them? the linux documentation states: note: use
Question about C Syntax: Nested curly brackets for struct declaration mid-function?
Title may be a bit confusing, as i am having trouble describing it. i am sure this is already asked but i have no idea how to properly
Ad
Blog Categories
Ad