* See the API contract for VOP_FPLOOKUP_VEXEC. */
| 5511 | * See the API contract for VOP_FPLOOKUP_VEXEC. |
| 5512 | */ |
| 5513 | static int __noinline |
| 5514 | cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) |
| 5515 | { |
| 5516 | struct componentname *cnp; |
| 5517 | struct vnode *dvp; |
| 5518 | seqc_t dvp_seqc; |
| 5519 | |
| 5520 | cnp = fpl->cnp; |
| 5521 | dvp = fpl->dvp; |
| 5522 | dvp_seqc = fpl->dvp_seqc; |
| 5523 | |
| 5524 | /* |
| 5525 | * TODO: Due to ignoring slashes lookup will perform a permission check |
| 5526 | * on the last dir when it should not have. If it fails, we get here. |
| 5527 | * It is possible possible to fix it up fully without resorting to |
| 5528 | * regular lookup, but for now just abort. |
| 5529 | */ |
| 5530 | if (cache_fpl_istrailingslash(fpl)) { |
| 5531 | return (cache_fpl_aborted(fpl)); |
| 5532 | } |
| 5533 | |
| 5534 | /* |
| 5535 | * Hack: delayed degenerate path checking. |
| 5536 | */ |
| 5537 | if (cnp->cn_nameptr[0] == '\0' && fpl->tvp == NULL) { |
| 5538 | return (cache_fplookup_degenerate(fpl)); |
| 5539 | } |
| 5540 | |
| 5541 | /* |
| 5542 | * Hack: delayed name len checking. |
| 5543 | */ |
| 5544 | if (__predict_false(cnp->cn_namelen > NAME_MAX)) { |
| 5545 | cache_fpl_smr_exit(fpl); |
| 5546 | return (cache_fpl_handled_error(fpl, ENAMETOOLONG)); |
| 5547 | } |
| 5548 | |
| 5549 | /* |
| 5550 | * Hack: they may be looking up foo/bar, where foo is not a directory. |
| 5551 | * In such a case we need to return ENOTDIR, but we may happen to get |
| 5552 | * here with a different error. |
| 5553 | */ |
| 5554 | if (dvp->v_type != VDIR) { |
| 5555 | error = ENOTDIR; |
| 5556 | } |
| 5557 | |
| 5558 | /* |
| 5559 | * Hack: handle O_SEARCH. |
| 5560 | * |
| 5561 | * Open Group Base Specifications Issue 7, 2018 edition states: |
| 5562 | * <quote> |
| 5563 | * If the access mode of the open file description associated with the |
| 5564 | * file descriptor is not O_SEARCH, the function shall check whether |
| 5565 | * directory searches are permitted using the current permissions of |
| 5566 | * the directory underlying the file descriptor. If the access mode is |
| 5567 | * O_SEARCH, the function shall not perform the check. |
| 5568 | * </quote> |
| 5569 | * |
| 5570 | * Regular lookup tests for the NOEXECCHECK flag for every path |
no test coverage detected