| 2594 | } |
| 2595 | |
| 2596 | static int |
| 2597 | mls_vnode_check_exec(struct ucred *cred, struct vnode *vp, |
| 2598 | struct label *vplabel, struct image_params *imgp, |
| 2599 | struct label *execlabel) |
| 2600 | { |
| 2601 | struct mac_mls *subj, *obj, *exec; |
| 2602 | int error; |
| 2603 | |
| 2604 | if (execlabel != NULL) { |
| 2605 | /* |
| 2606 | * We currently don't permit labels to be changed at |
| 2607 | * exec-time as part of MLS, so disallow non-NULL MLS label |
| 2608 | * elements in the execlabel. |
| 2609 | */ |
| 2610 | exec = SLOT(execlabel); |
| 2611 | error = mls_atmostflags(exec, 0); |
| 2612 | if (error) |
| 2613 | return (error); |
| 2614 | } |
| 2615 | |
| 2616 | if (!mls_enabled) |
| 2617 | return (0); |
| 2618 | |
| 2619 | subj = SLOT(cred->cr_label); |
| 2620 | obj = SLOT(vplabel); |
| 2621 | |
| 2622 | if (!mls_dominate_effective(subj, obj)) |
| 2623 | return (EACCES); |
| 2624 | |
| 2625 | return (0); |
| 2626 | } |
| 2627 | |
| 2628 | static int |
| 2629 | mls_vnode_check_getacl(struct ucred *cred, struct vnode *vp, |
nothing calls this directly
no test coverage detected