Skip to content

Commit

Permalink
/proc/pid/maps: fake jit-zygote-cache flags
Browse files Browse the repository at this point in the history
7lpb3c said so that he won't say anything
but actually said something
  • Loading branch information
backslashxx committed Dec 16, 2024
1 parent ea7585f commit 54a13f9
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,23 @@ static void show_vma_header_prefix(struct seq_file *m,
extern void susfs_sus_ino_for_show_map_vma(unsigned long ino, dev_t *out_dev, unsigned long *out_ino);
#endif

static void show_vma_header_prefix_fake(struct seq_file *m,
unsigned long start, unsigned long end,
vm_flags_t flags, unsigned long long pgoff,
dev_t dev, unsigned long ino)
{
seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
start,
end,
flags & VM_READ ? 'r' : '-',
flags & VM_WRITE ? 'w' : '-',
flags & VM_EXEC ? '-' : '-',
flags & VM_MAYSHARE ? 's' : 'p',
pgoff,
MAJOR(dev), MINOR(dev), ino);
}

static void
show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
{
Expand Down Expand Up @@ -388,14 +405,20 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
name = "/dev/ashmem (deleted)";
goto done;
}
if (strstr(path, "jit-zygote-cache")) {
start = vma->vm_start;
end = vma->vm_end;
show_vma_header_prefix_fake(m, start, end, flags, pgoff, dev, ino);
goto bypass;
}
}
}

/* We don't show the stack guard page in /proc/maps */
start = vma->vm_start;
end = vma->vm_end;
show_vma_header_prefix(m, start, end, flags, pgoff, dev, ino);

bypass:
/*
* Print the dentry name for named mappings, and a
* special [heap] marker for the heap:
Expand Down

0 comments on commit 54a13f9

Please sign in to comment.