Using eBPF to detect mmap leaks

Table of Contents background Official website malloc leak detection mmap leak detection Call munmap to release memory summary Background We know that the memory space requested by the mmap system call belongs to the file mapping area and the anonymous mapping area. This part of the area does not belong to the heap, so it […]

Zero-copy mmap of libpcap

1. User space After creating fd through socket(AF_PACKET,…), establish the receiving queue //pcap-linux.c static int pcap_activate_linux(pcap_t *handle) {<!– –> … ret = setup_mmapped(handle, & amp;status); … } 1.1 Set the default ring bufer size static int setup_mmapped(pcap_t *handle, int *status) {<!– –> … \t//1. if (handle->opt.buffer_size == 0) {<!– –> /* by default request 2M […]

Linux inter-process communication IPC (pipe fifo mmap)

1. Introduction to inter-process communication: In the Linux environment, the address spaces of each process are independent of each other. Variables in any process are invisible in another process, so they cannot be accessed between processes. To exchange data, you must go through the kernel and open up a buffer in the kernel. Area, process […]

nnunetv2 training error ValueError: mmap length is greater than file size

Directory Report an error Solution Error reporting The author is using nnunetv2 in the training steps of the KiTS19 kidney tumor segmentation experiment. There is no problem with training using 2d and 3d_lowres nnUNetv2_train 40 2d 0 nnUNetv2_train 40 3d_lowres 0 But training using 3d_cascade_fullres and 3d_fullres nnUNetv2_train 40 3d_cascade_fullres 0 nnUNetv2_train 40 3d_fullres 0 […]

mmap underlying driver implementation (remap_pfn_range function)

Mmap underlying driver implementation myfb.c (applied for 128K space) #include <linux/init.h> #include <linux/tty.h> #include <linux/device.h> #include <linux/export.h> #include <linux/types.h> #include <linux/module.h> #include <linux/export.h> #include <linux/mm_types.h> #include <linux/mm.h> #include <linux/slab.h> #define BUFF_SIZE (32 * 4 * 1024) static char *buff; static int major; static struct class * myfb_class; static int myfb_mmap (struct file *fp, struct vm_area_struct […]

Linux inter-process semaphore communication IPC (sem), mmap file memory mapping (inter-process file sharing)

1. Semaphore A semaphore is a primitive used to provide a means of synchronization between different processes or between different threads from a given process. 1.1. Selection of Posix semaphore 1) Shared by each thread of a single process, memory-based semaphores can be used. 2) When different processes that are not related to each other […]

KdMapper extension implementation ASUS (asmmap64.sys)

1.Background KdMapper is a tool that exploits Intel driver vulnerabilities to load unsigned drivers without trace. This article uses other vulnerabilities (refer to “[Reprint] Using Signed Driver Vulnerabilities to Load Unsigned Drivers”) and make corresponding modifications to achieve similar functions. . Everyone needs to have a certain understanding of the KdMapper code. 2. Driver information […]

[Linux operating system] Shared storage mapping (mmap) in Linux system programming

In Linux system programming, communication between processes is an important task. Shared memory mapping (mmap) is an efficient process communication method that allows multiple processes to share the same memory area to achieve data sharing and communication. This article will introduce the concept, principle, usage and precautions of shared memory mapping to help readers better […]

Viewing page fault interruption from the perspective of Linux mmap system call

Question 1. How does mmap achieve one memory copy less than read/write? 2. What is the difference between mmap shared mapping and private mapping when the kernel is implemented? 3. What is the difference between mmap’s file mapping and anonymous mapping when the kernel implements it? 4. How to implement the COW of the parent-child […]

Enumeration (EnumSet and EnumMap, etc.)

Article directory 1. Overview 2. Custom enumeration method 3. Use == to compare enumeration types 4. Use enumerated types in switch statements 5. Properties, methods and constructors of enumerated types 6. EnumSet and EnumMap 6.1. EnumSets 6.2. EnumMap 7. Implement some design patterns through enumeration 7.1 Singleton pattern 7.2 Strategy pattern 8. Java 8 and […]