| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* Internal procfs definitions |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. |
|---|
| 4 | 5 | * Written by David Howells (dhowells@redhat.com) |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License |
|---|
| 8 | | - * as published by the Free Software Foundation; either version |
|---|
| 9 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/proc_fs.h> |
|---|
| .. | .. |
|---|
| 43 | 39 | spinlock_t pde_unload_lock; |
|---|
| 44 | 40 | struct completion *pde_unload_completion; |
|---|
| 45 | 41 | const struct inode_operations *proc_iops; |
|---|
| 46 | | - const struct file_operations *proc_fops; |
|---|
| 42 | + union { |
|---|
| 43 | + const struct proc_ops *proc_ops; |
|---|
| 44 | + const struct file_operations *proc_dir_ops; |
|---|
| 45 | + }; |
|---|
| 47 | 46 | const struct dentry_operations *proc_dops; |
|---|
| 48 | 47 | union { |
|---|
| 49 | 48 | const struct seq_operations *seq_ops; |
|---|
| .. | .. |
|---|
| 62 | 61 | struct rb_node subdir_node; |
|---|
| 63 | 62 | char *name; |
|---|
| 64 | 63 | umode_t mode; |
|---|
| 64 | + u8 flags; |
|---|
| 65 | 65 | u8 namelen; |
|---|
| 66 | 66 | char inline_name[]; |
|---|
| 67 | 67 | } __randomize_layout; |
|---|
| .. | .. |
|---|
| 74 | 74 | 0) |
|---|
| 75 | 75 | #define SIZEOF_PDE_INLINE_NAME (SIZEOF_PDE - sizeof(struct proc_dir_entry)) |
|---|
| 76 | 76 | |
|---|
| 77 | +static inline bool pde_is_permanent(const struct proc_dir_entry *pde) |
|---|
| 78 | +{ |
|---|
| 79 | + return pde->flags & PROC_ENTRY_PERMANENT; |
|---|
| 80 | +} |
|---|
| 81 | + |
|---|
| 77 | 82 | extern struct kmem_cache *proc_dir_entry_cache; |
|---|
| 78 | 83 | void pde_free(struct proc_dir_entry *pde); |
|---|
| 79 | 84 | |
|---|
| .. | .. |
|---|
| 82 | 87 | int (*proc_show)(struct seq_file *m, |
|---|
| 83 | 88 | struct pid_namespace *ns, struct pid *pid, |
|---|
| 84 | 89 | struct task_struct *task); |
|---|
| 90 | + const char *lsm; |
|---|
| 85 | 91 | }; |
|---|
| 86 | 92 | |
|---|
| 87 | 93 | struct proc_inode { |
|---|
| .. | .. |
|---|
| 91 | 97 | struct proc_dir_entry *pde; |
|---|
| 92 | 98 | struct ctl_table_header *sysctl; |
|---|
| 93 | 99 | struct ctl_table *sysctl_entry; |
|---|
| 94 | | - struct hlist_node sysctl_inodes; |
|---|
| 100 | + struct hlist_node sibling_inodes; |
|---|
| 95 | 101 | const struct proc_ns_operations *ns_ops; |
|---|
| 96 | 102 | struct inode vfs_inode; |
|---|
| 97 | 103 | } __randomize_layout; |
|---|
| .. | .. |
|---|
| 158 | 164 | extern const struct dentry_operations pid_dentry_operations; |
|---|
| 159 | 165 | extern int pid_getattr(const struct path *, struct kstat *, u32, unsigned int); |
|---|
| 160 | 166 | extern int proc_setattr(struct dentry *, struct iattr *); |
|---|
| 167 | +extern void proc_pid_evict_inode(struct proc_inode *); |
|---|
| 161 | 168 | extern struct inode *proc_pid_make_inode(struct super_block *, struct task_struct *, umode_t); |
|---|
| 162 | 169 | extern void pid_update_inode(struct task_struct *, struct inode *); |
|---|
| 163 | 170 | extern int pid_delete_dentry(const struct dentry *); |
|---|
| 164 | 171 | extern int proc_pid_readdir(struct file *, struct dir_context *); |
|---|
| 165 | | -extern struct dentry *proc_pid_lookup(struct inode *, struct dentry *, unsigned int); |
|---|
| 172 | +struct dentry *proc_pid_lookup(struct dentry *, unsigned int); |
|---|
| 166 | 173 | extern loff_t mem_lseek(struct file *, loff_t, int); |
|---|
| 167 | 174 | |
|---|
| 168 | 175 | /* Lookups */ |
|---|
| .. | .. |
|---|
| 200 | 207 | * inode.c |
|---|
| 201 | 208 | */ |
|---|
| 202 | 209 | struct pde_opener { |
|---|
| 203 | | - struct file *file; |
|---|
| 204 | 210 | struct list_head lh; |
|---|
| 211 | + struct file *file; |
|---|
| 205 | 212 | bool closing; |
|---|
| 206 | 213 | struct completion *c; |
|---|
| 207 | 214 | } __randomize_layout; |
|---|
| 208 | 215 | extern const struct inode_operations proc_link_inode_operations; |
|---|
| 209 | | - |
|---|
| 210 | 216 | extern const struct inode_operations proc_pid_link_inode_operations; |
|---|
| 217 | +extern const struct super_operations proc_sops; |
|---|
| 211 | 218 | |
|---|
| 212 | 219 | void proc_init_kmemcache(void); |
|---|
| 220 | +void proc_invalidate_siblings_dcache(struct hlist_head *inodes, spinlock_t *lock); |
|---|
| 213 | 221 | void set_proc_pid_nlink(void); |
|---|
| 214 | 222 | extern struct inode *proc_get_inode(struct super_block *, struct proc_dir_entry *); |
|---|
| 215 | | -extern int proc_fill_super(struct super_block *); |
|---|
| 216 | 223 | extern void proc_entry_rundown(struct proc_dir_entry *); |
|---|
| 217 | 224 | |
|---|
| 218 | 225 | /* |
|---|
| .. | .. |
|---|
| 258 | 265 | #endif |
|---|
| 259 | 266 | |
|---|
| 260 | 267 | /* |
|---|
| 261 | | - * uid.c |
|---|
| 262 | | - */ |
|---|
| 263 | | -#ifdef CONFIG_PROC_UID |
|---|
| 264 | | -extern int proc_uid_init(void); |
|---|
| 265 | | -#else |
|---|
| 266 | | -static inline void proc_uid_init(void) { } |
|---|
| 267 | | -#endif |
|---|
| 268 | | - |
|---|
| 269 | | -/* |
|---|
| 270 | 268 | * proc_tty.c |
|---|
| 271 | 269 | */ |
|---|
| 272 | 270 | #ifdef CONFIG_TTY |
|---|
| .. | .. |
|---|
| 281 | 279 | extern struct proc_dir_entry proc_root; |
|---|
| 282 | 280 | |
|---|
| 283 | 281 | extern void proc_self_init(void); |
|---|
| 284 | | -extern int proc_remount(struct super_block *, int *, char *); |
|---|
| 285 | 282 | |
|---|
| 286 | 283 | /* |
|---|
| 287 | 284 | * task_[no]mmu.c |
|---|