xref: /freebsd/sys/security/mac/mac_syscalls.h (revision 3bdc5ba2ac760634056c66c3c98b6b3452258a5b)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2024 The FreeBSD Foundation
5  *
6  * This software was developed by Olivier Certner <olce.freebsd@certner.fr> at
7  * Kumacom SARL under sponsorship from the FreeBSD Foundation.
8  */
9 
10 /*
11  * Prototypes for functions used to implement system calls that must manipulate
12  * MAC labels.
13  */
14 
15 #ifndef _SECURITY_MAC_MAC_SYSCALLS_H_
16 #define _SECURITY_MAC_MAC_SYSCALLS_H_
17 
18 #ifndef _KERNEL
19 #error "no user-serviceable parts inside"
20 #endif
21 
22 int	mac_label_copyin(const struct mac *const u_mac, struct mac *const mac,
23 	    char **const u_string);
24 void	free_copied_label(const struct mac *const mac);
25 
26 #ifdef COMPAT_FREEBSD32
27 struct mac32;
28 
29 int	mac_label_copyin32(const struct mac32 *const u_mac,
30 	    struct mac *const mac, char **const u_string);
31 #endif /* COMPAT_FREEBSD32 */
32 
33 int	mac_set_proc_prepare(struct thread *const td,
34 	    const struct mac *const mac, void **const mac_set_proc_data);
35 int	mac_set_proc_core(struct thread *const td, struct ucred *const newcred,
36 	    void *const mac_set_proc_data);
37 void	mac_set_proc_finish(struct thread *const td, bool proc_label_set,
38 	    void *const mac_set_proc_data);
39 
40 #endif /* !_SECURITY_MAC_MAC_SYSCALLS_H_ */
41