vfs_lookup.c (c9536389d732feecf61afa4632397d67b04b2ab4) | vfs_lookup.c (b4a58fbf640409a1e507d9f7b411c83a3f83a2f3) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 280 unchanged lines hidden (view full) --- 289 struct file *dfp; 290 struct thread *td; 291 struct pwd *pwd; 292 cap_rights_t rights; 293 int error; 294 bool startdir_used; 295 296 cnp = &ndp->ni_cnd; | 1/*- 2 * SPDX-License-Identifier: BSD-3-Clause 3 * 4 * Copyright (c) 1982, 1986, 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 280 unchanged lines hidden (view full) --- 289 struct file *dfp; 290 struct thread *td; 291 struct pwd *pwd; 292 cap_rights_t rights; 293 int error; 294 bool startdir_used; 295 296 cnp = &ndp->ni_cnd; |
297 td = cnp->cn_thread; | 297 td = curthread; |
298 299 startdir_used = false; 300 *pwdp = NULL; 301 *dpp = NULL; 302 303#ifdef CAPABILITY_MODE 304 /* 305 * In capability mode, lookups must be restricted to happen in --- 241 unchanged lines hidden (view full) --- 547 struct componentname *cnp; 548 struct thread *td; 549 struct pwd *pwd; 550 struct uio auio; 551 int error, linklen; 552 enum cache_fpl_status status; 553 554 cnp = &ndp->ni_cnd; | 298 299 startdir_used = false; 300 *pwdp = NULL; 301 *dpp = NULL; 302 303#ifdef CAPABILITY_MODE 304 /* 305 * In capability mode, lookups must be restricted to happen in --- 241 unchanged lines hidden (view full) --- 547 struct componentname *cnp; 548 struct thread *td; 549 struct pwd *pwd; 550 struct uio auio; 551 int error, linklen; 552 enum cache_fpl_status status; 553 554 cnp = &ndp->ni_cnd; |
555 td = cnp->cn_thread; | 555 td = curthread; |
556#ifdef INVARIANTS | 556#ifdef INVARIANTS |
557 KASSERT(cnp->cn_thread == curthread, 558 ("namei not using curthread")); | |
559 KASSERT((ndp->ni_debugflags & NAMEI_DBG_CALLED) == 0, 560 ("%s: repeated call to namei without NDREINIT", __func__)); 561 KASSERT(ndp->ni_debugflags == NAMEI_DBG_INITED, 562 ("%s: bad debugflags %d", __func__, ndp->ni_debugflags)); 563 ndp->ni_debugflags |= NAMEI_DBG_CALLED; 564 if (ndp->ni_startdir != NULL) 565 ndp->ni_debugflags |= NAMEI_DBG_HADSTARTDIR; 566 if (cnp->cn_flags & FAILIFEXISTS) { --- 9 unchanged lines hidden (view full) --- 576 /* 577 * For NDVALIDATE. 578 * 579 * While NDINIT may seem like a more natural place to do it, there are 580 * callers which directly modify flags past invoking init. 581 */ 582 cnp->cn_origflags = cnp->cn_flags; 583#endif | 557 KASSERT((ndp->ni_debugflags & NAMEI_DBG_CALLED) == 0, 558 ("%s: repeated call to namei without NDREINIT", __func__)); 559 KASSERT(ndp->ni_debugflags == NAMEI_DBG_INITED, 560 ("%s: bad debugflags %d", __func__, ndp->ni_debugflags)); 561 ndp->ni_debugflags |= NAMEI_DBG_CALLED; 562 if (ndp->ni_startdir != NULL) 563 ndp->ni_debugflags |= NAMEI_DBG_HADSTARTDIR; 564 if (cnp->cn_flags & FAILIFEXISTS) { --- 9 unchanged lines hidden (view full) --- 574 /* 575 * For NDVALIDATE. 576 * 577 * While NDINIT may seem like a more natural place to do it, there are 578 * callers which directly modify flags past invoking init. 579 */ 580 cnp->cn_origflags = cnp->cn_flags; 581#endif |
584 ndp->ni_cnd.cn_cred = ndp->ni_cnd.cn_thread->td_ucred; | 582 ndp->ni_cnd.cn_cred = td->td_ucred; |
585 KASSERT(ndp->ni_resflags == 0, ("%s: garbage in ni_resflags: %x\n", 586 __func__, ndp->ni_resflags)); 587 KASSERT(cnp->cn_cred && td->td_proc, ("namei: bad cred/proc")); 588 KASSERT((cnp->cn_flags & NAMEI_INTERNAL_FLAGS) == 0, 589 ("namei: unexpected flags: %" PRIx64 "\n", 590 cnp->cn_flags & NAMEI_INTERNAL_FLAGS)); 591 if (cnp->cn_flags & NOCACHE) 592 KASSERT(cnp->cn_nameiop != LOOKUP, --- 498 unchanged lines hidden (view full) --- 1091 } 1092 } 1093 1094 /* 1095 * We now have a segment name to search for, and a directory to search. 1096 */ 1097unionlookup: 1098#ifdef MAC | 583 KASSERT(ndp->ni_resflags == 0, ("%s: garbage in ni_resflags: %x\n", 584 __func__, ndp->ni_resflags)); 585 KASSERT(cnp->cn_cred && td->td_proc, ("namei: bad cred/proc")); 586 KASSERT((cnp->cn_flags & NAMEI_INTERNAL_FLAGS) == 0, 587 ("namei: unexpected flags: %" PRIx64 "\n", 588 cnp->cn_flags & NAMEI_INTERNAL_FLAGS)); 589 if (cnp->cn_flags & NOCACHE) 590 KASSERT(cnp->cn_nameiop != LOOKUP, --- 498 unchanged lines hidden (view full) --- 1089 } 1090 } 1091 1092 /* 1093 * We now have a segment name to search for, and a directory to search. 1094 */ 1095unionlookup: 1096#ifdef MAC |
1099 error = mac_vnode_check_lookup(cnp->cn_thread->td_ucred, dp, cnp); | 1097 error = mac_vnode_check_lookup(cnp->cn_cred, dp, cnp); |
1100 if (error) 1101 goto bad; 1102#endif 1103 ndp->ni_dvp = dp; 1104 ndp->ni_vp = NULL; 1105 ASSERT_VOP_LOCKED(dp, "lookup"); 1106 /* 1107 * If we have a shared lock we may need to upgrade the lock for the --- 672 unchanged lines hidden --- | 1098 if (error) 1099 goto bad; 1100#endif 1101 ndp->ni_dvp = dp; 1102 ndp->ni_vp = NULL; 1103 ASSERT_VOP_LOCKED(dp, "lookup"); 1104 /* 1105 * If we have a shared lock we may need to upgrade the lock for the --- 672 unchanged lines hidden --- |