2 * Copyright (c) 2003-2004 Networks Associates Technology, Inc.
3 * Copyright (c) 2006 SPARTA, Inc.
6 * This software was developed for the FreeBSD Project in part by Network
7 * Associates Laboratories, the Security Research Division of Network
8 * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
9 * as part of the DARPA CHATS research program.
11 * This software was enhanced by SPARTA ISSO under SPAWAR contract
12 * N66001-04-C-6019 ("SEFOS").
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 #include <sys/cdefs.h>
37 __FBSDID("$FreeBSD$");
41 #include <sys/param.h>
42 #include <sys/kernel.h>
44 #include <sys/malloc.h>
45 #include <sys/mutex.h>
47 #include <sys/systm.h>
48 #include <sys/vnode.h>
49 #include <sys/mount.h>
51 #include <sys/namei.h>
52 #include <sys/sysctl.h>
55 #include <security/mac/mac_framework.h>
56 #include <security/mac/mac_internal.h>
57 #include <security/mac/mac_policy.h>
60 mac_sysv_sem_label_alloc(void)
64 label = mac_labelzone_alloc(M_WAITOK);
65 MAC_PERFORM(sysvsem_init_label, label);
70 mac_sysvsem_init(struct semid_kernel *semakptr)
73 semakptr->label = mac_sysv_sem_label_alloc();
77 mac_sysv_sem_label_free(struct label *label)
80 MAC_PERFORM(sysvsem_destroy_label, label);
81 mac_labelzone_free(label);
85 mac_sysvsem_destroy(struct semid_kernel *semakptr)
88 mac_sysv_sem_label_free(semakptr->label);
89 semakptr->label = NULL;
93 mac_sysvsem_create(struct ucred *cred, struct semid_kernel *semakptr)
96 MAC_PERFORM(sysvsem_create, cred, semakptr, semakptr->label);
100 mac_sysvsem_cleanup(struct semid_kernel *semakptr)
103 MAC_PERFORM(sysvsem_cleanup, semakptr->label);
107 mac_sysvsem_check_semctl(struct ucred *cred, struct semid_kernel *semakptr,
112 MAC_CHECK(sysvsem_check_semctl, cred, semakptr, semakptr->label,
119 mac_sysvsem_check_semget(struct ucred *cred, struct semid_kernel *semakptr)
123 MAC_CHECK(sysvsem_check_semget, cred, semakptr, semakptr->label);
129 mac_sysvsem_check_semop(struct ucred *cred, struct semid_kernel *semakptr,
134 MAC_CHECK(sysvsem_check_semop, cred, semakptr, semakptr->label,