What are memory mapped page and anonymous page?

The correct terms are memory mapped files and anonymous mappings. When referring to memory mapping, one is usually referring to mmap(2). There are 2 categories for using mmap. One category is SHARED vs PRIVATE mappings. The other category is FILE vs ANONYMOUS mappings. Mixed together you get the 4 following combinations: PRIVATE FILE MAPPING SHARED … Read more

kvm: module verification failed: signature and/or required key missing – tainting kernel

Instead of re-configuring the kernel, this error (module verification failed) could be resolved by just adding one line CONFIG_MODULE_SIG=n to the top of the Makefile for the module itself: CONFIG_MODULE_SIG=n # If KERNELRELEASE is defined, we’ve been invoked from the # kernel build system and can use its language. ifneq ($(KERNELRELEASE),) obj-m := hello.o # … Read more

module_init() vs. core_initcall() vs. early_initcall()

They determine the initialization order of built-in modules. Drivers will use device_initcall (or module_init; see below) most of the time. Early initialization (early_initcall) is normally used by architecture-specific code to initialize hardware subsystems (power management, DMAs, etc.) before any real driver gets initialized. Technical stuff for understanding below Look at init/main.c. After a few architecture-specific … Read more

Software memory bit-flip detection for platforms without ECC

The thing is, ECC is dirt cheap compared to “software ECC countermeasures”. You can easily detect if they have ECC modules and complain (or print a warning) when they don’t. http://www.cyberciti.biz/faq/ecc-memory-modules/ For example, can we see all writes to memory (both from user and kernel space), to distinguish between intended memory changes from in-memory bit … Read more

What is the meaning of question marks ‘?’ in Linux kernel panic call traces?

‘?’ means that the information about this stack entry is probably not reliable. The stack output mechanism (see the implementation of dump_trace() function) was unable to prove that the address it has found is a valid return address in the call stack. ‘?’ itself is output by printk_stack_address(). The stack entry may be valid or … Read more

What is the “current” in Linux kernel source?

It’s a pointer to the current process (i.e. the process that issued the system call). On x86, it’s defined in arch/x86/include/asm/current.h (similar files for other archs). #ifndef _ASM_X86_CURRENT_H #define _ASM_X86_CURRENT_H #include <linux/compiler.h> #include <asm/percpu.h> #ifndef __ASSEMBLY__ struct task_struct; DECLARE_PER_CPU(struct task_struct *, current_task); static __always_inline struct task_struct *get_current(void) { return percpu_read_stable(current_task); } #define current get_current() #endif … Read more

Content for Linux Operating Systems Class

My list: What an operating system’s concerns are: Abstraction and extension of the physical machine and resource management. How the build process works ie, how architecture specific/machine code stuff is implanted How system calls work and how modules can link up Memory management / Virtual Memory / Paging and all the rest How processes are … Read more