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

Function sys_mac_syscall

freebsd/security/mac/mac_syscalls.c:554–589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554int
555sys_mac_syscall(struct thread *td, struct mac_syscall_args *uap)
556{
557 struct mac_policy_conf *mpc;
558 char target[MAC_MAX_POLICY_NAME];
559 int error;
560
561 error = copyinstr(uap->policy, target, sizeof(target), NULL);
562 if (error)
563 return (error);
564
565 error = ENOSYS;
566 LIST_FOREACH(mpc, &mac_static_policy_list, mpc_list) {
567 if (strcmp(mpc->mpc_name, target) == 0 &&
568 mpc->mpc_ops->mpo_syscall != NULL) {
569 error = mpc->mpc_ops->mpo_syscall(td,
570 uap->call, uap->arg);
571 goto out;
572 }
573 }
574
575 if (!LIST_EMPTY(&mac_policy_list)) {
576 mac_policy_slock_sleep();
577 LIST_FOREACH(mpc, &mac_policy_list, mpc_list) {
578 if (strcmp(mpc->mpc_name, target) == 0 &&
579 mpc->mpc_ops->mpo_syscall != NULL) {
580 error = mpc->mpc_ops->mpo_syscall(td,
581 uap->call, uap->arg);
582 break;
583 }
584 }
585 mac_policy_sunlock_sleep();
586 }
587out:
588 return (error);
589}
590
591#else /* !MAC */
592

Callers

nothing calls this directly

Calls 4

strcmpFunction · 0.85
mac_policy_slock_sleepFunction · 0.85
mac_policy_sunlock_sleepFunction · 0.85
copyinstrFunction · 0.50

Tested by

no test coverage detected