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

Function mac_execve_enter

freebsd/security/mac/mac_process.c:135–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135int
136mac_execve_enter(struct image_params *imgp, struct mac *mac_p)
137{
138 struct label *label;
139 struct mac mac;
140 char *buffer;
141 int error;
142
143 if (mac_p == NULL)
144 return (0);
145
146 if (!(mac_labeled & MPC_OBJECT_CRED))
147 return (EINVAL);
148
149 error = copyin(mac_p, &mac, sizeof(mac));
150 if (error)
151 return (error);
152
153 error = mac_check_structmac_consistent(&mac);
154 if (error)
155 return (error);
156
157 buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
158 error = copyinstr(mac.m_string, buffer, mac.m_buflen, NULL);
159 if (error) {
160 free(buffer, M_MACTEMP);
161 return (error);
162 }
163
164 label = mac_cred_label_alloc();
165 error = mac_cred_internalize_label(label, buffer);
166 free(buffer, M_MACTEMP);
167 if (error) {
168 mac_cred_label_free(label);
169 return (error);
170 }
171 imgp->execlabel = label;
172 return (0);
173}
174
175void
176mac_execve_exit(struct image_params *imgp)

Callers 1

do_execveFunction · 0.85

Calls 8

mallocFunction · 0.85
mac_cred_label_allocFunction · 0.85
mac_cred_label_freeFunction · 0.85
copyinFunction · 0.50
copyinstrFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected