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

Function sys___mac_get_proc

freebsd/security/mac/mac_syscalls.c:133–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133int
134sys___mac_get_proc(struct thread *td, struct __mac_get_proc_args *uap)
135{
136 char *elements, *buffer;
137 struct mac mac;
138 int error;
139
140 error = copyin(uap->mac_p, &mac, sizeof(mac));
141 if (error)
142 return (error);
143
144 error = mac_check_structmac_consistent(&mac);
145 if (error)
146 return (error);
147
148 elements = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK);
149 error = copyinstr(mac.m_string, elements, mac.m_buflen, NULL);
150 if (error) {
151 free(elements, M_MACTEMP);
152 return (error);
153 }
154
155 buffer = malloc(mac.m_buflen, M_MACTEMP, M_WAITOK | M_ZERO);
156 error = mac_cred_externalize_label(td->td_ucred->cr_label,
157 elements, buffer, mac.m_buflen);
158 if (error == 0)
159 error = copyout(buffer, mac.m_string, strlen(buffer)+1);
160
161 free(buffer, M_MACTEMP);
162 free(elements, M_MACTEMP);
163 return (error);
164}
165
166int
167sys___mac_set_proc(struct thread *td, struct __mac_set_proc_args *uap)

Callers

nothing calls this directly

Calls 7

mallocFunction · 0.85
copyinFunction · 0.50
copyinstrFunction · 0.50
freeFunction · 0.50
copyoutFunction · 0.50

Tested by

no test coverage detected