If you are interest in flexsc, reference kernel module. Other dirty things are just the result of trial and error
trying to implement flexsc on ubuntu-linux 4.4.0. At now, codebase is dirty & messy :( 🔍
- Shared memory between kernel thread and user thread in user space(Not in kernel space) so that any kernel thread(called systhread in FlexSC) can access the shared memory
- Asynchronous process of system call through workqueue interface
- remap_pfn_range - remap kernel memory to userspace
- kmap, kunmap
- High memory & Low Memory: mapping with HIGH_MEM of user process
- Performing Direct I/O: Detailed description of get_user_pages
- how-to-use-mmapproc-shared-memory-between-kernel-and-userspace
- how-to-use-mmap-to-share-user-space-and-kernel-threads
- User space memory access from the Linux kernel
- SHARING MEMORY BETWEEN KERNEL AND USER SPACE IN LINUX
- How to mmap a file in linux kernel space?
- Implementing mmap for transferring data from user space to kernel space
- how-can-i-access-memory-at-known-physical-address-inside-a-kernel-module
- spinlock/flexsc
- spwilson2/async-sys-module: An Asynchronous IO kernel module that communicates with the kernel through a shared memory ring.
- imwack/mmap: User space sharing memory with kernel module Using proc & mmap
- bwrenn/mmap_example: An example of mmap to share memory between a kernel module and a user space application
- Alessio-Faina/uniioShd: Test for fast sharing of memory between kernel and many user programs
- dmansilva/OSProject04: The goal was to implement a new system call that can setup a shared page of memory
- kernel_thread() causes segfault
If you have a plan to make use of kernel_thread() in user context(when system call), annoying segfault error message arises. So you should take different approach to FlexSC because at the time when the paper is written(linux 2.6), it is possible to simply call kernel_thread() to create kernel_thread with sharing memory of calling user space process. But on recent kernel, kernel_thread() with (CLONE_FILES | CLONE_FD | CLONE_VM) flag causes segmentation fault. (See kernel_thread() causes segfault)
- Makefile
- flexsc/
- include/linux/sched.h - struct task_struct -> Add struct syspage
- arch/x86/entry/syscalls/syscall_64.tbl -> Add system call: flexsc_register(400), flexsc_wait(401), flexsc_start_hook(402), flexsc_exit(403)
- arch/x86/entry/entry_64.S -> system call hooking function in assembly level
- include/linux/workqueue.h -> struct flexsc_sysentry *work_entry in struct work_struct
- include/linux/workqueue.h -> FLEXSC_INIT_WORK