函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:security\selinux\selinuxfs.c Create Date:2022-07-27 20:35:37
首页 Copyright©Brick

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
static int sel_mmap_handle_status(struct file *filp,
                  struct vm_area_struct *vma)
{
    struct page    *status = filp->private_data;
    unsigned long   size = vma->vm_end - vma->vm_start;
 
    BUG_ON(!status);
 
    /* only allows one page from the head */
    if (vma->vm_pgoff > 0 || size != PAGE_SIZE)
        return -EIO;
    /* disallow writable mapping */
    if (vma->vm_flags & VM_WRITE)
        return -EPERM;
    /* disallow mprotect() turns it into writable */
    vma->vm_flags &= ~VM_MAYWRITE;
 
    return remap_pfn_range(vma, vma->vm_start,
                   page_to_pfn(status),
                   size, vma->vm_page_prot);
}