FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_capsicum.h"
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/dirent.h>
#include <sys/kernel.h>
#include <sys/capsicum.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/mount.h>
#include <sys/filedesc.h>
#include <sys/proc.h>
#include <sys/sdt.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
#include <vm/uma.h>
Go to the source code of this file.
Data Structures | |
struct | nameicap_tracker |
Macros | |
#define | NAMEI_DIAGNOSTIC 1 |
Functions | |
__FBSDID ("$FreeBSD$") | |
SDT_PROVIDER_DEFINE (vfs) | |
SDT_PROBE_DEFINE4 (vfs, namei, lookup, entry, "struct vnode *", "char *", "unsigned long", "bool") | |
SDT_PROBE_DEFINE4 (vfs, namei, lookup, return, "int", "struct vnode *", "bool", "struct nameidata") | |
static int | crossmp_vop_islocked (struct vop_islocked_args *ap) |
static int | crossmp_vop_lock1 (struct vop_lock1_args *ap) |
static int | crossmp_vop_unlock (struct vop_unlock_args *ap) |
MALLOC_DEFINE (M_NAMEITRACKER, "namei_tracker", "namei tracking for dotdot") | |
static void | nameiinit (void *dummy __unused) |
SYSINIT (vfs, SI_SUB_VFS, SI_ORDER_SECOND, nameiinit, NULL) | |
SYSCTL_INT (_vfs, OID_AUTO, lookup_cap_dotdot, CTLFLAG_RWTUN, &lookup_cap_dotdot, 0, "enables \"..\" components in path lookup in capability mode") | |
SYSCTL_INT (_vfs, OID_AUTO, lookup_cap_dotdot_nonlocal, CTLFLAG_RWTUN, &lookup_cap_dotdot_nonlocal, 0, "enables \"..\" components in path lookup in capability mode " "on non-local mount") | |
static void | nameicap_tracker_add (struct nameidata *ndp, struct vnode *dp) |
static void | nameicap_cleanup_from (struct nameidata *ndp, struct nameicap_tracker *first) |
static void | nameicap_cleanup (struct nameidata *ndp) |
static int | nameicap_check_dotdot (struct nameidata *ndp, struct vnode *dp) |
static void | namei_cleanup_cnp (struct componentname *cnp) |
static int | namei_handle_root (struct nameidata *ndp, struct vnode **dpp) |
static int | namei_setup (struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp) |
static int | namei_getpath (struct nameidata *ndp) |
static int | namei_emptypath (struct nameidata *ndp) |
int | namei (struct nameidata *ndp) |
static int | compute_cn_lkflags (struct mount *mp, int lkflags, int cnflags) |
static __inline int | needs_exclusive_leaf (struct mount *mp, int flags) |
_Static_assert (MAXNAMLEN==NAME_MAX, "MAXNAMLEN and NAME_MAX have different values") | |
int | vfs_lookup (struct nameidata *ndp) |
int | vfs_relookup (struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) |
void | NDFREE_PNBUF (struct nameidata *ndp) |
void() | NDFREE (struct nameidata *ndp, const u_int flags) |
int | kern_alternate_path (const char *prefix, const char *path, enum uio_seg pathseg, char **pathbuf, int create, int dirfd) |
Variables | |
uma_zone_t | namei_zone |
static struct vnode * | vp_crossmp |
static struct vop_vector | crossmp_vnodeops |
static int | lookup_cap_dotdot = 1 |
static int | lookup_cap_dotdot_nonlocal = 1 |
#define NAMEI_DIAGNOSTIC 1 |
Definition at line 74 of file vfs_lookup.c.
__FBSDID | ( | "$FreeBSD$" | ) |
_Static_assert | ( | MAXNAMLEN | = =NAME_MAX , |
"MAXNAMLEN and NAME_MAX have different values" | |||
) |
|
static |
Definition at line 755 of file vfs_lookup.c.
Referenced by vfs_lookup().
|
static |
Definition at line 90 of file vfs_lookup.c.
|
static |
Definition at line 97 of file vfs_lookup.c.
References flags, and panic().
|
static |
Definition at line 123 of file vfs_lookup.c.
int kern_alternate_path | ( | const char * | prefix, |
const char * | path, | ||
enum uio_seg | pathseg, | ||
char ** | pathbuf, | ||
int | create, | ||
int | dirfd | ||
) |
MALLOC_DEFINE | ( | M_NAMEITRACKER | , |
"namei_tracker" | , | ||
"namei tracking for dotdot" | |||
) |
int namei | ( | struct nameidata * | ndp | ) |
Definition at line 535 of file vfs_lookup.c.
References cache_fplookup(), namei(), namei_cleanup_cnp(), namei_emptypath(), namei_getpath(), namei_handle_root(), namei_setup(), namei_zone, nameicap_cleanup(), pwd_drop(), vfs_lookup(), vput(), and vrele().
Referenced by cache_fplookup(), do_execve(), kern___acl_aclcheck_path(), kern___acl_delete_path(), kern___acl_get_path(), kern___acl_set_path(), kern___realpathat(), kern_accessat(), kern_alternate_path(), kern_chdir(), kern_chflagsat(), kern_extattr_delete_path(), kern_extattr_get_path(), kern_extattr_list_path(), kern_extattr_set_path(), kern_fchmodat(), kern_fchownat(), kern_frmdirat(), kern_funlinkat(), kern_getfhat(), kern_jail_set(), kern_linkat(), kern_linkat_vp(), kern_lutimes(), kern_mkdirat(), kern_mkfifoat(), kern_mknodat(), kern_pathconf(), kern_readlinkat(), kern_renameat(), kern_statat(), kern_statfs(), kern_symlinkat(), kern_truncate(), kern_unmount(), kern_utimensat(), kern_utimesat(), load_file(), namei(), namei_emptypath(), namei_setup(), parse_mount_dev_present(), proc_get_binpath(), sys_chroot(), sys_extattrctl(), sys_quotactl(), sys_revoke(), sys_undelete(), sysctl_debug_tslog_user(), sysctl_try_reclaim_vnode(), tslog_user(), uipc_bindat(), unp_connectat(), vfs_domount(), vfs_mountroot_shuffle(), vn_open_cred(), and vn_path_to_global_path().
|
static |
Definition at line 253 of file vfs_lookup.c.
References namei_zone.
Referenced by namei(), and namei_emptypath().
|
static |
Definition at line 471 of file vfs_lookup.c.
References namei(), namei_cleanup_cnp(), namei_setup(), pwd_drop(), and vput().
Referenced by namei().
|
static |
Definition at line 443 of file vfs_lookup.c.
References namei_zone.
Referenced by namei().
|
static |
Definition at line 264 of file vfs_lookup.c.
References vrefact().
Referenced by namei(), and namei_setup().
|
static |
Definition at line 286 of file vfs_lookup.c.
References badfileops, fget_cap(), lookup_cap_dotdot, namei(), namei_handle_root(), pwd_drop(), pwd_hold(), vref(), vrefact(), and vrele().
Referenced by namei(), and namei_emptypath().
|
static |
Definition at line 226 of file vfs_lookup.c.
References nameicap_tracker::dp, lookup_cap_dotdot_nonlocal, and nameicap_cleanup_from().
Referenced by vfs_lookup().
|
static |
Definition at line 207 of file vfs_lookup.c.
References nameicap_cleanup_from().
Referenced by namei().
|
static |
Definition at line 194 of file vfs_lookup.c.
References nameicap_tracker::dp, free(), and vdrop().
Referenced by nameicap_check_dotdot(), and nameicap_cleanup().
|
static |
Definition at line 178 of file vfs_lookup.c.
References nameicap_tracker::dp, malloc(), and vhold().
Referenced by vfs_lookup().
|
static |
Definition at line 157 of file vfs_lookup.c.
References crossmp_vnodeops, getnewvnode(), namei_zone, and vp_crossmp.
void() NDFREE | ( | struct nameidata * | ndp, |
const u_int | flags | ||
) |
Definition at line 1554 of file vfs_lookup.c.
References flags, NDFREE_PNBUF(), vput(), and vrele().
Referenced by alq_open_flags(), corefile_open(), corefile_open_last(), do_execve(), kern___acl_aclcheck_path(), kern___acl_delete_path(), kern___acl_get_path(), kern___acl_set_path(), kern___realpathat(), kern_alternate_path(), kern_extattr_delete_path(), kern_extattr_get_path(), kern_extattr_list_path(), kern_extattr_set_path(), kern_frmdirat(), kern_funlinkat(), kern_jail_set(), kern_linkat(), kern_linkat_vp(), kern_mkdirat(), kern_mkfifoat(), kern_mknodat(), kern_openat(), kern_renameat(), kern_symlinkat(), kern_truncate(), kern_unmount(), link_elf_ctf_get(), link_elf_load_file(), linker_hints_lookup(), linker_lookup_file(), load_file(), parse_mount_dev_present(), proc_get_binpath(), sys_acct(), sys_extattrctl(), sys_ktrace(), sys_quotactl(), sys_undelete(), sysctl_try_reclaim_vnode(), uipc_bindat(), vfs_domount(), vfs_lookup(), vfs_mountroot_readconf(), vfs_mountroot_shuffle(), vn_open_cred(), vn_path_to_global_path(), and vop_stdvptocnp().
void NDFREE_PNBUF | ( | struct nameidata * | ndp | ) |
Definition at line 1517 of file vfs_lookup.c.
References namei_zone.
Referenced by NDFREE().
|
static |
Definition at line 768 of file vfs_lookup.c.
References flags.
Referenced by vfs_lookup().
SDT_PROBE_DEFINE4 | ( | vfs | , |
namei | , | ||
lookup | , | ||
entry | , | ||
"struct vnode *" | , | ||
"char *" | , | ||
"unsigned long" | , | ||
"bool" | |||
) |
SDT_PROBE_DEFINE4 | ( | vfs | , |
namei | , | ||
lookup | , | ||
return | , | ||
"int" | , | ||
"struct vnode *" | , | ||
"bool" | , | ||
"struct nameidata" | |||
) |
SDT_PROVIDER_DEFINE | ( | vfs | ) |
SYSCTL_INT | ( | _vfs | , |
OID_AUTO | , | ||
lookup_cap_dotdot | , | ||
CTLFLAG_RWTUN | , | ||
& | lookup_cap_dotdot, | ||
0 | , | ||
"enables \"..\" components in path lookup in capability mode" | |||
) |
SYSCTL_INT | ( | _vfs | , |
OID_AUTO | , | ||
lookup_cap_dotdot_nonlocal | , | ||
CTLFLAG_RWTUN | , | ||
& | lookup_cap_dotdot_nonlocal, | ||
0 | , | ||
"enables \"..\" components in path lookup in capability mode " "on non-local mount" | |||
) |
SYSINIT | ( | vfs | , |
SI_SUB_VFS | , | ||
SI_ORDER_SECOND | , | ||
nameiinit | , | ||
NULL | |||
) |
int vfs_lookup | ( | struct nameidata * | ndp | ) |
Definition at line 844 of file vfs_lookup.c.
References compute_cn_lkflags(), nameicap_check_dotdot(), nameicap_tracker_add(), NDFREE(), needs_exclusive_leaf(), panic(), pr, printf(), rootvnode, vfs_busy(), vfs_unbusy(), vn_printf(), vp_crossmp, vput(), vref(), vrefact(), and vrele().
Referenced by namei().
int vfs_relookup | ( | struct vnode * | dvp, |
struct vnode ** | vpp, | ||
struct componentname * | cnp | ||
) |
Definition at line 1389 of file vfs_lookup.c.
References panic(), printf(), vn_printf(), vput(), and vrele().
|
static |
Definition at line 137 of file vfs_lookup.c.
Referenced by nameiinit().
|
static |
Definition at line 167 of file vfs_lookup.c.
Referenced by namei_setup().
|
static |
Definition at line 171 of file vfs_lookup.c.
Referenced by nameicap_check_dotdot().
uma_zone_t namei_zone |
Definition at line 84 of file vfs_lookup.c.
Referenced by cache_fpl_cleanup_cnp(), kern_symlinkat(), namei(), namei_cleanup_cnp(), namei_getpath(), nameiinit(), NDFREE_PNBUF(), and sys___getcwd().
|
static |
Definition at line 87 of file vfs_lookup.c.
Referenced by nameiinit(), and vfs_lookup().