Memory Management API: vmalloc_user details, apivmalloc_user
Memory Management API: vmalloc_user details
Void * vmalloc_user (unsigned long size) is used to apply for memory of a virtual address for user space. Generally, this virtual memory is in the current process space, so a flag of VM_USERMAP is added to it. Prevent kernelspace data from being exposed to user space. the source code analysis is as follows: void * vmalloc_user (unsigned long size) {void * ret; # first, apply for a virtual memory ret = _ vmalloc (size, GFP_KERNEL | _ GFP_ZERO, PAGE_KERNEL); if (ret) {struct vm_area_struct * vma; down_write (random t-> mm-> mmap_sem ); # search for this virtual space in the current process space. Generally, you can find it, or use VM_USERMAPvma = find_vma (current-> mm, (unsigned long) ret ); if (vma) vma-> vm_flags | = VM_USERMAP; up_write (volume t-> mm-> mmap_sem);} # returns the virtual address. if r fails, returns nullreturn ret ;}