| 2807 | } |
| 2808 | |
| 2809 | static void |
| 2810 | lomac_vnode_execve_transition(struct ucred *old, struct ucred *new, |
| 2811 | struct vnode *vp, struct label *vplabel, struct label *interpvplabel, |
| 2812 | struct image_params *imgp, struct label *execlabel) |
| 2813 | { |
| 2814 | struct mac_lomac *source, *dest, *obj, *robj; |
| 2815 | |
| 2816 | source = SLOT(old->cr_label); |
| 2817 | dest = SLOT(new->cr_label); |
| 2818 | obj = SLOT(vplabel); |
| 2819 | robj = interpvplabel != NULL ? SLOT(interpvplabel) : obj; |
| 2820 | |
| 2821 | lomac_copy(source, dest); |
| 2822 | /* |
| 2823 | * If there's an auxiliary label on the real object, respect it and |
| 2824 | * assume that this level should be assumed immediately if a higher |
| 2825 | * level is currently in place. |
| 2826 | */ |
| 2827 | if (robj->ml_flags & MAC_LOMAC_FLAG_AUX && |
| 2828 | !lomac_dominate_element(&robj->ml_auxsingle, &dest->ml_single) |
| 2829 | && lomac_auxsingle_in_range(robj, dest)) |
| 2830 | lomac_set_single(dest, robj->ml_auxsingle.mle_type, |
| 2831 | robj->ml_auxsingle.mle_grade); |
| 2832 | /* |
| 2833 | * Restructuring to use the execve transitioning mechanism instead of |
| 2834 | * the normal demotion mechanism here would be difficult, so just |
| 2835 | * copy the label over and perform standard demotion. This is also |
| 2836 | * non-optimal because it will result in the intermediate label "new" |
| 2837 | * being created and immediately recycled. |
| 2838 | */ |
| 2839 | if (lomac_enabled && revocation_enabled && |
| 2840 | !lomac_dominate_single(obj, source)) |
| 2841 | (void)maybe_demote(source, obj, "executing", "file", vp); |
| 2842 | } |
| 2843 | |
| 2844 | static int |
| 2845 | lomac_vnode_execve_will_transition(struct ucred *old, struct vnode *vp, |
nothing calls this directly
no test coverage detected