I am currently writing a Linux kernel module. I am aware that in case of userspace programs, uninitialized global variables (exported to other modules using EXPORT_SYMBOL) are stored in BSS segment and initialized ones in Data Segment of userspace memory. But how are they stored in case of kernel code?

Are the function calls also included in Stack, in case of kernel code?

Thanks in advance for any help.

1 Answer 1


The kernel has some notion of data segment, which sits in RAM (physical memory loaded by the kernel loader such as GRUB, not virtual memory).

For details, examine the linker scripts used at kernel build time, perhaps something like arch/x86/kernel/vmlinux.lds or other *.lds files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.