xref: /freebsd/sys/security/mac_stub/mac_stub.c (revision 729362425c09cf6b362366aabc6fb547eee8035a)
1 /*-
2  * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
3  * Copyright (c) 2001, 2002 Networks Associates Technology, Inc.
4  * All rights reserved.
5  *
6  * This software was developed by Robert Watson for the TrustedBSD Project.
7  *
8  * This software was developed for the FreeBSD Project in part by Network
9  * Associates Laboratories, the Security Research Division of Network
10  * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"),
11  * as part of the DARPA CHATS research program.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  * $FreeBSD$
35  */
36 
37 /*
38  * Developed by the TrustedBSD Project.
39  * Generic mandatory access module that does nothing.
40  */
41 
42 #include <sys/types.h>
43 #include <sys/param.h>
44 #include <sys/acl.h>
45 #include <sys/conf.h>
46 #include <sys/extattr.h>
47 #include <sys/kernel.h>
48 #include <sys/mac.h>
49 #include <sys/mount.h>
50 #include <sys/proc.h>
51 #include <sys/systm.h>
52 #include <sys/sysproto.h>
53 #include <sys/sysent.h>
54 #include <sys/vnode.h>
55 #include <sys/file.h>
56 #include <sys/socket.h>
57 #include <sys/socketvar.h>
58 #include <sys/pipe.h>
59 #include <sys/sysctl.h>
60 
61 #include <fs/devfs/devfs.h>
62 
63 #include <net/bpfdesc.h>
64 #include <net/if.h>
65 #include <net/if_types.h>
66 #include <net/if_var.h>
67 
68 #include <netinet/in.h>
69 #include <netinet/ip_var.h>
70 
71 #include <vm/vm.h>
72 
73 #include <sys/mac_policy.h>
74 
75 SYSCTL_DECL(_security_mac);
76 
77 SYSCTL_NODE(_security_mac, OID_AUTO, none, CTLFLAG_RW, 0,
78     "TrustedBSD mac_none policy controls");
79 
80 static int	mac_none_enabled = 1;
81 SYSCTL_INT(_security_mac_none, OID_AUTO, enabled, CTLFLAG_RW,
82     &mac_none_enabled, 0, "Enforce none policy");
83 
84 /*
85  * Policy module operations.
86  */
87 static void
88 mac_none_destroy(struct mac_policy_conf *conf)
89 {
90 
91 }
92 
93 static void
94 mac_none_init(struct mac_policy_conf *conf)
95 {
96 
97 }
98 
99 static int
100 mac_none_syscall(struct thread *td, int call, void *arg)
101 {
102 
103 	return (0);
104 }
105 
106 /*
107  * Label operations.
108  */
109 static void
110 mac_none_init_label(struct label *label)
111 {
112 
113 }
114 
115 static int
116 mac_none_init_label_waitcheck(struct label *label, int flag)
117 {
118 
119 	return (0);
120 }
121 
122 static void
123 mac_none_destroy_label(struct label *label)
124 {
125 
126 }
127 
128 static int
129 mac_none_externalize_label(struct label *label, char *element_name,
130     char *element_data, size_t size, size_t *len, int *claimed)
131 {
132 
133 	return (0);
134 }
135 
136 static int
137 mac_none_internalize_label(struct label *label, char *element_name,
138     char *element_data, int *claimed)
139 {
140 
141 	return (0);
142 }
143 
144 /*
145  * Labeling event operations: file system objects, and things that look
146  * a lot like file system objects.
147  */
148 static void
149 mac_none_associate_vnode_devfs(struct mount *mp, struct label *fslabel,
150     struct devfs_dirent *de, struct label *delabel, struct vnode *vp,
151     struct label *vlabel)
152 {
153 
154 }
155 
156 static int
157 mac_none_associate_vnode_extattr(struct mount *mp, struct label *fslabel,
158     struct vnode *vp, struct label *vlabel)
159 {
160 
161 	return (0);
162 }
163 
164 static void
165 mac_none_associate_vnode_singlelabel(struct mount *mp,
166     struct label *fslabel, struct vnode *vp, struct label *vlabel)
167 {
168 
169 }
170 
171 static void
172 mac_none_create_devfs_device(struct mount *mp, dev_t dev,
173     struct devfs_dirent *devfs_dirent, struct label *label)
174 {
175 
176 }
177 
178 static void
179 mac_none_create_devfs_directory(struct mount *mp, char *dirname,
180     int dirnamelen, struct devfs_dirent *devfs_dirent, struct label *label)
181 {
182 
183 }
184 
185 static void
186 mac_none_create_devfs_symlink(struct ucred *cred, struct mount *mp,
187     struct devfs_dirent *dd, struct label *ddlabel, struct devfs_dirent *de,
188     struct label *delabel)
189 {
190 
191 }
192 
193 static int
194 mac_none_create_vnode_extattr(struct ucred *cred, struct mount *mp,
195     struct label *fslabel, struct vnode *dvp, struct label *dlabel,
196     struct vnode *vp, struct label *vlabel, struct componentname *cnp)
197 {
198 
199 	return (0);
200 }
201 
202 static void
203 mac_none_create_mount(struct ucred *cred, struct mount *mp,
204     struct label *mntlabel, struct label *fslabel)
205 {
206 
207 }
208 
209 static void
210 mac_none_create_root_mount(struct ucred *cred, struct mount *mp,
211     struct label *mntlabel, struct label *fslabel)
212 {
213 
214 }
215 
216 static void
217 mac_none_relabel_vnode(struct ucred *cred, struct vnode *vp,
218     struct label *vnodelabel, struct label *label)
219 {
220 
221 }
222 
223 static int
224 mac_none_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp,
225     struct label *vlabel, struct label *intlabel)
226 {
227 
228 	return (0);
229 }
230 
231 static void
232 mac_none_update_devfsdirent(struct mount *mp,
233     struct devfs_dirent *devfs_dirent, struct label *direntlabel,
234     struct vnode *vp, struct label *vnodelabel)
235 {
236 
237 }
238 
239 /*
240  * Labeling event operations: IPC object.
241  */
242 static void
243 mac_none_create_mbuf_from_socket(struct socket *so, struct label *socketlabel,
244     struct mbuf *m, struct label *mbuflabel)
245 {
246 
247 }
248 
249 static void
250 mac_none_create_socket(struct ucred *cred, struct socket *socket,
251     struct label *socketlabel)
252 {
253 
254 }
255 
256 static void
257 mac_none_create_pipe(struct ucred *cred, struct pipe *pipe,
258     struct label *pipelabel)
259 {
260 
261 }
262 
263 static void
264 mac_none_create_socket_from_socket(struct socket *oldsocket,
265     struct label *oldsocketlabel, struct socket *newsocket,
266     struct label *newsocketlabel)
267 {
268 
269 }
270 
271 static void
272 mac_none_relabel_socket(struct ucred *cred, struct socket *socket,
273     struct label *socketlabel, struct label *newlabel)
274 {
275 
276 }
277 
278 static void
279 mac_none_relabel_pipe(struct ucred *cred, struct pipe *pipe,
280     struct label *pipelabel, struct label *newlabel)
281 {
282 
283 }
284 
285 static void
286 mac_none_set_socket_peer_from_mbuf(struct mbuf *mbuf, struct label *mbuflabel,
287     struct socket *socket, struct label *socketpeerlabel)
288 {
289 
290 }
291 
292 static void
293 mac_none_set_socket_peer_from_socket(struct socket *oldsocket,
294     struct label *oldsocketlabel, struct socket *newsocket,
295     struct label *newsocketpeerlabel)
296 {
297 
298 }
299 
300 /*
301  * Labeling event operations: network objects.
302  */
303 static void
304 mac_none_create_bpfdesc(struct ucred *cred, struct bpf_d *bpf_d,
305     struct label *bpflabel)
306 {
307 
308 }
309 
310 static void
311 mac_none_create_datagram_from_ipq(struct ipq *ipq, struct label *ipqlabel,
312     struct mbuf *datagram, struct label *datagramlabel)
313 {
314 
315 }
316 
317 static void
318 mac_none_create_fragment(struct mbuf *datagram, struct label *datagramlabel,
319     struct mbuf *fragment, struct label *fragmentlabel)
320 {
321 
322 }
323 
324 static void
325 mac_none_create_ifnet(struct ifnet *ifnet, struct label *ifnetlabel)
326 {
327 
328 }
329 
330 static void
331 mac_none_create_ipq(struct mbuf *fragment, struct label *fragmentlabel,
332     struct ipq *ipq, struct label *ipqlabel)
333 {
334 
335 }
336 
337 static void
338 mac_none_create_mbuf_from_mbuf(struct mbuf *oldmbuf,
339     struct label *oldmbuflabel, struct mbuf *newmbuf,
340     struct label *newmbuflabel)
341 {
342 
343 }
344 
345 static void
346 mac_none_create_mbuf_linklayer(struct ifnet *ifnet, struct label *ifnetlabel,
347     struct mbuf *mbuf, struct label *mbuflabel)
348 {
349 
350 }
351 
352 static void
353 mac_none_create_mbuf_from_bpfdesc(struct bpf_d *bpf_d, struct label *bpflabel,
354     struct mbuf *mbuf, struct label *mbuflabel)
355 {
356 
357 }
358 
359 static void
360 mac_none_create_mbuf_from_ifnet(struct ifnet *ifnet, struct label *ifnetlabel,
361     struct mbuf *m, struct label *mbuflabel)
362 {
363 
364 }
365 
366 static void
367 mac_none_create_mbuf_multicast_encap(struct mbuf *oldmbuf,
368     struct label *oldmbuflabel, struct ifnet *ifnet, struct label *ifnetlabel,
369     struct mbuf *newmbuf, struct label *newmbuflabel)
370 {
371 
372 }
373 
374 static void
375 mac_none_create_mbuf_netlayer(struct mbuf *oldmbuf,
376     struct label *oldmbuflabel, struct mbuf *newmbuf, struct label *newmbuflabel)
377 {
378 
379 }
380 
381 static int
382 mac_none_fragment_match(struct mbuf *fragment, struct label *fragmentlabel,
383     struct ipq *ipq, struct label *ipqlabel)
384 {
385 
386 	return (1);
387 }
388 
389 static void
390 mac_none_relabel_ifnet(struct ucred *cred, struct ifnet *ifnet,
391     struct label *ifnetlabel, struct label *newlabel)
392 {
393 
394 }
395 
396 static void
397 mac_none_update_ipq(struct mbuf *fragment, struct label *fragmentlabel,
398     struct ipq *ipq, struct label *ipqlabel)
399 {
400 
401 }
402 
403 /*
404  * Labeling event operations: processes.
405  */
406 static void
407 mac_none_create_cred(struct ucred *cred_parent, struct ucred *cred_child)
408 {
409 
410 }
411 
412 static void
413 mac_none_execve_transition(struct ucred *old, struct ucred *new,
414     struct vnode *vp, struct label *vnodelabel,
415     struct label *interpvnodelabel, struct image_params *imgp,
416     struct label *execlabel)
417 {
418 
419 }
420 
421 static int
422 mac_none_execve_will_transition(struct ucred *old, struct vnode *vp,
423     struct label *vnodelabel, struct label *interpvnodelabel,
424     struct image_params *imgp, struct label *execlabel)
425 {
426 
427 	return (0);
428 }
429 
430 static void
431 mac_none_create_proc0(struct ucred *cred)
432 {
433 
434 }
435 
436 static void
437 mac_none_create_proc1(struct ucred *cred)
438 {
439 
440 }
441 
442 static void
443 mac_none_relabel_cred(struct ucred *cred, struct label *newlabel)
444 {
445 
446 }
447 
448 static void
449 mac_none_thread_userret(struct thread *td)
450 {
451 
452 }
453 
454 /*
455  * Access control checks.
456  */
457 static int
458 mac_none_check_bpfdesc_receive(struct bpf_d *bpf_d, struct label *bpflabel,
459     struct ifnet *ifnet, struct label *ifnet_label)
460 {
461 
462         return (0);
463 }
464 
465 static int
466 mac_none_check_cred_relabel(struct ucred *cred, struct label *newlabel)
467 {
468 
469 	return (0);
470 }
471 
472 static int
473 mac_none_check_cred_visible(struct ucred *u1, struct ucred *u2)
474 {
475 
476 	return (0);
477 }
478 
479 static int
480 mac_none_check_ifnet_relabel(struct ucred *cred, struct ifnet *ifnet,
481     struct label *ifnetlabel, struct label *newlabel)
482 {
483 
484 	return (0);
485 }
486 
487 static int
488 mac_none_check_ifnet_transmit(struct ifnet *ifnet, struct label *ifnetlabel,
489     struct mbuf *m, struct label *mbuflabel)
490 {
491 
492 	return (0);
493 }
494 
495 static int
496 mac_none_check_kenv_dump(struct ucred *cred)
497 {
498 
499 	return (0);
500 }
501 
502 static int
503 mac_none_check_kenv_get(struct ucred *cred, char *name)
504 {
505 
506 	return (0);
507 }
508 
509 static int
510 mac_none_check_kenv_set(struct ucred *cred, char *name, char *value)
511 {
512 
513 	return (0);
514 }
515 
516 static int
517 mac_none_check_kenv_unset(struct ucred *cred, char *name)
518 {
519 
520 	return (0);
521 }
522 
523 static int
524 mac_none_check_kld_load(struct ucred *cred, struct vnode *vp,
525     struct label *vlabel)
526 {
527 
528 	return (0);
529 }
530 
531 static int
532 mac_none_check_kld_stat(struct ucred *cred)
533 {
534 
535 	return (0);
536 }
537 
538 static int
539 mac_none_check_kld_unload(struct ucred *cred)
540 {
541 
542 	return (0);
543 }
544 
545 static int
546 mac_none_check_mount_stat(struct ucred *cred, struct mount *mp,
547     struct label *mntlabel)
548 {
549 
550 	return (0);
551 }
552 
553 static int
554 mac_none_check_pipe_ioctl(struct ucred *cred, struct pipe *pipe,
555     struct label *pipelabel, unsigned long cmd, void /* caddr_t */ *data)
556 {
557 
558 	return (0);
559 }
560 
561 static int
562 mac_none_check_pipe_poll(struct ucred *cred, struct pipe *pipe,
563     struct label *pipelabel)
564 {
565 
566 	return (0);
567 }
568 
569 static int
570 mac_none_check_pipe_read(struct ucred *cred, struct pipe *pipe,
571     struct label *pipelabel)
572 {
573 
574 	return (0);
575 }
576 
577 static int
578 mac_none_check_pipe_relabel(struct ucred *cred, struct pipe *pipe,
579     struct label *pipelabel, struct label *newlabel)
580 {
581 
582 	return (0);
583 }
584 
585 static int
586 mac_none_check_pipe_stat(struct ucred *cred, struct pipe *pipe,
587     struct label *pipelabel)
588 {
589 
590 	return (0);
591 }
592 
593 static int
594 mac_none_check_pipe_write(struct ucred *cred, struct pipe *pipe,
595     struct label *pipelabel)
596 {
597 
598 	return (0);
599 }
600 
601 static int
602 mac_none_check_proc_debug(struct ucred *cred, struct proc *proc)
603 {
604 
605 	return (0);
606 }
607 
608 static int
609 mac_none_check_proc_sched(struct ucred *cred, struct proc *proc)
610 {
611 
612 	return (0);
613 }
614 
615 static int
616 mac_none_check_proc_signal(struct ucred *cred, struct proc *proc, int signum)
617 {
618 
619 	return (0);
620 }
621 
622 static int
623 mac_none_check_socket_bind(struct ucred *cred, struct socket *socket,
624     struct label *socketlabel, struct sockaddr *sockaddr)
625 {
626 
627 	return (0);
628 }
629 
630 static int
631 mac_none_check_socket_connect(struct ucred *cred, struct socket *socket,
632     struct label *socketlabel, struct sockaddr *sockaddr)
633 {
634 
635 	return (0);
636 }
637 
638 static int
639 mac_none_check_socket_deliver(struct socket *so, struct label *socketlabel,
640     struct mbuf *m, struct label *mbuflabel)
641 {
642 
643 	return (0);
644 }
645 
646 static int
647 mac_none_check_socket_listen(struct ucred *cred, struct socket *so,
648     struct label *socketlabel)
649 {
650 
651 	return (0);
652 }
653 
654 static int
655 mac_none_check_socket_relabel(struct ucred *cred, struct socket *socket,
656     struct label *socketlabel, struct label *newlabel)
657 {
658 
659 	return (0);
660 }
661 
662 static int
663 mac_none_check_socket_visible(struct ucred *cred, struct socket *socket,
664    struct label *socketlabel)
665 {
666 
667 	return (0);
668 }
669 
670 static int
671 mac_none_check_sysarch_ioperm(struct ucred *cred)
672 {
673 
674 	return (0);
675 }
676 
677 static int
678 mac_none_check_system_acct(struct ucred *cred, struct vnode *vp,
679     struct label *vlabel)
680 {
681 
682 	return (0);
683 }
684 
685 static int
686 mac_none_check_system_reboot(struct ucred *cred, int how)
687 {
688 
689 	return (0);
690 }
691 
692 static int
693 mac_none_check_system_settime(struct ucred *cred)
694 {
695 
696 	return (0);
697 }
698 
699 static int
700 mac_none_check_system_swapon(struct ucred *cred, struct vnode *vp,
701     struct label *label)
702 {
703 
704 	return (0);
705 }
706 
707 static int
708 mac_none_check_system_swapoff(struct ucred *cred, struct vnode *vp,
709     struct label *label)
710 {
711 
712 	return (0);
713 }
714 
715 static int
716 mac_none_check_system_sysctl(struct ucred *cred, int *name, u_int namelen,
717     void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen)
718 {
719 
720 	return (0);
721 }
722 
723 static int
724 mac_none_check_vnode_access(struct ucred *cred, struct vnode *vp,
725     struct label *label, int acc_mode)
726 {
727 
728 	return (0);
729 }
730 
731 static int
732 mac_none_check_vnode_chdir(struct ucred *cred, struct vnode *dvp,
733     struct label *dlabel)
734 {
735 
736 	return (0);
737 }
738 
739 static int
740 mac_none_check_vnode_chroot(struct ucred *cred, struct vnode *dvp,
741     struct label *dlabel)
742 {
743 
744 	return (0);
745 }
746 
747 static int
748 mac_none_check_vnode_create(struct ucred *cred, struct vnode *dvp,
749     struct label *dlabel, struct componentname *cnp, struct vattr *vap)
750 {
751 
752 	return (0);
753 }
754 
755 static int
756 mac_none_check_vnode_delete(struct ucred *cred, struct vnode *dvp,
757     struct label *dlabel, struct vnode *vp, struct label *label,
758     struct componentname *cnp)
759 {
760 
761 	return (0);
762 }
763 
764 static int
765 mac_none_check_vnode_deleteacl(struct ucred *cred, struct vnode *vp,
766     struct label *label, acl_type_t type)
767 {
768 
769 	return (0);
770 }
771 
772 static int
773 mac_none_check_vnode_exec(struct ucred *cred, struct vnode *vp,
774     struct label *label, struct image_params *imgp,
775     struct label *execlabel)
776 {
777 
778 	return (0);
779 }
780 
781 static int
782 mac_none_check_vnode_getacl(struct ucred *cred, struct vnode *vp,
783     struct label *label, acl_type_t type)
784 {
785 
786 	return (0);
787 }
788 
789 static int
790 mac_none_check_vnode_getextattr(struct ucred *cred, struct vnode *vp,
791     struct label *label, int attrnamespace, const char *name, struct uio *uio)
792 {
793 
794 	return (0);
795 }
796 
797 static int
798 mac_none_check_vnode_link(struct ucred *cred, struct vnode *dvp,
799     struct label *dlabel, struct vnode *vp, struct label *label,
800     struct componentname *cnp)
801 {
802 
803 	return (0);
804 }
805 
806 static int
807 mac_none_check_vnode_lookup(struct ucred *cred, struct vnode *dvp,
808     struct label *dlabel, struct componentname *cnp)
809 {
810 
811 	return (0);
812 }
813 
814 static int
815 mac_none_check_vnode_mmap(struct ucred *cred, struct vnode *vp,
816     struct label *label, int prot)
817 {
818 
819 	return (0);
820 }
821 
822 static int
823 mac_none_check_vnode_mprotect(struct ucred *cred, struct vnode *vp,
824     struct label *label, int prot)
825 {
826 
827 	return (0);
828 }
829 
830 static int
831 mac_none_check_vnode_open(struct ucred *cred, struct vnode *vp,
832     struct label *filelabel, int acc_mode)
833 {
834 
835 	return (0);
836 }
837 
838 static int
839 mac_none_check_vnode_poll(struct ucred *active_cred, struct ucred *file_cred,
840     struct vnode *vp, struct label *label)
841 {
842 
843 	return (0);
844 }
845 
846 static int
847 mac_none_check_vnode_read(struct ucred *active_cred, struct ucred *file_cred,
848     struct vnode *vp, struct label *label)
849 {
850 
851 	return (0);
852 }
853 
854 static int
855 mac_none_check_vnode_readdir(struct ucred *cred, struct vnode *vp,
856     struct label *dlabel)
857 {
858 
859 	return (0);
860 }
861 
862 static int
863 mac_none_check_vnode_readlink(struct ucred *cred, struct vnode *vp,
864     struct label *vnodelabel)
865 {
866 
867 	return (0);
868 }
869 
870 static int
871 mac_none_check_vnode_relabel(struct ucred *cred, struct vnode *vp,
872     struct label *vnodelabel, struct label *newlabel)
873 {
874 
875 	return (0);
876 }
877 
878 static int
879 mac_none_check_vnode_rename_from(struct ucred *cred, struct vnode *dvp,
880     struct label *dlabel, struct vnode *vp, struct label *label,
881     struct componentname *cnp)
882 {
883 
884 	return (0);
885 }
886 
887 static int
888 mac_none_check_vnode_rename_to(struct ucred *cred, struct vnode *dvp,
889     struct label *dlabel, struct vnode *vp, struct label *label, int samedir,
890     struct componentname *cnp)
891 {
892 
893 	return (0);
894 }
895 
896 static int
897 mac_none_check_vnode_revoke(struct ucred *cred, struct vnode *vp,
898     struct label *label)
899 {
900 
901 	return (0);
902 }
903 
904 static int
905 mac_none_check_vnode_setacl(struct ucred *cred, struct vnode *vp,
906     struct label *label, acl_type_t type, struct acl *acl)
907 {
908 
909 	return (0);
910 }
911 
912 static int
913 mac_none_check_vnode_setextattr(struct ucred *cred, struct vnode *vp,
914     struct label *label, int attrnamespace, const char *name, struct uio *uio)
915 {
916 
917 	return (0);
918 }
919 
920 static int
921 mac_none_check_vnode_setflags(struct ucred *cred, struct vnode *vp,
922     struct label *label, u_long flags)
923 {
924 
925 	return (0);
926 }
927 
928 static int
929 mac_none_check_vnode_setmode(struct ucred *cred, struct vnode *vp,
930     struct label *label, mode_t mode)
931 {
932 
933 	return (0);
934 }
935 
936 static int
937 mac_none_check_vnode_setowner(struct ucred *cred, struct vnode *vp,
938     struct label *label, uid_t uid, gid_t gid)
939 {
940 
941 	return (0);
942 }
943 
944 static int
945 mac_none_check_vnode_setutimes(struct ucred *cred, struct vnode *vp,
946     struct label *label, struct timespec atime, struct timespec mtime)
947 {
948 
949 	return (0);
950 }
951 
952 static int
953 mac_none_check_vnode_stat(struct ucred *active_cred, struct ucred *file_cred,
954     struct vnode *vp, struct label *label)
955 {
956 
957 	return (0);
958 }
959 
960 static int
961 mac_none_check_vnode_write(struct ucred *active_cred,
962     struct ucred *file_cred, struct vnode *vp, struct label *label)
963 {
964 
965 	return (0);
966 }
967 
968 static struct mac_policy_ops mac_none_ops =
969 {
970 	.mpo_destroy = mac_none_destroy,
971 	.mpo_init = mac_none_init,
972 	.mpo_syscall = mac_none_syscall,
973 	.mpo_init_bpfdesc_label = mac_none_init_label,
974 	.mpo_init_cred_label = mac_none_init_label,
975 	.mpo_init_devfsdirent_label = mac_none_init_label,
976 	.mpo_init_ifnet_label = mac_none_init_label,
977 	.mpo_init_ipq_label = mac_none_init_label_waitcheck,
978 	.mpo_init_mbuf_label = mac_none_init_label_waitcheck,
979 	.mpo_init_mount_label = mac_none_init_label,
980 	.mpo_init_mount_fs_label = mac_none_init_label,
981 	.mpo_init_pipe_label = mac_none_init_label,
982 	.mpo_init_socket_label = mac_none_init_label_waitcheck,
983 	.mpo_init_socket_peer_label = mac_none_init_label_waitcheck,
984 	.mpo_init_vnode_label = mac_none_init_label,
985 	.mpo_destroy_bpfdesc_label = mac_none_destroy_label,
986 	.mpo_destroy_cred_label = mac_none_destroy_label,
987 	.mpo_destroy_devfsdirent_label = mac_none_destroy_label,
988 	.mpo_destroy_ifnet_label = mac_none_destroy_label,
989 	.mpo_destroy_ipq_label = mac_none_destroy_label,
990 	.mpo_destroy_mbuf_label = mac_none_destroy_label,
991 	.mpo_destroy_mount_label = mac_none_destroy_label,
992 	.mpo_destroy_mount_fs_label = mac_none_destroy_label,
993 	.mpo_destroy_pipe_label = mac_none_destroy_label,
994 	.mpo_destroy_socket_label = mac_none_destroy_label,
995 	.mpo_destroy_socket_peer_label = mac_none_destroy_label,
996 	.mpo_destroy_vnode_label = mac_none_destroy_label,
997 	.mpo_externalize_cred_label = mac_none_externalize_label,
998 	.mpo_externalize_ifnet_label = mac_none_externalize_label,
999 	.mpo_externalize_pipe_label = mac_none_externalize_label,
1000 	.mpo_externalize_socket_label = mac_none_externalize_label,
1001 	.mpo_externalize_socket_peer_label = mac_none_externalize_label,
1002 	.mpo_externalize_vnode_label = mac_none_externalize_label,
1003 	.mpo_internalize_cred_label = mac_none_internalize_label,
1004 	.mpo_internalize_ifnet_label = mac_none_internalize_label,
1005 	.mpo_internalize_pipe_label = mac_none_internalize_label,
1006 	.mpo_internalize_socket_label = mac_none_internalize_label,
1007 	.mpo_internalize_vnode_label = mac_none_internalize_label,
1008 	.mpo_associate_vnode_devfs = mac_none_associate_vnode_devfs,
1009 	.mpo_associate_vnode_extattr = mac_none_associate_vnode_extattr,
1010 	.mpo_associate_vnode_singlelabel = mac_none_associate_vnode_singlelabel,
1011 	.mpo_create_devfs_device = mac_none_create_devfs_device,
1012 	.mpo_create_devfs_directory = mac_none_create_devfs_directory,
1013 	.mpo_create_devfs_symlink = mac_none_create_devfs_symlink,
1014 	.mpo_create_vnode_extattr = mac_none_create_vnode_extattr,
1015 	.mpo_create_mount = mac_none_create_mount,
1016 	.mpo_create_root_mount = mac_none_create_root_mount,
1017 	.mpo_relabel_vnode = mac_none_relabel_vnode,
1018 	.mpo_setlabel_vnode_extattr = mac_none_setlabel_vnode_extattr,
1019 	.mpo_update_devfsdirent = mac_none_update_devfsdirent,
1020 	.mpo_create_mbuf_from_socket = mac_none_create_mbuf_from_socket,
1021 	.mpo_create_pipe = mac_none_create_pipe,
1022 	.mpo_create_socket = mac_none_create_socket,
1023 	.mpo_create_socket_from_socket = mac_none_create_socket_from_socket,
1024 	.mpo_relabel_pipe = mac_none_relabel_pipe,
1025 	.mpo_relabel_socket = mac_none_relabel_socket,
1026 	.mpo_set_socket_peer_from_mbuf = mac_none_set_socket_peer_from_mbuf,
1027 	.mpo_set_socket_peer_from_socket = mac_none_set_socket_peer_from_socket,
1028 	.mpo_create_bpfdesc = mac_none_create_bpfdesc,
1029 	.mpo_create_ifnet = mac_none_create_ifnet,
1030 	.mpo_create_ipq = mac_none_create_ipq,
1031 	.mpo_create_datagram_from_ipq = mac_none_create_datagram_from_ipq,
1032 	.mpo_create_fragment = mac_none_create_fragment,
1033 	.mpo_create_ipq = mac_none_create_ipq,
1034 	.mpo_create_mbuf_from_mbuf = mac_none_create_mbuf_from_mbuf,
1035 	.mpo_create_mbuf_linklayer = mac_none_create_mbuf_linklayer,
1036 	.mpo_create_mbuf_from_bpfdesc = mac_none_create_mbuf_from_bpfdesc,
1037 	.mpo_create_mbuf_from_ifnet = mac_none_create_mbuf_from_ifnet,
1038 	.mpo_create_mbuf_multicast_encap = mac_none_create_mbuf_multicast_encap,
1039 	.mpo_create_mbuf_netlayer = mac_none_create_mbuf_netlayer,
1040 	.mpo_fragment_match = mac_none_fragment_match,
1041 	.mpo_relabel_ifnet = mac_none_relabel_ifnet,
1042 	.mpo_update_ipq = mac_none_update_ipq,
1043 	.mpo_create_cred = mac_none_create_cred,
1044 	.mpo_execve_transition = mac_none_execve_transition,
1045 	.mpo_execve_will_transition = mac_none_execve_will_transition,
1046 	.mpo_create_proc0 = mac_none_create_proc0,
1047 	.mpo_create_proc1 = mac_none_create_proc1,
1048 	.mpo_relabel_cred = mac_none_relabel_cred,
1049 	.mpo_thread_userret = mac_none_thread_userret,
1050 	.mpo_check_bpfdesc_receive = mac_none_check_bpfdesc_receive,
1051 	.mpo_check_cred_relabel = mac_none_check_cred_relabel,
1052 	.mpo_check_cred_visible = mac_none_check_cred_visible,
1053 	.mpo_check_ifnet_relabel = mac_none_check_ifnet_relabel,
1054 	.mpo_check_ifnet_transmit = mac_none_check_ifnet_transmit,
1055 	.mpo_check_kenv_dump = mac_none_check_kenv_dump,
1056 	.mpo_check_kenv_get = mac_none_check_kenv_get,
1057 	.mpo_check_kenv_set = mac_none_check_kenv_set,
1058 	.mpo_check_kenv_unset = mac_none_check_kenv_unset,
1059 	.mpo_check_kld_load = mac_none_check_kld_load,
1060 	.mpo_check_kld_stat = mac_none_check_kld_stat,
1061 	.mpo_check_kld_unload = mac_none_check_kld_unload,
1062 	.mpo_check_mount_stat = mac_none_check_mount_stat,
1063 	.mpo_check_pipe_ioctl = mac_none_check_pipe_ioctl,
1064 	.mpo_check_pipe_poll = mac_none_check_pipe_poll,
1065 	.mpo_check_pipe_read = mac_none_check_pipe_read,
1066 	.mpo_check_pipe_relabel = mac_none_check_pipe_relabel,
1067 	.mpo_check_pipe_stat = mac_none_check_pipe_stat,
1068 	.mpo_check_pipe_write = mac_none_check_pipe_write,
1069 	.mpo_check_proc_debug = mac_none_check_proc_debug,
1070 	.mpo_check_proc_sched = mac_none_check_proc_sched,
1071 	.mpo_check_proc_signal = mac_none_check_proc_signal,
1072 	.mpo_check_socket_bind = mac_none_check_socket_bind,
1073 	.mpo_check_socket_connect = mac_none_check_socket_connect,
1074 	.mpo_check_socket_deliver = mac_none_check_socket_deliver,
1075 	.mpo_check_socket_listen = mac_none_check_socket_listen,
1076 	.mpo_check_socket_relabel = mac_none_check_socket_relabel,
1077 	.mpo_check_socket_visible = mac_none_check_socket_visible,
1078 	.mpo_check_sysarch_ioperm = mac_none_check_sysarch_ioperm,
1079 	.mpo_check_system_acct = mac_none_check_system_acct,
1080 	.mpo_check_system_reboot = mac_none_check_system_reboot,
1081 	.mpo_check_system_settime = mac_none_check_system_settime,
1082 	.mpo_check_system_swapon = mac_none_check_system_swapon,
1083 	.mpo_check_system_swapoff = mac_none_check_system_swapoff,
1084 	.mpo_check_system_sysctl = mac_none_check_system_sysctl,
1085 	.mpo_check_vnode_access = mac_none_check_vnode_access,
1086 	.mpo_check_vnode_chdir = mac_none_check_vnode_chdir,
1087 	.mpo_check_vnode_chroot = mac_none_check_vnode_chroot,
1088 	.mpo_check_vnode_create = mac_none_check_vnode_create,
1089 	.mpo_check_vnode_delete = mac_none_check_vnode_delete,
1090 	.mpo_check_vnode_deleteacl = mac_none_check_vnode_deleteacl,
1091 	.mpo_check_vnode_exec = mac_none_check_vnode_exec,
1092 	.mpo_check_vnode_getacl = mac_none_check_vnode_getacl,
1093 	.mpo_check_vnode_getextattr = mac_none_check_vnode_getextattr,
1094 	.mpo_check_vnode_link = mac_none_check_vnode_link,
1095 	.mpo_check_vnode_lookup = mac_none_check_vnode_lookup,
1096 	.mpo_check_vnode_mmap = mac_none_check_vnode_mmap,
1097 	.mpo_check_vnode_mprotect = mac_none_check_vnode_mprotect,
1098 	.mpo_check_vnode_open = mac_none_check_vnode_open,
1099 	.mpo_check_vnode_poll = mac_none_check_vnode_poll,
1100 	.mpo_check_vnode_read = mac_none_check_vnode_read,
1101 	.mpo_check_vnode_readdir = mac_none_check_vnode_readdir,
1102 	.mpo_check_vnode_readlink = mac_none_check_vnode_readlink,
1103 	.mpo_check_vnode_relabel = mac_none_check_vnode_relabel,
1104 	.mpo_check_vnode_rename_from = mac_none_check_vnode_rename_from,
1105 	.mpo_check_vnode_rename_to = mac_none_check_vnode_rename_to,
1106 	.mpo_check_vnode_revoke = mac_none_check_vnode_revoke,
1107 	.mpo_check_vnode_setacl = mac_none_check_vnode_setacl,
1108 	.mpo_check_vnode_setextattr = mac_none_check_vnode_setextattr,
1109 	.mpo_check_vnode_setflags = mac_none_check_vnode_setflags,
1110 	.mpo_check_vnode_setmode = mac_none_check_vnode_setmode,
1111 	.mpo_check_vnode_setowner = mac_none_check_vnode_setowner,
1112 	.mpo_check_vnode_setutimes = mac_none_check_vnode_setutimes,
1113 	.mpo_check_vnode_stat = mac_none_check_vnode_stat,
1114 	.mpo_check_vnode_write = mac_none_check_vnode_write,
1115 };
1116 
1117 MAC_POLICY_SET(&mac_none_ops, mac_none, "TrustedBSD MAC/None",
1118     MPC_LOADTIME_FLAG_UNLOADOK, NULL);
1119