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

Function msg_prison_check

freebsd/kern/sysv_msg.c:1499–1532  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1497 "Array of struct msqid_kernel for each potential message queue");
1498
1499static int
1500msg_prison_check(void *obj, void *data)
1501{
1502 struct prison *pr = obj;
1503 struct prison *prpr;
1504 struct vfsoptlist *opts = data;
1505 int error, jsys;
1506
1507 /*
1508 * sysvmsg is a jailsys integer.
1509 * It must be "disable" if the parent jail is disabled.
1510 */
1511 error = vfs_copyopt(opts, "sysvmsg", &jsys, sizeof(jsys));
1512 if (error != ENOENT) {
1513 if (error != 0)
1514 return (error);
1515 switch (jsys) {
1516 case JAIL_SYS_DISABLE:
1517 break;
1518 case JAIL_SYS_NEW:
1519 case JAIL_SYS_INHERIT:
1520 prison_lock(pr->pr_parent);
1521 prpr = osd_jail_get(pr->pr_parent, msg_prison_slot);
1522 prison_unlock(pr->pr_parent);
1523 if (prpr == NULL)
1524 return (EPERM);
1525 break;
1526 default:
1527 return (EINVAL);
1528 }
1529 }
1530
1531 return (0);
1532}
1533
1534static int
1535msg_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