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 NAI Labs, 9 * the Security Research Division of Network Associates, Inc. under 10 * DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA 11 * 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 * 3. The names of the authors may not be used to endorse or promote 22 * products derived from this software without specific prior written 23 * permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 * SUCH DAMAGE. 36 * 37 * $FreeBSD$ 38 */ 39 40 /* 41 * Developed by the TrustedBSD Project. 42 * Generic mandatory access module that does nothing. 43 */ 44 45 #include <sys/types.h> 46 #include <sys/param.h> 47 #include <sys/acl.h> 48 #include <sys/conf.h> 49 #include <sys/extattr.h> 50 #include <sys/kernel.h> 51 #include <sys/mac.h> 52 #include <sys/mount.h> 53 #include <sys/proc.h> 54 #include <sys/systm.h> 55 #include <sys/sysproto.h> 56 #include <sys/sysent.h> 57 #include <sys/vnode.h> 58 #include <sys/file.h> 59 #include <sys/socket.h> 60 #include <sys/socketvar.h> 61 #include <sys/sysctl.h> 62 63 #include <fs/devfs/devfs.h> 64 65 #include <net/bpfdesc.h> 66 #include <net/if.h> 67 #include <net/if_types.h> 68 #include <net/if_var.h> 69 70 #include <vm/vm.h> 71 72 #include <sys/mac_policy.h> 73 74 SYSCTL_DECL(_security_mac); 75 76 SYSCTL_NODE(_security_mac, OID_AUTO, test, CTLFLAG_RW, 0, 77 "TrustedBSD mac_test policy controls"); 78 79 static int mac_test_enabled = 0; 80 SYSCTL_INT(_security_mac_test, OID_AUTO, enabled, CTLFLAG_RW, 81 &mac_test_enabled, 0, "Enforce test policy"); 82 83 #define BPFMAGIC 0xfe1ad1b6 84 #define DEVFSMAGIC 0x9ee79c32 85 #define IFNETMAGIC 0xc218b120 86 #define IPQMAGIC 0x206188ef 87 #define MBUFMAGIC 0xbbefa5bb 88 #define MOUNTMAGIC 0xc7c46e47 89 #define SOCKETMAGIC 0x9199c6cd 90 #define PIPEMAGIC 0xdc6c9919 91 #define CREDMAGIC 0x9a5a4987 92 #define VNODEMAGIC 0x1a67a45c 93 #define EXMAGIC 0x849ba1fd 94 95 #define SLOT(x) LABEL_TO_SLOT((x), test_slot).l_long 96 static int test_slot; 97 SYSCTL_INT(_security_mac_test, OID_AUTO, slot, CTLFLAG_RD, 98 &test_slot, 0, "Slot allocated by framework"); 99 100 static int init_count_bpfdesc; 101 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_bpfdesc, CTLFLAG_RD, 102 &init_count_bpfdesc, 0, "bpfdesc init calls"); 103 static int init_count_cred; 104 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_cred, CTLFLAG_RD, 105 &init_count_cred, 0, "cred init calls"); 106 static int init_count_devfsdirent; 107 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_devfsdirent, CTLFLAG_RD, 108 &init_count_devfsdirent, 0, "devfsdirent init calls"); 109 static int init_count_ifnet; 110 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_ifnet, CTLFLAG_RD, 111 &init_count_ifnet, 0, "ifnet init calls"); 112 static int init_count_ipq; 113 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_ipq, CTLFLAG_RD, 114 &init_count_ipq, 0, "ipq init calls"); 115 static int init_count_mbuf; 116 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_mbuf, CTLFLAG_RD, 117 &init_count_mbuf, 0, "mbuf init calls"); 118 static int init_count_mount; 119 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_mount, CTLFLAG_RD, 120 &init_count_mount, 0, "mount init calls"); 121 static int init_count_mount_fslabel; 122 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_mount_fslabel, CTLFLAG_RD, 123 &init_count_mount_fslabel, 0, "mount_fslabel init calls"); 124 static int init_count_socket; 125 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_socket, CTLFLAG_RD, 126 &init_count_socket, 0, "socket init calls"); 127 static int init_count_socket_peerlabel; 128 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_socket_peerlabel, 129 CTLFLAG_RD, &init_count_socket_peerlabel, 0, 130 "socket_peerlabel init calls"); 131 static int init_count_pipe; 132 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_pipe, CTLFLAG_RD, 133 &init_count_pipe, 0, "pipe init calls"); 134 static int init_count_vnode; 135 SYSCTL_INT(_security_mac_test, OID_AUTO, init_count_vnode, CTLFLAG_RD, 136 &init_count_vnode, 0, "vnode init calls"); 137 138 static int destroy_count_bpfdesc; 139 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_bpfdesc, CTLFLAG_RD, 140 &destroy_count_bpfdesc, 0, "bpfdesc destroy calls"); 141 static int destroy_count_cred; 142 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_cred, CTLFLAG_RD, 143 &destroy_count_cred, 0, "cred destroy calls"); 144 static int destroy_count_devfsdirent; 145 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_devfsdirent, CTLFLAG_RD, 146 &destroy_count_devfsdirent, 0, "devfsdirent destroy calls"); 147 static int destroy_count_ifnet; 148 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_ifnet, CTLFLAG_RD, 149 &destroy_count_ifnet, 0, "ifnet destroy calls"); 150 static int destroy_count_ipq; 151 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_ipq, CTLFLAG_RD, 152 &destroy_count_ipq, 0, "ipq destroy calls"); 153 static int destroy_count_mbuf; 154 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_mbuf, CTLFLAG_RD, 155 &destroy_count_mbuf, 0, "mbuf destroy calls"); 156 static int destroy_count_mount; 157 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_mount, CTLFLAG_RD, 158 &destroy_count_mount, 0, "mount destroy calls"); 159 static int destroy_count_mount_fslabel; 160 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_mount_fslabel, 161 CTLFLAG_RD, &destroy_count_mount_fslabel, 0, 162 "mount_fslabel destroy calls"); 163 static int destroy_count_socket; 164 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_socket, CTLFLAG_RD, 165 &destroy_count_socket, 0, "socket destroy calls"); 166 static int destroy_count_socket_peerlabel; 167 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_socket_peerlabel, 168 CTLFLAG_RD, &destroy_count_socket_peerlabel, 0, 169 "socket_peerlabel destroy calls"); 170 static int destroy_count_pipe; 171 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_pipe, CTLFLAG_RD, 172 &destroy_count_pipe, 0, "pipe destroy calls"); 173 static int destroy_count_vnode; 174 SYSCTL_INT(_security_mac_test, OID_AUTO, destroy_count_vnode, CTLFLAG_RD, 175 &destroy_count_vnode, 0, "vnode destroy calls"); 176 177 static int externalize_count; 178 SYSCTL_INT(_security_mac_test, OID_AUTO, externalize_count, CTLFLAG_RD, 179 &externalize_count, 0, "Subject/object externalize calls"); 180 static int internalize_count; 181 SYSCTL_INT(_security_mac_test, OID_AUTO, internalize_count, CTLFLAG_RD, 182 &internalize_count, 0, "Subject/object internalize calls"); 183 184 /* 185 * Policy module operations. 186 */ 187 static void 188 mac_test_destroy(struct mac_policy_conf *conf) 189 { 190 191 } 192 193 static void 194 mac_test_init(struct mac_policy_conf *conf) 195 { 196 197 } 198 199 static int 200 mac_test_syscall(struct thread *td, int call, void *arg) 201 { 202 203 return (0); 204 } 205 206 /* 207 * Label operations. 208 */ 209 static void 210 mac_test_init_bpfdesc_label(struct label *label) 211 { 212 213 SLOT(label) = BPFMAGIC; 214 atomic_add_int(&init_count_bpfdesc, 1); 215 } 216 217 static void 218 mac_test_init_cred_label(struct label *label) 219 { 220 221 SLOT(label) = CREDMAGIC; 222 atomic_add_int(&init_count_cred, 1); 223 } 224 225 static void 226 mac_test_init_devfsdirent_label(struct label *label) 227 { 228 229 SLOT(label) = DEVFSMAGIC; 230 atomic_add_int(&init_count_devfsdirent, 1); 231 } 232 233 static void 234 mac_test_init_ifnet_label(struct label *label) 235 { 236 237 SLOT(label) = IFNETMAGIC; 238 atomic_add_int(&init_count_ifnet, 1); 239 } 240 241 static void 242 mac_test_init_ipq_label(struct label *label) 243 { 244 245 SLOT(label) = IPQMAGIC; 246 atomic_add_int(&init_count_ipq, 1); 247 } 248 249 static int 250 mac_test_init_mbuf_label(struct label *label, int flag) 251 { 252 253 SLOT(label) = MBUFMAGIC; 254 atomic_add_int(&init_count_mbuf, 1); 255 return (0); 256 } 257 258 static void 259 mac_test_init_mount_label(struct label *label) 260 { 261 262 SLOT(label) = MOUNTMAGIC; 263 atomic_add_int(&init_count_mount, 1); 264 } 265 266 static void 267 mac_test_init_mount_fs_label(struct label *label) 268 { 269 270 SLOT(label) = MOUNTMAGIC; 271 atomic_add_int(&init_count_mount_fslabel, 1); 272 } 273 274 static int 275 mac_test_init_socket_label(struct label *label, int flag) 276 { 277 278 SLOT(label) = SOCKETMAGIC; 279 atomic_add_int(&init_count_socket, 1); 280 return (0); 281 } 282 283 static int 284 mac_test_init_socket_peer_label(struct label *label, int flag) 285 { 286 287 SLOT(label) = SOCKETMAGIC; 288 atomic_add_int(&init_count_socket_peerlabel, 1); 289 return (0); 290 } 291 292 static void 293 mac_test_init_pipe_label(struct label *label) 294 { 295 296 SLOT(label) = PIPEMAGIC; 297 atomic_add_int(&init_count_pipe, 1); 298 } 299 300 static void 301 mac_test_init_vnode_label(struct label *label) 302 { 303 304 SLOT(label) = VNODEMAGIC; 305 atomic_add_int(&init_count_vnode, 1); 306 } 307 308 static void 309 mac_test_destroy_bpfdesc_label(struct label *label) 310 { 311 312 if (SLOT(label) == BPFMAGIC || SLOT(label) == 0) { 313 atomic_add_int(&destroy_count_bpfdesc, 1); 314 SLOT(label) = EXMAGIC; 315 } else if (SLOT(label) == EXMAGIC) { 316 Debugger("mac_test_destroy_bpfdesc: dup destroy"); 317 } else { 318 Debugger("mac_test_destroy_bpfdesc: corrupted label"); 319 } 320 } 321 322 static void 323 mac_test_destroy_cred_label(struct label *label) 324 { 325 326 if (SLOT(label) == CREDMAGIC || SLOT(label) == 0) { 327 atomic_add_int(&destroy_count_cred, 1); 328 SLOT(label) = EXMAGIC; 329 } else if (SLOT(label) == EXMAGIC) { 330 Debugger("mac_test_destroy_cred: dup destroy"); 331 } else { 332 Debugger("mac_test_destroy_cred: corrupted label"); 333 } 334 } 335 336 static void 337 mac_test_destroy_devfsdirent_label(struct label *label) 338 { 339 340 if (SLOT(label) == DEVFSMAGIC || SLOT(label) == 0) { 341 atomic_add_int(&destroy_count_devfsdirent, 1); 342 SLOT(label) = EXMAGIC; 343 } else if (SLOT(label) == EXMAGIC) { 344 Debugger("mac_test_destroy_devfsdirent: dup destroy"); 345 } else { 346 Debugger("mac_test_destroy_devfsdirent: corrupted label"); 347 } 348 } 349 350 static void 351 mac_test_destroy_ifnet_label(struct label *label) 352 { 353 354 if (SLOT(label) == IFNETMAGIC || SLOT(label) == 0) { 355 atomic_add_int(&destroy_count_ifnet, 1); 356 SLOT(label) = EXMAGIC; 357 } else if (SLOT(label) == EXMAGIC) { 358 Debugger("mac_test_destroy_ifnet: dup destroy"); 359 } else { 360 Debugger("mac_test_destroy_ifnet: corrupted label"); 361 } 362 } 363 364 static void 365 mac_test_destroy_ipq_label(struct label *label) 366 { 367 368 if (SLOT(label) == IPQMAGIC || SLOT(label) == 0) { 369 atomic_add_int(&destroy_count_ipq, 1); 370 SLOT(label) = EXMAGIC; 371 } else if (SLOT(label) == EXMAGIC) { 372 Debugger("mac_test_destroy_ipq: dup destroy"); 373 } else { 374 Debugger("mac_test_destroy_ipq: corrupted label"); 375 } 376 } 377 378 static void 379 mac_test_destroy_mbuf_label(struct label *label) 380 { 381 382 if (SLOT(label) == MBUFMAGIC || SLOT(label) == 0) { 383 atomic_add_int(&destroy_count_mbuf, 1); 384 SLOT(label) = EXMAGIC; 385 } else if (SLOT(label) == EXMAGIC) { 386 Debugger("mac_test_destroy_mbuf: dup destroy"); 387 } else { 388 Debugger("mac_test_destroy_mbuf: corrupted label"); 389 } 390 } 391 392 static void 393 mac_test_destroy_mount_label(struct label *label) 394 { 395 396 if ((SLOT(label) == MOUNTMAGIC || SLOT(label) == 0)) { 397 atomic_add_int(&destroy_count_mount, 1); 398 SLOT(label) = EXMAGIC; 399 } else if (SLOT(label) == EXMAGIC) { 400 Debugger("mac_test_destroy_mount: dup destroy"); 401 } else { 402 Debugger("mac_test_destroy_mount: corrupted label"); 403 } 404 } 405 406 static void 407 mac_test_destroy_mount_fs_label(struct label *label) 408 { 409 410 if ((SLOT(label) == MOUNTMAGIC || SLOT(label) == 0)) { 411 atomic_add_int(&destroy_count_mount_fslabel, 1); 412 SLOT(label) = EXMAGIC; 413 } else if (SLOT(label) == EXMAGIC) { 414 Debugger("mac_test_destroy_mount_fslabel: dup destroy"); 415 } else { 416 Debugger("mac_test_destroy_mount_fslabel: corrupted label"); 417 } 418 } 419 420 static void 421 mac_test_destroy_socket_label(struct label *label) 422 { 423 424 if ((SLOT(label) == SOCKETMAGIC || SLOT(label) == 0)) { 425 atomic_add_int(&destroy_count_socket, 1); 426 SLOT(label) = EXMAGIC; 427 } else if (SLOT(label) == EXMAGIC) { 428 Debugger("mac_test_destroy_socket: dup destroy"); 429 } else { 430 Debugger("mac_test_destroy_socket: corrupted label"); 431 } 432 } 433 434 static void 435 mac_test_destroy_socket_peer_label(struct label *label) 436 { 437 438 if ((SLOT(label) == SOCKETMAGIC || SLOT(label) == 0)) { 439 atomic_add_int(&destroy_count_socket_peerlabel, 1); 440 SLOT(label) = EXMAGIC; 441 } else if (SLOT(label) == EXMAGIC) { 442 Debugger("mac_test_destroy_socket_peerlabel: dup destroy"); 443 } else { 444 Debugger("mac_test_destroy_socket_peerlabel: corrupted label"); 445 } 446 } 447 448 static void 449 mac_test_destroy_pipe_label(struct label *label) 450 { 451 452 if ((SLOT(label) == PIPEMAGIC || SLOT(label) == 0)) { 453 atomic_add_int(&destroy_count_pipe, 1); 454 SLOT(label) = EXMAGIC; 455 } else if (SLOT(label) == EXMAGIC) { 456 Debugger("mac_test_destroy_pipe: dup destroy"); 457 } else { 458 Debugger("mac_test_destroy_pipe: corrupted label"); 459 } 460 } 461 462 static void 463 mac_test_destroy_vnode_label(struct label *label) 464 { 465 466 if (SLOT(label) == VNODEMAGIC || SLOT(label) == 0) { 467 atomic_add_int(&destroy_count_vnode, 1); 468 SLOT(label) = EXMAGIC; 469 } else if (SLOT(label) == EXMAGIC) { 470 Debugger("mac_test_destroy_vnode: dup destroy"); 471 } else { 472 Debugger("mac_test_destroy_vnode: corrupted label"); 473 } 474 } 475 476 static int 477 mac_test_externalize_label(struct label *label, char *element_name, 478 char *element_data, size_t size, size_t *len, int *claimed) 479 { 480 481 atomic_add_int(&externalize_count, 1); 482 483 return (0); 484 } 485 486 static int 487 mac_test_internalize_label(struct label *label, struct mac *mac, 488 char *element_name, char *element_data, int *claimed) 489 { 490 491 atomic_add_int(&internalize_count, 1); 492 493 return (0); 494 } 495 496 /* 497 * Labeling event operations: file system objects, and things that look 498 * a lot like file system objects. 499 */ 500 static void 501 mac_test_associate_vnode_devfs(struct mount *mp, struct label *fslabel, 502 struct devfs_dirent *de, struct label *delabel, struct vnode *vp, 503 struct label *vlabel) 504 { 505 506 } 507 508 static int 509 mac_test_associate_vnode_extattr(struct mount *mp, struct label *fslabel, 510 struct vnode *vp, struct label *vlabel) 511 { 512 513 return (0); 514 } 515 516 static void 517 mac_test_associate_vnode_singlelabel(struct mount *mp, 518 struct label *fslabel, struct vnode *vp, struct label *vlabel) 519 { 520 521 } 522 523 static void 524 mac_test_create_devfs_device(dev_t dev, struct devfs_dirent *devfs_dirent, 525 struct label *label) 526 { 527 528 } 529 530 static void 531 mac_test_create_devfs_directory(char *dirname, int dirnamelen, 532 struct devfs_dirent *devfs_dirent, struct label *label) 533 { 534 535 } 536 537 static void 538 mac_test_create_devfs_symlink(struct ucred *cred, struct devfs_dirent *dd, 539 struct label *ddlabel, struct devfs_dirent *de, struct label *delabel) 540 { 541 542 } 543 544 static void 545 mac_test_create_devfs_vnode(struct devfs_dirent *devfs_dirent, 546 struct label *direntlabel, struct vnode *vp, struct label *vnodelabel) 547 { 548 549 } 550 551 static int 552 mac_test_create_vnode_extattr(struct ucred *cred, struct mount *mp, 553 struct label *fslabel, struct vnode *dvp, struct label *dlabel, 554 struct vnode *vp, struct label *vlabel, struct componentname *cnp) 555 { 556 557 return (0); 558 } 559 560 static void 561 mac_test_create_mount(struct ucred *cred, struct mount *mp, 562 struct label *mntlabel, struct label *fslabel) 563 { 564 565 } 566 567 static void 568 mac_test_create_root_mount(struct ucred *cred, struct mount *mp, 569 struct label *mntlabel, struct label *fslabel) 570 { 571 572 } 573 574 static void 575 mac_test_relabel_vnode(struct ucred *cred, struct vnode *vp, 576 struct label *vnodelabel, struct label *label) 577 { 578 579 } 580 581 static int 582 mac_test_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp, 583 struct label *vlabel, struct label *intlabel) 584 { 585 586 return (0); 587 } 588 589 static void 590 mac_test_update_devfsdirent(struct devfs_dirent *devfs_dirent, 591 struct label *direntlabel, struct vnode *vp, struct label *vnodelabel) 592 { 593 594 } 595 596 /* 597 * Labeling event operations: IPC object. 598 */ 599 static void 600 mac_test_create_mbuf_from_socket(struct socket *so, struct label *socketlabel, 601 struct mbuf *m, struct label *mbuflabel) 602 { 603 604 } 605 606 static void 607 mac_test_create_socket(struct ucred *cred, struct socket *socket, 608 struct label *socketlabel) 609 { 610 611 } 612 613 static void 614 mac_test_create_pipe(struct ucred *cred, struct pipe *pipe, 615 struct label *pipelabel) 616 { 617 618 } 619 620 static void 621 mac_test_create_socket_from_socket(struct socket *oldsocket, 622 struct label *oldsocketlabel, struct socket *newsocket, 623 struct label *newsocketlabel) 624 { 625 626 } 627 628 static void 629 mac_test_relabel_socket(struct ucred *cred, struct socket *socket, 630 struct label *socketlabel, struct label *newlabel) 631 { 632 633 } 634 635 static void 636 mac_test_relabel_pipe(struct ucred *cred, struct pipe *pipe, 637 struct label *pipelabel, struct label *newlabel) 638 { 639 640 } 641 642 static void 643 mac_test_set_socket_peer_from_mbuf(struct mbuf *mbuf, struct label *mbuflabel, 644 struct socket *socket, struct label *socketpeerlabel) 645 { 646 647 } 648 649 /* 650 * Labeling event operations: network objects. 651 */ 652 static void 653 mac_test_set_socket_peer_from_socket(struct socket *oldsocket, 654 struct label *oldsocketlabel, struct socket *newsocket, 655 struct label *newsocketpeerlabel) 656 { 657 658 } 659 660 static void 661 mac_test_create_bpfdesc(struct ucred *cred, struct bpf_d *bpf_d, 662 struct label *bpflabel) 663 { 664 665 } 666 667 static void 668 mac_test_create_datagram_from_ipq(struct ipq *ipq, struct label *ipqlabel, 669 struct mbuf *datagram, struct label *datagramlabel) 670 { 671 672 } 673 674 static void 675 mac_test_create_fragment(struct mbuf *datagram, struct label *datagramlabel, 676 struct mbuf *fragment, struct label *fragmentlabel) 677 { 678 679 } 680 681 static void 682 mac_test_create_ifnet(struct ifnet *ifnet, struct label *ifnetlabel) 683 { 684 685 } 686 687 static void 688 mac_test_create_ipq(struct mbuf *fragment, struct label *fragmentlabel, 689 struct ipq *ipq, struct label *ipqlabel) 690 { 691 692 } 693 694 static void 695 mac_test_create_mbuf_from_mbuf(struct mbuf *oldmbuf, 696 struct label *oldmbuflabel, struct mbuf *newmbuf, 697 struct label *newmbuflabel) 698 { 699 700 } 701 702 static void 703 mac_test_create_mbuf_linklayer(struct ifnet *ifnet, struct label *ifnetlabel, 704 struct mbuf *mbuf, struct label *mbuflabel) 705 { 706 707 } 708 709 static void 710 mac_test_create_mbuf_from_bpfdesc(struct bpf_d *bpf_d, struct label *bpflabel, 711 struct mbuf *mbuf, struct label *mbuflabel) 712 { 713 714 } 715 716 static void 717 mac_test_create_mbuf_from_ifnet(struct ifnet *ifnet, struct label *ifnetlabel, 718 struct mbuf *m, struct label *mbuflabel) 719 { 720 721 } 722 723 static void 724 mac_test_create_mbuf_multicast_encap(struct mbuf *oldmbuf, 725 struct label *oldmbuflabel, struct ifnet *ifnet, struct label *ifnetlabel, 726 struct mbuf *newmbuf, struct label *newmbuflabel) 727 { 728 729 } 730 731 static void 732 mac_test_create_mbuf_netlayer(struct mbuf *oldmbuf, 733 struct label *oldmbuflabel, struct mbuf *newmbuf, 734 struct label *newmbuflabel) 735 { 736 737 } 738 739 static int 740 mac_test_fragment_match(struct mbuf *fragment, struct label *fragmentlabel, 741 struct ipq *ipq, struct label *ipqlabel) 742 { 743 744 return (1); 745 } 746 747 static void 748 mac_test_relabel_ifnet(struct ucred *cred, struct ifnet *ifnet, 749 struct label *ifnetlabel, struct label *newlabel) 750 { 751 752 } 753 754 static void 755 mac_test_update_ipq(struct mbuf *fragment, struct label *fragmentlabel, 756 struct ipq *ipq, struct label *ipqlabel) 757 { 758 759 } 760 761 /* 762 * Labeling event operations: processes. 763 */ 764 static void 765 mac_test_create_cred(struct ucred *cred_parent, struct ucred *cred_child) 766 { 767 768 } 769 770 static void 771 mac_test_execve_transition(struct ucred *old, struct ucred *new, 772 struct vnode *vp, struct label *filelabel) 773 { 774 775 } 776 777 static int 778 mac_test_execve_will_transition(struct ucred *old, struct vnode *vp, 779 struct label *filelabel) 780 { 781 782 return (0); 783 } 784 785 static void 786 mac_test_create_proc0(struct ucred *cred) 787 { 788 789 } 790 791 static void 792 mac_test_create_proc1(struct ucred *cred) 793 { 794 795 } 796 797 static void 798 mac_test_relabel_cred(struct ucred *cred, struct label *newlabel) 799 { 800 801 } 802 803 /* 804 * Access control checks. 805 */ 806 static int 807 mac_test_check_bpfdesc_receive(struct bpf_d *bpf_d, struct label *bpflabel, 808 struct ifnet *ifnet, struct label *ifnetlabel) 809 { 810 811 return (0); 812 } 813 814 static int 815 mac_test_check_cred_relabel(struct ucred *cred, struct label *newlabel) 816 { 817 818 return (0); 819 } 820 821 static int 822 mac_test_check_cred_visible(struct ucred *u1, struct ucred *u2) 823 { 824 825 return (0); 826 } 827 828 static int 829 mac_test_check_ifnet_relabel(struct ucred *cred, struct ifnet *ifnet, 830 struct label *ifnetlabel, struct label *newlabel) 831 { 832 833 return (0); 834 } 835 836 static int 837 mac_test_check_ifnet_transmit(struct ifnet *ifnet, struct label *ifnetlabel, 838 struct mbuf *m, struct label *mbuflabel) 839 { 840 841 return (0); 842 } 843 844 static int 845 mac_test_check_mount_stat(struct ucred *cred, struct mount *mp, 846 struct label *mntlabel) 847 { 848 849 return (0); 850 } 851 852 static int 853 mac_test_check_pipe_ioctl(struct ucred *cred, struct pipe *pipe, 854 struct label *pipelabel, unsigned long cmd, void /* caddr_t */ *data) 855 { 856 857 return (0); 858 } 859 860 static int 861 mac_test_check_pipe_poll(struct ucred *cred, struct pipe *pipe, 862 struct label *pipelabel) 863 { 864 865 return (0); 866 } 867 868 static int 869 mac_test_check_pipe_read(struct ucred *cred, struct pipe *pipe, 870 struct label *pipelabel) 871 { 872 873 return (0); 874 } 875 876 static int 877 mac_test_check_pipe_relabel(struct ucred *cred, struct pipe *pipe, 878 struct label *pipelabel, struct label *newlabel) 879 { 880 881 return (0); 882 } 883 884 static int 885 mac_test_check_pipe_stat(struct ucred *cred, struct pipe *pipe, 886 struct label *pipelabel) 887 { 888 889 return (0); 890 } 891 892 static int 893 mac_test_check_pipe_write(struct ucred *cred, struct pipe *pipe, 894 struct label *pipelabel) 895 { 896 897 return (0); 898 } 899 900 static int 901 mac_test_check_proc_debug(struct ucred *cred, struct proc *proc) 902 { 903 904 return (0); 905 } 906 907 static int 908 mac_test_check_proc_sched(struct ucred *cred, struct proc *proc) 909 { 910 911 return (0); 912 } 913 914 static int 915 mac_test_check_proc_signal(struct ucred *cred, struct proc *proc) 916 { 917 918 return (0); 919 } 920 921 static int 922 mac_test_check_socket_bind(struct ucred *cred, struct socket *socket, 923 struct label *socketlabel, struct sockaddr *sockaddr) 924 { 925 926 return (0); 927 } 928 929 static int 930 mac_test_check_socket_connect(struct ucred *cred, struct socket *socket, 931 struct label *socketlabel, struct sockaddr *sockaddr) 932 { 933 934 return (0); 935 } 936 937 static int 938 mac_test_check_socket_deliver(struct socket *socket, struct label *socketlabel, 939 struct mbuf *m, struct label *mbuflabel) 940 { 941 942 return (0); 943 } 944 945 static int 946 mac_test_check_socket_listen(struct ucred *cred, struct socket *socket, 947 struct label *socketlabel, struct sockaddr *sockaddr) 948 { 949 950 return (0); 951 } 952 953 static int 954 mac_test_check_socket_visible(struct ucred *cred, struct socket *socket, 955 struct label *socketlabel) 956 { 957 958 return (0); 959 } 960 961 static int 962 mac_test_check_socket_relabel(struct ucred *cred, struct socket *socket, 963 struct label *socketlabel, struct label *newlabel) 964 { 965 966 return (0); 967 } 968 969 static int 970 mac_test_check_vnode_access(struct ucred *cred, struct vnode *vp, 971 struct label *label, mode_t flags) 972 { 973 974 return (0); 975 } 976 977 static int 978 mac_test_check_vnode_chdir(struct ucred *cred, struct vnode *dvp, 979 struct label *dlabel) 980 { 981 982 return (0); 983 } 984 985 static int 986 mac_test_check_vnode_chroot(struct ucred *cred, struct vnode *dvp, 987 struct label *dlabel) 988 { 989 990 return (0); 991 } 992 993 static int 994 mac_test_check_vnode_create(struct ucred *cred, struct vnode *dvp, 995 struct label *dlabel, struct componentname *cnp, struct vattr *vap) 996 { 997 998 return (0); 999 } 1000 1001 static int 1002 mac_test_check_vnode_delete(struct ucred *cred, struct vnode *dvp, 1003 struct label *dlabel, struct vnode *vp, struct label *label, 1004 struct componentname *cnp) 1005 { 1006 1007 return (0); 1008 } 1009 1010 static int 1011 mac_test_check_vnode_deleteacl(struct ucred *cred, struct vnode *vp, 1012 struct label *label, acl_type_t type) 1013 { 1014 1015 return (0); 1016 } 1017 1018 static int 1019 mac_test_check_vnode_exec(struct ucred *cred, struct vnode *vp, 1020 struct label *label) 1021 { 1022 1023 return (0); 1024 } 1025 1026 static int 1027 mac_test_check_vnode_getacl(struct ucred *cred, struct vnode *vp, 1028 struct label *label, acl_type_t type) 1029 { 1030 1031 return (0); 1032 } 1033 1034 static int 1035 mac_test_check_vnode_getextattr(struct ucred *cred, struct vnode *vp, 1036 struct label *label, int attrnamespace, const char *name, struct uio *uio) 1037 { 1038 1039 return (0); 1040 } 1041 1042 static int 1043 mac_test_check_vnode_link(struct ucred *cred, struct vnode *dvp, 1044 struct label *dlabel, struct vnode *vp, struct label *label, 1045 struct componentname *cnp) 1046 { 1047 1048 return (0); 1049 } 1050 1051 static int 1052 mac_test_check_vnode_lookup(struct ucred *cred, struct vnode *dvp, 1053 struct label *dlabel, struct componentname *cnp) 1054 { 1055 1056 return (0); 1057 } 1058 1059 static int 1060 mac_test_check_vnode_mmap(struct ucred *cred, struct vnode *vp, 1061 struct label *label, int prot) 1062 { 1063 1064 return (0); 1065 } 1066 1067 static int 1068 mac_test_check_vnode_mprotect(struct ucred *cred, struct vnode *vp, 1069 struct label *label, int prot) 1070 { 1071 1072 return (0); 1073 } 1074 1075 static int 1076 mac_test_check_vnode_open(struct ucred *cred, struct vnode *vp, 1077 struct label *filelabel, mode_t acc_mode) 1078 { 1079 1080 return (0); 1081 } 1082 1083 static int 1084 mac_test_check_vnode_poll(struct ucred *active_cred, struct ucred *file_cred, 1085 struct vnode *vp, struct label *label) 1086 { 1087 1088 return (0); 1089 } 1090 1091 static int 1092 mac_test_check_vnode_read(struct ucred *active_cred, struct ucred *file_cred, 1093 struct vnode *vp, struct label *label) 1094 { 1095 1096 return (0); 1097 } 1098 1099 static int 1100 mac_test_check_vnode_readdir(struct ucred *cred, struct vnode *dvp, 1101 struct label *dlabel) 1102 { 1103 1104 return (0); 1105 } 1106 1107 static int 1108 mac_test_check_vnode_readlink(struct ucred *cred, struct vnode *vp, 1109 struct label *vnodelabel) 1110 { 1111 1112 return (0); 1113 } 1114 1115 static int 1116 mac_test_check_vnode_relabel(struct ucred *cred, struct vnode *vp, 1117 struct label *vnodelabel, struct label *newlabel) 1118 { 1119 1120 return (0); 1121 } 1122 1123 static int 1124 mac_test_check_vnode_rename_from(struct ucred *cred, struct vnode *dvp, 1125 struct label *dlabel, struct vnode *vp, struct label *label, 1126 struct componentname *cnp) 1127 { 1128 1129 return (0); 1130 } 1131 1132 static int 1133 mac_test_check_vnode_rename_to(struct ucred *cred, struct vnode *dvp, 1134 struct label *dlabel, struct vnode *vp, struct label *label, int samedir, 1135 struct componentname *cnp) 1136 { 1137 1138 return (0); 1139 } 1140 1141 static int 1142 mac_test_check_vnode_revoke(struct ucred *cred, struct vnode *vp, 1143 struct label *label) 1144 { 1145 1146 return (0); 1147 } 1148 1149 static int 1150 mac_test_check_vnode_setacl(struct ucred *cred, struct vnode *vp, 1151 struct label *label, acl_type_t type, struct acl *acl) 1152 { 1153 1154 return (0); 1155 } 1156 1157 static int 1158 mac_test_check_vnode_setextattr(struct ucred *cred, struct vnode *vp, 1159 struct label *label, int attrnamespace, const char *name, struct uio *uio) 1160 { 1161 1162 return (0); 1163 } 1164 1165 static int 1166 mac_test_check_vnode_setflags(struct ucred *cred, struct vnode *vp, 1167 struct label *label, u_long flags) 1168 { 1169 1170 return (0); 1171 } 1172 1173 static int 1174 mac_test_check_vnode_setmode(struct ucred *cred, struct vnode *vp, 1175 struct label *label, mode_t mode) 1176 { 1177 1178 return (0); 1179 } 1180 1181 static int 1182 mac_test_check_vnode_setowner(struct ucred *cred, struct vnode *vp, 1183 struct label *label, uid_t uid, gid_t gid) 1184 { 1185 1186 return (0); 1187 } 1188 1189 static int 1190 mac_test_check_vnode_setutimes(struct ucred *cred, struct vnode *vp, 1191 struct label *label, struct timespec atime, struct timespec mtime) 1192 { 1193 1194 return (0); 1195 } 1196 1197 static int 1198 mac_test_check_vnode_stat(struct ucred *active_cred, struct ucred *file_cred, 1199 struct vnode *vp, struct label *label) 1200 { 1201 1202 return (0); 1203 } 1204 1205 static int 1206 mac_test_check_vnode_write(struct ucred *active_cred, 1207 struct ucred *file_cred, struct vnode *vp, struct label *label) 1208 { 1209 1210 return (0); 1211 } 1212 1213 static struct mac_policy_op_entry mac_test_ops[] = 1214 { 1215 { MAC_DESTROY, 1216 (macop_t)mac_test_destroy }, 1217 { MAC_INIT, 1218 (macop_t)mac_test_init }, 1219 { MAC_SYSCALL, 1220 (macop_t)mac_test_syscall }, 1221 { MAC_INIT_BPFDESC_LABEL, 1222 (macop_t)mac_test_init_bpfdesc_label }, 1223 { MAC_INIT_CRED_LABEL, 1224 (macop_t)mac_test_init_cred_label }, 1225 { MAC_INIT_DEVFSDIRENT_LABEL, 1226 (macop_t)mac_test_init_devfsdirent_label }, 1227 { MAC_INIT_IFNET_LABEL, 1228 (macop_t)mac_test_init_ifnet_label }, 1229 { MAC_INIT_IPQ_LABEL, 1230 (macop_t)mac_test_init_ipq_label }, 1231 { MAC_INIT_MBUF_LABEL, 1232 (macop_t)mac_test_init_mbuf_label }, 1233 { MAC_INIT_MOUNT_LABEL, 1234 (macop_t)mac_test_init_mount_label }, 1235 { MAC_INIT_MOUNT_FS_LABEL, 1236 (macop_t)mac_test_init_mount_fs_label }, 1237 { MAC_INIT_PIPE_LABEL, 1238 (macop_t)mac_test_init_pipe_label }, 1239 { MAC_INIT_SOCKET_LABEL, 1240 (macop_t)mac_test_init_socket_label }, 1241 { MAC_INIT_SOCKET_PEER_LABEL, 1242 (macop_t)mac_test_init_socket_peer_label }, 1243 { MAC_INIT_VNODE_LABEL, 1244 (macop_t)mac_test_init_vnode_label }, 1245 { MAC_DESTROY_BPFDESC_LABEL, 1246 (macop_t)mac_test_destroy_bpfdesc_label }, 1247 { MAC_DESTROY_CRED_LABEL, 1248 (macop_t)mac_test_destroy_cred_label }, 1249 { MAC_DESTROY_DEVFSDIRENT_LABEL, 1250 (macop_t)mac_test_destroy_devfsdirent_label }, 1251 { MAC_DESTROY_IFNET_LABEL, 1252 (macop_t)mac_test_destroy_ifnet_label }, 1253 { MAC_DESTROY_IPQ_LABEL, 1254 (macop_t)mac_test_destroy_ipq_label }, 1255 { MAC_DESTROY_MBUF_LABEL, 1256 (macop_t)mac_test_destroy_mbuf_label }, 1257 { MAC_DESTROY_MOUNT_LABEL, 1258 (macop_t)mac_test_destroy_mount_label }, 1259 { MAC_DESTROY_MOUNT_FS_LABEL, 1260 (macop_t)mac_test_destroy_mount_fs_label }, 1261 { MAC_DESTROY_PIPE_LABEL, 1262 (macop_t)mac_test_destroy_pipe_label }, 1263 { MAC_DESTROY_SOCKET_LABEL, 1264 (macop_t)mac_test_destroy_socket_label }, 1265 { MAC_DESTROY_SOCKET_PEER_LABEL, 1266 (macop_t)mac_test_destroy_socket_peer_label }, 1267 { MAC_DESTROY_VNODE_LABEL, 1268 (macop_t)mac_test_destroy_vnode_label }, 1269 { MAC_EXTERNALIZE_CRED_LABEL, 1270 (macop_t)mac_test_externalize_label }, 1271 { MAC_EXTERNALIZE_IFNET_LABEL, 1272 (macop_t)mac_test_externalize_label }, 1273 { MAC_EXTERNALIZE_PIPE_LABEL, 1274 (macop_t)mac_test_externalize_label }, 1275 { MAC_EXTERNALIZE_SOCKET_LABEL, 1276 (macop_t)mac_test_externalize_label }, 1277 { MAC_EXTERNALIZE_SOCKET_PEER_LABEL, 1278 (macop_t)mac_test_externalize_label }, 1279 { MAC_EXTERNALIZE_VNODE_LABEL, 1280 (macop_t)mac_test_externalize_label }, 1281 { MAC_INTERNALIZE_CRED_LABEL, 1282 (macop_t)mac_test_internalize_label }, 1283 { MAC_INTERNALIZE_IFNET_LABEL, 1284 (macop_t)mac_test_internalize_label }, 1285 { MAC_INTERNALIZE_PIPE_LABEL, 1286 (macop_t)mac_test_internalize_label }, 1287 { MAC_INTERNALIZE_SOCKET_LABEL, 1288 (macop_t)mac_test_internalize_label }, 1289 { MAC_INTERNALIZE_VNODE_LABEL, 1290 (macop_t)mac_test_internalize_label }, 1291 { MAC_ASSOCIATE_VNODE_DEVFS, 1292 (macop_t)mac_test_associate_vnode_devfs }, 1293 { MAC_ASSOCIATE_VNODE_EXTATTR, 1294 (macop_t)mac_test_associate_vnode_extattr }, 1295 { MAC_ASSOCIATE_VNODE_SINGLELABEL, 1296 (macop_t)mac_test_associate_vnode_singlelabel }, 1297 { MAC_CREATE_DEVFS_DEVICE, 1298 (macop_t)mac_test_create_devfs_device }, 1299 { MAC_CREATE_DEVFS_DIRECTORY, 1300 (macop_t)mac_test_create_devfs_directory }, 1301 { MAC_CREATE_DEVFS_SYMLINK, 1302 (macop_t)mac_test_create_devfs_symlink }, 1303 { MAC_CREATE_DEVFS_VNODE, 1304 (macop_t)mac_test_create_devfs_vnode }, 1305 { MAC_CREATE_VNODE_EXTATTR, 1306 (macop_t)mac_test_create_vnode_extattr }, 1307 { MAC_CREATE_MOUNT, 1308 (macop_t)mac_test_create_mount }, 1309 { MAC_CREATE_ROOT_MOUNT, 1310 (macop_t)mac_test_create_root_mount }, 1311 { MAC_RELABEL_VNODE, 1312 (macop_t)mac_test_relabel_vnode }, 1313 { MAC_SETLABEL_VNODE_EXTATTR, 1314 (macop_t)mac_test_setlabel_vnode_extattr }, 1315 { MAC_UPDATE_DEVFSDIRENT, 1316 (macop_t)mac_test_update_devfsdirent }, 1317 { MAC_CREATE_MBUF_FROM_SOCKET, 1318 (macop_t)mac_test_create_mbuf_from_socket }, 1319 { MAC_CREATE_PIPE, 1320 (macop_t)mac_test_create_pipe }, 1321 { MAC_CREATE_SOCKET, 1322 (macop_t)mac_test_create_socket }, 1323 { MAC_CREATE_SOCKET_FROM_SOCKET, 1324 (macop_t)mac_test_create_socket_from_socket }, 1325 { MAC_RELABEL_PIPE, 1326 (macop_t)mac_test_relabel_pipe }, 1327 { MAC_RELABEL_SOCKET, 1328 (macop_t)mac_test_relabel_socket }, 1329 { MAC_SET_SOCKET_PEER_FROM_MBUF, 1330 (macop_t)mac_test_set_socket_peer_from_mbuf }, 1331 { MAC_SET_SOCKET_PEER_FROM_SOCKET, 1332 (macop_t)mac_test_set_socket_peer_from_socket }, 1333 { MAC_CREATE_BPFDESC, 1334 (macop_t)mac_test_create_bpfdesc }, 1335 { MAC_CREATE_IFNET, 1336 (macop_t)mac_test_create_ifnet }, 1337 { MAC_CREATE_DATAGRAM_FROM_IPQ, 1338 (macop_t)mac_test_create_datagram_from_ipq }, 1339 { MAC_CREATE_FRAGMENT, 1340 (macop_t)mac_test_create_fragment }, 1341 { MAC_CREATE_IPQ, 1342 (macop_t)mac_test_create_ipq }, 1343 { MAC_CREATE_MBUF_FROM_MBUF, 1344 (macop_t)mac_test_create_mbuf_from_mbuf }, 1345 { MAC_CREATE_MBUF_LINKLAYER, 1346 (macop_t)mac_test_create_mbuf_linklayer }, 1347 { MAC_CREATE_MBUF_FROM_BPFDESC, 1348 (macop_t)mac_test_create_mbuf_from_bpfdesc }, 1349 { MAC_CREATE_MBUF_FROM_IFNET, 1350 (macop_t)mac_test_create_mbuf_from_ifnet }, 1351 { MAC_CREATE_MBUF_MULTICAST_ENCAP, 1352 (macop_t)mac_test_create_mbuf_multicast_encap }, 1353 { MAC_CREATE_MBUF_NETLAYER, 1354 (macop_t)mac_test_create_mbuf_netlayer }, 1355 { MAC_FRAGMENT_MATCH, 1356 (macop_t)mac_test_fragment_match }, 1357 { MAC_RELABEL_IFNET, 1358 (macop_t)mac_test_relabel_ifnet }, 1359 { MAC_UPDATE_IPQ, 1360 (macop_t)mac_test_update_ipq }, 1361 { MAC_CREATE_CRED, 1362 (macop_t)mac_test_create_cred }, 1363 { MAC_EXECVE_TRANSITION, 1364 (macop_t)mac_test_execve_transition }, 1365 { MAC_EXECVE_WILL_TRANSITION, 1366 (macop_t)mac_test_execve_will_transition }, 1367 { MAC_CREATE_PROC0, 1368 (macop_t)mac_test_create_proc0 }, 1369 { MAC_CREATE_PROC1, 1370 (macop_t)mac_test_create_proc1 }, 1371 { MAC_RELABEL_CRED, 1372 (macop_t)mac_test_relabel_cred }, 1373 { MAC_CHECK_BPFDESC_RECEIVE, 1374 (macop_t)mac_test_check_bpfdesc_receive }, 1375 { MAC_CHECK_CRED_RELABEL, 1376 (macop_t)mac_test_check_cred_relabel }, 1377 { MAC_CHECK_CRED_VISIBLE, 1378 (macop_t)mac_test_check_cred_visible }, 1379 { MAC_CHECK_IFNET_RELABEL, 1380 (macop_t)mac_test_check_ifnet_relabel }, 1381 { MAC_CHECK_IFNET_TRANSMIT, 1382 (macop_t)mac_test_check_ifnet_transmit }, 1383 { MAC_CHECK_MOUNT_STAT, 1384 (macop_t)mac_test_check_mount_stat }, 1385 { MAC_CHECK_PIPE_IOCTL, 1386 (macop_t)mac_test_check_pipe_ioctl }, 1387 { MAC_CHECK_PIPE_POLL, 1388 (macop_t)mac_test_check_pipe_poll }, 1389 { MAC_CHECK_PIPE_READ, 1390 (macop_t)mac_test_check_pipe_read }, 1391 { MAC_CHECK_PIPE_RELABEL, 1392 (macop_t)mac_test_check_pipe_relabel }, 1393 { MAC_CHECK_PIPE_STAT, 1394 (macop_t)mac_test_check_pipe_stat }, 1395 { MAC_CHECK_PIPE_WRITE, 1396 (macop_t)mac_test_check_pipe_write }, 1397 { MAC_CHECK_PROC_DEBUG, 1398 (macop_t)mac_test_check_proc_debug }, 1399 { MAC_CHECK_PROC_SCHED, 1400 (macop_t)mac_test_check_proc_sched }, 1401 { MAC_CHECK_PROC_SIGNAL, 1402 (macop_t)mac_test_check_proc_signal }, 1403 { MAC_CHECK_SOCKET_BIND, 1404 (macop_t)mac_test_check_socket_bind }, 1405 { MAC_CHECK_SOCKET_CONNECT, 1406 (macop_t)mac_test_check_socket_connect }, 1407 { MAC_CHECK_SOCKET_DELIVER, 1408 (macop_t)mac_test_check_socket_deliver }, 1409 { MAC_CHECK_SOCKET_LISTEN, 1410 (macop_t)mac_test_check_socket_listen }, 1411 { MAC_CHECK_SOCKET_RELABEL, 1412 (macop_t)mac_test_check_socket_relabel }, 1413 { MAC_CHECK_SOCKET_VISIBLE, 1414 (macop_t)mac_test_check_socket_visible }, 1415 { MAC_CHECK_VNODE_ACCESS, 1416 (macop_t)mac_test_check_vnode_access }, 1417 { MAC_CHECK_VNODE_CHDIR, 1418 (macop_t)mac_test_check_vnode_chdir }, 1419 { MAC_CHECK_VNODE_CHROOT, 1420 (macop_t)mac_test_check_vnode_chroot }, 1421 { MAC_CHECK_VNODE_CREATE, 1422 (macop_t)mac_test_check_vnode_create }, 1423 { MAC_CHECK_VNODE_DELETE, 1424 (macop_t)mac_test_check_vnode_delete }, 1425 { MAC_CHECK_VNODE_DELETEACL, 1426 (macop_t)mac_test_check_vnode_deleteacl }, 1427 { MAC_CHECK_VNODE_EXEC, 1428 (macop_t)mac_test_check_vnode_exec }, 1429 { MAC_CHECK_VNODE_GETACL, 1430 (macop_t)mac_test_check_vnode_getacl }, 1431 { MAC_CHECK_VNODE_GETEXTATTR, 1432 (macop_t)mac_test_check_vnode_getextattr }, 1433 { MAC_CHECK_VNODE_LINK, 1434 (macop_t)mac_test_check_vnode_link }, 1435 { MAC_CHECK_VNODE_LOOKUP, 1436 (macop_t)mac_test_check_vnode_lookup }, 1437 { MAC_CHECK_VNODE_MMAP, 1438 (macop_t)mac_test_check_vnode_mmap }, 1439 { MAC_CHECK_VNODE_MPROTECT, 1440 (macop_t)mac_test_check_vnode_mprotect }, 1441 { MAC_CHECK_VNODE_OPEN, 1442 (macop_t)mac_test_check_vnode_open }, 1443 { MAC_CHECK_VNODE_POLL, 1444 (macop_t)mac_test_check_vnode_poll }, 1445 { MAC_CHECK_VNODE_READ, 1446 (macop_t)mac_test_check_vnode_read }, 1447 { MAC_CHECK_VNODE_READDIR, 1448 (macop_t)mac_test_check_vnode_readdir }, 1449 { MAC_CHECK_VNODE_READLINK, 1450 (macop_t)mac_test_check_vnode_readlink }, 1451 { MAC_CHECK_VNODE_RELABEL, 1452 (macop_t)mac_test_check_vnode_relabel }, 1453 { MAC_CHECK_VNODE_RENAME_FROM, 1454 (macop_t)mac_test_check_vnode_rename_from }, 1455 { MAC_CHECK_VNODE_RENAME_TO, 1456 (macop_t)mac_test_check_vnode_rename_to }, 1457 { MAC_CHECK_VNODE_REVOKE, 1458 (macop_t)mac_test_check_vnode_revoke }, 1459 { MAC_CHECK_VNODE_SETACL, 1460 (macop_t)mac_test_check_vnode_setacl }, 1461 { MAC_CHECK_VNODE_SETEXTATTR, 1462 (macop_t)mac_test_check_vnode_setextattr }, 1463 { MAC_CHECK_VNODE_SETFLAGS, 1464 (macop_t)mac_test_check_vnode_setflags }, 1465 { MAC_CHECK_VNODE_SETMODE, 1466 (macop_t)mac_test_check_vnode_setmode }, 1467 { MAC_CHECK_VNODE_SETOWNER, 1468 (macop_t)mac_test_check_vnode_setowner }, 1469 { MAC_CHECK_VNODE_SETUTIMES, 1470 (macop_t)mac_test_check_vnode_setutimes }, 1471 { MAC_CHECK_VNODE_STAT, 1472 (macop_t)mac_test_check_vnode_stat }, 1473 { MAC_CHECK_VNODE_WRITE, 1474 (macop_t)mac_test_check_vnode_write }, 1475 { MAC_OP_LAST, NULL } 1476 }; 1477 1478 MAC_POLICY_SET(mac_test_ops, trustedbsd_mac_test, "TrustedBSD MAC/Test", 1479 MPC_LOADTIME_FLAG_UNLOADOK, &test_slot); 1480