mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
procfs task exe symlink
The kernel implements readlink of /proc/pid/exe by getting the file from the first executable VMA. Then the path to the file is reconstructed and reported as the result. Because of the VMA walk the code is slightly different on nommu systems. This patch avoids separate /proc/pid/exe code on nommu systems. Instead of walking the VMAs to find the first executable file-backed VMA we store a reference to the exec'd file in the mm_struct. That reference would prevent the filesystem holding the executable file from being unmounted even after unmapping the VMAs. So we track the number of VM_EXECUTABLE VMAs and drop the new reference when the last one is unmapped. This avoids pinning the mounted filesystem. [akpm@linux-foundation.org: improve comments] [yamamoto@valinux.co.jp: fix dup_mmap] Signed-off-by: Matt Helsley <matthltc@us.ibm.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: David Howells <dhowells@redhat.com> Cc:"Eric W. Biederman" <ebiederm@xmission.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Hugh Dickins <hugh@veritas.com> Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e93b4ea20a
commit
925d1c401f
12 changed files with 157 additions and 81 deletions
|
@ -1066,6 +1066,19 @@ extern void unlink_file_vma(struct vm_area_struct *);
|
|||
extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
|
||||
unsigned long addr, unsigned long len, pgoff_t pgoff);
|
||||
extern void exit_mmap(struct mm_struct *);
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
|
||||
extern void added_exe_file_vma(struct mm_struct *mm);
|
||||
extern void removed_exe_file_vma(struct mm_struct *mm);
|
||||
#else
|
||||
static inline void added_exe_file_vma(struct mm_struct *mm)
|
||||
{}
|
||||
|
||||
static inline void removed_exe_file_vma(struct mm_struct *mm)
|
||||
{}
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
|
||||
extern int install_special_mapping(struct mm_struct *mm,
|
||||
unsigned long addr, unsigned long len,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue