uipc_shm.c (3f07b9d9f87e28e577453e784ae369e18d35157b) uipc_shm.c (d292b1940c9cc327810627c486cbcfa7e12ce8ad)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2006, 2011, 2016-2017 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * Portions of this software were developed by BAE Systems, the University of
8 * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL

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

674
675 accmode = 0;
676 if (flags & FREAD)
677 accmode |= VREAD;
678 if (flags & FWRITE)
679 accmode |= VWRITE;
680 mtx_lock(&shm_timestamp_lock);
681 error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid,
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2006, 2011, 2016-2017 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * Portions of this software were developed by BAE Systems, the University of
8 * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL

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

674
675 accmode = 0;
676 if (flags & FREAD)
677 accmode |= VREAD;
678 if (flags & FWRITE)
679 accmode |= VWRITE;
680 mtx_lock(&shm_timestamp_lock);
681 error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid,
682 accmode, ucred, NULL);
682 accmode, ucred);
683 mtx_unlock(&shm_timestamp_lock);
684 return (error);
685}
686
687/*
688 * Dictionary management. We maintain an in-kernel dictionary to map
689 * paths to shmfd objects. We use the FNV hash on the path to store
690 * the mappings in a hash table.

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

1235 * SUSv4 says that x bits of permission need not be affected.
1236 * Be consistent with our shm_open there.
1237 */
1238#ifdef MAC
1239 error = mac_posixshm_check_setmode(active_cred, shmfd, mode);
1240 if (error != 0)
1241 goto out;
1242#endif
683 mtx_unlock(&shm_timestamp_lock);
684 return (error);
685}
686
687/*
688 * Dictionary management. We maintain an in-kernel dictionary to map
689 * paths to shmfd objects. We use the FNV hash on the path to store
690 * the mappings in a hash table.

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

1235 * SUSv4 says that x bits of permission need not be affected.
1236 * Be consistent with our shm_open there.
1237 */
1238#ifdef MAC
1239 error = mac_posixshm_check_setmode(active_cred, shmfd, mode);
1240 if (error != 0)
1241 goto out;
1242#endif
1243 error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid,
1244 shmfd->shm_gid, VADMIN, active_cred, NULL);
1243 error = vaccess(VREG, shmfd->shm_mode, shmfd->shm_uid, shmfd->shm_gid,
1244 VADMIN, active_cred);
1245 if (error != 0)
1246 goto out;
1247 shmfd->shm_mode = mode & ACCESSPERMS;
1248out:
1249 mtx_unlock(&shm_timestamp_lock);
1250 return (error);
1251}
1252

--- 332 unchanged lines hidden ---
1245 if (error != 0)
1246 goto out;
1247 shmfd->shm_mode = mode & ACCESSPERMS;
1248out:
1249 mtx_unlock(&shm_timestamp_lock);
1250 return (error);
1251}
1252

--- 332 unchanged lines hidden ---