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

Function shm_prison_check

freebsd/kern/sysv_shm.c:1098–1131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1096}
1097
1098static int
1099shm_prison_check(void *obj, void *data)
1100{
1101 struct prison *pr = obj;
1102 struct prison *prpr;
1103 struct vfsoptlist *opts = data;
1104 int error, jsys;
1105
1106 /*
1107 * sysvshm is a jailsys integer.
1108 * It must be "disable" if the parent jail is disabled.
1109 */
1110 error = vfs_copyopt(opts, "sysvshm", &jsys, sizeof(jsys));
1111 if (error != ENOENT) {
1112 if (error != 0)
1113 return (error);
1114 switch (jsys) {
1115 case JAIL_SYS_DISABLE:
1116 break;
1117 case JAIL_SYS_NEW:
1118 case JAIL_SYS_INHERIT:
1119 prison_lock(pr->pr_parent);
1120 prpr = osd_jail_get(pr->pr_parent, shm_prison_slot);
1121 prison_unlock(pr->pr_parent);
1122 if (prpr == NULL)
1123 return (EPERM);
1124 break;
1125 default:
1126 return (EINVAL);
1127 }
1128 }
1129
1130 return (0);
1131}
1132
1133static int
1134shm_prison_set(void *obj, void *data)

Callers

nothing calls this directly

Calls 3

vfs_copyoptFunction · 0.85
prison_lockFunction · 0.85
prison_unlockFunction · 0.85

Tested by

no test coverage detected