MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lomac_vnode_execve_transition

Function lomac_vnode_execve_transition

freebsd/security/mac_lomac/mac_lomac.c:2809–2842  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2807}
2808
2809static void
2810lomac_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
2844static int
2845lomac_vnode_execve_will_transition(struct ucred *old, struct vnode *vp,

Callers

nothing calls this directly

Calls 6

lomac_copyFunction · 0.85
lomac_dominate_elementFunction · 0.85
lomac_auxsingle_in_rangeFunction · 0.85
lomac_set_singleFunction · 0.85
lomac_dominate_singleFunction · 0.85
maybe_demoteFunction · 0.85

Tested by

no test coverage detected