Deleted Added
full compact
mac_posix_shm.c (191731) mac_posix_shm.c (224914)
1/*-
2 * Copyright (c) 2003-2006 SPARTA, Inc.
3 * Copyright (c) 2009 Robert N. M. Watson
4 * All rights reserved.
5 *
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"),

--- 23 unchanged lines hidden (view full) ---

32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 */
38
39#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2003-2006 SPARTA, Inc.
3 * Copyright (c) 2009 Robert N. M. Watson
4 * All rights reserved.
5 *
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"),

--- 23 unchanged lines hidden (view full) ---

32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 */
38
39#include <sys/cdefs.h>
40__FBSDID("$FreeBSD: head/sys/security/mac/mac_posix_shm.c 191731 2009-05-01 21:05:40Z rwatson $");
40__FBSDID("$FreeBSD: head/sys/security/mac/mac_posix_shm.c 224914 2011-08-16 20:07:47Z kib $");
41
42#include "opt_kdtrace.h"
43#include "opt_mac.h"
44
45#include <sys/param.h>
46#include <sys/kernel.h>
47#include <sys/mman.h>
48#include <sys/malloc.h>

--- 127 unchanged lines hidden (view full) ---

176 int error;
177
178 MAC_POLICY_CHECK_NOSLEEP(posixshm_check_unlink, cred, shmfd,
179 shmfd->shm_label);
180 MAC_CHECK_PROBE2(posixshm_check_unlink, error, cred, shmfd);
181
182 return (error);
183}
41
42#include "opt_kdtrace.h"
43#include "opt_mac.h"
44
45#include <sys/param.h>
46#include <sys/kernel.h>
47#include <sys/mman.h>
48#include <sys/malloc.h>

--- 127 unchanged lines hidden (view full) ---

176 int error;
177
178 MAC_POLICY_CHECK_NOSLEEP(posixshm_check_unlink, cred, shmfd,
179 shmfd->shm_label);
180 MAC_CHECK_PROBE2(posixshm_check_unlink, error, cred, shmfd);
181
182 return (error);
183}
184
185MAC_CHECK_PROBE_DEFINE3(posixshm_check_setmode, "struct ucred *",
186 "struct shmfd *", "mode_t");
187
188int
189mac_posixshm_check_setmode(struct ucred *cred, struct shmfd *shmfd, mode_t mode)
190{
191 int error;
192
193 MAC_POLICY_CHECK_NOSLEEP(posixshm_check_setmode, cred, shmfd,
194 shmfd->shm_label, mode);
195 MAC_CHECK_PROBE3(posixshm_check_setmode, error, cred, shmfd, mode);
196
197 return (error);
198}
199
200MAC_CHECK_PROBE_DEFINE4(posixshm_check_setowner, "struct ucred *",
201 "struct shmfd *", "uid_t", "gid_t");
202
203int
204mac_posixshm_check_setowner(struct ucred *cred, struct shmfd *shmfd, uid_t uid,
205 gid_t gid)
206{
207 int error;
208
209 MAC_POLICY_CHECK_NOSLEEP(posixshm_check_setowner, cred, shmfd,
210 shmfd->shm_label, uid, gid);
211 MAC_CHECK_PROBE4(posixshm_check_setowner, error, cred, shmfd,
212 uid, gid);
213
214 return (error);
215}