17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 545916cd2Sjpk * Common Development and Distribution License (the "License"). 645916cd2Sjpk * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21657b1f3dSraf 227c478bd9Sstevel@tonic-gate /* 239e9e6ab8Spaulson * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * This file contains the audit event table used to control the production 317c478bd9Sstevel@tonic-gate * of audit records for each system call. 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #include <sys/policy.h> 357c478bd9Sstevel@tonic-gate #include <sys/cred.h> 367c478bd9Sstevel@tonic-gate #include <sys/types.h> 377c478bd9Sstevel@tonic-gate #include <sys/systm.h> 387c478bd9Sstevel@tonic-gate #include <sys/systeminfo.h> /* for sysinfo auditing */ 397c478bd9Sstevel@tonic-gate #include <sys/utsname.h> /* for sysinfo auditing */ 407c478bd9Sstevel@tonic-gate #include <sys/proc.h> 417c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 427c478bd9Sstevel@tonic-gate #include <sys/mman.h> /* for mmap(2) auditing etc. */ 437c478bd9Sstevel@tonic-gate #include <sys/fcntl.h> 447c478bd9Sstevel@tonic-gate #include <sys/modctl.h> /* for modctl auditing */ 457c478bd9Sstevel@tonic-gate #include <sys/vnode.h> 467c478bd9Sstevel@tonic-gate #include <sys/user.h> 477c478bd9Sstevel@tonic-gate #include <sys/types.h> 487c478bd9Sstevel@tonic-gate #include <sys/processor.h> 497c478bd9Sstevel@tonic-gate #include <sys/procset.h> 507c478bd9Sstevel@tonic-gate #include <sys/acl.h> 517c478bd9Sstevel@tonic-gate #include <sys/ipc.h> 527c478bd9Sstevel@tonic-gate #include <sys/door.h> 537c478bd9Sstevel@tonic-gate #include <sys/sem.h> 547c478bd9Sstevel@tonic-gate #include <sys/msg.h> 557c478bd9Sstevel@tonic-gate #include <sys/shm.h> 567c478bd9Sstevel@tonic-gate #include <sys/kmem.h> 577c478bd9Sstevel@tonic-gate #include <sys/file.h> /* for accept */ 587c478bd9Sstevel@tonic-gate #include <sys/utssys.h> /* for fuser */ 5945916cd2Sjpk #include <sys/tsol/label.h> 607c478bd9Sstevel@tonic-gate #include <c2/audit.h> 617c478bd9Sstevel@tonic-gate #include <c2/audit_kernel.h> 627c478bd9Sstevel@tonic-gate #include <c2/audit_kevents.h> 637c478bd9Sstevel@tonic-gate #include <c2/audit_record.h> 647c478bd9Sstevel@tonic-gate #include <sys/procset.h> 657c478bd9Sstevel@tonic-gate #include <nfs/mount.h> 667c478bd9Sstevel@tonic-gate #include <sys/param.h> 677c478bd9Sstevel@tonic-gate #include <sys/debug.h> 687c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 697c478bd9Sstevel@tonic-gate #include <sys/stream.h> 707c478bd9Sstevel@tonic-gate #include <sys/strsubr.h> 717c478bd9Sstevel@tonic-gate #include <sys/stropts.h> 727c478bd9Sstevel@tonic-gate #include <sys/tihdr.h> 737c478bd9Sstevel@tonic-gate #include <sys/socket.h> 747c478bd9Sstevel@tonic-gate #include <sys/socketvar.h> 757c478bd9Sstevel@tonic-gate #include <netinet/in.h> 767c478bd9Sstevel@tonic-gate #include <sys/ddi.h> 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate extern token_t *au_to_sock_inet(struct sockaddr_in *); 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate int au_naevent; 817c478bd9Sstevel@tonic-gate char _depends_on[] = "fs/sockfs"; 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate static au_event_t aui_null(au_event_t); 847c478bd9Sstevel@tonic-gate static au_event_t aui_open(au_event_t); 857c478bd9Sstevel@tonic-gate static au_event_t aui_fsat(au_event_t); 867c478bd9Sstevel@tonic-gate static au_event_t aui_msgsys(au_event_t); 877c478bd9Sstevel@tonic-gate static au_event_t aui_shmsys(au_event_t); 887c478bd9Sstevel@tonic-gate static au_event_t aui_semsys(au_event_t); 897c478bd9Sstevel@tonic-gate static au_event_t aui_utssys(au_event_t); 907c478bd9Sstevel@tonic-gate static au_event_t aui_fcntl(au_event_t); 917c478bd9Sstevel@tonic-gate static au_event_t aui_execv(au_event_t); 927c478bd9Sstevel@tonic-gate static au_event_t aui_execve(au_event_t); 937c478bd9Sstevel@tonic-gate static au_event_t aui_memcntl(au_event_t); 947c478bd9Sstevel@tonic-gate static au_event_t aui_sysinfo(au_event_t); 957c478bd9Sstevel@tonic-gate static au_event_t aui_auditsys(au_event_t); 967c478bd9Sstevel@tonic-gate static au_event_t aui_modctl(au_event_t); 977c478bd9Sstevel@tonic-gate static au_event_t aui_acl(au_event_t); 987c478bd9Sstevel@tonic-gate static au_event_t aui_doorfs(au_event_t); 997c478bd9Sstevel@tonic-gate static au_event_t aui_privsys(au_event_t); 100657b1f3dSraf static au_event_t aui_forksys(au_event_t); 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate static void aus_null(struct t_audit_data *); 1037c478bd9Sstevel@tonic-gate static void aus_open(struct t_audit_data *); 1047c478bd9Sstevel@tonic-gate static void aus_acl(struct t_audit_data *); 1057c478bd9Sstevel@tonic-gate static void aus_acct(struct t_audit_data *); 1067c478bd9Sstevel@tonic-gate static void aus_chown(struct t_audit_data *); 1077c478bd9Sstevel@tonic-gate static void aus_fchown(struct t_audit_data *); 1087c478bd9Sstevel@tonic-gate static void aus_lchown(struct t_audit_data *); 1097c478bd9Sstevel@tonic-gate static void aus_chmod(struct t_audit_data *); 1107c478bd9Sstevel@tonic-gate static void aus_facl(struct t_audit_data *); 1117c478bd9Sstevel@tonic-gate static void aus_fchmod(struct t_audit_data *); 1127c478bd9Sstevel@tonic-gate static void aus_fcntl(struct t_audit_data *); 1137c478bd9Sstevel@tonic-gate static void aus_fsat(struct t_audit_data *); 1147c478bd9Sstevel@tonic-gate static void aus_mkdir(struct t_audit_data *); 1157c478bd9Sstevel@tonic-gate static void aus_mknod(struct t_audit_data *); 1167c478bd9Sstevel@tonic-gate static void aus_mount(struct t_audit_data *); 1177c478bd9Sstevel@tonic-gate static void aus_umount(struct t_audit_data *); 1187c478bd9Sstevel@tonic-gate static void aus_umount2(struct t_audit_data *); 1197c478bd9Sstevel@tonic-gate static void aus_msgsys(struct t_audit_data *); 1207c478bd9Sstevel@tonic-gate static void aus_semsys(struct t_audit_data *); 1217c478bd9Sstevel@tonic-gate static void aus_close(struct t_audit_data *); 1227c478bd9Sstevel@tonic-gate static void aus_fstatfs(struct t_audit_data *); 1237c478bd9Sstevel@tonic-gate static void aus_setgid(struct t_audit_data *); 1247c478bd9Sstevel@tonic-gate static void aus_setuid(struct t_audit_data *); 1257c478bd9Sstevel@tonic-gate static void aus_shmsys(struct t_audit_data *); 1267c478bd9Sstevel@tonic-gate static void aus_doorfs(struct t_audit_data *); 1277c478bd9Sstevel@tonic-gate static void aus_ioctl(struct t_audit_data *); 1287c478bd9Sstevel@tonic-gate static void aus_memcntl(struct t_audit_data *); 1297c478bd9Sstevel@tonic-gate static void aus_mmap(struct t_audit_data *); 1307c478bd9Sstevel@tonic-gate static void aus_munmap(struct t_audit_data *); 1317c478bd9Sstevel@tonic-gate static void aus_priocntlsys(struct t_audit_data *); 1327c478bd9Sstevel@tonic-gate static void aus_setegid(struct t_audit_data *); 1337c478bd9Sstevel@tonic-gate static void aus_setgroups(struct t_audit_data *); 1347c478bd9Sstevel@tonic-gate static void aus_seteuid(struct t_audit_data *); 1357c478bd9Sstevel@tonic-gate static void aus_putmsg(struct t_audit_data *); 1367c478bd9Sstevel@tonic-gate static void aus_putpmsg(struct t_audit_data *); 1377c478bd9Sstevel@tonic-gate static void aus_getmsg(struct t_audit_data *); 1387c478bd9Sstevel@tonic-gate static void aus_getpmsg(struct t_audit_data *); 1397c478bd9Sstevel@tonic-gate static void aus_auditsys(struct t_audit_data *); 1407c478bd9Sstevel@tonic-gate static void aus_sysinfo(struct t_audit_data *); 1417c478bd9Sstevel@tonic-gate static void aus_modctl(struct t_audit_data *); 1427c478bd9Sstevel@tonic-gate static void aus_kill(struct t_audit_data *); 1437c478bd9Sstevel@tonic-gate static void aus_xmknod(struct t_audit_data *); 1447c478bd9Sstevel@tonic-gate static void aus_setregid(struct t_audit_data *); 1457c478bd9Sstevel@tonic-gate static void aus_setreuid(struct t_audit_data *); 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate static void auf_null(struct t_audit_data *, int, rval_t *); 1487c478bd9Sstevel@tonic-gate static void auf_mknod(struct t_audit_data *, int, rval_t *); 1497c478bd9Sstevel@tonic-gate static void auf_msgsys(struct t_audit_data *, int, rval_t *); 1507c478bd9Sstevel@tonic-gate static void auf_semsys(struct t_audit_data *, int, rval_t *); 1517c478bd9Sstevel@tonic-gate static void auf_shmsys(struct t_audit_data *, int, rval_t *); 1527c478bd9Sstevel@tonic-gate #if 0 1537c478bd9Sstevel@tonic-gate static void auf_open(struct t_audit_data *, int, rval_t *); 1547c478bd9Sstevel@tonic-gate #endif 1557c478bd9Sstevel@tonic-gate static void auf_xmknod(struct t_audit_data *, int, rval_t *); 1567c478bd9Sstevel@tonic-gate static void auf_read(struct t_audit_data *, int, rval_t *); 1577c478bd9Sstevel@tonic-gate static void auf_write(struct t_audit_data *, int, rval_t *); 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate static void aus_sigqueue(struct t_audit_data *); 1607c478bd9Sstevel@tonic-gate static void aus_p_online(struct t_audit_data *); 1617c478bd9Sstevel@tonic-gate static void aus_processor_bind(struct t_audit_data *); 1627c478bd9Sstevel@tonic-gate static void aus_inst_sync(struct t_audit_data *); 1639acbbeafSnn static void aus_brandsys(struct t_audit_data *); 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate static void auf_accept(struct t_audit_data *, int, rval_t *); 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate static void auf_bind(struct t_audit_data *, int, rval_t *); 1687c478bd9Sstevel@tonic-gate static void auf_connect(struct t_audit_data *, int, rval_t *); 1697c478bd9Sstevel@tonic-gate static void aus_shutdown(struct t_audit_data *); 1707c478bd9Sstevel@tonic-gate static void auf_setsockopt(struct t_audit_data *, int, rval_t *); 1717c478bd9Sstevel@tonic-gate static void aus_sockconfig(struct t_audit_data *); 1727c478bd9Sstevel@tonic-gate static void auf_recv(struct t_audit_data *, int, rval_t *); 1737c478bd9Sstevel@tonic-gate static void auf_recvmsg(struct t_audit_data *, int, rval_t *); 1747c478bd9Sstevel@tonic-gate static void auf_send(struct t_audit_data *, int, rval_t *); 1757c478bd9Sstevel@tonic-gate static void auf_sendmsg(struct t_audit_data *, int, rval_t *); 1767c478bd9Sstevel@tonic-gate static void auf_recvfrom(struct t_audit_data *, int, rval_t *); 1777c478bd9Sstevel@tonic-gate static void auf_sendto(struct t_audit_data *, int, rval_t *); 1787c478bd9Sstevel@tonic-gate static void aus_socket(struct t_audit_data *); 1797c478bd9Sstevel@tonic-gate /* 1807c478bd9Sstevel@tonic-gate * This table contains mapping information for converting system call numbers 1817c478bd9Sstevel@tonic-gate * to audit event IDs. In several cases it is necessary to map a single system 1827c478bd9Sstevel@tonic-gate * call to several events. 1837c478bd9Sstevel@tonic-gate */ 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate struct audit_s2e audit_s2e[] = 1867c478bd9Sstevel@tonic-gate { 1877c478bd9Sstevel@tonic-gate /* 1887c478bd9Sstevel@tonic-gate * ---------- ---------- ---------- ---------- 1897c478bd9Sstevel@tonic-gate * INITIAL AUDIT START SYSTEM 1907c478bd9Sstevel@tonic-gate * PROCESSING EVENT PROCESSING CALL 1917c478bd9Sstevel@tonic-gate * ---------- ---------- ---------- ----------- 1927c478bd9Sstevel@tonic-gate * FINISH EVENT 1937c478bd9Sstevel@tonic-gate * PROCESSING CONTROL 1947c478bd9Sstevel@tonic-gate * ---------------------------------------------------------- 1957c478bd9Sstevel@tonic-gate */ 1967c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 0 unused (indirect) */ 1977c478bd9Sstevel@tonic-gate auf_null, 0, 1987c478bd9Sstevel@tonic-gate aui_null, AUE_EXIT, aus_null, /* 1 exit */ 1997c478bd9Sstevel@tonic-gate auf_null, S2E_NPT, 2007c478bd9Sstevel@tonic-gate aui_null, AUE_FORKALL, aus_null, /* 2 forkall */ 2017c478bd9Sstevel@tonic-gate auf_null, 0, 2027c478bd9Sstevel@tonic-gate aui_null, AUE_READ, aus_null, /* 3 read */ 2037c478bd9Sstevel@tonic-gate auf_read, S2E_PUB, 2047c478bd9Sstevel@tonic-gate aui_null, AUE_WRITE, aus_null, /* 4 write */ 2057c478bd9Sstevel@tonic-gate auf_write, 0, 2067c478bd9Sstevel@tonic-gate aui_open, AUE_OPEN, aus_open, /* 5 open */ 2077c478bd9Sstevel@tonic-gate auf_null, S2E_SP, 2087c478bd9Sstevel@tonic-gate aui_null, AUE_CLOSE, aus_close, /* 6 close */ 2097c478bd9Sstevel@tonic-gate auf_null, 0, 2107c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 7 wait */ 2117c478bd9Sstevel@tonic-gate auf_null, 0, 2127c478bd9Sstevel@tonic-gate aui_null, AUE_CREAT, aus_null, /* 8 create */ 2137c478bd9Sstevel@tonic-gate auf_null, S2E_SP, 2147c478bd9Sstevel@tonic-gate aui_null, AUE_LINK, aus_null, /* 9 link */ 2157c478bd9Sstevel@tonic-gate auf_null, 0, 2167c478bd9Sstevel@tonic-gate aui_null, AUE_UNLINK, aus_null, /* 10 unlink */ 2177c478bd9Sstevel@tonic-gate auf_null, 0, 2187c478bd9Sstevel@tonic-gate aui_execv, AUE_EXEC, aus_null, /* 11 exec */ 2197c478bd9Sstevel@tonic-gate auf_null, S2E_MLD, 2207c478bd9Sstevel@tonic-gate aui_null, AUE_CHDIR, aus_null, /* 12 chdir */ 2217c478bd9Sstevel@tonic-gate auf_null, S2E_SP, 2227c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 13 time */ 2237c478bd9Sstevel@tonic-gate auf_null, 0, 2247c478bd9Sstevel@tonic-gate aui_null, AUE_MKNOD, aus_mknod, /* 14 mknod */ 2257c478bd9Sstevel@tonic-gate auf_mknod, 0, 2267c478bd9Sstevel@tonic-gate aui_null, AUE_CHMOD, aus_chmod, /* 15 chmod */ 2277c478bd9Sstevel@tonic-gate auf_null, 0, 2287c478bd9Sstevel@tonic-gate aui_null, AUE_CHOWN, aus_chown, /* 16 chown */ 2297c478bd9Sstevel@tonic-gate auf_null, 0, 2307c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 17 brk */ 2317c478bd9Sstevel@tonic-gate auf_null, 0, 2327c478bd9Sstevel@tonic-gate aui_null, AUE_STAT, aus_null, /* 18 stat */ 2337c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 2347c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 19 lseek */ 2357c478bd9Sstevel@tonic-gate auf_null, 0, 2367c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 20 getpid */ 2377c478bd9Sstevel@tonic-gate auf_null, 0, 2387c478bd9Sstevel@tonic-gate aui_null, AUE_MOUNT, aus_mount, /* 21 mount */ 2397c478bd9Sstevel@tonic-gate auf_null, S2E_MLD, 2407c478bd9Sstevel@tonic-gate aui_null, AUE_UMOUNT, aus_umount, /* 22 umount */ 2417c478bd9Sstevel@tonic-gate auf_null, 0, 2427c478bd9Sstevel@tonic-gate aui_null, AUE_SETUID, aus_setuid, /* 23 setuid */ 2437c478bd9Sstevel@tonic-gate auf_null, 0, 2447c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 24 getuid */ 2457c478bd9Sstevel@tonic-gate auf_null, 0, 2467c478bd9Sstevel@tonic-gate aui_null, AUE_STIME, aus_null, /* 25 stime */ 2477c478bd9Sstevel@tonic-gate auf_null, 0, 2487c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 26 (loadable) was ptrace */ 2497c478bd9Sstevel@tonic-gate auf_null, 0, 2507c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 27 alarm */ 2517c478bd9Sstevel@tonic-gate auf_null, 0, 2527c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 28 fstat */ 2537c478bd9Sstevel@tonic-gate auf_null, 0, 2547c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 29 pause */ 2557c478bd9Sstevel@tonic-gate auf_null, 0, 2567c478bd9Sstevel@tonic-gate aui_null, AUE_UTIME, aus_null, /* 30 utime */ 2577c478bd9Sstevel@tonic-gate auf_null, 0, 2587c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 31 stty (TIOCSETP-audit?) */ 2597c478bd9Sstevel@tonic-gate auf_null, 0, 2607c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 32 gtty */ 2617c478bd9Sstevel@tonic-gate auf_null, 0, 2627c478bd9Sstevel@tonic-gate aui_null, AUE_ACCESS, aus_null, /* 33 access */ 2637c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 2647c478bd9Sstevel@tonic-gate aui_null, AUE_NICE, aus_null, /* 34 nice */ 2657c478bd9Sstevel@tonic-gate auf_null, 0, 2667c478bd9Sstevel@tonic-gate aui_null, AUE_STATFS, aus_null, /* 35 statfs */ 2677c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 2687c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 36 sync */ 2697c478bd9Sstevel@tonic-gate auf_null, 0, 2707c478bd9Sstevel@tonic-gate aui_null, AUE_KILL, aus_kill, /* 37 kill */ 2717c478bd9Sstevel@tonic-gate auf_null, 0, 2727c478bd9Sstevel@tonic-gate aui_null, AUE_FSTATFS, aus_fstatfs, /* 38 fstatfs */ 2737c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 2747c478bd9Sstevel@tonic-gate aui_null, AUE_SETPGRP, aus_null, /* 39 setpgrp */ 2757c478bd9Sstevel@tonic-gate auf_null, 0, 2769acbbeafSnn aui_null, AUE_NULL, aus_null, /* 40 uucopystr */ 2777c478bd9Sstevel@tonic-gate auf_null, 0, 2787c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 41 dup */ 2797c478bd9Sstevel@tonic-gate auf_null, 0, 2807c478bd9Sstevel@tonic-gate aui_null, AUE_PIPE, aus_null, /* 42 pipe */ 2817c478bd9Sstevel@tonic-gate auf_null, 0, 2827c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 43 times */ 2837c478bd9Sstevel@tonic-gate auf_null, 0, 2847c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 44 profil */ 2857c478bd9Sstevel@tonic-gate auf_null, 0, 2867c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 45 (loadable) */ 2877c478bd9Sstevel@tonic-gate /* was proc lock */ 2887c478bd9Sstevel@tonic-gate auf_null, 0, 2897c478bd9Sstevel@tonic-gate aui_null, AUE_SETGID, aus_setgid, /* 46 setgid */ 2907c478bd9Sstevel@tonic-gate auf_null, 0, 2917c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 47 getgid */ 2927c478bd9Sstevel@tonic-gate auf_null, 0, 2937c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 48 sig */ 2947c478bd9Sstevel@tonic-gate auf_null, 0, 2957c478bd9Sstevel@tonic-gate aui_msgsys, AUE_MSGSYS, aus_msgsys, /* 49 (loadable) was msgsys */ 2967c478bd9Sstevel@tonic-gate auf_msgsys, 0, 2977c478bd9Sstevel@tonic-gate #if defined(__x86) 2987c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 50 sysi86 */ 2997c478bd9Sstevel@tonic-gate auf_null, 0, 3007c478bd9Sstevel@tonic-gate #else 3017c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 50 (loadable) was sys3b */ 3027c478bd9Sstevel@tonic-gate auf_null, 0, 3037c478bd9Sstevel@tonic-gate #endif /* __x86 */ 3047c478bd9Sstevel@tonic-gate aui_null, AUE_ACCT, aus_acct, /* 51 acct */ 3057c478bd9Sstevel@tonic-gate auf_null, 0, 3067c478bd9Sstevel@tonic-gate aui_shmsys, AUE_SHMSYS, aus_shmsys, /* 52 shared memory */ 3077c478bd9Sstevel@tonic-gate auf_shmsys, 0, 3087c478bd9Sstevel@tonic-gate aui_semsys, AUE_SEMSYS, aus_semsys, /* 53 IPC semaphores */ 3097c478bd9Sstevel@tonic-gate auf_semsys, 0, 3107c478bd9Sstevel@tonic-gate aui_null, AUE_IOCTL, aus_ioctl, /* 54 ioctl */ 3117c478bd9Sstevel@tonic-gate auf_null, 0, 3127c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 55 uadmin */ 3137c478bd9Sstevel@tonic-gate auf_null, 0, 3147c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 56 (loadable) was uexch */ 3157c478bd9Sstevel@tonic-gate auf_null, 0, 3167c478bd9Sstevel@tonic-gate aui_utssys, AUE_FUSERS, aus_null, /* 57 utssys */ 3177c478bd9Sstevel@tonic-gate auf_null, 0, 3187c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 58 fsync */ 3197c478bd9Sstevel@tonic-gate auf_null, 0, 3207c478bd9Sstevel@tonic-gate aui_execve, AUE_EXECVE, aus_null, /* 59 exece */ 3217c478bd9Sstevel@tonic-gate auf_null, S2E_MLD, 3227c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 60 umask */ 3237c478bd9Sstevel@tonic-gate auf_null, 0, 3247c478bd9Sstevel@tonic-gate aui_null, AUE_CHROOT, aus_null, /* 61 chroot */ 3257c478bd9Sstevel@tonic-gate auf_null, S2E_SP, 3267c478bd9Sstevel@tonic-gate aui_fcntl, AUE_FCNTL, aus_fcntl, /* 62 fcntl */ 3277c478bd9Sstevel@tonic-gate auf_null, 0, 3287c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 63 ulimit */ 3297c478bd9Sstevel@tonic-gate auf_null, 0, 3307c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 64 (loadable) */ 3317c478bd9Sstevel@tonic-gate auf_null, 0, 3327c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 65 (loadable) */ 3337c478bd9Sstevel@tonic-gate auf_null, 0, 3347c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 66 (loadable) */ 3357c478bd9Sstevel@tonic-gate auf_null, 0, 3367c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 67 (loadable) */ 3377c478bd9Sstevel@tonic-gate /* file locking call */ 3387c478bd9Sstevel@tonic-gate auf_null, 0, 3397c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 68 (loadable) */ 3407c478bd9Sstevel@tonic-gate /* local system calls */ 3417c478bd9Sstevel@tonic-gate auf_null, 0, 3427c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 69 (loadable) inode open */ 3437c478bd9Sstevel@tonic-gate auf_null, 0, 3447c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 70 (loadable) was advfs */ 3457c478bd9Sstevel@tonic-gate auf_null, 0, 3467c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 71 (loadable) was unadvfs */ 3477c478bd9Sstevel@tonic-gate auf_null, 0, 3487c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 72 (loadable) was notused */ 3497c478bd9Sstevel@tonic-gate auf_null, 0, 3507c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 73 (loadable) was notused */ 3517c478bd9Sstevel@tonic-gate auf_null, 0, 3527c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 74 (loadable) was notused */ 3537c478bd9Sstevel@tonic-gate auf_null, 0, 354f48205beScasper aui_null, AUE_NULL, aus_null, /* 75 sidsys */ 3557c478bd9Sstevel@tonic-gate /* was sigret (SunOS) */ 3567c478bd9Sstevel@tonic-gate auf_null, 0, 3577c478bd9Sstevel@tonic-gate aui_fsat, AUE_FSAT, aus_fsat, /* 76 fsat */ 3587c478bd9Sstevel@tonic-gate auf_null, 0, 3597c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 77 (loadable) was rfstop */ 3607c478bd9Sstevel@tonic-gate auf_null, 0, 3617c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 78 (loadable) was rfssys */ 3627c478bd9Sstevel@tonic-gate auf_null, 0, 3637c478bd9Sstevel@tonic-gate aui_null, AUE_RMDIR, aus_null, /* 79 rmdir */ 3647c478bd9Sstevel@tonic-gate auf_null, 0, 3657c478bd9Sstevel@tonic-gate aui_null, AUE_MKDIR, aus_mkdir, /* 80 mkdir */ 3667c478bd9Sstevel@tonic-gate auf_null, 0, 3677c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 81 getdents */ 3687c478bd9Sstevel@tonic-gate auf_null, 0, 3697c478bd9Sstevel@tonic-gate aui_privsys, AUE_NULL, aus_null, /* 82 privsys */ 3707c478bd9Sstevel@tonic-gate /* was libattach */ 3717c478bd9Sstevel@tonic-gate auf_null, 0, 3727c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 83 (loadable) */ 3737c478bd9Sstevel@tonic-gate /* was libdetach */ 3747c478bd9Sstevel@tonic-gate auf_null, 0, 3757c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 84 sysfs */ 3767c478bd9Sstevel@tonic-gate auf_null, 0, 3777c478bd9Sstevel@tonic-gate aui_null, AUE_GETMSG, aus_getmsg, /* 85 getmsg */ 3787c478bd9Sstevel@tonic-gate auf_null, 0, 3797c478bd9Sstevel@tonic-gate aui_null, AUE_PUTMSG, aus_putmsg, /* 86 putmsg */ 3807c478bd9Sstevel@tonic-gate auf_null, 0, 3817c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 87 poll */ 3827c478bd9Sstevel@tonic-gate auf_null, 0, 3837c478bd9Sstevel@tonic-gate aui_null, AUE_LSTAT, aus_null, /* 88 lstat */ 3847c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 3857c478bd9Sstevel@tonic-gate aui_null, AUE_SYMLINK, aus_null, /* 89 symlink */ 3867c478bd9Sstevel@tonic-gate auf_null, 0, 3877c478bd9Sstevel@tonic-gate aui_null, AUE_READLINK, aus_null, /* 90 readlink */ 3887c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 3897c478bd9Sstevel@tonic-gate aui_null, AUE_SETGROUPS, aus_setgroups, /* 91 setgroups */ 3907c478bd9Sstevel@tonic-gate auf_null, 0, 3917c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 92 getgroups */ 3927c478bd9Sstevel@tonic-gate auf_null, 0, 3937c478bd9Sstevel@tonic-gate aui_null, AUE_FCHMOD, aus_fchmod, /* 93 fchmod */ 3947c478bd9Sstevel@tonic-gate auf_null, 0, 3957c478bd9Sstevel@tonic-gate aui_null, AUE_FCHOWN, aus_fchown, /* 94 fchown */ 3967c478bd9Sstevel@tonic-gate auf_null, 0, 3977c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 95 sigprocmask */ 3987c478bd9Sstevel@tonic-gate auf_null, 0, 3997c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 96 sigsuspend */ 4007c478bd9Sstevel@tonic-gate auf_null, 0, 4017c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 97 sigaltstack */ 4027c478bd9Sstevel@tonic-gate auf_null, 0, 4037c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 98 sigaction */ 4047c478bd9Sstevel@tonic-gate auf_null, 0, 4057c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 99 sigpending */ 4067c478bd9Sstevel@tonic-gate auf_null, 0, 4077c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 100 setcontext */ 4087c478bd9Sstevel@tonic-gate auf_null, 0, 4097c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 101 (loadable) was evsys */ 4107c478bd9Sstevel@tonic-gate auf_null, 0, 4117c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 102 (loadable) */ 4127c478bd9Sstevel@tonic-gate /* was evtrapret */ 4137c478bd9Sstevel@tonic-gate auf_null, 0, 4147c478bd9Sstevel@tonic-gate aui_null, AUE_STATVFS, aus_null, /* 103 statvfs */ 4157c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 4167c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 104 fstatvfs */ 4177c478bd9Sstevel@tonic-gate auf_null, 0, 4187c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 105 (loadable) */ 4197c478bd9Sstevel@tonic-gate auf_null, 0, 4207c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 106 nfssys */ 4217c478bd9Sstevel@tonic-gate auf_null, 0, 4227c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 107 waitset */ 4237c478bd9Sstevel@tonic-gate auf_null, 0, 4247c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 108 sigsendset */ 4257c478bd9Sstevel@tonic-gate auf_null, 0, 4267c478bd9Sstevel@tonic-gate #if defined(__x86) 4277c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 109 hrtsys */ 4287c478bd9Sstevel@tonic-gate auf_null, 0, 4297c478bd9Sstevel@tonic-gate #else 4307c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 109 (loadable) */ 4317c478bd9Sstevel@tonic-gate auf_null, 0, 4327c478bd9Sstevel@tonic-gate #endif /* __x86 */ 4337c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 110 (loadable) was acancel */ 4347c478bd9Sstevel@tonic-gate auf_null, 0, 4357c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 111 (loadable) was async */ 4367c478bd9Sstevel@tonic-gate auf_null, 0, 4377c478bd9Sstevel@tonic-gate aui_null, AUE_PRIOCNTLSYS, aus_priocntlsys, 4387c478bd9Sstevel@tonic-gate auf_null, 0, /* 112 priocntlsys */ 4397c478bd9Sstevel@tonic-gate aui_null, AUE_PATHCONF, aus_null, /* 113 pathconf */ 4407c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 4417c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 114 mincore */ 4427c478bd9Sstevel@tonic-gate auf_null, 0, 4437c478bd9Sstevel@tonic-gate aui_null, AUE_MMAP, aus_mmap, /* 115 mmap */ 4447c478bd9Sstevel@tonic-gate auf_null, 0, 4457c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 116 mprotect */ 4467c478bd9Sstevel@tonic-gate auf_null, 0, 4477c478bd9Sstevel@tonic-gate aui_null, AUE_MUNMAP, aus_munmap, /* 117 munmap */ 4487c478bd9Sstevel@tonic-gate auf_null, 0, 4497c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 118 fpathconf */ 4507c478bd9Sstevel@tonic-gate auf_null, 0, 4517c478bd9Sstevel@tonic-gate aui_null, AUE_VFORK, aus_null, /* 119 vfork */ 4527c478bd9Sstevel@tonic-gate auf_null, 0, 4537c478bd9Sstevel@tonic-gate aui_null, AUE_FCHDIR, aus_null, /* 120 fchdir */ 4547c478bd9Sstevel@tonic-gate auf_null, 0, 4557c478bd9Sstevel@tonic-gate aui_null, AUE_READ, aus_null, /* 121 readv */ 4567c478bd9Sstevel@tonic-gate auf_read, S2E_PUB, 4577c478bd9Sstevel@tonic-gate aui_null, AUE_WRITE, aus_null, /* 122 writev */ 4587c478bd9Sstevel@tonic-gate auf_write, 0, 4597c478bd9Sstevel@tonic-gate aui_null, AUE_STAT, aus_null, /* 123 xstat (x86) */ 4607c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 4617c478bd9Sstevel@tonic-gate aui_null, AUE_LSTAT, aus_null, /* 124 lxstat (x86) */ 4627c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 4637c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 125 fxstat (x86) */ 4647c478bd9Sstevel@tonic-gate auf_null, 0, 4657c478bd9Sstevel@tonic-gate aui_null, AUE_MKNOD, aus_xmknod, /* 126 xmknod (x86) */ 4667c478bd9Sstevel@tonic-gate auf_xmknod, 0, 4677c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 127 (loadable) was clocal */ 4687c478bd9Sstevel@tonic-gate auf_null, 0, 4697c478bd9Sstevel@tonic-gate aui_null, AUE_SETRLIMIT, aus_null, /* 128 setrlimit */ 4707c478bd9Sstevel@tonic-gate auf_null, 0, 4717c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 129 getrlimit */ 4727c478bd9Sstevel@tonic-gate auf_null, 0, 4737c478bd9Sstevel@tonic-gate aui_null, AUE_LCHOWN, aus_lchown, /* 130 lchown */ 4747c478bd9Sstevel@tonic-gate auf_null, 0, 4757c478bd9Sstevel@tonic-gate aui_memcntl, AUE_MEMCNTL, aus_memcntl, /* 131 memcntl */ 4767c478bd9Sstevel@tonic-gate auf_null, 0, 4777c478bd9Sstevel@tonic-gate aui_null, AUE_GETPMSG, aus_getpmsg, /* 132 getpmsg */ 4787c478bd9Sstevel@tonic-gate auf_null, 0, 4797c478bd9Sstevel@tonic-gate aui_null, AUE_PUTPMSG, aus_putpmsg, /* 133 putpmsg */ 4807c478bd9Sstevel@tonic-gate auf_null, 0, 4817c478bd9Sstevel@tonic-gate aui_null, AUE_RENAME, aus_null, /* 134 rename */ 4827c478bd9Sstevel@tonic-gate auf_null, 0, 4837c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 135 uname */ 4847c478bd9Sstevel@tonic-gate auf_null, 0, 4857c478bd9Sstevel@tonic-gate aui_null, AUE_SETEGID, aus_setegid, /* 136 setegid */ 4867c478bd9Sstevel@tonic-gate auf_null, 0, 4877c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 137 sysconfig */ 4887c478bd9Sstevel@tonic-gate auf_null, 0, 4897c478bd9Sstevel@tonic-gate aui_null, AUE_ADJTIME, aus_null, /* 138 adjtime */ 4907c478bd9Sstevel@tonic-gate auf_null, 0, 4917c478bd9Sstevel@tonic-gate aui_sysinfo, AUE_SYSINFO, aus_sysinfo, /* 139 systeminfo */ 4927c478bd9Sstevel@tonic-gate auf_null, 0, 4937c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 140 reserved */ 4947c478bd9Sstevel@tonic-gate auf_null, 0, 4957c478bd9Sstevel@tonic-gate aui_null, AUE_SETEUID, aus_seteuid, /* 141 seteuid */ 4967c478bd9Sstevel@tonic-gate auf_null, 0, 497657b1f3dSraf aui_forksys, AUE_NULL, aus_null, /* 142 forksys */ 4987c478bd9Sstevel@tonic-gate auf_null, 0, 4997c478bd9Sstevel@tonic-gate aui_null, AUE_FORK1, aus_null, /* 143 fork1 */ 5007c478bd9Sstevel@tonic-gate auf_null, 0, 5017c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 144 sigwait */ 5027c478bd9Sstevel@tonic-gate auf_null, 0, 5037c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 145 lwp_info */ 5047c478bd9Sstevel@tonic-gate auf_null, 0, 5057c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 146 yield */ 5067c478bd9Sstevel@tonic-gate auf_null, 0, 5077c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 147 lwp_sema_wait */ 5087c478bd9Sstevel@tonic-gate auf_null, 0, 5097c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 148 lwp_sema_post */ 5107c478bd9Sstevel@tonic-gate auf_null, 0, 5117c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 149 lwp_sema_trywait */ 5127c478bd9Sstevel@tonic-gate auf_null, 0, 5137c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 150 (loadable reserved) */ 5147c478bd9Sstevel@tonic-gate auf_null, 0, 5157c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 151 (loadable reserved) */ 5167c478bd9Sstevel@tonic-gate auf_null, 0, 5177c478bd9Sstevel@tonic-gate aui_modctl, AUE_MODCTL, aus_modctl, /* 152 modctl */ 5187c478bd9Sstevel@tonic-gate auf_null, 0, 5197c478bd9Sstevel@tonic-gate aui_null, AUE_FCHROOT, aus_null, /* 153 fchroot */ 5207c478bd9Sstevel@tonic-gate auf_null, 0, 5217c478bd9Sstevel@tonic-gate aui_null, AUE_UTIMES, aus_null, /* 154 utimes */ 5227c478bd9Sstevel@tonic-gate auf_null, 0, 5237c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 155 vhangup */ 5247c478bd9Sstevel@tonic-gate auf_null, 0, 5257c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 156 gettimeofday */ 5267c478bd9Sstevel@tonic-gate auf_null, 0, 5277c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 157 getitimer */ 5287c478bd9Sstevel@tonic-gate auf_null, 0, 5297c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 158 setitimer */ 5307c478bd9Sstevel@tonic-gate auf_null, 0, 5317c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 159 lwp_create */ 5327c478bd9Sstevel@tonic-gate auf_null, 0, 5337c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 160 lwp_exit */ 5347c478bd9Sstevel@tonic-gate auf_null, 0, 5357c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 161 lwp_suspend */ 5367c478bd9Sstevel@tonic-gate auf_null, 0, 5377c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 162 lwp_continue */ 5387c478bd9Sstevel@tonic-gate auf_null, 0, 5397c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 163 lwp_kill */ 5407c478bd9Sstevel@tonic-gate auf_null, 0, 5417c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 164 lwp_self */ 5427c478bd9Sstevel@tonic-gate auf_null, 0, 5437c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 165 (loadable) */ 5447c478bd9Sstevel@tonic-gate /* was lwp_setprivate */ 5457c478bd9Sstevel@tonic-gate auf_null, 0, 5467c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 166 (loadable) */ 5477c478bd9Sstevel@tonic-gate /* was lwp_getprivate */ 5487c478bd9Sstevel@tonic-gate auf_null, 0, 5497c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 167 lwp_wait */ 5507c478bd9Sstevel@tonic-gate auf_null, 0, 551*883492d5Sraf aui_null, AUE_NULL, aus_null, /* 168 lwp_mutex_wakeup */ 5527c478bd9Sstevel@tonic-gate auf_null, 0, 5537c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 169 lwp_mutex_lock */ 5547c478bd9Sstevel@tonic-gate auf_null, 0, 5557c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 170 lwp_cond_wait */ 5567c478bd9Sstevel@tonic-gate auf_null, 0, 5577c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 171 lwp_cond_signal */ 5587c478bd9Sstevel@tonic-gate auf_null, 0, 5597c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 172 lwp_cond_broadcast */ 5607c478bd9Sstevel@tonic-gate auf_null, 0, 5617c478bd9Sstevel@tonic-gate aui_null, AUE_READ, aus_null, /* 173 pread */ 5627c478bd9Sstevel@tonic-gate auf_read, S2E_PUB, 5637c478bd9Sstevel@tonic-gate aui_null, AUE_WRITE, aus_null, /* 174 pwrite */ 5647c478bd9Sstevel@tonic-gate auf_write, 0, 5657c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 175 llseek */ 5667c478bd9Sstevel@tonic-gate auf_null, 0, 5677c478bd9Sstevel@tonic-gate aui_null, AUE_INST_SYNC, aus_inst_sync, /* 176 (loadable) */ 5687c478bd9Sstevel@tonic-gate /* aus_inst_sync */ 5697c478bd9Sstevel@tonic-gate auf_null, 0, 5709acbbeafSnn aui_null, AUE_BRANDSYS, aus_brandsys, /* 177 brandsys */ 5717c478bd9Sstevel@tonic-gate auf_null, 0, 5727c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 178 (loadable) */ 5737c478bd9Sstevel@tonic-gate auf_null, 0, 5747c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 179 (loadable) */ 5757c478bd9Sstevel@tonic-gate auf_null, 0, 5767c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 180 (loadable) kaio */ 5777c478bd9Sstevel@tonic-gate auf_null, 0, 5787c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 181 (loadable) */ 5797c478bd9Sstevel@tonic-gate auf_null, 0, 5807c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 182 (loadable) */ 5817c478bd9Sstevel@tonic-gate auf_null, 0, 5827c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 183 (loadable) */ 5837c478bd9Sstevel@tonic-gate auf_null, 0, 5847c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 184 (loadable) tsolsys */ 5857c478bd9Sstevel@tonic-gate auf_null, 0, 5867c478bd9Sstevel@tonic-gate aui_acl, AUE_ACLSET, aus_acl, /* 185 acl */ 5877c478bd9Sstevel@tonic-gate auf_null, 0, 5887c478bd9Sstevel@tonic-gate aui_auditsys, AUE_AUDITSYS, aus_auditsys, /* 186 auditsys */ 5897c478bd9Sstevel@tonic-gate auf_null, 0, 5907c478bd9Sstevel@tonic-gate aui_null, AUE_PROCESSOR_BIND, aus_processor_bind, 5917c478bd9Sstevel@tonic-gate auf_null, 0, /* 187 processor_bind */ 5927c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 188 processor_info */ 5937c478bd9Sstevel@tonic-gate auf_null, 0, 5947c478bd9Sstevel@tonic-gate aui_null, AUE_P_ONLINE, aus_p_online, /* 189 p_online */ 5957c478bd9Sstevel@tonic-gate auf_null, 0, 5967c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_sigqueue, /* 190 sigqueue */ 5977c478bd9Sstevel@tonic-gate auf_null, 0, 5987c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 191 clock_gettime */ 5997c478bd9Sstevel@tonic-gate auf_null, 0, 6007c478bd9Sstevel@tonic-gate aui_null, AUE_CLOCK_SETTIME, aus_null, /* 192 clock_settime */ 6017c478bd9Sstevel@tonic-gate auf_null, 0, 6027c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 193 clock_getres */ 6037c478bd9Sstevel@tonic-gate auf_null, 0, 6047c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 194 timer_create */ 6057c478bd9Sstevel@tonic-gate auf_null, 0, 6067c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 195 timer_delete */ 6077c478bd9Sstevel@tonic-gate auf_null, 0, 6087c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 196 timer_settime */ 6097c478bd9Sstevel@tonic-gate auf_null, 0, 6107c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 197 timer_gettime */ 6117c478bd9Sstevel@tonic-gate auf_null, 0, 6127c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 198 timer_getoverrun */ 6137c478bd9Sstevel@tonic-gate auf_null, 0, 6147c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 199 nanosleep */ 6157c478bd9Sstevel@tonic-gate auf_null, 0, 6167c478bd9Sstevel@tonic-gate aui_acl, AUE_FACLSET, aus_facl, /* 200 facl */ 6177c478bd9Sstevel@tonic-gate auf_null, 0, 6187c478bd9Sstevel@tonic-gate aui_doorfs, AUE_DOORFS, aus_doorfs, /* 201 (loadable) doorfs */ 6197c478bd9Sstevel@tonic-gate auf_null, 0, 6207c478bd9Sstevel@tonic-gate aui_null, AUE_SETREUID, aus_setreuid, /* 202 setreuid */ 6217c478bd9Sstevel@tonic-gate auf_null, 0, 6227c478bd9Sstevel@tonic-gate aui_null, AUE_SETREGID, aus_setregid, /* 203 setregid */ 6237c478bd9Sstevel@tonic-gate auf_null, 0, 6247c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 204 install_utrap */ 6257c478bd9Sstevel@tonic-gate auf_null, 0, 6267c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 205 signotify */ 6277c478bd9Sstevel@tonic-gate auf_null, 0, 6287c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 206 schedctl */ 6297c478bd9Sstevel@tonic-gate auf_null, 0, 6307c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 207 (loadable) pset */ 6317c478bd9Sstevel@tonic-gate auf_null, 0, 6327c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 208 (loadable) */ 6337c478bd9Sstevel@tonic-gate auf_null, 0, 6347c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 209 resolvepath */ 6357c478bd9Sstevel@tonic-gate auf_null, 0, 6367c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 210 lwp_mutex_timedlock */ 6377c478bd9Sstevel@tonic-gate auf_null, 0, 6387c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 211 lwp_sema_timedwait */ 6397c478bd9Sstevel@tonic-gate auf_null, 0, 6407c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 212 lwp_rwlock_sys */ 6417c478bd9Sstevel@tonic-gate auf_null, 0, 6427c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 213 getdents64 (__ppc) */ 6437c478bd9Sstevel@tonic-gate auf_null, 0, 6447c478bd9Sstevel@tonic-gate aui_null, AUE_MMAP, aus_mmap, /* 214 mmap64 */ 6457c478bd9Sstevel@tonic-gate auf_null, 0, 6467c478bd9Sstevel@tonic-gate aui_null, AUE_STAT, aus_null, /* 215 stat64 */ 6477c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 6487c478bd9Sstevel@tonic-gate aui_null, AUE_LSTAT, aus_null, /* 216 lstat64 */ 6497c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 6507c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 217 fstat64 */ 6517c478bd9Sstevel@tonic-gate auf_null, 0, 6527c478bd9Sstevel@tonic-gate aui_null, AUE_STATVFS, aus_null, /* 218 statvfs64 */ 6537c478bd9Sstevel@tonic-gate auf_null, S2E_PUB, 6547c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 219 fstatvfs64 */ 6557c478bd9Sstevel@tonic-gate auf_null, 0, 6567c478bd9Sstevel@tonic-gate aui_null, AUE_SETRLIMIT, aus_null, /* 220 setrlimit64 */ 6577c478bd9Sstevel@tonic-gate auf_null, 0, 6587c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 221 getrlimit64 */ 6597c478bd9Sstevel@tonic-gate auf_null, 0, 6607c478bd9Sstevel@tonic-gate aui_null, AUE_READ, aus_null, /* 222 pread64 */ 6617c478bd9Sstevel@tonic-gate auf_read, S2E_PUB, 6627c478bd9Sstevel@tonic-gate aui_null, AUE_WRITE, aus_null, /* 223 pwrite64 */ 6637c478bd9Sstevel@tonic-gate auf_write, 0, 6647c478bd9Sstevel@tonic-gate aui_null, AUE_CREAT, aus_null, /* 224 creat64 */ 6657c478bd9Sstevel@tonic-gate auf_null, S2E_SP, 6667c478bd9Sstevel@tonic-gate aui_open, AUE_OPEN, aus_open, /* 225 open64 */ 6677c478bd9Sstevel@tonic-gate auf_null, S2E_SP, 6687c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 226 (loadable) rpcsys */ 6697c478bd9Sstevel@tonic-gate auf_null, 0, 6707c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 227 (loadable) */ 6717c478bd9Sstevel@tonic-gate auf_null, 0, 6727c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 228 (loadable) */ 6737c478bd9Sstevel@tonic-gate auf_null, 0, 6747c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 229 (loadable) */ 6757c478bd9Sstevel@tonic-gate auf_null, 0, 6767c478bd9Sstevel@tonic-gate aui_null, AUE_SOCKET, aus_socket, /* 230 so_socket */ 6777c478bd9Sstevel@tonic-gate auf_null, 0, 6787c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 231 so_socketpair */ 6797c478bd9Sstevel@tonic-gate auf_null, 0, 6807c478bd9Sstevel@tonic-gate aui_null, AUE_BIND, aus_null, /* 232 bind */ 6817c478bd9Sstevel@tonic-gate auf_bind, 0, 6827c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 233 listen */ 6837c478bd9Sstevel@tonic-gate auf_null, 0, 6847c478bd9Sstevel@tonic-gate aui_null, AUE_ACCEPT, aus_null, /* 234 accept */ 6857c478bd9Sstevel@tonic-gate auf_accept, 0, 6867c478bd9Sstevel@tonic-gate aui_null, AUE_CONNECT, aus_null, /* 235 connect */ 6877c478bd9Sstevel@tonic-gate auf_connect, 0, 6887c478bd9Sstevel@tonic-gate aui_null, AUE_SHUTDOWN, aus_shutdown, /* 236 shutdown */ 6897c478bd9Sstevel@tonic-gate auf_null, 0, 6907c478bd9Sstevel@tonic-gate aui_null, AUE_READ, aus_null, /* 237 recv */ 6917c478bd9Sstevel@tonic-gate auf_recv, 0, 6927c478bd9Sstevel@tonic-gate aui_null, AUE_RECVFROM, aus_null, /* 238 recvfrom */ 6937c478bd9Sstevel@tonic-gate auf_recvfrom, 0, 6947c478bd9Sstevel@tonic-gate aui_null, AUE_RECVMSG, aus_null, /* 239 recvmsg */ 6957c478bd9Sstevel@tonic-gate auf_recvmsg, 0, 6967c478bd9Sstevel@tonic-gate aui_null, AUE_WRITE, aus_null, /* 240 send */ 6977c478bd9Sstevel@tonic-gate auf_send, 0, 6987c478bd9Sstevel@tonic-gate aui_null, AUE_SENDMSG, aus_null, /* 241 sendmsg */ 6997c478bd9Sstevel@tonic-gate auf_sendmsg, 0, 7007c478bd9Sstevel@tonic-gate aui_null, AUE_SENDTO, aus_null, /* 242 sendto */ 7017c478bd9Sstevel@tonic-gate auf_sendto, 0, 7027c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 243 getpeername */ 7037c478bd9Sstevel@tonic-gate auf_null, 0, 7047c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 244 getsockname */ 7057c478bd9Sstevel@tonic-gate auf_null, 0, 7067c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 245 getsockopt */ 7077c478bd9Sstevel@tonic-gate auf_null, 0, 7087c478bd9Sstevel@tonic-gate aui_null, AUE_SETSOCKOPT, aus_null, /* 246 setsockopt */ 7097c478bd9Sstevel@tonic-gate auf_setsockopt, 0, 7107c478bd9Sstevel@tonic-gate aui_null, AUE_SOCKCONFIG, aus_sockconfig, /* 247 sockconfig */ 7117c478bd9Sstevel@tonic-gate auf_null, 0, 7127c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 248 ntp_gettime */ 7137c478bd9Sstevel@tonic-gate auf_null, 0, 7147c478bd9Sstevel@tonic-gate aui_null, AUE_NTP_ADJTIME, aus_null, /* 249 ntp_adjtime */ 7157c478bd9Sstevel@tonic-gate auf_null, 0, 7167c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 250 lwp_mutex_unlock */ 7177c478bd9Sstevel@tonic-gate auf_null, 0, 7187c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 251 lwp_mutex_trylock */ 7197c478bd9Sstevel@tonic-gate auf_null, 0, 720*883492d5Sraf aui_null, AUE_NULL, aus_null, /* 252 lwp_mutex_register */ 7217c478bd9Sstevel@tonic-gate auf_null, 0, 7227c478bd9Sstevel@tonic-gate aui_null, AUE_NULL, aus_null, /* 253 cladm */ 7237c478bd9Sstevel@tonic-gate auf_null, 0, 7249acbbeafSnn aui_null, AUE_NULL, aus_null, /* 254 uucopy */ 7257c478bd9Sstevel@tonic-gate auf_null, 0, 7267c478bd9Sstevel@tonic-gate aui_null, AUE_UMOUNT2, aus_umount2, /* 255 umount2 */ 7277c478bd9Sstevel@tonic-gate auf_null, 0 7287c478bd9Sstevel@tonic-gate }; 7297c478bd9Sstevel@tonic-gate 7307c478bd9Sstevel@tonic-gate uint_t num_syscall = sizeof (audit_s2e) / sizeof (struct audit_s2e); 7317c478bd9Sstevel@tonic-gate 7327c478bd9Sstevel@tonic-gate char *so_not_bound = "socket not bound"; 7337c478bd9Sstevel@tonic-gate char *so_not_conn = "socket not connected"; 7347c478bd9Sstevel@tonic-gate char *so_bad_addr = "bad socket address"; 7357c478bd9Sstevel@tonic-gate char *so_bad_peer_addr = "bad peer address"; 7367c478bd9Sstevel@tonic-gate 7377c478bd9Sstevel@tonic-gate /* null start function */ 7387c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 7397c478bd9Sstevel@tonic-gate static void 7407c478bd9Sstevel@tonic-gate aus_null(struct t_audit_data *tad) 7417c478bd9Sstevel@tonic-gate { 7427c478bd9Sstevel@tonic-gate } 7437c478bd9Sstevel@tonic-gate 7447c478bd9Sstevel@tonic-gate /* acct start function */ 7457c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 7467c478bd9Sstevel@tonic-gate static void 7477c478bd9Sstevel@tonic-gate aus_acct(struct t_audit_data *tad) 7487c478bd9Sstevel@tonic-gate { 7497c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 7507c478bd9Sstevel@tonic-gate uintptr_t fname; 7517c478bd9Sstevel@tonic-gate 7527c478bd9Sstevel@tonic-gate struct a { 7537c478bd9Sstevel@tonic-gate long fname; /* char * */ 7547c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 7557c478bd9Sstevel@tonic-gate 7567c478bd9Sstevel@tonic-gate fname = (uintptr_t)uap->fname; 7577c478bd9Sstevel@tonic-gate 7587c478bd9Sstevel@tonic-gate if (fname == 0) 7597c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "accounting off", (uint32_t)0)); 7607c478bd9Sstevel@tonic-gate } 7617c478bd9Sstevel@tonic-gate 7627c478bd9Sstevel@tonic-gate /* chown start function */ 7637c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 7647c478bd9Sstevel@tonic-gate static void 7657c478bd9Sstevel@tonic-gate aus_chown(struct t_audit_data *tad) 7667c478bd9Sstevel@tonic-gate { 7677c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 7687c478bd9Sstevel@tonic-gate uint32_t uid, gid; 7697c478bd9Sstevel@tonic-gate 7707c478bd9Sstevel@tonic-gate struct a { 7717c478bd9Sstevel@tonic-gate long fname; /* char * */ 7727c478bd9Sstevel@tonic-gate long uid; 7737c478bd9Sstevel@tonic-gate long gid; 7747c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 7757c478bd9Sstevel@tonic-gate 7767c478bd9Sstevel@tonic-gate uid = (uint32_t)uap->uid; 7777c478bd9Sstevel@tonic-gate gid = (uint32_t)uap->gid; 7787c478bd9Sstevel@tonic-gate 7797c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "new file uid", uid)); 7807c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "new file gid", gid)); 7817c478bd9Sstevel@tonic-gate } 7827c478bd9Sstevel@tonic-gate 7837c478bd9Sstevel@tonic-gate /* fchown start function */ 7847c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 7857c478bd9Sstevel@tonic-gate static void 7867c478bd9Sstevel@tonic-gate aus_fchown(struct t_audit_data *tad) 7877c478bd9Sstevel@tonic-gate { 7887c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 7897c478bd9Sstevel@tonic-gate uint32_t uid, gid, fd; 7907c478bd9Sstevel@tonic-gate struct file *fp; 7917c478bd9Sstevel@tonic-gate struct vnode *vp; 7927c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 7937c478bd9Sstevel@tonic-gate 7947c478bd9Sstevel@tonic-gate struct a { 7957c478bd9Sstevel@tonic-gate long fd; 7967c478bd9Sstevel@tonic-gate long uid; 7977c478bd9Sstevel@tonic-gate long gid; 7987c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 7997c478bd9Sstevel@tonic-gate 8007c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fd; 8017c478bd9Sstevel@tonic-gate uid = (uint32_t)uap->uid; 8027c478bd9Sstevel@tonic-gate gid = (uint32_t)uap->gid; 8037c478bd9Sstevel@tonic-gate 8047c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "new file uid", uid)); 8057c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "new file gid", gid)); 8067c478bd9Sstevel@tonic-gate 8077c478bd9Sstevel@tonic-gate /* 8087c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 8097c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 8107c478bd9Sstevel@tonic-gate */ 8117c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 8127c478bd9Sstevel@tonic-gate return; 8137c478bd9Sstevel@tonic-gate 8147c478bd9Sstevel@tonic-gate /* get path from file struct here */ 8157c478bd9Sstevel@tonic-gate fad = F2A(fp); 8167c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 8177c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 8187c478bd9Sstevel@tonic-gate } else { 8197c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 8207c478bd9Sstevel@tonic-gate } 8217c478bd9Sstevel@tonic-gate 8227c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 8237c478bd9Sstevel@tonic-gate audit_attributes(vp); 8247c478bd9Sstevel@tonic-gate 8257c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 8267c478bd9Sstevel@tonic-gate releasef(fd); 8277c478bd9Sstevel@tonic-gate } 8287c478bd9Sstevel@tonic-gate 8297c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 8307c478bd9Sstevel@tonic-gate static void 8317c478bd9Sstevel@tonic-gate aus_lchown(struct t_audit_data *tad) 8327c478bd9Sstevel@tonic-gate { 8337c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 8347c478bd9Sstevel@tonic-gate uint32_t uid, gid; 8357c478bd9Sstevel@tonic-gate 8367c478bd9Sstevel@tonic-gate 8377c478bd9Sstevel@tonic-gate struct a { 8387c478bd9Sstevel@tonic-gate long fname; /* char * */ 8397c478bd9Sstevel@tonic-gate long uid; 8407c478bd9Sstevel@tonic-gate long gid; 8417c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 8427c478bd9Sstevel@tonic-gate 8437c478bd9Sstevel@tonic-gate uid = (uint32_t)uap->uid; 8447c478bd9Sstevel@tonic-gate gid = (uint32_t)uap->gid; 8457c478bd9Sstevel@tonic-gate 8467c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "new file uid", uid)); 8477c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "new file gid", gid)); 8487c478bd9Sstevel@tonic-gate } 8497c478bd9Sstevel@tonic-gate 8507c478bd9Sstevel@tonic-gate /* chmod start function */ 8517c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 8527c478bd9Sstevel@tonic-gate static void 8537c478bd9Sstevel@tonic-gate aus_chmod(struct t_audit_data *tad) 8547c478bd9Sstevel@tonic-gate { 8557c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 8567c478bd9Sstevel@tonic-gate uint32_t fmode; 8577c478bd9Sstevel@tonic-gate 8587c478bd9Sstevel@tonic-gate struct a { 8597c478bd9Sstevel@tonic-gate long fname; /* char * */ 8607c478bd9Sstevel@tonic-gate long fmode; 8617c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 8627c478bd9Sstevel@tonic-gate 8637c478bd9Sstevel@tonic-gate fmode = (uint32_t)uap->fmode; 8647c478bd9Sstevel@tonic-gate 8657c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "new file mode", fmode&07777)); 8667c478bd9Sstevel@tonic-gate } 8677c478bd9Sstevel@tonic-gate 8687c478bd9Sstevel@tonic-gate /* chmod start function */ 8697c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 8707c478bd9Sstevel@tonic-gate static void 8717c478bd9Sstevel@tonic-gate aus_fchmod(struct t_audit_data *tad) 8727c478bd9Sstevel@tonic-gate { 8737c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 8747c478bd9Sstevel@tonic-gate uint32_t fmode, fd; 8757c478bd9Sstevel@tonic-gate struct file *fp; 8767c478bd9Sstevel@tonic-gate struct vnode *vp; 8777c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 8787c478bd9Sstevel@tonic-gate 8797c478bd9Sstevel@tonic-gate struct a { 8807c478bd9Sstevel@tonic-gate long fd; 8817c478bd9Sstevel@tonic-gate long fmode; 8827c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 8837c478bd9Sstevel@tonic-gate 8847c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fd; 8857c478bd9Sstevel@tonic-gate fmode = (uint32_t)uap->fmode; 8867c478bd9Sstevel@tonic-gate 8877c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "new file mode", fmode&07777)); 8887c478bd9Sstevel@tonic-gate 8897c478bd9Sstevel@tonic-gate /* 8907c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 8917c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 8927c478bd9Sstevel@tonic-gate */ 8937c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 8947c478bd9Sstevel@tonic-gate return; 8957c478bd9Sstevel@tonic-gate 8967c478bd9Sstevel@tonic-gate /* get path from file struct here */ 8977c478bd9Sstevel@tonic-gate fad = F2A(fp); 8987c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 8997c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 9007c478bd9Sstevel@tonic-gate } else { 9017c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 9027c478bd9Sstevel@tonic-gate } 9037c478bd9Sstevel@tonic-gate 9047c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 9057c478bd9Sstevel@tonic-gate audit_attributes(vp); 9067c478bd9Sstevel@tonic-gate 9077c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 9087c478bd9Sstevel@tonic-gate releasef(fd); 9097c478bd9Sstevel@tonic-gate } 9107c478bd9Sstevel@tonic-gate 9117c478bd9Sstevel@tonic-gate /* null function */ 9127c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 9137c478bd9Sstevel@tonic-gate static void 9147c478bd9Sstevel@tonic-gate auf_null(struct t_audit_data *tad, int error, rval_t *rval) 9157c478bd9Sstevel@tonic-gate { 9167c478bd9Sstevel@tonic-gate } 9177c478bd9Sstevel@tonic-gate 9187c478bd9Sstevel@tonic-gate /* null function */ 9197c478bd9Sstevel@tonic-gate static au_event_t 9207c478bd9Sstevel@tonic-gate aui_null(au_event_t e) 9217c478bd9Sstevel@tonic-gate { 9227c478bd9Sstevel@tonic-gate return (e); 9237c478bd9Sstevel@tonic-gate } 9247c478bd9Sstevel@tonic-gate 9257c478bd9Sstevel@tonic-gate /* convert open to appropriate event */ 9267c478bd9Sstevel@tonic-gate static au_event_t 9277c478bd9Sstevel@tonic-gate aui_open(au_event_t e) 9287c478bd9Sstevel@tonic-gate { 9297c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 9307c478bd9Sstevel@tonic-gate uint_t fm; 9317c478bd9Sstevel@tonic-gate 9327c478bd9Sstevel@tonic-gate struct a { 9337c478bd9Sstevel@tonic-gate long fnamep; /* char * */ 9347c478bd9Sstevel@tonic-gate long fmode; 9357c478bd9Sstevel@tonic-gate long cmode; 9367c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 9377c478bd9Sstevel@tonic-gate 9387c478bd9Sstevel@tonic-gate fm = (uint_t)uap->fmode; 9397c478bd9Sstevel@tonic-gate 9407c478bd9Sstevel@tonic-gate if (fm & O_WRONLY) 9417c478bd9Sstevel@tonic-gate e = AUE_OPEN_W; 9427c478bd9Sstevel@tonic-gate else if (fm & O_RDWR) 9437c478bd9Sstevel@tonic-gate e = AUE_OPEN_RW; 9447c478bd9Sstevel@tonic-gate else 9457c478bd9Sstevel@tonic-gate e = AUE_OPEN_R; 9467c478bd9Sstevel@tonic-gate 9477c478bd9Sstevel@tonic-gate if (fm & O_CREAT) 9487c478bd9Sstevel@tonic-gate e += 1; 9497c478bd9Sstevel@tonic-gate if (fm & O_TRUNC) 9507c478bd9Sstevel@tonic-gate e += 2; 9517c478bd9Sstevel@tonic-gate 9527c478bd9Sstevel@tonic-gate return (e); 9537c478bd9Sstevel@tonic-gate } 9547c478bd9Sstevel@tonic-gate 9557c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 9567c478bd9Sstevel@tonic-gate static void 9577c478bd9Sstevel@tonic-gate aus_open(struct t_audit_data *tad) 9587c478bd9Sstevel@tonic-gate { 9597c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 9607c478bd9Sstevel@tonic-gate uint_t fm; 9617c478bd9Sstevel@tonic-gate 9627c478bd9Sstevel@tonic-gate struct a { 9637c478bd9Sstevel@tonic-gate long fnamep; /* char * */ 9647c478bd9Sstevel@tonic-gate long fmode; 9657c478bd9Sstevel@tonic-gate long cmode; 9667c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 9677c478bd9Sstevel@tonic-gate 9687c478bd9Sstevel@tonic-gate fm = (uint_t)uap->fmode; 9697c478bd9Sstevel@tonic-gate 9707c478bd9Sstevel@tonic-gate /* If no write, create, or trunc modes, mark as a public op */ 9717c478bd9Sstevel@tonic-gate if (!(fm & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))) 9727c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_PUBLIC_EV; 9737c478bd9Sstevel@tonic-gate } 9747c478bd9Sstevel@tonic-gate 9757c478bd9Sstevel@tonic-gate /* convert openat(2) to appropriate event */ 9767c478bd9Sstevel@tonic-gate static au_event_t 9777c478bd9Sstevel@tonic-gate aui_fsat(au_event_t e) 9787c478bd9Sstevel@tonic-gate { 9797c478bd9Sstevel@tonic-gate t_audit_data_t *tad = U2A(u); 9807c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 9817c478bd9Sstevel@tonic-gate uint_t fmcode, fm; 9827c478bd9Sstevel@tonic-gate struct a { 9837c478bd9Sstevel@tonic-gate long id; 9847c478bd9Sstevel@tonic-gate long arg1; 9857c478bd9Sstevel@tonic-gate long arg2; 9867c478bd9Sstevel@tonic-gate long arg3; 9877c478bd9Sstevel@tonic-gate long arg4; 9887c478bd9Sstevel@tonic-gate long arg5; 9897c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 9907c478bd9Sstevel@tonic-gate 9917c478bd9Sstevel@tonic-gate fmcode = (uint_t)uap->id; 9927c478bd9Sstevel@tonic-gate 9937c478bd9Sstevel@tonic-gate switch (fmcode) { 9947c478bd9Sstevel@tonic-gate 9957c478bd9Sstevel@tonic-gate case 0: /* openat */ 9967c478bd9Sstevel@tonic-gate case 1: /* openat64 */ 9977c478bd9Sstevel@tonic-gate fm = (uint_t)uap->arg3; 9987c478bd9Sstevel@tonic-gate if (fm & O_WRONLY) 9997c478bd9Sstevel@tonic-gate e = AUE_OPENAT_W; 10007c478bd9Sstevel@tonic-gate else if (fm & O_RDWR) 10017c478bd9Sstevel@tonic-gate e = AUE_OPENAT_RW; 10027c478bd9Sstevel@tonic-gate else 10037c478bd9Sstevel@tonic-gate e = AUE_OPENAT_R; 10047c478bd9Sstevel@tonic-gate 10057c478bd9Sstevel@tonic-gate /* 10067c478bd9Sstevel@tonic-gate * openat modes are defined in the following order: 10077c478bd9Sstevel@tonic-gate * Read only 10087c478bd9Sstevel@tonic-gate * Read|Create 10097c478bd9Sstevel@tonic-gate * Read|Trunc 10107c478bd9Sstevel@tonic-gate * Read|Create|Trunc 10117c478bd9Sstevel@tonic-gate * Write Only 10127c478bd9Sstevel@tonic-gate * Write|Create 10137c478bd9Sstevel@tonic-gate * Write|Trunc 10147c478bd9Sstevel@tonic-gate * Write|Create|Trunc * RW Only 10157c478bd9Sstevel@tonic-gate * RW|Create 10167c478bd9Sstevel@tonic-gate * RW|Trunc 10177c478bd9Sstevel@tonic-gate * RW|Create|Trunc 10187c478bd9Sstevel@tonic-gate */ 10197c478bd9Sstevel@tonic-gate if (fm & O_CREAT) 10207c478bd9Sstevel@tonic-gate e += 1; /* increment to include CREAT in mode */ 10217c478bd9Sstevel@tonic-gate if (fm & O_TRUNC) 10227c478bd9Sstevel@tonic-gate e += 2; /* increment to include TRUNC in mode */ 10237c478bd9Sstevel@tonic-gate 10247c478bd9Sstevel@tonic-gate /* convert to appropriate au_ctrl */ 10257c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_SAVPATH; 10267c478bd9Sstevel@tonic-gate if (fm & FXATTR) 10277c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_ATPATH; 10287c478bd9Sstevel@tonic-gate 10297c478bd9Sstevel@tonic-gate 10307c478bd9Sstevel@tonic-gate break; 10317c478bd9Sstevel@tonic-gate case 2: /* fstatat64 */ 10327c478bd9Sstevel@tonic-gate case 3: /* fstatat */ 10337c478bd9Sstevel@tonic-gate e = AUE_FSTATAT; 10347c478bd9Sstevel@tonic-gate break; 10357c478bd9Sstevel@tonic-gate case 4: /* fchownat */ 10367c478bd9Sstevel@tonic-gate e = AUE_FCHOWNAT; 10377c478bd9Sstevel@tonic-gate break; 10387c478bd9Sstevel@tonic-gate case 5: /* unlinkat */ 10397c478bd9Sstevel@tonic-gate e = AUE_UNLINKAT; 10407c478bd9Sstevel@tonic-gate break; 10417c478bd9Sstevel@tonic-gate case 6: /* futimesat */ 10427c478bd9Sstevel@tonic-gate e = AUE_FUTIMESAT; 10437c478bd9Sstevel@tonic-gate break; 10447c478bd9Sstevel@tonic-gate case 7: /* renameat */ 10457c478bd9Sstevel@tonic-gate e = AUE_RENAMEAT; 10467c478bd9Sstevel@tonic-gate break; 10477c478bd9Sstevel@tonic-gate default: 10487c478bd9Sstevel@tonic-gate e = AUE_NULL; 10497c478bd9Sstevel@tonic-gate break; 10507c478bd9Sstevel@tonic-gate } 10517c478bd9Sstevel@tonic-gate 10527c478bd9Sstevel@tonic-gate return (e); 10537c478bd9Sstevel@tonic-gate } 10547c478bd9Sstevel@tonic-gate 10557c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 10567c478bd9Sstevel@tonic-gate static void 10577c478bd9Sstevel@tonic-gate aus_fsat(struct t_audit_data *tad) 10587c478bd9Sstevel@tonic-gate { 10597c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 10607c478bd9Sstevel@tonic-gate uint_t fmcode, fm; 10617c478bd9Sstevel@tonic-gate struct a { 10627c478bd9Sstevel@tonic-gate long id; 10637c478bd9Sstevel@tonic-gate long arg1; 10647c478bd9Sstevel@tonic-gate long arg2; 10657c478bd9Sstevel@tonic-gate long arg3; 10667c478bd9Sstevel@tonic-gate long arg4; 10677c478bd9Sstevel@tonic-gate long arg5; 10687c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 10697c478bd9Sstevel@tonic-gate 10707c478bd9Sstevel@tonic-gate fmcode = (uint_t)uap->id; 10717c478bd9Sstevel@tonic-gate 10727c478bd9Sstevel@tonic-gate switch (fmcode) { 10737c478bd9Sstevel@tonic-gate 10747c478bd9Sstevel@tonic-gate case 0: /* openat */ 10757c478bd9Sstevel@tonic-gate case 1: /* openat64 */ 10767c478bd9Sstevel@tonic-gate fm = (uint_t)uap->arg3; 10777c478bd9Sstevel@tonic-gate /* If no write, create, or trunc modes, mark as a public op */ 10787c478bd9Sstevel@tonic-gate if (!(fm & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))) 10797c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_PUBLIC_EV; 10807c478bd9Sstevel@tonic-gate 10817c478bd9Sstevel@tonic-gate break; 10827c478bd9Sstevel@tonic-gate case 2: /* fstatat64 */ 10837c478bd9Sstevel@tonic-gate case 3: /* fstatat */ 10847c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_PUBLIC_EV; 10857c478bd9Sstevel@tonic-gate break; 10867c478bd9Sstevel@tonic-gate default: 10877c478bd9Sstevel@tonic-gate break; 10887c478bd9Sstevel@tonic-gate } 10897c478bd9Sstevel@tonic-gate } 10907c478bd9Sstevel@tonic-gate 10917c478bd9Sstevel@tonic-gate /* msgsys */ 10927c478bd9Sstevel@tonic-gate static au_event_t 10937c478bd9Sstevel@tonic-gate aui_msgsys(au_event_t e) 10947c478bd9Sstevel@tonic-gate { 10957c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 10967c478bd9Sstevel@tonic-gate uint_t fm; 10977c478bd9Sstevel@tonic-gate 10987c478bd9Sstevel@tonic-gate struct a { 10997c478bd9Sstevel@tonic-gate long id; /* function code id */ 11007c478bd9Sstevel@tonic-gate long ap; /* arg pointer for recvmsg */ 11017c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 11027c478bd9Sstevel@tonic-gate 11037c478bd9Sstevel@tonic-gate struct b { 11047c478bd9Sstevel@tonic-gate long msgid; 11057c478bd9Sstevel@tonic-gate long cmd; 11067c478bd9Sstevel@tonic-gate long buf; /* struct msqid_ds * */ 11077c478bd9Sstevel@tonic-gate } *uap1 = (struct b *)&clwp->lwp_ap[1]; 11087c478bd9Sstevel@tonic-gate 11097c478bd9Sstevel@tonic-gate fm = (uint_t)uap->id; 11107c478bd9Sstevel@tonic-gate 11117c478bd9Sstevel@tonic-gate switch (fm) { 11127c478bd9Sstevel@tonic-gate case 0: /* msgget */ 11137c478bd9Sstevel@tonic-gate e = AUE_MSGGET; 11147c478bd9Sstevel@tonic-gate break; 11157c478bd9Sstevel@tonic-gate case 1: /* msgctl */ 11167c478bd9Sstevel@tonic-gate switch ((uint_t)uap1->cmd) { 11177c478bd9Sstevel@tonic-gate case IPC_RMID: 11187c478bd9Sstevel@tonic-gate e = AUE_MSGCTL_RMID; 11197c478bd9Sstevel@tonic-gate break; 11207c478bd9Sstevel@tonic-gate case IPC_SET: 11217c478bd9Sstevel@tonic-gate e = AUE_MSGCTL_SET; 11227c478bd9Sstevel@tonic-gate break; 11237c478bd9Sstevel@tonic-gate case IPC_STAT: 11247c478bd9Sstevel@tonic-gate e = AUE_MSGCTL_STAT; 11257c478bd9Sstevel@tonic-gate break; 11267c478bd9Sstevel@tonic-gate default: 11277c478bd9Sstevel@tonic-gate e = AUE_MSGCTL; 11287c478bd9Sstevel@tonic-gate break; 11297c478bd9Sstevel@tonic-gate } 11307c478bd9Sstevel@tonic-gate break; 11317c478bd9Sstevel@tonic-gate case 2: /* msgrcv */ 11327c478bd9Sstevel@tonic-gate e = AUE_MSGRCV; 11337c478bd9Sstevel@tonic-gate break; 11347c478bd9Sstevel@tonic-gate case 3: /* msgsnd */ 11357c478bd9Sstevel@tonic-gate e = AUE_MSGSND; 11367c478bd9Sstevel@tonic-gate break; 11377c478bd9Sstevel@tonic-gate default: /* illegal system call */ 11387c478bd9Sstevel@tonic-gate e = AUE_NULL; 11397c478bd9Sstevel@tonic-gate break; 11407c478bd9Sstevel@tonic-gate } 11417c478bd9Sstevel@tonic-gate 11427c478bd9Sstevel@tonic-gate return (e); 11437c478bd9Sstevel@tonic-gate } 11447c478bd9Sstevel@tonic-gate 11457c478bd9Sstevel@tonic-gate 11467c478bd9Sstevel@tonic-gate /* shmsys */ 11477c478bd9Sstevel@tonic-gate static au_event_t 11487c478bd9Sstevel@tonic-gate aui_shmsys(au_event_t e) 11497c478bd9Sstevel@tonic-gate { 11507c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 11517c478bd9Sstevel@tonic-gate int fm; 11527c478bd9Sstevel@tonic-gate 11537c478bd9Sstevel@tonic-gate struct a { /* shmsys */ 11547c478bd9Sstevel@tonic-gate long id; /* function code id */ 11557c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 11567c478bd9Sstevel@tonic-gate 11577c478bd9Sstevel@tonic-gate struct b { /* ctrl */ 11587c478bd9Sstevel@tonic-gate long shmid; 11597c478bd9Sstevel@tonic-gate long cmd; 11607c478bd9Sstevel@tonic-gate long arg; /* struct shmid_ds * */ 11617c478bd9Sstevel@tonic-gate } *uap1 = (struct b *)&clwp->lwp_ap[1]; 11627c478bd9Sstevel@tonic-gate fm = (uint_t)uap->id; 11637c478bd9Sstevel@tonic-gate 11647c478bd9Sstevel@tonic-gate switch (fm) { 11657c478bd9Sstevel@tonic-gate case 0: /* shmat */ 11667c478bd9Sstevel@tonic-gate e = AUE_SHMAT; 11677c478bd9Sstevel@tonic-gate break; 11687c478bd9Sstevel@tonic-gate case 1: /* shmctl */ 11697c478bd9Sstevel@tonic-gate switch ((uint_t)uap1->cmd) { 11707c478bd9Sstevel@tonic-gate case IPC_RMID: 11717c478bd9Sstevel@tonic-gate e = AUE_SHMCTL_RMID; 11727c478bd9Sstevel@tonic-gate break; 11737c478bd9Sstevel@tonic-gate case IPC_SET: 11747c478bd9Sstevel@tonic-gate e = AUE_SHMCTL_SET; 11757c478bd9Sstevel@tonic-gate break; 11767c478bd9Sstevel@tonic-gate case IPC_STAT: 11777c478bd9Sstevel@tonic-gate e = AUE_SHMCTL_STAT; 11787c478bd9Sstevel@tonic-gate break; 11797c478bd9Sstevel@tonic-gate default: 11807c478bd9Sstevel@tonic-gate e = AUE_SHMCTL; 11817c478bd9Sstevel@tonic-gate break; 11827c478bd9Sstevel@tonic-gate } 11837c478bd9Sstevel@tonic-gate break; 11847c478bd9Sstevel@tonic-gate case 2: /* shmdt */ 11857c478bd9Sstevel@tonic-gate e = AUE_SHMDT; 11867c478bd9Sstevel@tonic-gate break; 11877c478bd9Sstevel@tonic-gate case 3: /* shmget */ 11887c478bd9Sstevel@tonic-gate e = AUE_SHMGET; 11897c478bd9Sstevel@tonic-gate break; 11907c478bd9Sstevel@tonic-gate default: /* illegal system call */ 11917c478bd9Sstevel@tonic-gate e = AUE_NULL; 11927c478bd9Sstevel@tonic-gate break; 11937c478bd9Sstevel@tonic-gate } 11947c478bd9Sstevel@tonic-gate 11957c478bd9Sstevel@tonic-gate return (e); 11967c478bd9Sstevel@tonic-gate } 11977c478bd9Sstevel@tonic-gate 11987c478bd9Sstevel@tonic-gate 11997c478bd9Sstevel@tonic-gate /* semsys */ 12007c478bd9Sstevel@tonic-gate static au_event_t 12017c478bd9Sstevel@tonic-gate aui_semsys(au_event_t e) 12027c478bd9Sstevel@tonic-gate { 12037c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 12047c478bd9Sstevel@tonic-gate uint_t fm; 12057c478bd9Sstevel@tonic-gate 12067c478bd9Sstevel@tonic-gate struct a { /* semsys */ 12077c478bd9Sstevel@tonic-gate long id; 12087c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 12097c478bd9Sstevel@tonic-gate 12107c478bd9Sstevel@tonic-gate struct b { /* ctrl */ 12117c478bd9Sstevel@tonic-gate long semid; 12127c478bd9Sstevel@tonic-gate long semnum; 12137c478bd9Sstevel@tonic-gate long cmd; 12147c478bd9Sstevel@tonic-gate long arg; 12157c478bd9Sstevel@tonic-gate } *uap1 = (struct b *)&clwp->lwp_ap[1]; 12167c478bd9Sstevel@tonic-gate 12177c478bd9Sstevel@tonic-gate fm = (uint_t)uap->id; 12187c478bd9Sstevel@tonic-gate 12197c478bd9Sstevel@tonic-gate switch (fm) { 12207c478bd9Sstevel@tonic-gate case 0: /* semctl */ 12217c478bd9Sstevel@tonic-gate switch ((uint_t)uap1->cmd) { 12227c478bd9Sstevel@tonic-gate case IPC_RMID: 12237c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_RMID; 12247c478bd9Sstevel@tonic-gate break; 12257c478bd9Sstevel@tonic-gate case IPC_SET: 12267c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_SET; 12277c478bd9Sstevel@tonic-gate break; 12287c478bd9Sstevel@tonic-gate case IPC_STAT: 12297c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_STAT; 12307c478bd9Sstevel@tonic-gate break; 12317c478bd9Sstevel@tonic-gate case GETNCNT: 12327c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_GETNCNT; 12337c478bd9Sstevel@tonic-gate break; 12347c478bd9Sstevel@tonic-gate case GETPID: 12357c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_GETPID; 12367c478bd9Sstevel@tonic-gate break; 12377c478bd9Sstevel@tonic-gate case GETVAL: 12387c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_GETVAL; 12397c478bd9Sstevel@tonic-gate break; 12407c478bd9Sstevel@tonic-gate case GETALL: 12417c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_GETALL; 12427c478bd9Sstevel@tonic-gate break; 12437c478bd9Sstevel@tonic-gate case GETZCNT: 12447c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_GETZCNT; 12457c478bd9Sstevel@tonic-gate break; 12467c478bd9Sstevel@tonic-gate case SETVAL: 12477c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_SETVAL; 12487c478bd9Sstevel@tonic-gate break; 12497c478bd9Sstevel@tonic-gate case SETALL: 12507c478bd9Sstevel@tonic-gate e = AUE_SEMCTL_SETALL; 12517c478bd9Sstevel@tonic-gate break; 12527c478bd9Sstevel@tonic-gate default: 12537c478bd9Sstevel@tonic-gate e = AUE_SEMCTL; 12547c478bd9Sstevel@tonic-gate break; 12557c478bd9Sstevel@tonic-gate } 12567c478bd9Sstevel@tonic-gate break; 12577c478bd9Sstevel@tonic-gate case 1: /* semget */ 12587c478bd9Sstevel@tonic-gate e = AUE_SEMGET; 12597c478bd9Sstevel@tonic-gate break; 12607c478bd9Sstevel@tonic-gate case 2: /* semop */ 12617c478bd9Sstevel@tonic-gate e = AUE_SEMOP; 12627c478bd9Sstevel@tonic-gate break; 12637c478bd9Sstevel@tonic-gate default: /* illegal system call */ 12647c478bd9Sstevel@tonic-gate e = AUE_NULL; 12657c478bd9Sstevel@tonic-gate break; 12667c478bd9Sstevel@tonic-gate } 12677c478bd9Sstevel@tonic-gate 12687c478bd9Sstevel@tonic-gate return (e); 12697c478bd9Sstevel@tonic-gate } 12707c478bd9Sstevel@tonic-gate 12717c478bd9Sstevel@tonic-gate /* utssys - uname(2), ustat(2), fusers(2) */ 12727c478bd9Sstevel@tonic-gate static au_event_t 12737c478bd9Sstevel@tonic-gate aui_utssys(au_event_t e) 12747c478bd9Sstevel@tonic-gate { 12757c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 12767c478bd9Sstevel@tonic-gate uint_t type; 12777c478bd9Sstevel@tonic-gate 12787c478bd9Sstevel@tonic-gate struct a { 12797c478bd9Sstevel@tonic-gate union { 12807c478bd9Sstevel@tonic-gate long cbuf; /* char * */ 12817c478bd9Sstevel@tonic-gate long ubuf; /* struct stat * */ 12827c478bd9Sstevel@tonic-gate } ub; 12837c478bd9Sstevel@tonic-gate union { 12847c478bd9Sstevel@tonic-gate long mv; /* for USTAT */ 12857c478bd9Sstevel@tonic-gate long flags; /* for FUSERS */ 12867c478bd9Sstevel@tonic-gate } un; 12877c478bd9Sstevel@tonic-gate long type; 12887c478bd9Sstevel@tonic-gate long outbp; /* char * for FUSERS */ 12897c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 12907c478bd9Sstevel@tonic-gate 12917c478bd9Sstevel@tonic-gate type = (uint_t)uap->type; 12927c478bd9Sstevel@tonic-gate 12937c478bd9Sstevel@tonic-gate if (type == UTS_FUSERS) 12947c478bd9Sstevel@tonic-gate return (e); 12957c478bd9Sstevel@tonic-gate else 12967c478bd9Sstevel@tonic-gate return ((au_event_t)AUE_NULL); 12977c478bd9Sstevel@tonic-gate } 12987c478bd9Sstevel@tonic-gate 12997c478bd9Sstevel@tonic-gate static au_event_t 13007c478bd9Sstevel@tonic-gate aui_fcntl(au_event_t e) 13017c478bd9Sstevel@tonic-gate { 13027c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 13037c478bd9Sstevel@tonic-gate uint_t cmd; 13047c478bd9Sstevel@tonic-gate 13057c478bd9Sstevel@tonic-gate struct a { 13067c478bd9Sstevel@tonic-gate long fdes; 13077c478bd9Sstevel@tonic-gate long cmd; 13087c478bd9Sstevel@tonic-gate long arg; 13097c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 13107c478bd9Sstevel@tonic-gate 13117c478bd9Sstevel@tonic-gate cmd = (uint_t)uap->cmd; 13127c478bd9Sstevel@tonic-gate 13137c478bd9Sstevel@tonic-gate switch (cmd) { 13147c478bd9Sstevel@tonic-gate case F_GETLK: 13157c478bd9Sstevel@tonic-gate case F_SETLK: 13167c478bd9Sstevel@tonic-gate case F_SETLKW: 13177c478bd9Sstevel@tonic-gate break; 13187c478bd9Sstevel@tonic-gate case F_SETFL: 13197c478bd9Sstevel@tonic-gate case F_GETFL: 13207c478bd9Sstevel@tonic-gate case F_GETFD: 13217c478bd9Sstevel@tonic-gate break; 13227c478bd9Sstevel@tonic-gate default: 13237c478bd9Sstevel@tonic-gate e = (au_event_t)AUE_NULL; 13247c478bd9Sstevel@tonic-gate break; 13257c478bd9Sstevel@tonic-gate } 13267c478bd9Sstevel@tonic-gate return ((au_event_t)e); 13277c478bd9Sstevel@tonic-gate } 13287c478bd9Sstevel@tonic-gate 13297c478bd9Sstevel@tonic-gate /* null function for now */ 13307c478bd9Sstevel@tonic-gate static au_event_t 13317c478bd9Sstevel@tonic-gate aui_execv(au_event_t e) 13327c478bd9Sstevel@tonic-gate { 13337c478bd9Sstevel@tonic-gate return (e); 13347c478bd9Sstevel@tonic-gate } 13357c478bd9Sstevel@tonic-gate 13367c478bd9Sstevel@tonic-gate /* null function for now */ 13377c478bd9Sstevel@tonic-gate static au_event_t 13387c478bd9Sstevel@tonic-gate aui_execve(au_event_t e) 13397c478bd9Sstevel@tonic-gate { 13407c478bd9Sstevel@tonic-gate return (e); 13417c478bd9Sstevel@tonic-gate } 13427c478bd9Sstevel@tonic-gate 13437c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 13447c478bd9Sstevel@tonic-gate static void 13457c478bd9Sstevel@tonic-gate aus_fcntl(struct t_audit_data *tad) 13467c478bd9Sstevel@tonic-gate { 13477c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 13487c478bd9Sstevel@tonic-gate uint32_t cmd, fd; 13497c478bd9Sstevel@tonic-gate struct file *fp; 13507c478bd9Sstevel@tonic-gate struct vnode *vp; 13517c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 13527c478bd9Sstevel@tonic-gate 13537c478bd9Sstevel@tonic-gate struct a { 13547c478bd9Sstevel@tonic-gate long fd; 13557c478bd9Sstevel@tonic-gate long cmd; 13567c478bd9Sstevel@tonic-gate long arg; 13577c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 13587c478bd9Sstevel@tonic-gate 13597c478bd9Sstevel@tonic-gate cmd = (uint32_t)uap->cmd; 13607c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fd; 13617c478bd9Sstevel@tonic-gate 13627c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "cmd", cmd)); 13637c478bd9Sstevel@tonic-gate 13647c478bd9Sstevel@tonic-gate /* 13657c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 13667c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 13677c478bd9Sstevel@tonic-gate */ 13687c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 13697c478bd9Sstevel@tonic-gate return; 13707c478bd9Sstevel@tonic-gate 13717c478bd9Sstevel@tonic-gate /* get path from file struct here */ 13727c478bd9Sstevel@tonic-gate fad = F2A(fp); 13737c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 13747c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 13757c478bd9Sstevel@tonic-gate } else { 13767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 13777c478bd9Sstevel@tonic-gate } 13787c478bd9Sstevel@tonic-gate 13797c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 13807c478bd9Sstevel@tonic-gate audit_attributes(vp); 13817c478bd9Sstevel@tonic-gate 13827c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 13837c478bd9Sstevel@tonic-gate releasef(fd); 13847c478bd9Sstevel@tonic-gate } 13857c478bd9Sstevel@tonic-gate 13867c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 13877c478bd9Sstevel@tonic-gate static void 13887c478bd9Sstevel@tonic-gate aus_kill(struct t_audit_data *tad) 13897c478bd9Sstevel@tonic-gate { 13907c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 13917c478bd9Sstevel@tonic-gate struct proc *p; 13927c478bd9Sstevel@tonic-gate uint32_t signo; 13937c478bd9Sstevel@tonic-gate uid_t uid, ruid; 13947c478bd9Sstevel@tonic-gate gid_t gid, rgid; 13957c478bd9Sstevel@tonic-gate pid_t pid; 13967c478bd9Sstevel@tonic-gate const auditinfo_addr_t *ainfo; 13977c478bd9Sstevel@tonic-gate cred_t *cr; 13987c478bd9Sstevel@tonic-gate 13997c478bd9Sstevel@tonic-gate struct a { 14007c478bd9Sstevel@tonic-gate long pid; 14017c478bd9Sstevel@tonic-gate long signo; 14027c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 14037c478bd9Sstevel@tonic-gate 14047c478bd9Sstevel@tonic-gate pid = (pid_t)uap->pid; 14057c478bd9Sstevel@tonic-gate signo = (uint32_t)uap->signo; 14067c478bd9Sstevel@tonic-gate 14077c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "signal", signo)); 14087c478bd9Sstevel@tonic-gate if (pid > 0) { 14097c478bd9Sstevel@tonic-gate mutex_enter(&pidlock); 14107c478bd9Sstevel@tonic-gate if (((p = prfind(pid)) == (struct proc *)0) || 14117c478bd9Sstevel@tonic-gate (p->p_stat == SIDL)) { 14127c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 14137c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "process", (uint32_t)pid)); 14147c478bd9Sstevel@tonic-gate return; 14157c478bd9Sstevel@tonic-gate } 14167c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock); /* so process doesn't go away */ 14177c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 14187c478bd9Sstevel@tonic-gate 14197c478bd9Sstevel@tonic-gate mutex_enter(&p->p_crlock); 14207c478bd9Sstevel@tonic-gate crhold(cr = p->p_cred); 14217c478bd9Sstevel@tonic-gate mutex_exit(&p->p_crlock); 14227c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock); 14237c478bd9Sstevel@tonic-gate 14247c478bd9Sstevel@tonic-gate ainfo = crgetauinfo(cr); 14257c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 14267c478bd9Sstevel@tonic-gate crfree(cr); 14277c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "process", (uint32_t)pid)); 14287c478bd9Sstevel@tonic-gate return; 14297c478bd9Sstevel@tonic-gate } 14307c478bd9Sstevel@tonic-gate 14317c478bd9Sstevel@tonic-gate uid = crgetuid(cr); 14327c478bd9Sstevel@tonic-gate gid = crgetgid(cr); 14337c478bd9Sstevel@tonic-gate ruid = crgetruid(cr); 14347c478bd9Sstevel@tonic-gate rgid = crgetrgid(cr); 14357c478bd9Sstevel@tonic-gate au_uwrite(au_to_process(uid, gid, ruid, rgid, pid, 14367c478bd9Sstevel@tonic-gate ainfo->ai_auid, ainfo->ai_asid, &ainfo->ai_termid)); 143745916cd2Sjpk 143845916cd2Sjpk if (is_system_labeled()) 143945916cd2Sjpk au_uwrite(au_to_label(CR_SL(cr))); 144045916cd2Sjpk 14417c478bd9Sstevel@tonic-gate crfree(cr); 14427c478bd9Sstevel@tonic-gate } 14437c478bd9Sstevel@tonic-gate else 14447c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "process", (uint32_t)pid)); 14457c478bd9Sstevel@tonic-gate } 14467c478bd9Sstevel@tonic-gate 14477c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 14487c478bd9Sstevel@tonic-gate static void 14497c478bd9Sstevel@tonic-gate aus_mkdir(struct t_audit_data *tad) 14507c478bd9Sstevel@tonic-gate { 14517c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 14527c478bd9Sstevel@tonic-gate uint32_t dmode; 14537c478bd9Sstevel@tonic-gate 14547c478bd9Sstevel@tonic-gate struct a { 14557c478bd9Sstevel@tonic-gate long dirnamep; /* char * */ 14567c478bd9Sstevel@tonic-gate long dmode; 14577c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 14587c478bd9Sstevel@tonic-gate 14597c478bd9Sstevel@tonic-gate dmode = (uint32_t)uap->dmode; 14607c478bd9Sstevel@tonic-gate 14617c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "mode", dmode)); 14627c478bd9Sstevel@tonic-gate } 14637c478bd9Sstevel@tonic-gate 14647c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 14657c478bd9Sstevel@tonic-gate static void 14667c478bd9Sstevel@tonic-gate aus_mknod(struct t_audit_data *tad) 14677c478bd9Sstevel@tonic-gate { 14687c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 14697c478bd9Sstevel@tonic-gate uint32_t fmode; 14707c478bd9Sstevel@tonic-gate dev_t dev; 14717c478bd9Sstevel@tonic-gate 14727c478bd9Sstevel@tonic-gate struct a { 14737c478bd9Sstevel@tonic-gate long pnamep; /* char * */ 14747c478bd9Sstevel@tonic-gate long fmode; 14757c478bd9Sstevel@tonic-gate long dev; 14767c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 14777c478bd9Sstevel@tonic-gate 14787c478bd9Sstevel@tonic-gate fmode = (uint32_t)uap->fmode; 14797c478bd9Sstevel@tonic-gate dev = (dev_t)uap->dev; 14807c478bd9Sstevel@tonic-gate 14817c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "mode", fmode)); 14827c478bd9Sstevel@tonic-gate #ifdef _LP64 14837c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(3, "dev", dev)); 14847c478bd9Sstevel@tonic-gate #else 14857c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "dev", dev)); 14867c478bd9Sstevel@tonic-gate #endif 14877c478bd9Sstevel@tonic-gate } 14887c478bd9Sstevel@tonic-gate 14897c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 14907c478bd9Sstevel@tonic-gate static void 14917c478bd9Sstevel@tonic-gate aus_xmknod(struct t_audit_data *tad) 14927c478bd9Sstevel@tonic-gate { 14937c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 14947c478bd9Sstevel@tonic-gate uint32_t fmode; 14957c478bd9Sstevel@tonic-gate dev_t dev; 14967c478bd9Sstevel@tonic-gate 14977c478bd9Sstevel@tonic-gate struct a { 14987c478bd9Sstevel@tonic-gate long version; /* version */ 14997c478bd9Sstevel@tonic-gate long pnamep; /* char * */ 15007c478bd9Sstevel@tonic-gate long fmode; 15017c478bd9Sstevel@tonic-gate long dev; 15027c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 15037c478bd9Sstevel@tonic-gate 15047c478bd9Sstevel@tonic-gate fmode = (uint32_t)uap->fmode; 15057c478bd9Sstevel@tonic-gate dev = (dev_t)uap->dev; 15067c478bd9Sstevel@tonic-gate 15077c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "mode", fmode)); 15087c478bd9Sstevel@tonic-gate #ifdef _LP64 15097c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(3, "dev", dev)); 15107c478bd9Sstevel@tonic-gate #else 15117c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "dev", dev)); 15127c478bd9Sstevel@tonic-gate #endif 15137c478bd9Sstevel@tonic-gate } 15147c478bd9Sstevel@tonic-gate 15157c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 15167c478bd9Sstevel@tonic-gate static void 15177c478bd9Sstevel@tonic-gate auf_mknod(struct t_audit_data *tad, int error, rval_t *rval) 15187c478bd9Sstevel@tonic-gate { 15197c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 15207c478bd9Sstevel@tonic-gate vnode_t *dvp; 15217c478bd9Sstevel@tonic-gate caddr_t pnamep; 15227c478bd9Sstevel@tonic-gate 15237c478bd9Sstevel@tonic-gate struct a { 15247c478bd9Sstevel@tonic-gate long pnamep; /* char * */ 15257c478bd9Sstevel@tonic-gate long fmode; 15267c478bd9Sstevel@tonic-gate long dev; 15277c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 15287c478bd9Sstevel@tonic-gate 15297c478bd9Sstevel@tonic-gate /* no error, then already path token in audit record */ 15307c478bd9Sstevel@tonic-gate if (error != EPERM) 15317c478bd9Sstevel@tonic-gate return; 15327c478bd9Sstevel@tonic-gate 15337c478bd9Sstevel@tonic-gate /* not auditing this event, nothing then to do */ 15347c478bd9Sstevel@tonic-gate if (tad->tad_flag == 0) 15357c478bd9Sstevel@tonic-gate return; 15367c478bd9Sstevel@tonic-gate 15377c478bd9Sstevel@tonic-gate /* do the lookup to force generation of path token */ 15387c478bd9Sstevel@tonic-gate pnamep = (caddr_t)uap->pnamep; 15397c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_NOATTRB; 15407c478bd9Sstevel@tonic-gate error = lookupname(pnamep, UIO_USERSPACE, NO_FOLLOW, &dvp, NULLVPP); 15417c478bd9Sstevel@tonic-gate if (error == 0) 15427c478bd9Sstevel@tonic-gate VN_RELE(dvp); 15437c478bd9Sstevel@tonic-gate } 15447c478bd9Sstevel@tonic-gate 15457c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 15467c478bd9Sstevel@tonic-gate static void 15477c478bd9Sstevel@tonic-gate auf_xmknod(struct t_audit_data *tad, int error, rval_t *rval) 15487c478bd9Sstevel@tonic-gate { 15497c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 15507c478bd9Sstevel@tonic-gate vnode_t *dvp; 15517c478bd9Sstevel@tonic-gate caddr_t pnamep; 15527c478bd9Sstevel@tonic-gate 15537c478bd9Sstevel@tonic-gate struct a { 15547c478bd9Sstevel@tonic-gate long version; /* version */ 15557c478bd9Sstevel@tonic-gate long pnamep; /* char * */ 15567c478bd9Sstevel@tonic-gate long fmode; 15577c478bd9Sstevel@tonic-gate long dev; 15587c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_arg; 15597c478bd9Sstevel@tonic-gate 15607c478bd9Sstevel@tonic-gate 15617c478bd9Sstevel@tonic-gate /* no error, then already path token in audit record */ 15627c478bd9Sstevel@tonic-gate if (error != EPERM) 15637c478bd9Sstevel@tonic-gate return; 15647c478bd9Sstevel@tonic-gate 15657c478bd9Sstevel@tonic-gate /* not auditing this event, nothing then to do */ 15667c478bd9Sstevel@tonic-gate if (tad->tad_flag == 0) 15677c478bd9Sstevel@tonic-gate return; 15687c478bd9Sstevel@tonic-gate 15697c478bd9Sstevel@tonic-gate /* do the lookup to force generation of path token */ 15707c478bd9Sstevel@tonic-gate pnamep = (caddr_t)uap->pnamep; 15717c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_NOATTRB; 15727c478bd9Sstevel@tonic-gate error = lookupname(pnamep, UIO_USERSPACE, NO_FOLLOW, &dvp, NULLVPP); 15737c478bd9Sstevel@tonic-gate if (error == 0) 15747c478bd9Sstevel@tonic-gate VN_RELE(dvp); 15757c478bd9Sstevel@tonic-gate } 15767c478bd9Sstevel@tonic-gate 15777c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 15787c478bd9Sstevel@tonic-gate static void 15797c478bd9Sstevel@tonic-gate aus_mount(struct t_audit_data *tad) 15807c478bd9Sstevel@tonic-gate { /* AUS_START */ 15817c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 15827c478bd9Sstevel@tonic-gate uint32_t flags; 15837c478bd9Sstevel@tonic-gate uintptr_t u_fstype, dataptr; 15847c478bd9Sstevel@tonic-gate STRUCT_DECL(nfs_args, nfsargs); 15857c478bd9Sstevel@tonic-gate size_t len; 15867c478bd9Sstevel@tonic-gate char *fstype, *hostname; 15877c478bd9Sstevel@tonic-gate 15887c478bd9Sstevel@tonic-gate struct a { 15897c478bd9Sstevel@tonic-gate long spec; /* char * */ 15907c478bd9Sstevel@tonic-gate long dir; /* char * */ 15917c478bd9Sstevel@tonic-gate long flags; 15927c478bd9Sstevel@tonic-gate long fstype; /* char * */ 15937c478bd9Sstevel@tonic-gate long dataptr; /* char * */ 15947c478bd9Sstevel@tonic-gate long datalen; 15957c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 15967c478bd9Sstevel@tonic-gate 15977c478bd9Sstevel@tonic-gate u_fstype = (uintptr_t)uap->fstype; 15987c478bd9Sstevel@tonic-gate flags = (uint32_t)uap->flags; 15997c478bd9Sstevel@tonic-gate dataptr = (uintptr_t)uap->dataptr; 16007c478bd9Sstevel@tonic-gate 16017c478bd9Sstevel@tonic-gate fstype = kmem_alloc(MAXNAMELEN, KM_SLEEP); 16027c478bd9Sstevel@tonic-gate if (copyinstr((caddr_t)u_fstype, (caddr_t)fstype, MAXNAMELEN, &len)) 16037c478bd9Sstevel@tonic-gate goto mount_free_fstype; 16047c478bd9Sstevel@tonic-gate 16057c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", flags)); 16067c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(fstype)); 16077c478bd9Sstevel@tonic-gate 16087c478bd9Sstevel@tonic-gate if (strncmp(fstype, "nfs", 3) == 0) { 16097c478bd9Sstevel@tonic-gate 16107c478bd9Sstevel@tonic-gate STRUCT_INIT(nfsargs, get_udatamodel()); 16117c478bd9Sstevel@tonic-gate bzero(STRUCT_BUF(nfsargs), STRUCT_SIZE(nfsargs)); 16127c478bd9Sstevel@tonic-gate 16137c478bd9Sstevel@tonic-gate if (copyin((caddr_t)dataptr, 16147c478bd9Sstevel@tonic-gate STRUCT_BUF(nfsargs), 16157c478bd9Sstevel@tonic-gate MIN(uap->datalen, STRUCT_SIZE(nfsargs)))) { 16167c478bd9Sstevel@tonic-gate /* DEBUG debug_enter((char *)NULL); */ 16177c478bd9Sstevel@tonic-gate goto mount_free_fstype; 16187c478bd9Sstevel@tonic-gate } 16197c478bd9Sstevel@tonic-gate hostname = kmem_alloc(MAXNAMELEN, KM_SLEEP); 16207c478bd9Sstevel@tonic-gate if (copyinstr(STRUCT_FGETP(nfsargs, hostname), 16217c478bd9Sstevel@tonic-gate (caddr_t)hostname, 16227c478bd9Sstevel@tonic-gate MAXNAMELEN, &len)) { 16237c478bd9Sstevel@tonic-gate goto mount_free_hostname; 16247c478bd9Sstevel@tonic-gate } 16257c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(hostname)); 16267c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "internal flags", 16277c478bd9Sstevel@tonic-gate (uint_t)STRUCT_FGET(nfsargs, flags))); 16287c478bd9Sstevel@tonic-gate 16297c478bd9Sstevel@tonic-gate mount_free_hostname: 16307c478bd9Sstevel@tonic-gate kmem_free(hostname, MAXNAMELEN); 16317c478bd9Sstevel@tonic-gate } 16327c478bd9Sstevel@tonic-gate 16337c478bd9Sstevel@tonic-gate mount_free_fstype: 16347c478bd9Sstevel@tonic-gate kmem_free(fstype, MAXNAMELEN); 16357c478bd9Sstevel@tonic-gate } /* AUS_MOUNT */ 16367c478bd9Sstevel@tonic-gate 16377c478bd9Sstevel@tonic-gate static void 16387c478bd9Sstevel@tonic-gate aus_umount_path(caddr_t umount_dir) 16397c478bd9Sstevel@tonic-gate { 16407c478bd9Sstevel@tonic-gate char *dir_path; 16417c478bd9Sstevel@tonic-gate struct audit_path *path; 16427c478bd9Sstevel@tonic-gate size_t path_len, dir_len; 16437c478bd9Sstevel@tonic-gate 16447c478bd9Sstevel@tonic-gate /* length alloc'd for two string pointers */ 16457c478bd9Sstevel@tonic-gate path_len = sizeof (struct audit_path) + sizeof (char *); 16467c478bd9Sstevel@tonic-gate path = kmem_alloc(path_len, KM_SLEEP); 16477c478bd9Sstevel@tonic-gate dir_path = kmem_alloc(MAXPATHLEN, KM_SLEEP); 16487c478bd9Sstevel@tonic-gate 16497c478bd9Sstevel@tonic-gate if (copyinstr(umount_dir, (caddr_t)dir_path, 16507c478bd9Sstevel@tonic-gate MAXPATHLEN, &dir_len)) 16517c478bd9Sstevel@tonic-gate goto umount2_free_dir; 16527c478bd9Sstevel@tonic-gate 16537c478bd9Sstevel@tonic-gate /* 16547c478bd9Sstevel@tonic-gate * the audit_path struct assumes that the buffer pointed to 16557c478bd9Sstevel@tonic-gate * by audp_sect[n] contains string 0 immediatedly followed 16567c478bd9Sstevel@tonic-gate * by string 1. 16577c478bd9Sstevel@tonic-gate */ 16587c478bd9Sstevel@tonic-gate path->audp_sect[0] = dir_path; 16597c478bd9Sstevel@tonic-gate path->audp_sect[1] = dir_path + strlen(dir_path) + 1; 16607c478bd9Sstevel@tonic-gate path->audp_size = path_len; 16617c478bd9Sstevel@tonic-gate path->audp_ref = 1; /* not used */ 16627c478bd9Sstevel@tonic-gate path->audp_cnt = 1; /* one path string */ 16637c478bd9Sstevel@tonic-gate 16647c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(path)); 16657c478bd9Sstevel@tonic-gate 16667c478bd9Sstevel@tonic-gate umount2_free_dir: 16677c478bd9Sstevel@tonic-gate kmem_free(dir_path, MAXPATHLEN); 16687c478bd9Sstevel@tonic-gate kmem_free(path, path_len); 16697c478bd9Sstevel@tonic-gate } 16707c478bd9Sstevel@tonic-gate 16717c478bd9Sstevel@tonic-gate /* 16727c478bd9Sstevel@tonic-gate * the umount syscall is implemented as a call to umount2, but the args 16737c478bd9Sstevel@tonic-gate * are different... 16747c478bd9Sstevel@tonic-gate */ 16757c478bd9Sstevel@tonic-gate 16767c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 16777c478bd9Sstevel@tonic-gate static void 16787c478bd9Sstevel@tonic-gate aus_umount(struct t_audit_data *tad) 16797c478bd9Sstevel@tonic-gate { 16807c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 16817c478bd9Sstevel@tonic-gate struct a { 16827c478bd9Sstevel@tonic-gate long dir; /* char * */ 16837c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 16847c478bd9Sstevel@tonic-gate 16857c478bd9Sstevel@tonic-gate aus_umount_path((caddr_t)uap->dir); 16867c478bd9Sstevel@tonic-gate } 16877c478bd9Sstevel@tonic-gate 16887c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 16897c478bd9Sstevel@tonic-gate static void 16907c478bd9Sstevel@tonic-gate aus_umount2(struct t_audit_data *tad) 16917c478bd9Sstevel@tonic-gate { 16927c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 16937c478bd9Sstevel@tonic-gate struct a { 16947c478bd9Sstevel@tonic-gate long dir; /* char * */ 16957c478bd9Sstevel@tonic-gate long flags; 16967c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 16977c478bd9Sstevel@tonic-gate 16987c478bd9Sstevel@tonic-gate aus_umount_path((caddr_t)uap->dir); 16997c478bd9Sstevel@tonic-gate 17007c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "flags", (uint32_t)uap->flags)); 17017c478bd9Sstevel@tonic-gate } 17027c478bd9Sstevel@tonic-gate 17037c478bd9Sstevel@tonic-gate static void 17047c478bd9Sstevel@tonic-gate aus_msgsys(struct t_audit_data *tad) 17057c478bd9Sstevel@tonic-gate { 17067c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 17077c478bd9Sstevel@tonic-gate uint32_t msgid; 17087c478bd9Sstevel@tonic-gate 17097c478bd9Sstevel@tonic-gate struct b { 17107c478bd9Sstevel@tonic-gate long msgid; 17117c478bd9Sstevel@tonic-gate long cmd; 17127c478bd9Sstevel@tonic-gate long buf; /* struct msqid_ds * */ 17137c478bd9Sstevel@tonic-gate } *uap1 = (struct b *)&clwp->lwp_ap[1]; 17147c478bd9Sstevel@tonic-gate 17157c478bd9Sstevel@tonic-gate msgid = (uint32_t)uap1->msgid; 17167c478bd9Sstevel@tonic-gate 17177c478bd9Sstevel@tonic-gate 17187c478bd9Sstevel@tonic-gate switch (tad->tad_event) { 17197c478bd9Sstevel@tonic-gate case AUE_MSGGET: /* msgget */ 17207c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "msg key", msgid)); 17217c478bd9Sstevel@tonic-gate break; 17227c478bd9Sstevel@tonic-gate case AUE_MSGCTL: /* msgctl */ 17237c478bd9Sstevel@tonic-gate case AUE_MSGCTL_RMID: /* msgctl */ 17247c478bd9Sstevel@tonic-gate case AUE_MSGCTL_STAT: /* msgctl */ 17257c478bd9Sstevel@tonic-gate case AUE_MSGRCV: /* msgrcv */ 17267c478bd9Sstevel@tonic-gate case AUE_MSGSND: /* msgsnd */ 17277c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "msg ID", msgid)); 17287c478bd9Sstevel@tonic-gate break; 17297c478bd9Sstevel@tonic-gate case AUE_MSGCTL_SET: /* msgctl */ 17307c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "msg ID", msgid)); 17317c478bd9Sstevel@tonic-gate break; 17327c478bd9Sstevel@tonic-gate } 17337c478bd9Sstevel@tonic-gate } 17347c478bd9Sstevel@tonic-gate 17357c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 17367c478bd9Sstevel@tonic-gate static void 17377c478bd9Sstevel@tonic-gate auf_msgsys(struct t_audit_data *tad, int error, rval_t *rval) 17387c478bd9Sstevel@tonic-gate { 17397c478bd9Sstevel@tonic-gate int id; 17407c478bd9Sstevel@tonic-gate 17417c478bd9Sstevel@tonic-gate if (error != 0) 17427c478bd9Sstevel@tonic-gate return; 17437c478bd9Sstevel@tonic-gate if (tad->tad_event == AUE_MSGGET) { 17447c478bd9Sstevel@tonic-gate uint32_t scid; 17457c478bd9Sstevel@tonic-gate uint32_t sy_flags; 17467c478bd9Sstevel@tonic-gate 17477c478bd9Sstevel@tonic-gate /* need to determine type of executing binary */ 17487c478bd9Sstevel@tonic-gate scid = tad->tad_scid; 17497c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 17507c478bd9Sstevel@tonic-gate if (lwp_getdatamodel(ttolwp(curthread)) == DATAMODEL_NATIVE) 17517c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 17527c478bd9Sstevel@tonic-gate else 17537c478bd9Sstevel@tonic-gate sy_flags = sysent32[scid].sy_flags & SE_RVAL_MASK; 17547c478bd9Sstevel@tonic-gate #else 17557c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 17567c478bd9Sstevel@tonic-gate #endif 17577c478bd9Sstevel@tonic-gate if (sy_flags == SE_32RVAL1) 17587c478bd9Sstevel@tonic-gate id = rval->r_val1; 17597c478bd9Sstevel@tonic-gate if (sy_flags == (SE_32RVAL2|SE_32RVAL1)) 17607c478bd9Sstevel@tonic-gate id = rval->r_val1; 17617c478bd9Sstevel@tonic-gate if (sy_flags == SE_64RVAL) 17627c478bd9Sstevel@tonic-gate id = (int)rval->r_vals; 17637c478bd9Sstevel@tonic-gate 17647c478bd9Sstevel@tonic-gate au_uwrite(au_to_ipc(AT_IPC_MSG, id)); 17657c478bd9Sstevel@tonic-gate } 17667c478bd9Sstevel@tonic-gate } 17677c478bd9Sstevel@tonic-gate 17687c478bd9Sstevel@tonic-gate static void 17697c478bd9Sstevel@tonic-gate aus_semsys(struct t_audit_data *tad) 17707c478bd9Sstevel@tonic-gate { 17717c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 17727c478bd9Sstevel@tonic-gate uint32_t semid; 17737c478bd9Sstevel@tonic-gate 17747c478bd9Sstevel@tonic-gate struct b { /* ctrl */ 17757c478bd9Sstevel@tonic-gate long semid; 17767c478bd9Sstevel@tonic-gate long semnum; 17777c478bd9Sstevel@tonic-gate long cmd; 17787c478bd9Sstevel@tonic-gate long arg; 17797c478bd9Sstevel@tonic-gate } *uap1 = (struct b *)&clwp->lwp_ap[1]; 17807c478bd9Sstevel@tonic-gate 17817c478bd9Sstevel@tonic-gate semid = (uint32_t)uap1->semid; 17827c478bd9Sstevel@tonic-gate 17837c478bd9Sstevel@tonic-gate switch (tad->tad_event) { 17847c478bd9Sstevel@tonic-gate case AUE_SEMCTL_RMID: 17857c478bd9Sstevel@tonic-gate case AUE_SEMCTL_STAT: 17867c478bd9Sstevel@tonic-gate case AUE_SEMCTL_GETNCNT: 17877c478bd9Sstevel@tonic-gate case AUE_SEMCTL_GETPID: 17887c478bd9Sstevel@tonic-gate case AUE_SEMCTL_GETVAL: 17897c478bd9Sstevel@tonic-gate case AUE_SEMCTL_GETALL: 17907c478bd9Sstevel@tonic-gate case AUE_SEMCTL_GETZCNT: 17917c478bd9Sstevel@tonic-gate case AUE_SEMCTL_SETVAL: 17927c478bd9Sstevel@tonic-gate case AUE_SEMCTL_SETALL: 17937c478bd9Sstevel@tonic-gate case AUE_SEMCTL: 17947c478bd9Sstevel@tonic-gate case AUE_SEMOP: 17957c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "sem ID", semid)); 17967c478bd9Sstevel@tonic-gate break; 17977c478bd9Sstevel@tonic-gate case AUE_SEMCTL_SET: 17987c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "sem ID", semid)); 17997c478bd9Sstevel@tonic-gate break; 18007c478bd9Sstevel@tonic-gate case AUE_SEMGET: 18017c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "sem key", semid)); 18027c478bd9Sstevel@tonic-gate break; 18037c478bd9Sstevel@tonic-gate } 18047c478bd9Sstevel@tonic-gate } 18057c478bd9Sstevel@tonic-gate 18067c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 18077c478bd9Sstevel@tonic-gate static void 18087c478bd9Sstevel@tonic-gate auf_semsys(struct t_audit_data *tad, int error, rval_t *rval) 18097c478bd9Sstevel@tonic-gate { 18107c478bd9Sstevel@tonic-gate int id; 18117c478bd9Sstevel@tonic-gate 18127c478bd9Sstevel@tonic-gate if (error != 0) 18137c478bd9Sstevel@tonic-gate return; 18147c478bd9Sstevel@tonic-gate if (tad->tad_event == AUE_SEMGET) { 18157c478bd9Sstevel@tonic-gate uint32_t scid; 18167c478bd9Sstevel@tonic-gate uint32_t sy_flags; 18177c478bd9Sstevel@tonic-gate 18187c478bd9Sstevel@tonic-gate /* need to determine type of executing binary */ 18197c478bd9Sstevel@tonic-gate scid = tad->tad_scid; 18207c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 18217c478bd9Sstevel@tonic-gate if (lwp_getdatamodel(ttolwp(curthread)) == DATAMODEL_NATIVE) 18227c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 18237c478bd9Sstevel@tonic-gate else 18247c478bd9Sstevel@tonic-gate sy_flags = sysent32[scid].sy_flags & SE_RVAL_MASK; 18257c478bd9Sstevel@tonic-gate #else 18267c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 18277c478bd9Sstevel@tonic-gate #endif 18287c478bd9Sstevel@tonic-gate if (sy_flags == SE_32RVAL1) 18297c478bd9Sstevel@tonic-gate id = rval->r_val1; 18307c478bd9Sstevel@tonic-gate if (sy_flags == (SE_32RVAL2|SE_32RVAL1)) 18317c478bd9Sstevel@tonic-gate id = rval->r_val1; 18327c478bd9Sstevel@tonic-gate if (sy_flags == SE_64RVAL) 18337c478bd9Sstevel@tonic-gate id = (int)rval->r_vals; 18347c478bd9Sstevel@tonic-gate 18357c478bd9Sstevel@tonic-gate au_uwrite(au_to_ipc(AT_IPC_SEM, id)); 18367c478bd9Sstevel@tonic-gate } 18377c478bd9Sstevel@tonic-gate } 18387c478bd9Sstevel@tonic-gate 18397c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 18407c478bd9Sstevel@tonic-gate static void 18417c478bd9Sstevel@tonic-gate aus_close(struct t_audit_data *tad) 18427c478bd9Sstevel@tonic-gate { 18437c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 18447c478bd9Sstevel@tonic-gate uint32_t fd; 18457c478bd9Sstevel@tonic-gate struct file *fp; 18467c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 18477c478bd9Sstevel@tonic-gate struct vnode *vp; 18487c478bd9Sstevel@tonic-gate struct vattr attr; 18499e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 18507c478bd9Sstevel@tonic-gate 18517c478bd9Sstevel@tonic-gate struct a { 18527c478bd9Sstevel@tonic-gate long i; 18537c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 18547c478bd9Sstevel@tonic-gate 18557c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->i; 18567c478bd9Sstevel@tonic-gate 18577c478bd9Sstevel@tonic-gate attr.va_mask = 0; 18587c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "fd", fd)); 18597c478bd9Sstevel@tonic-gate 18607c478bd9Sstevel@tonic-gate /* 18617c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 18627c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 18637c478bd9Sstevel@tonic-gate */ 18647c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 18657c478bd9Sstevel@tonic-gate return; 18667c478bd9Sstevel@tonic-gate 18677c478bd9Sstevel@tonic-gate fad = F2A(fp); 18687c478bd9Sstevel@tonic-gate tad->tad_evmod = (short)fad->fad_flags; 18697c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 18707c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 18717c478bd9Sstevel@tonic-gate if ((vp = fp->f_vnode) != NULL) { 18727c478bd9Sstevel@tonic-gate attr.va_mask = AT_ALL; 18737c478bd9Sstevel@tonic-gate if (VOP_GETATTR(vp, &attr, 0, CRED()) == 0) { 18747c478bd9Sstevel@tonic-gate /* 18757c478bd9Sstevel@tonic-gate * When write was not used and the file can be 18767c478bd9Sstevel@tonic-gate * considered public, skip the audit. 18777c478bd9Sstevel@tonic-gate */ 18787c478bd9Sstevel@tonic-gate if (((fp->f_flag & FWRITE) == 0) && 18797c478bd9Sstevel@tonic-gate file_is_public(&attr)) { 18807c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 18817c478bd9Sstevel@tonic-gate tad->tad_evmod = 0; 18827c478bd9Sstevel@tonic-gate /* free any residual audit data */ 18837c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 18847c478bd9Sstevel@tonic-gate releasef(fd); 18857c478bd9Sstevel@tonic-gate return; 18867c478bd9Sstevel@tonic-gate } 188745916cd2Sjpk au_uwrite(au_to_attr(&attr)); 188845916cd2Sjpk audit_sec_attributes(&(u_ad), vp); 18897c478bd9Sstevel@tonic-gate } 18907c478bd9Sstevel@tonic-gate } 18917c478bd9Sstevel@tonic-gate } 18927c478bd9Sstevel@tonic-gate 18937c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 18947c478bd9Sstevel@tonic-gate releasef(fd); 18957c478bd9Sstevel@tonic-gate } 18967c478bd9Sstevel@tonic-gate 18977c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 18987c478bd9Sstevel@tonic-gate static void 18997c478bd9Sstevel@tonic-gate aus_fstatfs(struct t_audit_data *tad) 19007c478bd9Sstevel@tonic-gate { 19017c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 19027c478bd9Sstevel@tonic-gate uint32_t fd; 19037c478bd9Sstevel@tonic-gate struct file *fp; 19047c478bd9Sstevel@tonic-gate struct vnode *vp; 19057c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 19067c478bd9Sstevel@tonic-gate 19077c478bd9Sstevel@tonic-gate struct a { 19087c478bd9Sstevel@tonic-gate long fd; 19097c478bd9Sstevel@tonic-gate long buf; /* struct statfs * */ 19107c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 19117c478bd9Sstevel@tonic-gate 19127c478bd9Sstevel@tonic-gate fd = (uint_t)uap->fd; 19137c478bd9Sstevel@tonic-gate 19147c478bd9Sstevel@tonic-gate /* 19157c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 19167c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 19177c478bd9Sstevel@tonic-gate */ 19187c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 19197c478bd9Sstevel@tonic-gate return; 19207c478bd9Sstevel@tonic-gate 19217c478bd9Sstevel@tonic-gate /* get path from file struct here */ 19227c478bd9Sstevel@tonic-gate fad = F2A(fp); 19237c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 19247c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 19257c478bd9Sstevel@tonic-gate } else { 19267c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 19277c478bd9Sstevel@tonic-gate } 19287c478bd9Sstevel@tonic-gate 19297c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 19307c478bd9Sstevel@tonic-gate audit_attributes(vp); 19317c478bd9Sstevel@tonic-gate 19327c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 19337c478bd9Sstevel@tonic-gate releasef(fd); 19347c478bd9Sstevel@tonic-gate } 19357c478bd9Sstevel@tonic-gate 19367c478bd9Sstevel@tonic-gate #ifdef NOTYET 19377c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 19387c478bd9Sstevel@tonic-gate static void 19397c478bd9Sstevel@tonic-gate aus_setpgrp(struct t_audit_data *tad) 19407c478bd9Sstevel@tonic-gate { 19417c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 19427c478bd9Sstevel@tonic-gate uint32_t pgrp; 19437c478bd9Sstevel@tonic-gate struct proc *p; 19447c478bd9Sstevel@tonic-gate uid_t uid, ruid; 19457c478bd9Sstevel@tonic-gate gid_t gid, rgid; 19467c478bd9Sstevel@tonic-gate pid_t pid; 19477c478bd9Sstevel@tonic-gate const auditinfo_addr_t *ainfo; 19487c478bd9Sstevel@tonic-gate cred_t *cr; 19497c478bd9Sstevel@tonic-gate 19507c478bd9Sstevel@tonic-gate struct a { 19517c478bd9Sstevel@tonic-gate long pid; 19527c478bd9Sstevel@tonic-gate long pgrp; 19537c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 19547c478bd9Sstevel@tonic-gate 19557c478bd9Sstevel@tonic-gate pid = (pid_t)uap->pid; 19567c478bd9Sstevel@tonic-gate pgrp = (uint32_t)uap->pgrp; 19577c478bd9Sstevel@tonic-gate 19587c478bd9Sstevel@tonic-gate /* current process? */ 19597c478bd9Sstevel@tonic-gate if (pid == 0) 19607c478bd9Sstevel@tonic-gate (return); 19617c478bd9Sstevel@tonic-gate 19627c478bd9Sstevel@tonic-gate mutex_enter(&pidlock); 19637c478bd9Sstevel@tonic-gate p = prfind(pid); 19647c478bd9Sstevel@tonic-gate if (p == NULL || p->p_as == &kas) { 19657c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 19667c478bd9Sstevel@tonic-gate return; 19677c478bd9Sstevel@tonic-gate } 19687c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock); /* so process doesn't go away */ 19697c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 19707c478bd9Sstevel@tonic-gate 19717c478bd9Sstevel@tonic-gate mutex_enter(&p->p_crlock); 19727c478bd9Sstevel@tonic-gate crhold(cr = p->p_cred); 19737c478bd9Sstevel@tonic-gate mutex_exit(&p->p_crlock); 19747c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock); 19757c478bd9Sstevel@tonic-gate 19767c478bd9Sstevel@tonic-gate ainfo = crgetauinfo(cr); 19777c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 19787c478bd9Sstevel@tonic-gate crfree(cr); 19797c478bd9Sstevel@tonic-gate return; 19807c478bd9Sstevel@tonic-gate } 19817c478bd9Sstevel@tonic-gate 19827c478bd9Sstevel@tonic-gate uid = crgetuid(cr); 19837c478bd9Sstevel@tonic-gate gid = crgetgid(cr); 19847c478bd9Sstevel@tonic-gate ruid = crgetruid(cr); 19857c478bd9Sstevel@tonic-gate rgid = crgetrgid(cr); 19867c478bd9Sstevel@tonic-gate au_uwrite(au_to_process(uid, gid, ruid, rgid, pid, 19877c478bd9Sstevel@tonic-gate ainfo->ai_auid, ainfo->ai_asid, &ainfo->ai_termid)); 19887c478bd9Sstevel@tonic-gate crfree(cr); 19897c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "pgrp", pgrp)); 19907c478bd9Sstevel@tonic-gate } 19917c478bd9Sstevel@tonic-gate #endif 19927c478bd9Sstevel@tonic-gate 19937c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 19947c478bd9Sstevel@tonic-gate static void 19957c478bd9Sstevel@tonic-gate aus_setregid(struct t_audit_data *tad) 19967c478bd9Sstevel@tonic-gate { 19977c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 19987c478bd9Sstevel@tonic-gate uint32_t rgid, egid; 19997c478bd9Sstevel@tonic-gate 20007c478bd9Sstevel@tonic-gate struct a { 20017c478bd9Sstevel@tonic-gate long rgid; 20027c478bd9Sstevel@tonic-gate long egid; 20037c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 20047c478bd9Sstevel@tonic-gate 20057c478bd9Sstevel@tonic-gate rgid = (uint32_t)uap->rgid; 20067c478bd9Sstevel@tonic-gate egid = (uint32_t)uap->egid; 20077c478bd9Sstevel@tonic-gate 20087c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "rgid", rgid)); 20097c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "egid", egid)); 20107c478bd9Sstevel@tonic-gate } 20117c478bd9Sstevel@tonic-gate 20127c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 20137c478bd9Sstevel@tonic-gate static void 20147c478bd9Sstevel@tonic-gate aus_setgid(struct t_audit_data *tad) 20157c478bd9Sstevel@tonic-gate { 20167c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 20177c478bd9Sstevel@tonic-gate uint32_t gid; 20187c478bd9Sstevel@tonic-gate 20197c478bd9Sstevel@tonic-gate struct a { 20207c478bd9Sstevel@tonic-gate long gid; 20217c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 20227c478bd9Sstevel@tonic-gate 20237c478bd9Sstevel@tonic-gate gid = (uint32_t)uap->gid; 20247c478bd9Sstevel@tonic-gate 20257c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "gid", gid)); 20267c478bd9Sstevel@tonic-gate } 20277c478bd9Sstevel@tonic-gate 20287c478bd9Sstevel@tonic-gate 20297c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 20307c478bd9Sstevel@tonic-gate static void 20317c478bd9Sstevel@tonic-gate aus_setreuid(struct t_audit_data *tad) 20327c478bd9Sstevel@tonic-gate { 20337c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 20347c478bd9Sstevel@tonic-gate uint32_t ruid, euid; 20357c478bd9Sstevel@tonic-gate 20367c478bd9Sstevel@tonic-gate struct a { 20377c478bd9Sstevel@tonic-gate long ruid; 20387c478bd9Sstevel@tonic-gate long euid; 20397c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 20407c478bd9Sstevel@tonic-gate 20417c478bd9Sstevel@tonic-gate ruid = (uint32_t)uap->ruid; 20427c478bd9Sstevel@tonic-gate euid = (uint32_t)uap->euid; 20437c478bd9Sstevel@tonic-gate 20447c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "ruid", ruid)); 20457c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "euid", euid)); 20467c478bd9Sstevel@tonic-gate } 20477c478bd9Sstevel@tonic-gate 20487c478bd9Sstevel@tonic-gate 20497c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 20507c478bd9Sstevel@tonic-gate static void 20517c478bd9Sstevel@tonic-gate aus_setuid(struct t_audit_data *tad) 20527c478bd9Sstevel@tonic-gate { 20537c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 20547c478bd9Sstevel@tonic-gate uint32_t uid; 20557c478bd9Sstevel@tonic-gate 20567c478bd9Sstevel@tonic-gate struct a { 20577c478bd9Sstevel@tonic-gate long uid; 20587c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 20597c478bd9Sstevel@tonic-gate 20607c478bd9Sstevel@tonic-gate uid = (uint32_t)uap->uid; 20617c478bd9Sstevel@tonic-gate 20627c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "uid", uid)); 20637c478bd9Sstevel@tonic-gate } 20647c478bd9Sstevel@tonic-gate 20657c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 20667c478bd9Sstevel@tonic-gate static void 20677c478bd9Sstevel@tonic-gate aus_shmsys(struct t_audit_data *tad) 20687c478bd9Sstevel@tonic-gate { 20697c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 20707c478bd9Sstevel@tonic-gate uint32_t id, cmd; 20717c478bd9Sstevel@tonic-gate 20727c478bd9Sstevel@tonic-gate struct b { 20737c478bd9Sstevel@tonic-gate long id; 20747c478bd9Sstevel@tonic-gate long cmd; 20757c478bd9Sstevel@tonic-gate long buf; /* struct shmid_ds * */ 20767c478bd9Sstevel@tonic-gate } *uap1 = (struct b *)&clwp->lwp_ap[1]; 20777c478bd9Sstevel@tonic-gate 20787c478bd9Sstevel@tonic-gate id = (uint32_t)uap1->id; 20797c478bd9Sstevel@tonic-gate cmd = (uint32_t)uap1->cmd; 20807c478bd9Sstevel@tonic-gate 20817c478bd9Sstevel@tonic-gate switch (tad->tad_event) { 20827c478bd9Sstevel@tonic-gate case AUE_SHMGET: /* shmget */ 20837c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "shm key", id)); 20847c478bd9Sstevel@tonic-gate break; 20857c478bd9Sstevel@tonic-gate case AUE_SHMCTL: /* shmctl */ 20867c478bd9Sstevel@tonic-gate case AUE_SHMCTL_RMID: /* shmctl */ 20877c478bd9Sstevel@tonic-gate case AUE_SHMCTL_STAT: /* shmctl */ 20887c478bd9Sstevel@tonic-gate case AUE_SHMCTL_SET: /* shmctl */ 20897c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "shm ID", id)); 20907c478bd9Sstevel@tonic-gate break; 20917c478bd9Sstevel@tonic-gate case AUE_SHMDT: /* shmdt */ 20927c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "shm adr", id)); 20937c478bd9Sstevel@tonic-gate break; 20947c478bd9Sstevel@tonic-gate case AUE_SHMAT: /* shmat */ 20957c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "shm ID", id)); 20967c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "shm adr", cmd)); 20977c478bd9Sstevel@tonic-gate break; 20987c478bd9Sstevel@tonic-gate } 20997c478bd9Sstevel@tonic-gate } 21007c478bd9Sstevel@tonic-gate 21017c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 21027c478bd9Sstevel@tonic-gate static void 21037c478bd9Sstevel@tonic-gate auf_shmsys(struct t_audit_data *tad, int error, rval_t *rval) 21047c478bd9Sstevel@tonic-gate { 21057c478bd9Sstevel@tonic-gate int id; 21067c478bd9Sstevel@tonic-gate 21077c478bd9Sstevel@tonic-gate if (error != 0) 21087c478bd9Sstevel@tonic-gate return; 21097c478bd9Sstevel@tonic-gate if (tad->tad_event == AUE_SHMGET) { 21107c478bd9Sstevel@tonic-gate uint32_t scid; 21117c478bd9Sstevel@tonic-gate uint32_t sy_flags; 21127c478bd9Sstevel@tonic-gate 21137c478bd9Sstevel@tonic-gate /* need to determine type of executing binary */ 21147c478bd9Sstevel@tonic-gate scid = tad->tad_scid; 21157c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 21167c478bd9Sstevel@tonic-gate if (lwp_getdatamodel(ttolwp(curthread)) == DATAMODEL_NATIVE) 21177c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 21187c478bd9Sstevel@tonic-gate else 21197c478bd9Sstevel@tonic-gate sy_flags = sysent32[scid].sy_flags & SE_RVAL_MASK; 21207c478bd9Sstevel@tonic-gate #else 21217c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 21227c478bd9Sstevel@tonic-gate #endif 21237c478bd9Sstevel@tonic-gate if (sy_flags == SE_32RVAL1) 21247c478bd9Sstevel@tonic-gate id = rval->r_val1; 21257c478bd9Sstevel@tonic-gate if (sy_flags == (SE_32RVAL2|SE_32RVAL1)) 21267c478bd9Sstevel@tonic-gate id = rval->r_val1; 21277c478bd9Sstevel@tonic-gate if (sy_flags == SE_64RVAL) 21287c478bd9Sstevel@tonic-gate id = (int)rval->r_vals; 21297c478bd9Sstevel@tonic-gate au_uwrite(au_to_ipc(AT_IPC_SHM, id)); 21307c478bd9Sstevel@tonic-gate } 21317c478bd9Sstevel@tonic-gate } 21327c478bd9Sstevel@tonic-gate 21337c478bd9Sstevel@tonic-gate 21347c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 21357c478bd9Sstevel@tonic-gate static void 21367c478bd9Sstevel@tonic-gate aus_ioctl(struct t_audit_data *tad) 21377c478bd9Sstevel@tonic-gate { 21387c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 21397c478bd9Sstevel@tonic-gate struct file *fp; 21407c478bd9Sstevel@tonic-gate struct vnode *vp; 21417c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 21427c478bd9Sstevel@tonic-gate uint32_t fd, cmd; 21437c478bd9Sstevel@tonic-gate uintptr_t cmarg; 21447c478bd9Sstevel@tonic-gate 21457c478bd9Sstevel@tonic-gate /* XX64 */ 21467c478bd9Sstevel@tonic-gate struct a { 21477c478bd9Sstevel@tonic-gate long fd; 21487c478bd9Sstevel@tonic-gate long cmd; 21497c478bd9Sstevel@tonic-gate long cmarg; /* caddr_t */ 21507c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 21517c478bd9Sstevel@tonic-gate 21527c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fd; 21537c478bd9Sstevel@tonic-gate cmd = (uint32_t)uap->cmd; 21547c478bd9Sstevel@tonic-gate cmarg = (uintptr_t)uap->cmarg; 21557c478bd9Sstevel@tonic-gate 21567c478bd9Sstevel@tonic-gate /* 21577c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 21587c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 21597c478bd9Sstevel@tonic-gate */ 21607c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) { 21617c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "fd", fd)); 21627c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "cmd", cmd)); 21637c478bd9Sstevel@tonic-gate #ifndef _LP64 21647c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "arg", (uint32_t)cmarg)); 21657c478bd9Sstevel@tonic-gate #else 21667c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(3, "arg", (uint64_t)cmarg)); 21677c478bd9Sstevel@tonic-gate #endif 21687c478bd9Sstevel@tonic-gate return; 21697c478bd9Sstevel@tonic-gate } 21707c478bd9Sstevel@tonic-gate 21717c478bd9Sstevel@tonic-gate /* get path from file struct here */ 21727c478bd9Sstevel@tonic-gate fad = F2A(fp); 21737c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 21747c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 21757c478bd9Sstevel@tonic-gate } else { 21767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 21777c478bd9Sstevel@tonic-gate } 21787c478bd9Sstevel@tonic-gate 21797c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 21807c478bd9Sstevel@tonic-gate audit_attributes(vp); 21817c478bd9Sstevel@tonic-gate 21827c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 21837c478bd9Sstevel@tonic-gate releasef(fd); 21847c478bd9Sstevel@tonic-gate 21857c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "cmd", cmd)); 21867c478bd9Sstevel@tonic-gate #ifndef _LP64 21877c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "arg", (uint32_t)cmarg)); 21887c478bd9Sstevel@tonic-gate #else 21897c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(3, "arg", (uint64_t)cmarg)); 21907c478bd9Sstevel@tonic-gate #endif 21917c478bd9Sstevel@tonic-gate } 21927c478bd9Sstevel@tonic-gate 21937c478bd9Sstevel@tonic-gate /* 21947c478bd9Sstevel@tonic-gate * null function for memcntl for now. We might want to limit memcntl() 21957c478bd9Sstevel@tonic-gate * auditing to commands: MC_LOCKAS, MC_LOCK, MC_UNLOCKAS, MC_UNLOCK which 21967c478bd9Sstevel@tonic-gate * require privileges. 21977c478bd9Sstevel@tonic-gate */ 21987c478bd9Sstevel@tonic-gate static au_event_t 21997c478bd9Sstevel@tonic-gate aui_memcntl(au_event_t e) 22007c478bd9Sstevel@tonic-gate { 22017c478bd9Sstevel@tonic-gate return (e); 22027c478bd9Sstevel@tonic-gate } 22037c478bd9Sstevel@tonic-gate 22047c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 22057c478bd9Sstevel@tonic-gate static au_event_t 22067c478bd9Sstevel@tonic-gate aui_privsys(au_event_t e) 22077c478bd9Sstevel@tonic-gate { 22087c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 22097c478bd9Sstevel@tonic-gate 22107c478bd9Sstevel@tonic-gate struct a { 22117c478bd9Sstevel@tonic-gate long opcode; 22127c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 22137c478bd9Sstevel@tonic-gate 22147c478bd9Sstevel@tonic-gate switch (uap->opcode) { 22157c478bd9Sstevel@tonic-gate case PRIVSYS_SETPPRIV: 22167c478bd9Sstevel@tonic-gate return (AUE_SETPPRIV); 22177c478bd9Sstevel@tonic-gate default: 22187c478bd9Sstevel@tonic-gate return (AUE_NULL); 22197c478bd9Sstevel@tonic-gate } 22207c478bd9Sstevel@tonic-gate } 22217c478bd9Sstevel@tonic-gate 22227c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 22237c478bd9Sstevel@tonic-gate static void 22247c478bd9Sstevel@tonic-gate aus_memcntl(struct t_audit_data *tad) 22257c478bd9Sstevel@tonic-gate { 22267c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 22277c478bd9Sstevel@tonic-gate 22287c478bd9Sstevel@tonic-gate struct a { 22297c478bd9Sstevel@tonic-gate long addr; 22307c478bd9Sstevel@tonic-gate long len; 22317c478bd9Sstevel@tonic-gate long cmd; 22327c478bd9Sstevel@tonic-gate long arg; 22337c478bd9Sstevel@tonic-gate long attr; 22347c478bd9Sstevel@tonic-gate long mask; 22357c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 22367c478bd9Sstevel@tonic-gate 22377c478bd9Sstevel@tonic-gate #ifdef _LP64 22387c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(1, "base", (uint64_t)uap->addr)); 22397c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(2, "len", (uint64_t)uap->len)); 22407c478bd9Sstevel@tonic-gate #else 22417c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "base", (uint32_t)uap->addr)); 22427c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "len", (uint32_t)uap->len)); 22437c478bd9Sstevel@tonic-gate #endif 22447c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "cmd", (uint_t)uap->cmd)); 22457c478bd9Sstevel@tonic-gate #ifdef _LP64 22467c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(4, "arg", (uint64_t)uap->arg)); 22477c478bd9Sstevel@tonic-gate #else 22487c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(4, "arg", (uint32_t)uap->arg)); 22497c478bd9Sstevel@tonic-gate #endif 22507c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(5, "attr", (uint_t)uap->attr)); 22517c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(6, "mask", (uint_t)uap->mask)); 22527c478bd9Sstevel@tonic-gate } 22537c478bd9Sstevel@tonic-gate 22547c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 22557c478bd9Sstevel@tonic-gate static void 22567c478bd9Sstevel@tonic-gate aus_mmap(struct t_audit_data *tad) 22577c478bd9Sstevel@tonic-gate { 22587c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 22597c478bd9Sstevel@tonic-gate struct file *fp; 22607c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 22617c478bd9Sstevel@tonic-gate struct vnode *vp; 22627c478bd9Sstevel@tonic-gate uint32_t fd; 22637c478bd9Sstevel@tonic-gate 22647c478bd9Sstevel@tonic-gate struct a { 22657c478bd9Sstevel@tonic-gate long addr; 22667c478bd9Sstevel@tonic-gate long len; 22677c478bd9Sstevel@tonic-gate long prot; 22687c478bd9Sstevel@tonic-gate long flags; 22697c478bd9Sstevel@tonic-gate long fd; 22707c478bd9Sstevel@tonic-gate long pos; 22717c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 22727c478bd9Sstevel@tonic-gate 22737c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fd; 22747c478bd9Sstevel@tonic-gate 22757c478bd9Sstevel@tonic-gate #ifdef _LP64 22767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(1, "addr", (uint64_t)uap->addr)); 22777c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(2, "len", (uint64_t)uap->len)); 22787c478bd9Sstevel@tonic-gate #else 22797c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "addr", (uint32_t)uap->addr)); 22807c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "len", (uint32_t)uap->len)); 22817c478bd9Sstevel@tonic-gate #endif 22827c478bd9Sstevel@tonic-gate 22837c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) { 22847c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(5, "fd", (uint32_t)uap->fd)); 22857c478bd9Sstevel@tonic-gate return; 22867c478bd9Sstevel@tonic-gate } 22877c478bd9Sstevel@tonic-gate 22887c478bd9Sstevel@tonic-gate /* 22897c478bd9Sstevel@tonic-gate * Mark in the tad if write access is NOT requested... if 22907c478bd9Sstevel@tonic-gate * this is later detected (in audit_attributes) to be a 22917c478bd9Sstevel@tonic-gate * public object, the mmap event may be discarded. 22927c478bd9Sstevel@tonic-gate */ 22937c478bd9Sstevel@tonic-gate if (((uap->prot) & PROT_WRITE) == 0) { 22947c478bd9Sstevel@tonic-gate tad->tad_ctrl |= PAD_PUBLIC_EV; 22957c478bd9Sstevel@tonic-gate } 22967c478bd9Sstevel@tonic-gate 22977c478bd9Sstevel@tonic-gate fad = F2A(fp); 22987c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 22997c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 23007c478bd9Sstevel@tonic-gate } else { 23017c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 23027c478bd9Sstevel@tonic-gate } 23037c478bd9Sstevel@tonic-gate 23047c478bd9Sstevel@tonic-gate vp = (struct vnode *)fp->f_vnode; 23057c478bd9Sstevel@tonic-gate audit_attributes(vp); 23067c478bd9Sstevel@tonic-gate 23077c478bd9Sstevel@tonic-gate /* mark READ/WRITE since we can't predict access */ 23087c478bd9Sstevel@tonic-gate if (uap->prot & PROT_READ) 23097c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 23107c478bd9Sstevel@tonic-gate if (uap->prot & PROT_WRITE) 23117c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 23127c478bd9Sstevel@tonic-gate 23137c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 23147c478bd9Sstevel@tonic-gate releasef(fd); 23157c478bd9Sstevel@tonic-gate 23167c478bd9Sstevel@tonic-gate } /* AUS_MMAP */ 23177c478bd9Sstevel@tonic-gate 23187c478bd9Sstevel@tonic-gate 23197c478bd9Sstevel@tonic-gate 23207c478bd9Sstevel@tonic-gate 23217c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 23227c478bd9Sstevel@tonic-gate static void 23237c478bd9Sstevel@tonic-gate aus_munmap(struct t_audit_data *tad) 23247c478bd9Sstevel@tonic-gate { 23257c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 23267c478bd9Sstevel@tonic-gate 23277c478bd9Sstevel@tonic-gate struct a { 23287c478bd9Sstevel@tonic-gate long addr; 23297c478bd9Sstevel@tonic-gate long len; 23307c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 23317c478bd9Sstevel@tonic-gate 23327c478bd9Sstevel@tonic-gate #ifdef _LP64 23337c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(1, "addr", (uint64_t)uap->addr)); 23347c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64(2, "len", (uint64_t)uap->len)); 23357c478bd9Sstevel@tonic-gate #else 23367c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "addr", (uint32_t)uap->addr)); 23377c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "len", (uint32_t)uap->len)); 23387c478bd9Sstevel@tonic-gate #endif 23397c478bd9Sstevel@tonic-gate 23407c478bd9Sstevel@tonic-gate } /* AUS_MUNMAP */ 23417c478bd9Sstevel@tonic-gate 23427c478bd9Sstevel@tonic-gate 23437c478bd9Sstevel@tonic-gate 23447c478bd9Sstevel@tonic-gate 23457c478bd9Sstevel@tonic-gate 23467c478bd9Sstevel@tonic-gate 23477c478bd9Sstevel@tonic-gate 23487c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 23497c478bd9Sstevel@tonic-gate static void 23507c478bd9Sstevel@tonic-gate aus_priocntlsys(struct t_audit_data *tad) 23517c478bd9Sstevel@tonic-gate { 23527c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 23537c478bd9Sstevel@tonic-gate 23547c478bd9Sstevel@tonic-gate struct a { 23557c478bd9Sstevel@tonic-gate long pc_version; 23567c478bd9Sstevel@tonic-gate long psp; /* procset_t */ 23577c478bd9Sstevel@tonic-gate long cmd; 23587c478bd9Sstevel@tonic-gate long arg; 23597c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 23607c478bd9Sstevel@tonic-gate 23617c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "pc_version", (uint32_t)uap->pc_version)); 23627c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "cmd", (uint32_t)uap->cmd)); 23637c478bd9Sstevel@tonic-gate 23647c478bd9Sstevel@tonic-gate } /* AUS_PRIOCNTLSYS */ 23657c478bd9Sstevel@tonic-gate 23667c478bd9Sstevel@tonic-gate 23677c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 23687c478bd9Sstevel@tonic-gate static void 23697c478bd9Sstevel@tonic-gate aus_setegid(struct t_audit_data *tad) 23707c478bd9Sstevel@tonic-gate { 23717c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 23727c478bd9Sstevel@tonic-gate uint32_t gid; 23737c478bd9Sstevel@tonic-gate 23747c478bd9Sstevel@tonic-gate struct a { 23757c478bd9Sstevel@tonic-gate long gid; 23767c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 23777c478bd9Sstevel@tonic-gate 23787c478bd9Sstevel@tonic-gate gid = (uint32_t)uap->gid; 23797c478bd9Sstevel@tonic-gate 23807c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "gid", gid)); 23817c478bd9Sstevel@tonic-gate } /* AUS_SETEGID */ 23827c478bd9Sstevel@tonic-gate 23837c478bd9Sstevel@tonic-gate 23847c478bd9Sstevel@tonic-gate 23857c478bd9Sstevel@tonic-gate 23867c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 23877c478bd9Sstevel@tonic-gate static void 23887c478bd9Sstevel@tonic-gate aus_setgroups(struct t_audit_data *tad) 23897c478bd9Sstevel@tonic-gate { 23907c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 23917c478bd9Sstevel@tonic-gate int i; 23927c478bd9Sstevel@tonic-gate int gidsetsize; 23937c478bd9Sstevel@tonic-gate uintptr_t gidset; 23947c478bd9Sstevel@tonic-gate gid_t *gidlist; 23957c478bd9Sstevel@tonic-gate 23967c478bd9Sstevel@tonic-gate struct a { 23977c478bd9Sstevel@tonic-gate long gidsetsize; 23987c478bd9Sstevel@tonic-gate long gidset; 23997c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 24007c478bd9Sstevel@tonic-gate 24017c478bd9Sstevel@tonic-gate gidsetsize = (uint_t)uap->gidsetsize; 24027c478bd9Sstevel@tonic-gate gidset = (uintptr_t)uap->gidset; 24037c478bd9Sstevel@tonic-gate 24047c478bd9Sstevel@tonic-gate if ((gidsetsize > NGROUPS_MAX_DEFAULT) || (gidsetsize < 0)) 24057c478bd9Sstevel@tonic-gate return; 24067c478bd9Sstevel@tonic-gate if (gidsetsize != 0) { 24077c478bd9Sstevel@tonic-gate gidlist = kmem_alloc(gidsetsize * sizeof (gid_t), 24087c478bd9Sstevel@tonic-gate KM_SLEEP); 24097c478bd9Sstevel@tonic-gate if (copyin((caddr_t)gidset, gidlist, 24107c478bd9Sstevel@tonic-gate gidsetsize * sizeof (gid_t)) == 0) 24117c478bd9Sstevel@tonic-gate for (i = 0; i < gidsetsize; i++) 24127c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "setgroups", 24137c478bd9Sstevel@tonic-gate (uint32_t)gidlist[i])); 24147c478bd9Sstevel@tonic-gate kmem_free(gidlist, gidsetsize * sizeof (gid_t)); 24157c478bd9Sstevel@tonic-gate } else 24167c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "setgroups", (uint32_t)0)); 24177c478bd9Sstevel@tonic-gate 24187c478bd9Sstevel@tonic-gate } /* AUS_SETGROUPS */ 24197c478bd9Sstevel@tonic-gate 24207c478bd9Sstevel@tonic-gate 24217c478bd9Sstevel@tonic-gate 24227c478bd9Sstevel@tonic-gate 24237c478bd9Sstevel@tonic-gate 24247c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 24257c478bd9Sstevel@tonic-gate static void 24267c478bd9Sstevel@tonic-gate aus_seteuid(struct t_audit_data *tad) 24277c478bd9Sstevel@tonic-gate { 24287c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 24297c478bd9Sstevel@tonic-gate uint32_t uid; 24307c478bd9Sstevel@tonic-gate 24317c478bd9Sstevel@tonic-gate struct a { 24327c478bd9Sstevel@tonic-gate long uid; 24337c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 24347c478bd9Sstevel@tonic-gate 24357c478bd9Sstevel@tonic-gate uid = (uint32_t)uap->uid; 24367c478bd9Sstevel@tonic-gate 24377c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "euid", uid)); 24387c478bd9Sstevel@tonic-gate 24397c478bd9Sstevel@tonic-gate } /* AUS_SETEUID */ 24407c478bd9Sstevel@tonic-gate 24417c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 24427c478bd9Sstevel@tonic-gate static void 24437c478bd9Sstevel@tonic-gate aus_putmsg(struct t_audit_data *tad) 24447c478bd9Sstevel@tonic-gate { 24457c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 24467c478bd9Sstevel@tonic-gate uint32_t fd, pri; 24477c478bd9Sstevel@tonic-gate struct file *fp; 24487c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 24497c478bd9Sstevel@tonic-gate 24507c478bd9Sstevel@tonic-gate struct a { 24517c478bd9Sstevel@tonic-gate long fdes; 24527c478bd9Sstevel@tonic-gate long ctl; /* struct strbuf * */ 24537c478bd9Sstevel@tonic-gate long data; /* struct strbuf * */ 24547c478bd9Sstevel@tonic-gate long pri; 24557c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 24567c478bd9Sstevel@tonic-gate 24577c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fdes; 24587c478bd9Sstevel@tonic-gate pri = (uint32_t)uap->pri; 24597c478bd9Sstevel@tonic-gate 24607c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "fd", fd)); 24617c478bd9Sstevel@tonic-gate 24627c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) != NULL) { 24637c478bd9Sstevel@tonic-gate fad = F2A(fp); 24647c478bd9Sstevel@tonic-gate 24657c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 24667c478bd9Sstevel@tonic-gate 24677c478bd9Sstevel@tonic-gate /* add path name to audit record */ 24687c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 24697c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 24707c478bd9Sstevel@tonic-gate } 24717c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 24727c478bd9Sstevel@tonic-gate 24737c478bd9Sstevel@tonic-gate releasef(fd); 24747c478bd9Sstevel@tonic-gate } 24757c478bd9Sstevel@tonic-gate 24767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(4, "pri", pri)); 24777c478bd9Sstevel@tonic-gate } 24787c478bd9Sstevel@tonic-gate 24797c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 24807c478bd9Sstevel@tonic-gate static void 24817c478bd9Sstevel@tonic-gate aus_putpmsg(struct t_audit_data *tad) 24827c478bd9Sstevel@tonic-gate { 24837c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 24847c478bd9Sstevel@tonic-gate uint32_t fd, pri, flags; 24857c478bd9Sstevel@tonic-gate struct file *fp; 24867c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 24877c478bd9Sstevel@tonic-gate 24887c478bd9Sstevel@tonic-gate struct a { 24897c478bd9Sstevel@tonic-gate long fdes; 24907c478bd9Sstevel@tonic-gate long ctl; /* struct strbuf * */ 24917c478bd9Sstevel@tonic-gate long data; /* struct strbuf * */ 24927c478bd9Sstevel@tonic-gate long pri; 24937c478bd9Sstevel@tonic-gate long flags; 24947c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 24957c478bd9Sstevel@tonic-gate 24967c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fdes; 24977c478bd9Sstevel@tonic-gate pri = (uint32_t)uap->pri; 24987c478bd9Sstevel@tonic-gate flags = (uint32_t)uap->flags; 24997c478bd9Sstevel@tonic-gate 25007c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "fd", fd)); 25017c478bd9Sstevel@tonic-gate 25027c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) != NULL) { 25037c478bd9Sstevel@tonic-gate fad = F2A(fp); 25047c478bd9Sstevel@tonic-gate 25057c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 25067c478bd9Sstevel@tonic-gate 25077c478bd9Sstevel@tonic-gate /* add path name to audit record */ 25087c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 25097c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 25107c478bd9Sstevel@tonic-gate } 25117c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 25127c478bd9Sstevel@tonic-gate 25137c478bd9Sstevel@tonic-gate releasef(fd); 25147c478bd9Sstevel@tonic-gate } 25157c478bd9Sstevel@tonic-gate 25167c478bd9Sstevel@tonic-gate 25177c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(4, "pri", pri)); 25187c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(5, "flags", flags)); 25197c478bd9Sstevel@tonic-gate } 25207c478bd9Sstevel@tonic-gate 25217c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 25227c478bd9Sstevel@tonic-gate static void 25237c478bd9Sstevel@tonic-gate aus_getmsg(struct t_audit_data *tad) 25247c478bd9Sstevel@tonic-gate { 25257c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 25267c478bd9Sstevel@tonic-gate uint32_t fd, pri; 25277c478bd9Sstevel@tonic-gate struct file *fp; 25287c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 25297c478bd9Sstevel@tonic-gate 25307c478bd9Sstevel@tonic-gate struct a { 25317c478bd9Sstevel@tonic-gate long fdes; 25327c478bd9Sstevel@tonic-gate long ctl; /* struct strbuf * */ 25337c478bd9Sstevel@tonic-gate long data; /* struct strbuf * */ 25347c478bd9Sstevel@tonic-gate long pri; 25357c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 25367c478bd9Sstevel@tonic-gate 25377c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fdes; 25387c478bd9Sstevel@tonic-gate pri = (uint32_t)uap->pri; 25397c478bd9Sstevel@tonic-gate 25407c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "fd", fd)); 25417c478bd9Sstevel@tonic-gate 25427c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) != NULL) { 25437c478bd9Sstevel@tonic-gate fad = F2A(fp); 25447c478bd9Sstevel@tonic-gate 25457c478bd9Sstevel@tonic-gate /* 25467c478bd9Sstevel@tonic-gate * read operation on this object 25477c478bd9Sstevel@tonic-gate */ 25487c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 25497c478bd9Sstevel@tonic-gate 25507c478bd9Sstevel@tonic-gate /* add path name to audit record */ 25517c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 25527c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 25537c478bd9Sstevel@tonic-gate } 25547c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 25557c478bd9Sstevel@tonic-gate 25567c478bd9Sstevel@tonic-gate releasef(fd); 25577c478bd9Sstevel@tonic-gate } 25587c478bd9Sstevel@tonic-gate 25597c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(4, "pri", pri)); 25607c478bd9Sstevel@tonic-gate } 25617c478bd9Sstevel@tonic-gate 25627c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 25637c478bd9Sstevel@tonic-gate static void 25647c478bd9Sstevel@tonic-gate aus_getpmsg(struct t_audit_data *tad) 25657c478bd9Sstevel@tonic-gate { 25667c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 25677c478bd9Sstevel@tonic-gate uint32_t fd; 25687c478bd9Sstevel@tonic-gate struct file *fp; 25697c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 25707c478bd9Sstevel@tonic-gate 25717c478bd9Sstevel@tonic-gate struct a { 25727c478bd9Sstevel@tonic-gate long fdes; 25737c478bd9Sstevel@tonic-gate long ctl; /* struct strbuf * */ 25747c478bd9Sstevel@tonic-gate long data; /* struct strbuf * */ 25757c478bd9Sstevel@tonic-gate long pri; 25767c478bd9Sstevel@tonic-gate long flags; 25777c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 25787c478bd9Sstevel@tonic-gate 25797c478bd9Sstevel@tonic-gate fd = (uint32_t)uap->fdes; 25807c478bd9Sstevel@tonic-gate 25817c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "fd", fd)); 25827c478bd9Sstevel@tonic-gate 25837c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) != NULL) { 25847c478bd9Sstevel@tonic-gate fad = F2A(fp); 25857c478bd9Sstevel@tonic-gate 25867c478bd9Sstevel@tonic-gate /* 25877c478bd9Sstevel@tonic-gate * read operation on this object 25887c478bd9Sstevel@tonic-gate */ 25897c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 25907c478bd9Sstevel@tonic-gate 25917c478bd9Sstevel@tonic-gate /* add path name to audit record */ 25927c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 25937c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 25947c478bd9Sstevel@tonic-gate } 25957c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 25967c478bd9Sstevel@tonic-gate 25977c478bd9Sstevel@tonic-gate releasef(fd); 25987c478bd9Sstevel@tonic-gate } 25997c478bd9Sstevel@tonic-gate } 26007c478bd9Sstevel@tonic-gate 26017c478bd9Sstevel@tonic-gate static au_event_t 26027c478bd9Sstevel@tonic-gate aui_auditsys(au_event_t e) 26037c478bd9Sstevel@tonic-gate { 26047c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 26057c478bd9Sstevel@tonic-gate uint32_t code; 26067c478bd9Sstevel@tonic-gate 26077c478bd9Sstevel@tonic-gate struct a { 26087c478bd9Sstevel@tonic-gate long code; 26097c478bd9Sstevel@tonic-gate long a1; 26107c478bd9Sstevel@tonic-gate long a2; 26117c478bd9Sstevel@tonic-gate long a3; 26127c478bd9Sstevel@tonic-gate long a4; 26137c478bd9Sstevel@tonic-gate long a5; 26147c478bd9Sstevel@tonic-gate long a6; 26157c478bd9Sstevel@tonic-gate long a7; 26167c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 26177c478bd9Sstevel@tonic-gate 26187c478bd9Sstevel@tonic-gate code = (uint32_t)uap->code; 26197c478bd9Sstevel@tonic-gate 26207c478bd9Sstevel@tonic-gate switch (code) { 26217c478bd9Sstevel@tonic-gate 26227c478bd9Sstevel@tonic-gate case BSM_GETAUID: 26237c478bd9Sstevel@tonic-gate e = AUE_GETAUID; 26247c478bd9Sstevel@tonic-gate break; 26257c478bd9Sstevel@tonic-gate case BSM_SETAUID: 26267c478bd9Sstevel@tonic-gate e = AUE_SETAUID; 26277c478bd9Sstevel@tonic-gate break; 26287c478bd9Sstevel@tonic-gate case BSM_GETAUDIT: 26297c478bd9Sstevel@tonic-gate e = AUE_GETAUDIT; 26307c478bd9Sstevel@tonic-gate break; 26317c478bd9Sstevel@tonic-gate case BSM_GETAUDIT_ADDR: 26327c478bd9Sstevel@tonic-gate e = AUE_GETAUDIT_ADDR; 26337c478bd9Sstevel@tonic-gate break; 26347c478bd9Sstevel@tonic-gate case BSM_SETAUDIT: 26357c478bd9Sstevel@tonic-gate e = AUE_SETAUDIT; 26367c478bd9Sstevel@tonic-gate break; 26377c478bd9Sstevel@tonic-gate case BSM_SETAUDIT_ADDR: 26387c478bd9Sstevel@tonic-gate e = AUE_SETAUDIT_ADDR; 26397c478bd9Sstevel@tonic-gate break; 26407c478bd9Sstevel@tonic-gate case BSM_AUDIT: 26417c478bd9Sstevel@tonic-gate e = AUE_AUDIT; 26427c478bd9Sstevel@tonic-gate break; 26437c478bd9Sstevel@tonic-gate case BSM_AUDITSVC: 26447c478bd9Sstevel@tonic-gate e = AUE_AUDITSVC; 26457c478bd9Sstevel@tonic-gate break; 26467c478bd9Sstevel@tonic-gate case BSM_GETPORTAUDIT: 26477c478bd9Sstevel@tonic-gate e = AUE_GETPORTAUDIT; 26487c478bd9Sstevel@tonic-gate break; 26497c478bd9Sstevel@tonic-gate case BSM_AUDITON: 26507c478bd9Sstevel@tonic-gate case BSM_AUDITCTL: 26517c478bd9Sstevel@tonic-gate 26527c478bd9Sstevel@tonic-gate switch ((uint_t)uap->a1) { 26537c478bd9Sstevel@tonic-gate 26547c478bd9Sstevel@tonic-gate case A_GETPOLICY: 26557c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GPOLICY; 26567c478bd9Sstevel@tonic-gate break; 26577c478bd9Sstevel@tonic-gate case A_SETPOLICY: 26587c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SPOLICY; 26597c478bd9Sstevel@tonic-gate break; 26607c478bd9Sstevel@tonic-gate case A_GETKMASK: 26617c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GETKMASK; 26627c478bd9Sstevel@tonic-gate break; 26637c478bd9Sstevel@tonic-gate case A_SETKMASK: 26647c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SETKMASK; 26657c478bd9Sstevel@tonic-gate break; 26667c478bd9Sstevel@tonic-gate case A_GETQCTRL: 26677c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GQCTRL; 26687c478bd9Sstevel@tonic-gate break; 26697c478bd9Sstevel@tonic-gate case A_SETQCTRL: 26707c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SQCTRL; 26717c478bd9Sstevel@tonic-gate break; 26727c478bd9Sstevel@tonic-gate case A_GETCWD: 26737c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GETCWD; 26747c478bd9Sstevel@tonic-gate break; 26757c478bd9Sstevel@tonic-gate case A_GETCAR: 26767c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GETCAR; 26777c478bd9Sstevel@tonic-gate break; 26787c478bd9Sstevel@tonic-gate case A_GETSTAT: 26797c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GETSTAT; 26807c478bd9Sstevel@tonic-gate break; 26817c478bd9Sstevel@tonic-gate case A_SETSTAT: 26827c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SETSTAT; 26837c478bd9Sstevel@tonic-gate break; 26847c478bd9Sstevel@tonic-gate case A_SETUMASK: 26857c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SETUMASK; 26867c478bd9Sstevel@tonic-gate break; 26877c478bd9Sstevel@tonic-gate case A_SETSMASK: 26887c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SETSMASK; 26897c478bd9Sstevel@tonic-gate break; 26907c478bd9Sstevel@tonic-gate case A_GETCOND: 26917c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GETCOND; 26927c478bd9Sstevel@tonic-gate break; 26937c478bd9Sstevel@tonic-gate case A_SETCOND: 26947c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SETCOND; 26957c478bd9Sstevel@tonic-gate break; 26967c478bd9Sstevel@tonic-gate case A_GETCLASS: 26977c478bd9Sstevel@tonic-gate e = AUE_AUDITON_GETCLASS; 26987c478bd9Sstevel@tonic-gate break; 26997c478bd9Sstevel@tonic-gate case A_SETCLASS: 27007c478bd9Sstevel@tonic-gate e = AUE_AUDITON_SETCLASS; 27017c478bd9Sstevel@tonic-gate break; 27027c478bd9Sstevel@tonic-gate default: 27037c478bd9Sstevel@tonic-gate e = AUE_NULL; 27047c478bd9Sstevel@tonic-gate break; 27057c478bd9Sstevel@tonic-gate } 27067c478bd9Sstevel@tonic-gate break; 27077c478bd9Sstevel@tonic-gate default: 27087c478bd9Sstevel@tonic-gate e = AUE_NULL; 27097c478bd9Sstevel@tonic-gate break; 27107c478bd9Sstevel@tonic-gate } 27117c478bd9Sstevel@tonic-gate 27127c478bd9Sstevel@tonic-gate return (e); 27137c478bd9Sstevel@tonic-gate 27147c478bd9Sstevel@tonic-gate 27157c478bd9Sstevel@tonic-gate 27167c478bd9Sstevel@tonic-gate 27177c478bd9Sstevel@tonic-gate } /* AUI_AUDITSYS */ 27187c478bd9Sstevel@tonic-gate 27197c478bd9Sstevel@tonic-gate 27207c478bd9Sstevel@tonic-gate 27217c478bd9Sstevel@tonic-gate 27227c478bd9Sstevel@tonic-gate 27237c478bd9Sstevel@tonic-gate 27247c478bd9Sstevel@tonic-gate 27257c478bd9Sstevel@tonic-gate static void 27267c478bd9Sstevel@tonic-gate aus_auditsys(struct t_audit_data *tad) 27277c478bd9Sstevel@tonic-gate { 27287c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 27297c478bd9Sstevel@tonic-gate uintptr_t a1, a2; 27307c478bd9Sstevel@tonic-gate struct file *fp; 27317c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 27327c478bd9Sstevel@tonic-gate struct vnode *vp; 27337c478bd9Sstevel@tonic-gate STRUCT_DECL(auditinfo, ainfo); 27347c478bd9Sstevel@tonic-gate STRUCT_DECL(auditinfo_addr, ainfo_addr); 27357c478bd9Sstevel@tonic-gate au_evclass_map_t event; 27367c478bd9Sstevel@tonic-gate au_mask_t mask; 27377c478bd9Sstevel@tonic-gate int auditstate, policy; 2738f2fcf18cStz au_id_t auid; 27397c478bd9Sstevel@tonic-gate 27407c478bd9Sstevel@tonic-gate 27417c478bd9Sstevel@tonic-gate struct a { 27427c478bd9Sstevel@tonic-gate long code; 27437c478bd9Sstevel@tonic-gate long a1; 27447c478bd9Sstevel@tonic-gate long a2; 27457c478bd9Sstevel@tonic-gate long a3; 27467c478bd9Sstevel@tonic-gate long a4; 27477c478bd9Sstevel@tonic-gate long a5; 27487c478bd9Sstevel@tonic-gate long a6; 27497c478bd9Sstevel@tonic-gate long a7; 27507c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 27517c478bd9Sstevel@tonic-gate 27527c478bd9Sstevel@tonic-gate a1 = (uintptr_t)uap->a1; 27537c478bd9Sstevel@tonic-gate a2 = (uintptr_t)uap->a2; 27547c478bd9Sstevel@tonic-gate 27557c478bd9Sstevel@tonic-gate switch (tad->tad_event) { 27567c478bd9Sstevel@tonic-gate case AUE_SETAUID: 2757f2fcf18cStz if (copyin((caddr_t)a1, &auid, sizeof (au_id_t))) 2758f2fcf18cStz return; 2759f2fcf18cStz au_uwrite(au_to_arg32(2, "setauid", auid)); 27607c478bd9Sstevel@tonic-gate break; 27617c478bd9Sstevel@tonic-gate case AUE_SETAUDIT: 27627c478bd9Sstevel@tonic-gate STRUCT_INIT(ainfo, get_udatamodel()); 27637c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a1, STRUCT_BUF(ainfo), 27647c478bd9Sstevel@tonic-gate STRUCT_SIZE(ainfo))) { 27657c478bd9Sstevel@tonic-gate return; 27667c478bd9Sstevel@tonic-gate } 27677c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "setaudit:auid", 27687c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_auid))); 27697c478bd9Sstevel@tonic-gate #ifdef _LP64 27707c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64((char)1, "setaudit:port", 27717c478bd9Sstevel@tonic-gate (uint64_t)STRUCT_FGET(ainfo, ai_termid.port))); 27727c478bd9Sstevel@tonic-gate #else 27737c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "setaudit:port", 27747c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_termid.port))); 27757c478bd9Sstevel@tonic-gate #endif 27767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "setaudit:machine", 27777c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_termid.machine))); 27787c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "setaudit:as_success", 27797c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_mask.as_success))); 27807c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "setaudit:as_failure", 27817c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_mask.as_failure))); 27827c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "setaudit:asid", 27837c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_asid))); 27847c478bd9Sstevel@tonic-gate break; 27857c478bd9Sstevel@tonic-gate case AUE_SETAUDIT_ADDR: 27867c478bd9Sstevel@tonic-gate STRUCT_INIT(ainfo_addr, get_udatamodel()); 27877c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a1, STRUCT_BUF(ainfo_addr), 27887c478bd9Sstevel@tonic-gate STRUCT_SIZE(ainfo_addr))) { 27897c478bd9Sstevel@tonic-gate return; 27907c478bd9Sstevel@tonic-gate } 27917c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "auid", 27927c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo_addr, ai_auid))); 27937c478bd9Sstevel@tonic-gate #ifdef _LP64 27947c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64((char)1, "port", 27957c478bd9Sstevel@tonic-gate (uint64_t)STRUCT_FGET(ainfo_addr, ai_termid.at_port))); 27967c478bd9Sstevel@tonic-gate #else 27977c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "port", 27987c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo_addr, ai_termid.at_port))); 27997c478bd9Sstevel@tonic-gate #endif 28007c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "type", 28017c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo_addr, ai_termid.at_type))); 28027c478bd9Sstevel@tonic-gate if ((uint32_t)STRUCT_FGET(ainfo_addr, ai_termid.at_type) == 28037c478bd9Sstevel@tonic-gate AU_IPv4) { 28047c478bd9Sstevel@tonic-gate au_uwrite(au_to_in_addr( 28057c478bd9Sstevel@tonic-gate (struct in_addr *)STRUCT_FGETP(ainfo_addr, 28067c478bd9Sstevel@tonic-gate ai_termid.at_addr))); 28077c478bd9Sstevel@tonic-gate } else { 28087c478bd9Sstevel@tonic-gate au_uwrite(au_to_in_addr_ex( 28097c478bd9Sstevel@tonic-gate (int32_t *)STRUCT_FGETP(ainfo_addr, 28107c478bd9Sstevel@tonic-gate ai_termid.at_addr))); 28117c478bd9Sstevel@tonic-gate } 28127c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "as_success", 28137c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo_addr, ai_mask.as_success))); 28147c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "as_failure", 28157c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo_addr, ai_mask.as_failure))); 28167c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32((char)1, "asid", 28177c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo_addr, ai_asid))); 28187c478bd9Sstevel@tonic-gate break; 28197c478bd9Sstevel@tonic-gate case AUE_AUDITSVC: 28207c478bd9Sstevel@tonic-gate /* 28217c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 28227c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here 28237c478bd9Sstevel@tonic-gate */ 28247c478bd9Sstevel@tonic-gate if ((fp = getf((uint_t)a1)) == NULL) 28257c478bd9Sstevel@tonic-gate return; 28267c478bd9Sstevel@tonic-gate fad = F2A(fp); 28277c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 28287c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 28297c478bd9Sstevel@tonic-gate } else { 28307c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "no path: fd", (uint32_t)a1)); 28317c478bd9Sstevel@tonic-gate } 28327c478bd9Sstevel@tonic-gate 28337c478bd9Sstevel@tonic-gate vp = fp->f_vnode; /* include vnode attributes */ 28347c478bd9Sstevel@tonic-gate audit_attributes(vp); 28357c478bd9Sstevel@tonic-gate 28367c478bd9Sstevel@tonic-gate /* decrement file descriptor ref count */ 28377c478bd9Sstevel@tonic-gate releasef((uint_t)a1); 28387c478bd9Sstevel@tonic-gate 28397c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "limit", (uint32_t)a2)); 28407c478bd9Sstevel@tonic-gate break; 28417c478bd9Sstevel@tonic-gate case AUE_AUDITON_SETKMASK: 28427c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a2, &mask, sizeof (au_mask_t))) 28437c478bd9Sstevel@tonic-gate return; 28447c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 28457c478bd9Sstevel@tonic-gate 2, "setkmask:as_success", (uint32_t)mask.as_success)); 28467c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 28477c478bd9Sstevel@tonic-gate 2, "setkmask:as_failure", (uint32_t)mask.as_failure)); 28487c478bd9Sstevel@tonic-gate break; 28497c478bd9Sstevel@tonic-gate case AUE_AUDITON_SPOLICY: 28507c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a2, &policy, sizeof (int))) 28517c478bd9Sstevel@tonic-gate return; 28527c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "setpolicy", (uint32_t)policy)); 28537c478bd9Sstevel@tonic-gate break; 28547c478bd9Sstevel@tonic-gate case AUE_AUDITON_SQCTRL: { 28557c478bd9Sstevel@tonic-gate STRUCT_DECL(au_qctrl, qctrl); 28567c478bd9Sstevel@tonic-gate model_t model; 28577c478bd9Sstevel@tonic-gate 28587c478bd9Sstevel@tonic-gate model = get_udatamodel(); 28597c478bd9Sstevel@tonic-gate STRUCT_INIT(qctrl, model); 28607c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a2, STRUCT_BUF(qctrl), STRUCT_SIZE(qctrl))) 28617c478bd9Sstevel@tonic-gate return; 28627c478bd9Sstevel@tonic-gate if (model == DATAMODEL_ILP32) { 28637c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 28647c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_hiwater", 28657c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(qctrl, aq_hiwater))); 28667c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 28677c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_lowater", 28687c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(qctrl, aq_lowater))); 28697c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 28707c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_bufsz", 28717c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(qctrl, aq_bufsz))); 28727c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 28737c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_delay", 28747c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(qctrl, aq_delay))); 28757c478bd9Sstevel@tonic-gate } else { 28767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64( 28777c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_hiwater", 28787c478bd9Sstevel@tonic-gate (uint64_t)STRUCT_FGET(qctrl, aq_hiwater))); 28797c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64( 28807c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_lowater", 28817c478bd9Sstevel@tonic-gate (uint64_t)STRUCT_FGET(qctrl, aq_lowater))); 28827c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64( 28837c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_bufsz", 28847c478bd9Sstevel@tonic-gate (uint64_t)STRUCT_FGET(qctrl, aq_bufsz))); 28857c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg64( 28867c478bd9Sstevel@tonic-gate 3, "setqctrl:aq_delay", 28877c478bd9Sstevel@tonic-gate (uint64_t)STRUCT_FGET(qctrl, aq_delay))); 28887c478bd9Sstevel@tonic-gate } 28897c478bd9Sstevel@tonic-gate break; 28907c478bd9Sstevel@tonic-gate } 28917c478bd9Sstevel@tonic-gate case AUE_AUDITON_SETUMASK: 28927c478bd9Sstevel@tonic-gate STRUCT_INIT(ainfo, get_udatamodel()); 28937c478bd9Sstevel@tonic-gate if (copyin((caddr_t)uap->a2, STRUCT_BUF(ainfo), 28947c478bd9Sstevel@tonic-gate STRUCT_SIZE(ainfo))) { 28957c478bd9Sstevel@tonic-gate return; 28967c478bd9Sstevel@tonic-gate } 28977c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "setumask:as_success", 28987c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_mask.as_success))); 28997c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "setumask:as_failure", 29007c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_mask.as_failure))); 29017c478bd9Sstevel@tonic-gate break; 29027c478bd9Sstevel@tonic-gate case AUE_AUDITON_SETSMASK: 29037c478bd9Sstevel@tonic-gate STRUCT_INIT(ainfo, get_udatamodel()); 29047c478bd9Sstevel@tonic-gate if (copyin((caddr_t)uap->a2, STRUCT_BUF(ainfo), 29057c478bd9Sstevel@tonic-gate STRUCT_SIZE(ainfo))) { 29067c478bd9Sstevel@tonic-gate return; 29077c478bd9Sstevel@tonic-gate } 29087c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "setsmask:as_success", 29097c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_mask.as_success))); 29107c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "setsmask:as_failure", 29117c478bd9Sstevel@tonic-gate (uint32_t)STRUCT_FGET(ainfo, ai_mask.as_failure))); 29127c478bd9Sstevel@tonic-gate break; 29137c478bd9Sstevel@tonic-gate case AUE_AUDITON_SETCOND: 29147c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a2, &auditstate, sizeof (int))) 29157c478bd9Sstevel@tonic-gate return; 29167c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "setcond", (uint32_t)auditstate)); 29177c478bd9Sstevel@tonic-gate break; 29187c478bd9Sstevel@tonic-gate case AUE_AUDITON_SETCLASS: 29197c478bd9Sstevel@tonic-gate if (copyin((caddr_t)a2, &event, sizeof (au_evclass_map_t))) 29207c478bd9Sstevel@tonic-gate return; 29217c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 29227c478bd9Sstevel@tonic-gate 2, "setclass:ec_event", (uint32_t)event.ec_number)); 29237c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32( 29247c478bd9Sstevel@tonic-gate 3, "setclass:ec_class", (uint32_t)event.ec_class)); 29257c478bd9Sstevel@tonic-gate break; 29267c478bd9Sstevel@tonic-gate case AUE_GETAUID: 29277c478bd9Sstevel@tonic-gate case AUE_GETAUDIT: 29287c478bd9Sstevel@tonic-gate case AUE_GETAUDIT_ADDR: 29297c478bd9Sstevel@tonic-gate case AUE_AUDIT: 29307c478bd9Sstevel@tonic-gate case AUE_GETPORTAUDIT: 29317c478bd9Sstevel@tonic-gate case AUE_AUDITON_GPOLICY: 29327c478bd9Sstevel@tonic-gate case AUE_AUDITON_GQCTRL: 29337c478bd9Sstevel@tonic-gate case AUE_AUDITON_GETKMASK: 29347c478bd9Sstevel@tonic-gate case AUE_AUDITON_GETCWD: 29357c478bd9Sstevel@tonic-gate case AUE_AUDITON_GETCAR: 29367c478bd9Sstevel@tonic-gate case AUE_AUDITON_GETSTAT: 29377c478bd9Sstevel@tonic-gate case AUE_AUDITON_SETSTAT: 29387c478bd9Sstevel@tonic-gate case AUE_AUDITON_GETCOND: 29397c478bd9Sstevel@tonic-gate case AUE_AUDITON_GETCLASS: 29407c478bd9Sstevel@tonic-gate break; 29417c478bd9Sstevel@tonic-gate default: 29427c478bd9Sstevel@tonic-gate break; 29437c478bd9Sstevel@tonic-gate } 29447c478bd9Sstevel@tonic-gate 29457c478bd9Sstevel@tonic-gate } /* AUS_AUDITSYS */ 29467c478bd9Sstevel@tonic-gate 29477c478bd9Sstevel@tonic-gate 29487c478bd9Sstevel@tonic-gate /* only audit privileged operations for systeminfo(2) system call */ 29497c478bd9Sstevel@tonic-gate static au_event_t 29507c478bd9Sstevel@tonic-gate aui_sysinfo(au_event_t e) 29517c478bd9Sstevel@tonic-gate { 29527c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 29537c478bd9Sstevel@tonic-gate uint32_t command; 29547c478bd9Sstevel@tonic-gate 29557c478bd9Sstevel@tonic-gate struct a { 29567c478bd9Sstevel@tonic-gate long command; 29577c478bd9Sstevel@tonic-gate long buf; /* char * */ 29587c478bd9Sstevel@tonic-gate long count; 29597c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 29607c478bd9Sstevel@tonic-gate 29617c478bd9Sstevel@tonic-gate command = (uint32_t)uap->command; 29627c478bd9Sstevel@tonic-gate 29637c478bd9Sstevel@tonic-gate switch (command) { 29647c478bd9Sstevel@tonic-gate case SI_SET_HOSTNAME: 29657c478bd9Sstevel@tonic-gate case SI_SET_SRPC_DOMAIN: 29667c478bd9Sstevel@tonic-gate e = (au_event_t)AUE_SYSINFO; 29677c478bd9Sstevel@tonic-gate break; 29687c478bd9Sstevel@tonic-gate default: 29697c478bd9Sstevel@tonic-gate e = (au_event_t)AUE_NULL; 29707c478bd9Sstevel@tonic-gate break; 29717c478bd9Sstevel@tonic-gate } 29727c478bd9Sstevel@tonic-gate return (e); 29737c478bd9Sstevel@tonic-gate } 29747c478bd9Sstevel@tonic-gate 29757c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 29767c478bd9Sstevel@tonic-gate static void 29777c478bd9Sstevel@tonic-gate aus_sysinfo(struct t_audit_data *tad) 29787c478bd9Sstevel@tonic-gate { 29797c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 29807c478bd9Sstevel@tonic-gate uint32_t command; 29817c478bd9Sstevel@tonic-gate size_t len, maxlen; 29827c478bd9Sstevel@tonic-gate char *name; 29837c478bd9Sstevel@tonic-gate uintptr_t buf; 29847c478bd9Sstevel@tonic-gate 29857c478bd9Sstevel@tonic-gate struct a { 29867c478bd9Sstevel@tonic-gate long command; 29877c478bd9Sstevel@tonic-gate long buf; /* char * */ 29887c478bd9Sstevel@tonic-gate long count; 29897c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 29907c478bd9Sstevel@tonic-gate 29917c478bd9Sstevel@tonic-gate command = (uint32_t)uap->command; 29927c478bd9Sstevel@tonic-gate buf = (uintptr_t)uap->buf; 29937c478bd9Sstevel@tonic-gate 29947c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "cmd", command)); 29957c478bd9Sstevel@tonic-gate 29967c478bd9Sstevel@tonic-gate switch (command) { 29977c478bd9Sstevel@tonic-gate case SI_SET_HOSTNAME: 29987c478bd9Sstevel@tonic-gate { 29997c478bd9Sstevel@tonic-gate if (secpolicy_sys_config(CRED(), B_TRUE) != 0) 30007c478bd9Sstevel@tonic-gate return; 30017c478bd9Sstevel@tonic-gate 30027c478bd9Sstevel@tonic-gate maxlen = SYS_NMLN; 30037c478bd9Sstevel@tonic-gate name = kmem_alloc(maxlen, KM_SLEEP); 30047c478bd9Sstevel@tonic-gate if (copyinstr((caddr_t)buf, name, SYS_NMLN, &len)) 30057c478bd9Sstevel@tonic-gate break; 30067c478bd9Sstevel@tonic-gate 30077c478bd9Sstevel@tonic-gate /* 30087c478bd9Sstevel@tonic-gate * Must be non-NULL string and string 30097c478bd9Sstevel@tonic-gate * must be less than SYS_NMLN chars. 30107c478bd9Sstevel@tonic-gate */ 30117c478bd9Sstevel@tonic-gate if (len < 2 || (len == SYS_NMLN && name[SYS_NMLN - 1] != '\0')) 30127c478bd9Sstevel@tonic-gate break; 30137c478bd9Sstevel@tonic-gate 30147c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(name)); 30157c478bd9Sstevel@tonic-gate break; 30167c478bd9Sstevel@tonic-gate } 30177c478bd9Sstevel@tonic-gate 30187c478bd9Sstevel@tonic-gate case SI_SET_SRPC_DOMAIN: 30197c478bd9Sstevel@tonic-gate { 30207c478bd9Sstevel@tonic-gate if (secpolicy_sys_config(CRED(), B_TRUE) != 0) 30217c478bd9Sstevel@tonic-gate return; 30227c478bd9Sstevel@tonic-gate 30237c478bd9Sstevel@tonic-gate maxlen = SYS_NMLN; 30247c478bd9Sstevel@tonic-gate name = kmem_alloc(maxlen, KM_SLEEP); 30257c478bd9Sstevel@tonic-gate if (copyinstr((caddr_t)buf, name, SYS_NMLN, &len)) 30267c478bd9Sstevel@tonic-gate break; 30277c478bd9Sstevel@tonic-gate 30287c478bd9Sstevel@tonic-gate /* 30297c478bd9Sstevel@tonic-gate * If string passed in is longer than length 30307c478bd9Sstevel@tonic-gate * allowed for domain name, fail. 30317c478bd9Sstevel@tonic-gate */ 30327c478bd9Sstevel@tonic-gate if (len == SYS_NMLN && name[SYS_NMLN - 1] != '\0') 30337c478bd9Sstevel@tonic-gate break; 30347c478bd9Sstevel@tonic-gate 30357c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(name)); 30367c478bd9Sstevel@tonic-gate break; 30377c478bd9Sstevel@tonic-gate } 30387c478bd9Sstevel@tonic-gate 30397c478bd9Sstevel@tonic-gate default: 30407c478bd9Sstevel@tonic-gate return; 30417c478bd9Sstevel@tonic-gate } 30427c478bd9Sstevel@tonic-gate 30437c478bd9Sstevel@tonic-gate kmem_free(name, maxlen); 30447c478bd9Sstevel@tonic-gate } 30457c478bd9Sstevel@tonic-gate 30467c478bd9Sstevel@tonic-gate static au_event_t 30477c478bd9Sstevel@tonic-gate aui_modctl(au_event_t e) 30487c478bd9Sstevel@tonic-gate { 30497c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 30507c478bd9Sstevel@tonic-gate uint_t cmd; 30517c478bd9Sstevel@tonic-gate 30527c478bd9Sstevel@tonic-gate struct a { 30537c478bd9Sstevel@tonic-gate long cmd; 30547c478bd9Sstevel@tonic-gate } *uap = (struct a *)clwp->lwp_ap; 30557c478bd9Sstevel@tonic-gate 30567c478bd9Sstevel@tonic-gate cmd = (uint_t)uap->cmd; 30577c478bd9Sstevel@tonic-gate 30587c478bd9Sstevel@tonic-gate switch (cmd) { 30597c478bd9Sstevel@tonic-gate case MODLOAD: 30607c478bd9Sstevel@tonic-gate e = AUE_MODLOAD; 30617c478bd9Sstevel@tonic-gate break; 30627c478bd9Sstevel@tonic-gate case MODUNLOAD: 30637c478bd9Sstevel@tonic-gate e = AUE_MODUNLOAD; 30647c478bd9Sstevel@tonic-gate break; 30657c478bd9Sstevel@tonic-gate case MODADDMAJBIND: 30667c478bd9Sstevel@tonic-gate e = AUE_MODADDMAJ; 30677c478bd9Sstevel@tonic-gate break; 30687c478bd9Sstevel@tonic-gate case MODSETDEVPOLICY: 30697c478bd9Sstevel@tonic-gate e = AUE_MODDEVPLCY; 30707c478bd9Sstevel@tonic-gate break; 30717c478bd9Sstevel@tonic-gate case MODALLOCPRIV: 30727c478bd9Sstevel@tonic-gate e = AUE_MODADDPRIV; 30737c478bd9Sstevel@tonic-gate break; 30747c478bd9Sstevel@tonic-gate default: 30757c478bd9Sstevel@tonic-gate e = AUE_NULL; 30767c478bd9Sstevel@tonic-gate break; 30777c478bd9Sstevel@tonic-gate } 30787c478bd9Sstevel@tonic-gate return (e); 30797c478bd9Sstevel@tonic-gate } 30807c478bd9Sstevel@tonic-gate 30817c478bd9Sstevel@tonic-gate 30827c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 30837c478bd9Sstevel@tonic-gate static void 30847c478bd9Sstevel@tonic-gate aus_modctl(struct t_audit_data *tad) 30857c478bd9Sstevel@tonic-gate { 30867c478bd9Sstevel@tonic-gate klwp_t *clwp = ttolwp(curthread); 30877c478bd9Sstevel@tonic-gate void *a = clwp->lwp_ap; 30887c478bd9Sstevel@tonic-gate uint_t use_path; 30897c478bd9Sstevel@tonic-gate 30907c478bd9Sstevel@tonic-gate switch (tad->tad_event) { 30917c478bd9Sstevel@tonic-gate case AUE_MODLOAD: { 30927c478bd9Sstevel@tonic-gate typedef struct { 30937c478bd9Sstevel@tonic-gate long cmd; 30947c478bd9Sstevel@tonic-gate long use_path; 30957c478bd9Sstevel@tonic-gate long filename; /* char * */ 30967c478bd9Sstevel@tonic-gate } modloada_t; 30977c478bd9Sstevel@tonic-gate 30987c478bd9Sstevel@tonic-gate char *filenamep; 30997c478bd9Sstevel@tonic-gate uintptr_t fname; 31007c478bd9Sstevel@tonic-gate extern char *default_path; 31017c478bd9Sstevel@tonic-gate 31027c478bd9Sstevel@tonic-gate fname = (uintptr_t)((modloada_t *)a)->filename; 31037c478bd9Sstevel@tonic-gate use_path = (uint_t)((modloada_t *)a)->use_path; 31047c478bd9Sstevel@tonic-gate 31057c478bd9Sstevel@tonic-gate /* space to hold path */ 31067c478bd9Sstevel@tonic-gate filenamep = kmem_alloc(MOD_MAXPATH, KM_SLEEP); 31077c478bd9Sstevel@tonic-gate /* get string */ 31087c478bd9Sstevel@tonic-gate if (copyinstr((caddr_t)fname, filenamep, MOD_MAXPATH, 0)) { 31097c478bd9Sstevel@tonic-gate /* free allocated path */ 31107c478bd9Sstevel@tonic-gate kmem_free(filenamep, MOD_MAXPATH); 31117c478bd9Sstevel@tonic-gate return; 31127c478bd9Sstevel@tonic-gate } 31137c478bd9Sstevel@tonic-gate /* ensure it's null terminated */ 31147c478bd9Sstevel@tonic-gate filenamep[MOD_MAXPATH - 1] = 0; 31157c478bd9Sstevel@tonic-gate 31167c478bd9Sstevel@tonic-gate if (use_path) 31177c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(default_path)); 31187c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(filenamep)); 31197c478bd9Sstevel@tonic-gate 31207c478bd9Sstevel@tonic-gate /* release temporary memory */ 31217c478bd9Sstevel@tonic-gate kmem_free(filenamep, MOD_MAXPATH); 31227c478bd9Sstevel@tonic-gate break; 31237c478bd9Sstevel@tonic-gate } 31247c478bd9Sstevel@tonic-gate case AUE_MODUNLOAD: { 31257c478bd9Sstevel@tonic-gate typedef struct { 31267c478bd9Sstevel@tonic-gate long cmd; 31277c478bd9Sstevel@tonic-gate long id; 31287c478bd9Sstevel@tonic-gate } modunloada_t; 31297c478bd9Sstevel@tonic-gate 31307c478bd9Sstevel@tonic-gate uint32_t id = (uint32_t)((modunloada_t *)a)->id; 31317c478bd9Sstevel@tonic-gate 31327c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "id", id)); 31337c478bd9Sstevel@tonic-gate break; 31347c478bd9Sstevel@tonic-gate } 31357c478bd9Sstevel@tonic-gate case AUE_MODADDMAJ: { 31367c478bd9Sstevel@tonic-gate STRUCT_DECL(modconfig, mc); 31377c478bd9Sstevel@tonic-gate typedef struct { 31387c478bd9Sstevel@tonic-gate long cmd; 31397c478bd9Sstevel@tonic-gate long subcmd; 31407c478bd9Sstevel@tonic-gate long data; /* int * */ 31417c478bd9Sstevel@tonic-gate } modconfiga_t; 31427c478bd9Sstevel@tonic-gate 31437c478bd9Sstevel@tonic-gate STRUCT_DECL(aliases, alias); 31447c478bd9Sstevel@tonic-gate caddr_t ap; 31457c478bd9Sstevel@tonic-gate int i, num_aliases; 31467c478bd9Sstevel@tonic-gate char *drvname, *mc_drvname; 31477c478bd9Sstevel@tonic-gate char *name; 31487c478bd9Sstevel@tonic-gate extern char *ddi_major_to_name(major_t); 31497c478bd9Sstevel@tonic-gate model_t model; 31507c478bd9Sstevel@tonic-gate 31517c478bd9Sstevel@tonic-gate uintptr_t data = (uintptr_t)((modconfiga_t *)a)->data; 31527c478bd9Sstevel@tonic-gate 31537c478bd9Sstevel@tonic-gate model = get_udatamodel(); 31547c478bd9Sstevel@tonic-gate STRUCT_INIT(mc, model); 31557c478bd9Sstevel@tonic-gate /* sanitize buffer */ 31567c478bd9Sstevel@tonic-gate bzero((caddr_t)STRUCT_BUF(mc), STRUCT_SIZE(mc)); 31577c478bd9Sstevel@tonic-gate /* get user arguments */ 31587c478bd9Sstevel@tonic-gate if (copyin((caddr_t)data, (caddr_t)STRUCT_BUF(mc), 31597c478bd9Sstevel@tonic-gate STRUCT_SIZE(mc)) != 0) 31607c478bd9Sstevel@tonic-gate return; 31617c478bd9Sstevel@tonic-gate 31627c478bd9Sstevel@tonic-gate mc_drvname = STRUCT_FGET(mc, drvname); 31637c478bd9Sstevel@tonic-gate if ((drvname = ddi_major_to_name( 31647c478bd9Sstevel@tonic-gate (major_t)STRUCT_FGET(mc, major))) != NULL && 31657c478bd9Sstevel@tonic-gate strncmp(drvname, mc_drvname, MAXMODCONFNAME) != 0) { 31667c478bd9Sstevel@tonic-gate /* safety */ 31677c478bd9Sstevel@tonic-gate if (mc_drvname[0] != '\0') { 31687c478bd9Sstevel@tonic-gate mc_drvname[MAXMODCONFNAME-1] = '\0'; 31697c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(mc_drvname)); 31707c478bd9Sstevel@tonic-gate } 31717c478bd9Sstevel@tonic-gate /* drvname != NULL from test above */ 31727c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(drvname)); 31737c478bd9Sstevel@tonic-gate return; 31747c478bd9Sstevel@tonic-gate } 31757c478bd9Sstevel@tonic-gate 31767c478bd9Sstevel@tonic-gate if (mc_drvname[0] != '\0') { 31777c478bd9Sstevel@tonic-gate /* safety */ 31787c478bd9Sstevel@tonic-gate mc_drvname[MAXMODCONFNAME-1] = '\0'; 31797c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(mc_drvname)); 31807c478bd9Sstevel@tonic-gate } else 31817c478bd9Sstevel@tonic-gate au_uwrite(au_to_text("no drvname")); 31827c478bd9Sstevel@tonic-gate 31837c478bd9Sstevel@tonic-gate num_aliases = STRUCT_FGET(mc, num_aliases); 31847c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(5, "", (uint32_t)num_aliases)); 31857c478bd9Sstevel@tonic-gate ap = (caddr_t)STRUCT_FGETP(mc, ap); 31867c478bd9Sstevel@tonic-gate name = kmem_alloc(MAXMODCONFNAME, KM_SLEEP); 31877c478bd9Sstevel@tonic-gate STRUCT_INIT(alias, model); 31887c478bd9Sstevel@tonic-gate for (i = 0; i < num_aliases; i++) { 31897c478bd9Sstevel@tonic-gate bzero((caddr_t)STRUCT_BUF(alias), 31907c478bd9Sstevel@tonic-gate STRUCT_SIZE(alias)); 31917c478bd9Sstevel@tonic-gate if (copyin((caddr_t)ap, (caddr_t)STRUCT_BUF(alias), 31927c478bd9Sstevel@tonic-gate STRUCT_SIZE(alias)) != 0) 31937c478bd9Sstevel@tonic-gate break; 31947c478bd9Sstevel@tonic-gate if (copyinstr(STRUCT_FGETP(alias, a_name), name, 31957c478bd9Sstevel@tonic-gate MAXMODCONFNAME, NULL) != 0) { 31967c478bd9Sstevel@tonic-gate break; 31977c478bd9Sstevel@tonic-gate } 31987c478bd9Sstevel@tonic-gate 31997c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(name)); 32007c478bd9Sstevel@tonic-gate ap = (caddr_t)STRUCT_FGETP(alias, a_next); 32017c478bd9Sstevel@tonic-gate } 32027c478bd9Sstevel@tonic-gate kmem_free(name, MAXMODCONFNAME); 32037c478bd9Sstevel@tonic-gate break; 32047c478bd9Sstevel@tonic-gate } 32057c478bd9Sstevel@tonic-gate default: 32067c478bd9Sstevel@tonic-gate break; 32077c478bd9Sstevel@tonic-gate } 32087c478bd9Sstevel@tonic-gate } 32097c478bd9Sstevel@tonic-gate 32107c478bd9Sstevel@tonic-gate /* 32117c478bd9Sstevel@tonic-gate * private version of getsonode that does not do eprintsoline() 32127c478bd9Sstevel@tonic-gate */ 32137c478bd9Sstevel@tonic-gate static struct sonode * 32147c478bd9Sstevel@tonic-gate au_getsonode(int sock, int *errorp, file_t **fpp) 32157c478bd9Sstevel@tonic-gate { 32167c478bd9Sstevel@tonic-gate file_t *fp; 32177c478bd9Sstevel@tonic-gate register vnode_t *vp; 32187c478bd9Sstevel@tonic-gate struct sonode *so; 32197c478bd9Sstevel@tonic-gate 32207c478bd9Sstevel@tonic-gate if ((fp = getf(sock)) == NULL) { 32217c478bd9Sstevel@tonic-gate *errorp = EBADF; 32227c478bd9Sstevel@tonic-gate return (NULL); 32237c478bd9Sstevel@tonic-gate } 32247c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 32257c478bd9Sstevel@tonic-gate /* Check if it is a socket */ 32267c478bd9Sstevel@tonic-gate if (vp->v_type != VSOCK) { 32277c478bd9Sstevel@tonic-gate releasef(sock); 32287c478bd9Sstevel@tonic-gate *errorp = ENOTSOCK; 32297c478bd9Sstevel@tonic-gate return (NULL); 32307c478bd9Sstevel@tonic-gate } 32317c478bd9Sstevel@tonic-gate /* 32327c478bd9Sstevel@tonic-gate * Use the stream head to find the real socket vnode. 32337c478bd9Sstevel@tonic-gate * This is needed when namefs sits above sockfs. 32347c478bd9Sstevel@tonic-gate */ 32357c478bd9Sstevel@tonic-gate ASSERT(vp->v_stream); 32367c478bd9Sstevel@tonic-gate ASSERT(vp->v_stream->sd_vnode); 32377c478bd9Sstevel@tonic-gate vp = vp->v_stream->sd_vnode; 32387c478bd9Sstevel@tonic-gate so = VTOSO(vp); 32397c478bd9Sstevel@tonic-gate if (so->so_version == SOV_STREAM) { 32407c478bd9Sstevel@tonic-gate releasef(sock); 32417c478bd9Sstevel@tonic-gate *errorp = ENOTSOCK; 32427c478bd9Sstevel@tonic-gate return (NULL); 32437c478bd9Sstevel@tonic-gate } 32447c478bd9Sstevel@tonic-gate if (fpp) 32457c478bd9Sstevel@tonic-gate *fpp = fp; 32467c478bd9Sstevel@tonic-gate return (so); 32477c478bd9Sstevel@tonic-gate } 32487c478bd9Sstevel@tonic-gate 32497c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 32507c478bd9Sstevel@tonic-gate static void 32517c478bd9Sstevel@tonic-gate auf_accept( 32527c478bd9Sstevel@tonic-gate struct t_audit_data *tad, 32537c478bd9Sstevel@tonic-gate int error, 32547c478bd9Sstevel@tonic-gate rval_t *rval) 32557c478bd9Sstevel@tonic-gate { 32567c478bd9Sstevel@tonic-gate uint32_t scid; 32577c478bd9Sstevel@tonic-gate uint32_t sy_flags; 32587c478bd9Sstevel@tonic-gate int fd; 32597c478bd9Sstevel@tonic-gate struct sonode *so; 32607c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 32617c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 32627c478bd9Sstevel@tonic-gate int err; 32637c478bd9Sstevel@tonic-gate int len; 32647c478bd9Sstevel@tonic-gate short so_family, so_type; 32657c478bd9Sstevel@tonic-gate int add_sock_token = 0; 32667c478bd9Sstevel@tonic-gate 32677c478bd9Sstevel@tonic-gate /* need to determine type of executing binary */ 32687c478bd9Sstevel@tonic-gate scid = tad->tad_scid; 32697c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32_IMPL 32707c478bd9Sstevel@tonic-gate if (lwp_getdatamodel(ttolwp(curthread)) == DATAMODEL_NATIVE) 32717c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 32727c478bd9Sstevel@tonic-gate else 32737c478bd9Sstevel@tonic-gate sy_flags = sysent32[scid].sy_flags & SE_RVAL_MASK; 32747c478bd9Sstevel@tonic-gate #else 32757c478bd9Sstevel@tonic-gate sy_flags = sysent[scid].sy_flags & SE_RVAL_MASK; 32767c478bd9Sstevel@tonic-gate #endif 32777c478bd9Sstevel@tonic-gate if (sy_flags == SE_32RVAL1) 32787c478bd9Sstevel@tonic-gate fd = rval->r_val1; 32797c478bd9Sstevel@tonic-gate if (sy_flags == (SE_32RVAL2|SE_32RVAL1)) 32807c478bd9Sstevel@tonic-gate fd = rval->r_val1; 32817c478bd9Sstevel@tonic-gate if (sy_flags == SE_64RVAL) 32827c478bd9Sstevel@tonic-gate fd = (int)rval->r_vals; 32837c478bd9Sstevel@tonic-gate 32847c478bd9Sstevel@tonic-gate if (error) { 32857c478bd9Sstevel@tonic-gate /* can't trust socket contents. Just return */ 32867c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 32877c478bd9Sstevel@tonic-gate return; 32887c478bd9Sstevel@tonic-gate } 32897c478bd9Sstevel@tonic-gate 32907c478bd9Sstevel@tonic-gate if ((so = au_getsonode((int)fd, &err, NULL)) == NULL) { 32917c478bd9Sstevel@tonic-gate /* 32927c478bd9Sstevel@tonic-gate * not security relevant if doing a accept from non socket 32937c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 32947c478bd9Sstevel@tonic-gate * generation here. 32957c478bd9Sstevel@tonic-gate */ 32967c478bd9Sstevel@tonic-gate return; 32977c478bd9Sstevel@tonic-gate } 32987c478bd9Sstevel@tonic-gate 32997c478bd9Sstevel@tonic-gate so_family = so->so_family; 33007c478bd9Sstevel@tonic-gate so_type = so->so_type; 33017c478bd9Sstevel@tonic-gate 33027c478bd9Sstevel@tonic-gate switch (so_family) { 33037c478bd9Sstevel@tonic-gate case AF_INET: 33047c478bd9Sstevel@tonic-gate case AF_INET6: 33057c478bd9Sstevel@tonic-gate /* 33067c478bd9Sstevel@tonic-gate * XXX - what about other socket types for AF_INET (e.g. DGRAM) 33077c478bd9Sstevel@tonic-gate */ 33087c478bd9Sstevel@tonic-gate if (so->so_type == SOCK_STREAM) { 33097c478bd9Sstevel@tonic-gate 33107c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 33117c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 33127c478bd9Sstevel@tonic-gate 33137c478bd9Sstevel@tonic-gate /* 33147c478bd9Sstevel@tonic-gate * no local address then need to get it from lower 33157c478bd9Sstevel@tonic-gate * levels. only put out record on first read ala 33167c478bd9Sstevel@tonic-gate * AUE_WRITE. 33177c478bd9Sstevel@tonic-gate */ 33187c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 33197c478bd9Sstevel@tonic-gate /* only done once on a connection */ 33207c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 33217c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 33227c478bd9Sstevel@tonic-gate 33237c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 33247c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 33257c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 33267c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 33277c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 33287c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 33297c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 33307c478bd9Sstevel@tonic-gate } 33317c478bd9Sstevel@tonic-gate 33327c478bd9Sstevel@tonic-gate add_sock_token = 1; 33337c478bd9Sstevel@tonic-gate } 33347c478bd9Sstevel@tonic-gate break; 33357c478bd9Sstevel@tonic-gate 33367c478bd9Sstevel@tonic-gate default: 33377c478bd9Sstevel@tonic-gate /* AF_UNIX, AF_ROUTE, AF_KEY do not support accept */ 33387c478bd9Sstevel@tonic-gate break; 33397c478bd9Sstevel@tonic-gate } 33407c478bd9Sstevel@tonic-gate 33417c478bd9Sstevel@tonic-gate releasef(fd); 33427c478bd9Sstevel@tonic-gate 33437c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 33447c478bd9Sstevel@tonic-gate 33457c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 33467c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(0, "family", (uint32_t)(so_family))); 33477c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(0, "type", (uint32_t)(so_type))); 33487c478bd9Sstevel@tonic-gate return; 33497c478bd9Sstevel@tonic-gate } 33507c478bd9Sstevel@tonic-gate 33517c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 33527c478bd9Sstevel@tonic-gate 33537c478bd9Sstevel@tonic-gate } 33547c478bd9Sstevel@tonic-gate 33557c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 33567c478bd9Sstevel@tonic-gate static void 33577c478bd9Sstevel@tonic-gate auf_bind(struct t_audit_data *tad, int error, rval_t *rvp) 33587c478bd9Sstevel@tonic-gate { 33597c478bd9Sstevel@tonic-gate struct a { 33607c478bd9Sstevel@tonic-gate long fd; 33617c478bd9Sstevel@tonic-gate long addr; 33627c478bd9Sstevel@tonic-gate long len; 33637c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 33647c478bd9Sstevel@tonic-gate 33657c478bd9Sstevel@tonic-gate struct sonode *so; 33667c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 33677c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 33687c478bd9Sstevel@tonic-gate int err, fd; 33697c478bd9Sstevel@tonic-gate int len; 33707c478bd9Sstevel@tonic-gate short so_family, so_type; 33717c478bd9Sstevel@tonic-gate int add_sock_token = 0; 33727c478bd9Sstevel@tonic-gate 33737c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 33747c478bd9Sstevel@tonic-gate 33757c478bd9Sstevel@tonic-gate /* 33767c478bd9Sstevel@tonic-gate * bind failed, then nothing extra to add to audit record. 33777c478bd9Sstevel@tonic-gate */ 33787c478bd9Sstevel@tonic-gate if (error) { 33797c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 33807c478bd9Sstevel@tonic-gate /* XXX may want to add failed address some day */ 33817c478bd9Sstevel@tonic-gate return; 33827c478bd9Sstevel@tonic-gate } 33837c478bd9Sstevel@tonic-gate 33847c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, NULL)) == NULL) { 33857c478bd9Sstevel@tonic-gate /* 33867c478bd9Sstevel@tonic-gate * not security relevant if doing a bind from non socket 33877c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 33887c478bd9Sstevel@tonic-gate * generation here. 33897c478bd9Sstevel@tonic-gate */ 33907c478bd9Sstevel@tonic-gate return; 33917c478bd9Sstevel@tonic-gate } 33927c478bd9Sstevel@tonic-gate 33937c478bd9Sstevel@tonic-gate so_family = so->so_family; 33947c478bd9Sstevel@tonic-gate so_type = so->so_type; 33957c478bd9Sstevel@tonic-gate 33967c478bd9Sstevel@tonic-gate switch (so_family) { 33977c478bd9Sstevel@tonic-gate case AF_INET: 33987c478bd9Sstevel@tonic-gate case AF_INET6: 33997c478bd9Sstevel@tonic-gate 34007c478bd9Sstevel@tonic-gate bzero(so_faddr, sizeof (so_faddr)); 34017c478bd9Sstevel@tonic-gate 34027c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 34037c478bd9Sstevel@tonic-gate /* only done once on a connection */ 34047c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 34057c478bd9Sstevel@tonic-gate } 34067c478bd9Sstevel@tonic-gate 34077c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 34087c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 34097c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 34107c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 34117c478bd9Sstevel@tonic-gate 34127c478bd9Sstevel@tonic-gate add_sock_token = 1; 34137c478bd9Sstevel@tonic-gate 34147c478bd9Sstevel@tonic-gate break; 34157c478bd9Sstevel@tonic-gate 34167c478bd9Sstevel@tonic-gate case AF_UNIX: 34177c478bd9Sstevel@tonic-gate /* token added by lookup */ 34187c478bd9Sstevel@tonic-gate break; 34197c478bd9Sstevel@tonic-gate default: 34207c478bd9Sstevel@tonic-gate /* AF_ROUTE, AF_KEY do not support accept */ 34217c478bd9Sstevel@tonic-gate break; 34227c478bd9Sstevel@tonic-gate } 34237c478bd9Sstevel@tonic-gate 34247c478bd9Sstevel@tonic-gate releasef(fd); 34257c478bd9Sstevel@tonic-gate 34267c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 34277c478bd9Sstevel@tonic-gate 34287c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 34297c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)(so_family))); 34307c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)(so_type))); 34317c478bd9Sstevel@tonic-gate return; 34327c478bd9Sstevel@tonic-gate } 34337c478bd9Sstevel@tonic-gate 34347c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 34357c478bd9Sstevel@tonic-gate 34367c478bd9Sstevel@tonic-gate } 34377c478bd9Sstevel@tonic-gate 34387c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 34397c478bd9Sstevel@tonic-gate static void 34407c478bd9Sstevel@tonic-gate auf_connect(struct t_audit_data *tad, int error, rval_t *rval) 34417c478bd9Sstevel@tonic-gate { 34427c478bd9Sstevel@tonic-gate struct a { 34437c478bd9Sstevel@tonic-gate long fd; 34447c478bd9Sstevel@tonic-gate long addr; 34457c478bd9Sstevel@tonic-gate long len; 34467c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 34477c478bd9Sstevel@tonic-gate 34487c478bd9Sstevel@tonic-gate struct sonode *so; 34497c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 34507c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 34517c478bd9Sstevel@tonic-gate int err, fd; 34527c478bd9Sstevel@tonic-gate int len; 34537c478bd9Sstevel@tonic-gate short so_family, so_type; 34547c478bd9Sstevel@tonic-gate int add_sock_token = 0; 34557c478bd9Sstevel@tonic-gate 34567c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 34577c478bd9Sstevel@tonic-gate 34587c478bd9Sstevel@tonic-gate 34597c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, NULL)) == NULL) { 34607c478bd9Sstevel@tonic-gate /* 34617c478bd9Sstevel@tonic-gate * not security relevant if doing a connect from non socket 34627c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 34637c478bd9Sstevel@tonic-gate * generation here. 34647c478bd9Sstevel@tonic-gate */ 34657c478bd9Sstevel@tonic-gate return; 34667c478bd9Sstevel@tonic-gate } 34677c478bd9Sstevel@tonic-gate 34687c478bd9Sstevel@tonic-gate so_family = so->so_family; 34697c478bd9Sstevel@tonic-gate so_type = so->so_type; 34707c478bd9Sstevel@tonic-gate 34717c478bd9Sstevel@tonic-gate switch (so_family) { 34727c478bd9Sstevel@tonic-gate case AF_INET: 34737c478bd9Sstevel@tonic-gate case AF_INET6: 34747c478bd9Sstevel@tonic-gate /* 34757c478bd9Sstevel@tonic-gate * no local address then need to get it from lower 34767c478bd9Sstevel@tonic-gate * levels. 34777c478bd9Sstevel@tonic-gate */ 34787c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 34797c478bd9Sstevel@tonic-gate /* only done once on a connection */ 34807c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 34817c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 34827c478bd9Sstevel@tonic-gate } 34837c478bd9Sstevel@tonic-gate 34847c478bd9Sstevel@tonic-gate bzero(so_laddr, sizeof (so_laddr)); 34857c478bd9Sstevel@tonic-gate bzero(so_faddr, sizeof (so_faddr)); 34867c478bd9Sstevel@tonic-gate 34877c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 34887c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 34897c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 34907c478bd9Sstevel@tonic-gate if (error) { 34917c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 34927c478bd9Sstevel@tonic-gate if (uap->addr == NULL) 34937c478bd9Sstevel@tonic-gate break; 34947c478bd9Sstevel@tonic-gate if (uap->len <= 0) 34957c478bd9Sstevel@tonic-gate break; 34967c478bd9Sstevel@tonic-gate len = min(uap->len, sizeof (so_faddr)); 34977c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->addr), so_faddr, len) != 0) 34987c478bd9Sstevel@tonic-gate break; 34997c478bd9Sstevel@tonic-gate #ifdef NOTYET 35007c478bd9Sstevel@tonic-gate au_uwrite(au_to_data(AUP_HEX, AUR_CHAR, len, so_faddr)); 35017c478bd9Sstevel@tonic-gate #endif 35027c478bd9Sstevel@tonic-gate } else { 35037c478bd9Sstevel@tonic-gate /* sanity check on length */ 35047c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 35057c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 35067c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 35077c478bd9Sstevel@tonic-gate } 35087c478bd9Sstevel@tonic-gate 35097c478bd9Sstevel@tonic-gate add_sock_token = 1; 35107c478bd9Sstevel@tonic-gate 35117c478bd9Sstevel@tonic-gate break; 35127c478bd9Sstevel@tonic-gate 35137c478bd9Sstevel@tonic-gate case AF_UNIX: 35147c478bd9Sstevel@tonic-gate /* does a lookup on name */ 35157c478bd9Sstevel@tonic-gate break; 35167c478bd9Sstevel@tonic-gate 35177c478bd9Sstevel@tonic-gate default: 35187c478bd9Sstevel@tonic-gate /* AF_ROUTE, AF_KEY do not support accept */ 35197c478bd9Sstevel@tonic-gate break; 35207c478bd9Sstevel@tonic-gate } 35217c478bd9Sstevel@tonic-gate 35227c478bd9Sstevel@tonic-gate releasef(fd); 35237c478bd9Sstevel@tonic-gate 35247c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 35257c478bd9Sstevel@tonic-gate 35267c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 35277c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)(so_family))); 35287c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)(so_type))); 35297c478bd9Sstevel@tonic-gate return; 35307c478bd9Sstevel@tonic-gate } 35317c478bd9Sstevel@tonic-gate 35327c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 35337c478bd9Sstevel@tonic-gate 35347c478bd9Sstevel@tonic-gate } 35357c478bd9Sstevel@tonic-gate 35367c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 35377c478bd9Sstevel@tonic-gate static void 35387c478bd9Sstevel@tonic-gate aus_shutdown(struct t_audit_data *tad) 35397c478bd9Sstevel@tonic-gate { 35407c478bd9Sstevel@tonic-gate struct a { 35417c478bd9Sstevel@tonic-gate long fd; 35427c478bd9Sstevel@tonic-gate long how; 35437c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 35447c478bd9Sstevel@tonic-gate 35457c478bd9Sstevel@tonic-gate struct sonode *so; 35467c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 35477c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 35487c478bd9Sstevel@tonic-gate int err, fd; 35497c478bd9Sstevel@tonic-gate int len; 35507c478bd9Sstevel@tonic-gate short so_family, so_type; 35517c478bd9Sstevel@tonic-gate int add_sock_token = 0; 35527c478bd9Sstevel@tonic-gate file_t *fp; /* unix domain sockets */ 35537c478bd9Sstevel@tonic-gate struct f_audit_data *fad; /* unix domain sockets */ 35547c478bd9Sstevel@tonic-gate 35557c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 35567c478bd9Sstevel@tonic-gate 35577c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 35587c478bd9Sstevel@tonic-gate /* 35597c478bd9Sstevel@tonic-gate * not security relevant if doing a shutdown using non socket 35607c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 35617c478bd9Sstevel@tonic-gate * generation here. 35627c478bd9Sstevel@tonic-gate */ 35637c478bd9Sstevel@tonic-gate return; 35647c478bd9Sstevel@tonic-gate } 35657c478bd9Sstevel@tonic-gate 35667c478bd9Sstevel@tonic-gate so_family = so->so_family; 35677c478bd9Sstevel@tonic-gate so_type = so->so_type; 35687c478bd9Sstevel@tonic-gate 35697c478bd9Sstevel@tonic-gate switch (so_family) { 35707c478bd9Sstevel@tonic-gate case AF_INET: 35717c478bd9Sstevel@tonic-gate case AF_INET6: 35727c478bd9Sstevel@tonic-gate 35737c478bd9Sstevel@tonic-gate bzero(so_laddr, sizeof (so_laddr)); 35747c478bd9Sstevel@tonic-gate bzero(so_faddr, sizeof (so_faddr)); 35757c478bd9Sstevel@tonic-gate 35767c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 35777c478bd9Sstevel@tonic-gate /* 35787c478bd9Sstevel@tonic-gate * no local address then need to get it from lower 35797c478bd9Sstevel@tonic-gate * levels. 35807c478bd9Sstevel@tonic-gate */ 35817c478bd9Sstevel@tonic-gate if (so->so_laddr_len == 0) 35827c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 35837c478bd9Sstevel@tonic-gate if (so->so_faddr_len == 0) 35847c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 35857c478bd9Sstevel@tonic-gate } 35867c478bd9Sstevel@tonic-gate 35877c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 35887c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 35897c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 35907c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 35917c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 35927c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 35937c478bd9Sstevel@tonic-gate 35947c478bd9Sstevel@tonic-gate add_sock_token = 1; 35957c478bd9Sstevel@tonic-gate 35967c478bd9Sstevel@tonic-gate break; 35977c478bd9Sstevel@tonic-gate 35987c478bd9Sstevel@tonic-gate case AF_UNIX: 35997c478bd9Sstevel@tonic-gate 36007c478bd9Sstevel@tonic-gate /* get path from file struct here */ 36017c478bd9Sstevel@tonic-gate fad = F2A(fp); 36027c478bd9Sstevel@tonic-gate ASSERT(fad); 36037c478bd9Sstevel@tonic-gate 36047c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 36057c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 36067c478bd9Sstevel@tonic-gate } else { 36077c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 36087c478bd9Sstevel@tonic-gate } 36097c478bd9Sstevel@tonic-gate 36107c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 36117c478bd9Sstevel@tonic-gate 36127c478bd9Sstevel@tonic-gate break; 36137c478bd9Sstevel@tonic-gate 36147c478bd9Sstevel@tonic-gate default: 36157c478bd9Sstevel@tonic-gate /* 36167c478bd9Sstevel@tonic-gate * AF_KEY and AF_ROUTE support shutdown. No socket token 36177c478bd9Sstevel@tonic-gate * added. 36187c478bd9Sstevel@tonic-gate */ 36197c478bd9Sstevel@tonic-gate break; 36207c478bd9Sstevel@tonic-gate } 36217c478bd9Sstevel@tonic-gate 36227c478bd9Sstevel@tonic-gate releasef(fd); 36237c478bd9Sstevel@tonic-gate 36247c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 36257c478bd9Sstevel@tonic-gate 36267c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 36277c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)(so_family))); 36287c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)(so_type))); 36297c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "how", (uint32_t)(uap->how))); 36307c478bd9Sstevel@tonic-gate return; 36317c478bd9Sstevel@tonic-gate } 36327c478bd9Sstevel@tonic-gate 36337c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "how", (uint32_t)(uap->how))); 36347c478bd9Sstevel@tonic-gate 36357c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 36367c478bd9Sstevel@tonic-gate 36377c478bd9Sstevel@tonic-gate } 36387c478bd9Sstevel@tonic-gate 36397c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 36407c478bd9Sstevel@tonic-gate static void 36417c478bd9Sstevel@tonic-gate auf_setsockopt(struct t_audit_data *tad, int error, rval_t *rval) 36427c478bd9Sstevel@tonic-gate { 36437c478bd9Sstevel@tonic-gate struct a { 36447c478bd9Sstevel@tonic-gate long fd; 36457c478bd9Sstevel@tonic-gate long level; 36467c478bd9Sstevel@tonic-gate long optname; 36477c478bd9Sstevel@tonic-gate long *optval; 36487c478bd9Sstevel@tonic-gate long optlen; 36497c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 36507c478bd9Sstevel@tonic-gate 36517c478bd9Sstevel@tonic-gate struct sonode *so; 36527c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 36537c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 36547c478bd9Sstevel@tonic-gate char val[AU_BUFSIZE]; 36557c478bd9Sstevel@tonic-gate int err, fd; 36567c478bd9Sstevel@tonic-gate int len; 36577c478bd9Sstevel@tonic-gate short so_family, so_type; 36587c478bd9Sstevel@tonic-gate int add_sock_token = 0; 36597c478bd9Sstevel@tonic-gate file_t *fp; /* unix domain sockets */ 36607c478bd9Sstevel@tonic-gate struct f_audit_data *fad; /* unix domain sockets */ 36617c478bd9Sstevel@tonic-gate 36627c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 36637c478bd9Sstevel@tonic-gate 36647c478bd9Sstevel@tonic-gate if (error) { 36657c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 36667c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "level", (uint32_t)uap->level)); 36677c478bd9Sstevel@tonic-gate /* XXX may want to include other arguments */ 36687c478bd9Sstevel@tonic-gate return; 36697c478bd9Sstevel@tonic-gate } 36707c478bd9Sstevel@tonic-gate 36717c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 36727c478bd9Sstevel@tonic-gate /* 36737c478bd9Sstevel@tonic-gate * not security relevant if doing a setsockopt from non socket 36747c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 36757c478bd9Sstevel@tonic-gate * generation here. 36767c478bd9Sstevel@tonic-gate */ 36777c478bd9Sstevel@tonic-gate return; 36787c478bd9Sstevel@tonic-gate } 36797c478bd9Sstevel@tonic-gate 36807c478bd9Sstevel@tonic-gate so_family = so->so_family; 36817c478bd9Sstevel@tonic-gate so_type = so->so_type; 36827c478bd9Sstevel@tonic-gate 36837c478bd9Sstevel@tonic-gate switch (so_family) { 36847c478bd9Sstevel@tonic-gate case AF_INET: 36857c478bd9Sstevel@tonic-gate case AF_INET6: 36867c478bd9Sstevel@tonic-gate 36877c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 36887c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 36897c478bd9Sstevel@tonic-gate 36907c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 36917c478bd9Sstevel@tonic-gate if (so->so_laddr_len == 0) 36927c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 36937c478bd9Sstevel@tonic-gate if (so->so_faddr_len == 0) 36947c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 36957c478bd9Sstevel@tonic-gate } 36967c478bd9Sstevel@tonic-gate 36977c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 36987c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 36997c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 37007c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 37017c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 37027c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 37037c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 37047c478bd9Sstevel@tonic-gate 37057c478bd9Sstevel@tonic-gate add_sock_token = 1; 37067c478bd9Sstevel@tonic-gate 37077c478bd9Sstevel@tonic-gate break; 37087c478bd9Sstevel@tonic-gate 37097c478bd9Sstevel@tonic-gate case AF_UNIX: 37107c478bd9Sstevel@tonic-gate 37117c478bd9Sstevel@tonic-gate /* get path from file struct here */ 37127c478bd9Sstevel@tonic-gate fad = F2A(fp); 37137c478bd9Sstevel@tonic-gate ASSERT(fad); 37147c478bd9Sstevel@tonic-gate 37157c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 37167c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 37177c478bd9Sstevel@tonic-gate } else { 37187c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 37197c478bd9Sstevel@tonic-gate } 37207c478bd9Sstevel@tonic-gate 37217c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 37227c478bd9Sstevel@tonic-gate 37237c478bd9Sstevel@tonic-gate break; 37247c478bd9Sstevel@tonic-gate 37257c478bd9Sstevel@tonic-gate default: 37267c478bd9Sstevel@tonic-gate /* 37277c478bd9Sstevel@tonic-gate * AF_KEY and AF_ROUTE support setsockopt. No socket token 37287c478bd9Sstevel@tonic-gate * added. 37297c478bd9Sstevel@tonic-gate */ 37307c478bd9Sstevel@tonic-gate break; 37317c478bd9Sstevel@tonic-gate } 37327c478bd9Sstevel@tonic-gate 37337c478bd9Sstevel@tonic-gate releasef(fd); 37347c478bd9Sstevel@tonic-gate 37357c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 37367c478bd9Sstevel@tonic-gate 37377c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 37387c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)(so_family))); 37397c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)(so_type))); 37407c478bd9Sstevel@tonic-gate } 37417c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "level", (uint32_t)(uap->level))); 37427c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "optname", (uint32_t)(uap->optname))); 37437c478bd9Sstevel@tonic-gate 37447c478bd9Sstevel@tonic-gate bzero(val, sizeof (val)); 37457c478bd9Sstevel@tonic-gate len = min(uap->optlen, sizeof (val)); 37467c478bd9Sstevel@tonic-gate if ((len > 0) && 37477c478bd9Sstevel@tonic-gate (copyin((caddr_t)(uap->optval), (caddr_t)val, len) == 0)) { 37487c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(5, "optlen", (uint32_t)(uap->optlen))); 37497c478bd9Sstevel@tonic-gate au_uwrite(au_to_data(AUP_HEX, AUR_BYTE, len, val)); 37507c478bd9Sstevel@tonic-gate } 37517c478bd9Sstevel@tonic-gate 37527c478bd9Sstevel@tonic-gate if (add_sock_token == 0) 37537c478bd9Sstevel@tonic-gate return; 37547c478bd9Sstevel@tonic-gate 37557c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 37567c478bd9Sstevel@tonic-gate 37577c478bd9Sstevel@tonic-gate } 37587c478bd9Sstevel@tonic-gate 37597c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 37607c478bd9Sstevel@tonic-gate static void 37617c478bd9Sstevel@tonic-gate aus_sockconfig(tad) 37627c478bd9Sstevel@tonic-gate struct t_audit_data *tad; 37637c478bd9Sstevel@tonic-gate { 37647c478bd9Sstevel@tonic-gate struct a { 37657c478bd9Sstevel@tonic-gate long domain; 37667c478bd9Sstevel@tonic-gate long type; 37677c478bd9Sstevel@tonic-gate long protocol; 37687c478bd9Sstevel@tonic-gate long devpath; 37697c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 37707c478bd9Sstevel@tonic-gate 37717c478bd9Sstevel@tonic-gate char *kdevpath; 37727c478bd9Sstevel@tonic-gate int kdevpathlen = MAXPATHLEN + 1; 37737c478bd9Sstevel@tonic-gate size_t size; 37747c478bd9Sstevel@tonic-gate 37757c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "domain", (uint32_t)uap->domain)); 37767c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "type", (uint32_t)uap->type)); 37777c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "protocol", (uint32_t)uap->protocol)); 37787c478bd9Sstevel@tonic-gate 37797c478bd9Sstevel@tonic-gate if (uap->devpath == 0) { 37807c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "devpath", (uint32_t)0)); 37817c478bd9Sstevel@tonic-gate } else { 37827c478bd9Sstevel@tonic-gate kdevpath = kmem_alloc(kdevpathlen, KM_SLEEP); 37837c478bd9Sstevel@tonic-gate 37847c478bd9Sstevel@tonic-gate if (copyinstr((caddr_t)uap->devpath, kdevpath, kdevpathlen, 37857c478bd9Sstevel@tonic-gate &size)) { 37867c478bd9Sstevel@tonic-gate kmem_free(kdevpath, kdevpathlen); 37877c478bd9Sstevel@tonic-gate return; 37887c478bd9Sstevel@tonic-gate } 37897c478bd9Sstevel@tonic-gate 37907c478bd9Sstevel@tonic-gate if (size > MAXPATHLEN) { 37917c478bd9Sstevel@tonic-gate kmem_free(kdevpath, kdevpathlen); 37927c478bd9Sstevel@tonic-gate return; 37937c478bd9Sstevel@tonic-gate } 37947c478bd9Sstevel@tonic-gate 37957c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(kdevpath)); 37967c478bd9Sstevel@tonic-gate kmem_free(kdevpath, kdevpathlen); 37977c478bd9Sstevel@tonic-gate } 37987c478bd9Sstevel@tonic-gate } 37997c478bd9Sstevel@tonic-gate 38007c478bd9Sstevel@tonic-gate /* 38017c478bd9Sstevel@tonic-gate * only audit recvmsg when the system call represents the creation of a new 38027c478bd9Sstevel@tonic-gate * circuit. This effectively occurs for all UDP packets and may occur for 38037c478bd9Sstevel@tonic-gate * special TCP situations where the local host has not set a local address 38047c478bd9Sstevel@tonic-gate * in the socket structure. 38057c478bd9Sstevel@tonic-gate */ 38067c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 38077c478bd9Sstevel@tonic-gate static void 38087c478bd9Sstevel@tonic-gate auf_recvmsg( 38097c478bd9Sstevel@tonic-gate struct t_audit_data *tad, 38107c478bd9Sstevel@tonic-gate int error, 38117c478bd9Sstevel@tonic-gate rval_t *rvp) 38127c478bd9Sstevel@tonic-gate { 38137c478bd9Sstevel@tonic-gate struct a { 38147c478bd9Sstevel@tonic-gate long fd; 38157c478bd9Sstevel@tonic-gate long msg; /* struct msghdr */ 38167c478bd9Sstevel@tonic-gate long flags; 38177c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 38187c478bd9Sstevel@tonic-gate 38197c478bd9Sstevel@tonic-gate struct sonode *so; 38207c478bd9Sstevel@tonic-gate STRUCT_DECL(msghdr, msg); 38217c478bd9Sstevel@tonic-gate caddr_t msg_name; 38227c478bd9Sstevel@tonic-gate socklen_t msg_namelen; 38237c478bd9Sstevel@tonic-gate int fd; 38247c478bd9Sstevel@tonic-gate int err; 38257c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 38267c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 38277c478bd9Sstevel@tonic-gate int len; 38287c478bd9Sstevel@tonic-gate file_t *fp; /* unix domain sockets */ 38297c478bd9Sstevel@tonic-gate struct f_audit_data *fad; /* unix domain sockets */ 38307c478bd9Sstevel@tonic-gate short so_family, so_type; 38317c478bd9Sstevel@tonic-gate int add_sock_token = 0; 38329e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 38337c478bd9Sstevel@tonic-gate 38347c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 38357c478bd9Sstevel@tonic-gate 38367c478bd9Sstevel@tonic-gate /* bail if an error */ 38377c478bd9Sstevel@tonic-gate if (error) { 38387c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 38397c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 38407c478bd9Sstevel@tonic-gate return; 38417c478bd9Sstevel@tonic-gate } 38427c478bd9Sstevel@tonic-gate 38437c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 38447c478bd9Sstevel@tonic-gate /* 38457c478bd9Sstevel@tonic-gate * not security relevant if doing a recvmsg from non socket 38467c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 38477c478bd9Sstevel@tonic-gate * generation here. 38487c478bd9Sstevel@tonic-gate */ 38497c478bd9Sstevel@tonic-gate return; 38507c478bd9Sstevel@tonic-gate } 38517c478bd9Sstevel@tonic-gate 38527c478bd9Sstevel@tonic-gate so_family = so->so_family; 38537c478bd9Sstevel@tonic-gate so_type = so->so_type; 38547c478bd9Sstevel@tonic-gate 38557c478bd9Sstevel@tonic-gate /* 38567c478bd9Sstevel@tonic-gate * only putout SOCKET_EX token if INET/INET6 family. 38577c478bd9Sstevel@tonic-gate * XXX - what do we do about other families? 38587c478bd9Sstevel@tonic-gate */ 38597c478bd9Sstevel@tonic-gate 38607c478bd9Sstevel@tonic-gate switch (so_family) { 38617c478bd9Sstevel@tonic-gate case AF_INET: 38627c478bd9Sstevel@tonic-gate case AF_INET6: 38637c478bd9Sstevel@tonic-gate 38647c478bd9Sstevel@tonic-gate /* 38657c478bd9Sstevel@tonic-gate * if datagram type socket, then just use what is in 38667c478bd9Sstevel@tonic-gate * socket structure for local address. 38677c478bd9Sstevel@tonic-gate * XXX - what do we do for other types? 38687c478bd9Sstevel@tonic-gate */ 38697c478bd9Sstevel@tonic-gate if ((so->so_type == SOCK_DGRAM) || 38707c478bd9Sstevel@tonic-gate (so->so_type == SOCK_RAW)) { 38717c478bd9Sstevel@tonic-gate add_sock_token = 1; 38727c478bd9Sstevel@tonic-gate 38737c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 38747c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 38757c478bd9Sstevel@tonic-gate 38767c478bd9Sstevel@tonic-gate /* get local address */ 38777c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 38787c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 38797c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 38807c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 38817c478bd9Sstevel@tonic-gate 38827c478bd9Sstevel@tonic-gate /* get peer address */ 38837c478bd9Sstevel@tonic-gate STRUCT_INIT(msg, get_udatamodel()); 38847c478bd9Sstevel@tonic-gate 38857c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->msg), 38867c478bd9Sstevel@tonic-gate (caddr_t)STRUCT_BUF(msg), STRUCT_SIZE(msg)) != 0) { 38877c478bd9Sstevel@tonic-gate break; 38887c478bd9Sstevel@tonic-gate } 38897c478bd9Sstevel@tonic-gate msg_name = (caddr_t)STRUCT_FGETP(msg, msg_name); 38907c478bd9Sstevel@tonic-gate if (msg_name == NULL) { 38917c478bd9Sstevel@tonic-gate break; 38927c478bd9Sstevel@tonic-gate } 38937c478bd9Sstevel@tonic-gate 38947c478bd9Sstevel@tonic-gate /* length is value from recvmsg - sanity check */ 38957c478bd9Sstevel@tonic-gate msg_namelen = (socklen_t)STRUCT_FGET(msg, msg_namelen); 38967c478bd9Sstevel@tonic-gate if (msg_namelen == 0) { 38977c478bd9Sstevel@tonic-gate break; 38987c478bd9Sstevel@tonic-gate } 38997c478bd9Sstevel@tonic-gate if (copyin(msg_name, so_faddr, 39007c478bd9Sstevel@tonic-gate sizeof (so_faddr)) != 0) { 39017c478bd9Sstevel@tonic-gate break; 39027c478bd9Sstevel@tonic-gate } 39037c478bd9Sstevel@tonic-gate 39047c478bd9Sstevel@tonic-gate } else if (so->so_type == SOCK_STREAM) { 39057c478bd9Sstevel@tonic-gate 39067c478bd9Sstevel@tonic-gate /* get path from file struct here */ 39077c478bd9Sstevel@tonic-gate fad = F2A(fp); 39087c478bd9Sstevel@tonic-gate ASSERT(fad); 39097c478bd9Sstevel@tonic-gate 39107c478bd9Sstevel@tonic-gate /* 39117c478bd9Sstevel@tonic-gate * already processed this file for read attempt 39127c478bd9Sstevel@tonic-gate */ 39137c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_READ) { 39147c478bd9Sstevel@tonic-gate /* don't want to audit every recvmsg attempt */ 39157c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 39167c478bd9Sstevel@tonic-gate /* free any residual audit data */ 39177c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 39187c478bd9Sstevel@tonic-gate releasef(fd); 39197c478bd9Sstevel@tonic-gate return; 39207c478bd9Sstevel@tonic-gate } 39217c478bd9Sstevel@tonic-gate /* 39227c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 39237c478bd9Sstevel@tonic-gate * repeat things 39247c478bd9Sstevel@tonic-gate */ 39257c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 39267c478bd9Sstevel@tonic-gate 39277c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 39287c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 39297c478bd9Sstevel@tonic-gate 39307c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 39317c478bd9Sstevel@tonic-gate 39327c478bd9Sstevel@tonic-gate if (so->so_laddr_len == 0) 39337c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 39347c478bd9Sstevel@tonic-gate if (so->so_faddr_len == 0) 39357c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 39367c478bd9Sstevel@tonic-gate 39377c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 39387c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 39397c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 39407c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 39417c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 39427c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 39437c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 39447c478bd9Sstevel@tonic-gate } 39457c478bd9Sstevel@tonic-gate 39467c478bd9Sstevel@tonic-gate add_sock_token = 1; 39477c478bd9Sstevel@tonic-gate } 39487c478bd9Sstevel@tonic-gate 39497c478bd9Sstevel@tonic-gate /* XXX - what about SOCK_RDM/SOCK_SEQPACKET ??? */ 39507c478bd9Sstevel@tonic-gate 39517c478bd9Sstevel@tonic-gate break; 39527c478bd9Sstevel@tonic-gate 39537c478bd9Sstevel@tonic-gate case AF_UNIX: 39547c478bd9Sstevel@tonic-gate /* 39557c478bd9Sstevel@tonic-gate * first check if this is first time through. Too much 39567c478bd9Sstevel@tonic-gate * duplicate code to put this in an aui_ routine. 39577c478bd9Sstevel@tonic-gate */ 39587c478bd9Sstevel@tonic-gate 39597c478bd9Sstevel@tonic-gate /* get path from file struct here */ 39607c478bd9Sstevel@tonic-gate fad = F2A(fp); 39617c478bd9Sstevel@tonic-gate ASSERT(fad); 39627c478bd9Sstevel@tonic-gate 39637c478bd9Sstevel@tonic-gate /* 39647c478bd9Sstevel@tonic-gate * already processed this file for read attempt 39657c478bd9Sstevel@tonic-gate */ 39667c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_READ) { 39677c478bd9Sstevel@tonic-gate releasef(fd); 39687c478bd9Sstevel@tonic-gate /* don't want to audit every recvmsg attempt */ 39697c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 39707c478bd9Sstevel@tonic-gate /* free any residual audit data */ 39717c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 39727c478bd9Sstevel@tonic-gate return; 39737c478bd9Sstevel@tonic-gate } 39747c478bd9Sstevel@tonic-gate /* 39757c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 39767c478bd9Sstevel@tonic-gate * repeat things 39777c478bd9Sstevel@tonic-gate */ 39787c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 39797c478bd9Sstevel@tonic-gate 39807c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 39817c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 39827c478bd9Sstevel@tonic-gate } else { 39837c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 39847c478bd9Sstevel@tonic-gate } 39857c478bd9Sstevel@tonic-gate 39867c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 39877c478bd9Sstevel@tonic-gate 39887c478bd9Sstevel@tonic-gate releasef(fd); 39897c478bd9Sstevel@tonic-gate 39907c478bd9Sstevel@tonic-gate return; 39917c478bd9Sstevel@tonic-gate 39927c478bd9Sstevel@tonic-gate default: 39937c478bd9Sstevel@tonic-gate break; 39947c478bd9Sstevel@tonic-gate 39957c478bd9Sstevel@tonic-gate } 39967c478bd9Sstevel@tonic-gate 39977c478bd9Sstevel@tonic-gate releasef(fd); 39987c478bd9Sstevel@tonic-gate 39997c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 40007c478bd9Sstevel@tonic-gate 40017c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 40027c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)so_family)); 40037c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)so_type)); 40047c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 40057c478bd9Sstevel@tonic-gate return; 40067c478bd9Sstevel@tonic-gate } 40077c478bd9Sstevel@tonic-gate 40087c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 40097c478bd9Sstevel@tonic-gate 40107c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 40117c478bd9Sstevel@tonic-gate 40127c478bd9Sstevel@tonic-gate } 40137c478bd9Sstevel@tonic-gate 40147c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 40157c478bd9Sstevel@tonic-gate static void 40167c478bd9Sstevel@tonic-gate auf_recvfrom( 40177c478bd9Sstevel@tonic-gate struct t_audit_data *tad, 40187c478bd9Sstevel@tonic-gate int error, 40197c478bd9Sstevel@tonic-gate rval_t *rvp) 40207c478bd9Sstevel@tonic-gate { 40217c478bd9Sstevel@tonic-gate 40227c478bd9Sstevel@tonic-gate struct a { 40237c478bd9Sstevel@tonic-gate long fd; 40247c478bd9Sstevel@tonic-gate long msg; /* char */ 40257c478bd9Sstevel@tonic-gate long len; 40267c478bd9Sstevel@tonic-gate long flags; 40277c478bd9Sstevel@tonic-gate long from; /* struct sockaddr */ 40287c478bd9Sstevel@tonic-gate long fromlen; 40297c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 40307c478bd9Sstevel@tonic-gate 40317c478bd9Sstevel@tonic-gate socklen_t fromlen; 40327c478bd9Sstevel@tonic-gate struct sonode *so; 40337c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 40347c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 40357c478bd9Sstevel@tonic-gate int fd; 40367c478bd9Sstevel@tonic-gate short so_family, so_type; 40377c478bd9Sstevel@tonic-gate int add_sock_token = 0; 40387c478bd9Sstevel@tonic-gate int len; 40397c478bd9Sstevel@tonic-gate int err; 40407c478bd9Sstevel@tonic-gate struct file *fp; 40417c478bd9Sstevel@tonic-gate struct f_audit_data *fad; /* unix domain sockets */ 40429e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 40437c478bd9Sstevel@tonic-gate 40447c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 40457c478bd9Sstevel@tonic-gate 40467c478bd9Sstevel@tonic-gate /* bail if an error */ 40477c478bd9Sstevel@tonic-gate if (error) { 40487c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 40497c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 40507c478bd9Sstevel@tonic-gate return; 40517c478bd9Sstevel@tonic-gate } 40527c478bd9Sstevel@tonic-gate 40537c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 40547c478bd9Sstevel@tonic-gate /* 40557c478bd9Sstevel@tonic-gate * not security relevant if doing a recvmsg from non socket 40567c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 40577c478bd9Sstevel@tonic-gate * generation here. 40587c478bd9Sstevel@tonic-gate */ 40597c478bd9Sstevel@tonic-gate return; 40607c478bd9Sstevel@tonic-gate } 40617c478bd9Sstevel@tonic-gate 40627c478bd9Sstevel@tonic-gate so_family = so->so_family; 40637c478bd9Sstevel@tonic-gate so_type = so->so_type; 40647c478bd9Sstevel@tonic-gate 40657c478bd9Sstevel@tonic-gate /* 40667c478bd9Sstevel@tonic-gate * only putout SOCKET_EX token if INET/INET6 family. 40677c478bd9Sstevel@tonic-gate * XXX - what do we do about other families? 40687c478bd9Sstevel@tonic-gate */ 40697c478bd9Sstevel@tonic-gate 40707c478bd9Sstevel@tonic-gate switch (so_family) { 40717c478bd9Sstevel@tonic-gate case AF_INET: 40727c478bd9Sstevel@tonic-gate case AF_INET6: 40737c478bd9Sstevel@tonic-gate 40747c478bd9Sstevel@tonic-gate /* 40757c478bd9Sstevel@tonic-gate * if datagram type socket, then just use what is in 40767c478bd9Sstevel@tonic-gate * socket structure for local address. 40777c478bd9Sstevel@tonic-gate * XXX - what do we do for other types? 40787c478bd9Sstevel@tonic-gate */ 40797c478bd9Sstevel@tonic-gate if ((so->so_type == SOCK_DGRAM) || 40807c478bd9Sstevel@tonic-gate (so->so_type == SOCK_RAW)) { 40817c478bd9Sstevel@tonic-gate add_sock_token = 1; 40827c478bd9Sstevel@tonic-gate 40837c478bd9Sstevel@tonic-gate /* get local address */ 40847c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 40857c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 40867c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 40877c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 40887c478bd9Sstevel@tonic-gate 40897c478bd9Sstevel@tonic-gate /* get peer address */ 40907c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 40917c478bd9Sstevel@tonic-gate 40927c478bd9Sstevel@tonic-gate /* sanity check */ 40937c478bd9Sstevel@tonic-gate if (uap->from == NULL) 40947c478bd9Sstevel@tonic-gate break; 40957c478bd9Sstevel@tonic-gate 40967c478bd9Sstevel@tonic-gate /* sanity checks */ 40977c478bd9Sstevel@tonic-gate if (uap->fromlen == 0) 40987c478bd9Sstevel@tonic-gate break; 40997c478bd9Sstevel@tonic-gate 41007c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->fromlen), (caddr_t)&fromlen, 41017c478bd9Sstevel@tonic-gate sizeof (fromlen)) != 0) 41027c478bd9Sstevel@tonic-gate break; 41037c478bd9Sstevel@tonic-gate 41047c478bd9Sstevel@tonic-gate if (fromlen == 0) 41057c478bd9Sstevel@tonic-gate break; 41067c478bd9Sstevel@tonic-gate 41077c478bd9Sstevel@tonic-gate /* enforce maximum size */ 41087c478bd9Sstevel@tonic-gate if (fromlen > sizeof (so_faddr)) 41097c478bd9Sstevel@tonic-gate fromlen = sizeof (so_faddr); 41107c478bd9Sstevel@tonic-gate 41117c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->from), so_faddr, 41127c478bd9Sstevel@tonic-gate fromlen) != 0) 41137c478bd9Sstevel@tonic-gate break; 41147c478bd9Sstevel@tonic-gate 41157c478bd9Sstevel@tonic-gate } else if (so->so_type == SOCK_STREAM) { 41167c478bd9Sstevel@tonic-gate 41177c478bd9Sstevel@tonic-gate /* get path from file struct here */ 41187c478bd9Sstevel@tonic-gate fad = F2A(fp); 41197c478bd9Sstevel@tonic-gate ASSERT(fad); 41207c478bd9Sstevel@tonic-gate 41217c478bd9Sstevel@tonic-gate /* 41227c478bd9Sstevel@tonic-gate * already processed this file for read attempt 41237c478bd9Sstevel@tonic-gate */ 41247c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_READ) { 41257c478bd9Sstevel@tonic-gate /* don't want to audit every recvfrom attempt */ 41267c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 41277c478bd9Sstevel@tonic-gate /* free any residual audit data */ 41287c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 41297c478bd9Sstevel@tonic-gate releasef(fd); 41307c478bd9Sstevel@tonic-gate return; 41317c478bd9Sstevel@tonic-gate } 41327c478bd9Sstevel@tonic-gate /* 41337c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 41347c478bd9Sstevel@tonic-gate * repeat things 41357c478bd9Sstevel@tonic-gate */ 41367c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 41377c478bd9Sstevel@tonic-gate 41387c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 41397c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 41407c478bd9Sstevel@tonic-gate 41417c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 41427c478bd9Sstevel@tonic-gate 41437c478bd9Sstevel@tonic-gate if (so->so_laddr_len == 0) 41447c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 41457c478bd9Sstevel@tonic-gate if (so->so_faddr_len == 0) 41467c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 41477c478bd9Sstevel@tonic-gate 41487c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 41497c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 41507c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 41517c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 41527c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 41537c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 41547c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 41557c478bd9Sstevel@tonic-gate } 41567c478bd9Sstevel@tonic-gate 41577c478bd9Sstevel@tonic-gate add_sock_token = 1; 41587c478bd9Sstevel@tonic-gate } 41597c478bd9Sstevel@tonic-gate 41607c478bd9Sstevel@tonic-gate /* XXX - what about SOCK_RDM/SOCK_SEQPACKET ??? */ 41617c478bd9Sstevel@tonic-gate 41627c478bd9Sstevel@tonic-gate break; 41637c478bd9Sstevel@tonic-gate 41647c478bd9Sstevel@tonic-gate case AF_UNIX: 41657c478bd9Sstevel@tonic-gate /* 41667c478bd9Sstevel@tonic-gate * first check if this is first time through. Too much 41677c478bd9Sstevel@tonic-gate * duplicate code to put this in an aui_ routine. 41687c478bd9Sstevel@tonic-gate */ 41697c478bd9Sstevel@tonic-gate 41707c478bd9Sstevel@tonic-gate /* get path from file struct here */ 41717c478bd9Sstevel@tonic-gate fad = F2A(fp); 41727c478bd9Sstevel@tonic-gate ASSERT(fad); 41737c478bd9Sstevel@tonic-gate 41747c478bd9Sstevel@tonic-gate /* 41757c478bd9Sstevel@tonic-gate * already processed this file for read attempt 41767c478bd9Sstevel@tonic-gate */ 41777c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_READ) { 41787c478bd9Sstevel@tonic-gate /* don't want to audit every recvfrom attempt */ 41797c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 41807c478bd9Sstevel@tonic-gate /* free any residual audit data */ 41817c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 41827c478bd9Sstevel@tonic-gate releasef(fd); 41837c478bd9Sstevel@tonic-gate return; 41847c478bd9Sstevel@tonic-gate } 41857c478bd9Sstevel@tonic-gate /* 41867c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 41877c478bd9Sstevel@tonic-gate * repeat things 41887c478bd9Sstevel@tonic-gate */ 41897c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 41907c478bd9Sstevel@tonic-gate 41917c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 41927c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 41937c478bd9Sstevel@tonic-gate } else { 41947c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 41957c478bd9Sstevel@tonic-gate } 41967c478bd9Sstevel@tonic-gate 41977c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 41987c478bd9Sstevel@tonic-gate 41997c478bd9Sstevel@tonic-gate releasef(fd); 42007c478bd9Sstevel@tonic-gate 42017c478bd9Sstevel@tonic-gate return; 42027c478bd9Sstevel@tonic-gate 42037c478bd9Sstevel@tonic-gate default: 42047c478bd9Sstevel@tonic-gate break; 42057c478bd9Sstevel@tonic-gate 42067c478bd9Sstevel@tonic-gate } 42077c478bd9Sstevel@tonic-gate 42087c478bd9Sstevel@tonic-gate releasef(fd); 42097c478bd9Sstevel@tonic-gate 42107c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 42117c478bd9Sstevel@tonic-gate 42127c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 42137c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)so_family)); 42147c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)so_type)); 42157c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 42167c478bd9Sstevel@tonic-gate return; 42177c478bd9Sstevel@tonic-gate } 42187c478bd9Sstevel@tonic-gate 42197c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 42207c478bd9Sstevel@tonic-gate 42217c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 42227c478bd9Sstevel@tonic-gate } 42237c478bd9Sstevel@tonic-gate 42247c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 42257c478bd9Sstevel@tonic-gate static void 42267c478bd9Sstevel@tonic-gate auf_sendmsg(struct t_audit_data *tad, int error, rval_t *rval) 42277c478bd9Sstevel@tonic-gate { 42287c478bd9Sstevel@tonic-gate struct a { 42297c478bd9Sstevel@tonic-gate long fd; 42307c478bd9Sstevel@tonic-gate long msg; /* struct msghdr */ 42317c478bd9Sstevel@tonic-gate long flags; 42327c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 42337c478bd9Sstevel@tonic-gate 42347c478bd9Sstevel@tonic-gate struct sonode *so; 42357c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 42367c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 42377c478bd9Sstevel@tonic-gate int err; 42387c478bd9Sstevel@tonic-gate int fd; 42397c478bd9Sstevel@tonic-gate short so_family, so_type; 42407c478bd9Sstevel@tonic-gate int add_sock_token = 0; 42417c478bd9Sstevel@tonic-gate int len; 42427c478bd9Sstevel@tonic-gate struct file *fp; 42437c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 42447c478bd9Sstevel@tonic-gate caddr_t msg_name; 42457c478bd9Sstevel@tonic-gate socklen_t msg_namelen; 42467c478bd9Sstevel@tonic-gate STRUCT_DECL(msghdr, msg); 42479e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 42487c478bd9Sstevel@tonic-gate 42497c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 42507c478bd9Sstevel@tonic-gate 42517c478bd9Sstevel@tonic-gate /* bail if an error */ 42527c478bd9Sstevel@tonic-gate if (error) { 42537c478bd9Sstevel@tonic-gate /* XXX include destination address from system call arguments */ 42547c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 42557c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 42567c478bd9Sstevel@tonic-gate return; 42577c478bd9Sstevel@tonic-gate } 42587c478bd9Sstevel@tonic-gate 42597c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 42607c478bd9Sstevel@tonic-gate /* 42617c478bd9Sstevel@tonic-gate * not security relevant if doing a sendmsg from non socket 42627c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 42637c478bd9Sstevel@tonic-gate * generation here. 42647c478bd9Sstevel@tonic-gate */ 42657c478bd9Sstevel@tonic-gate return; 42667c478bd9Sstevel@tonic-gate } 42677c478bd9Sstevel@tonic-gate 42687c478bd9Sstevel@tonic-gate so_family = so->so_family; 42697c478bd9Sstevel@tonic-gate so_type = so->so_type; 42707c478bd9Sstevel@tonic-gate 42717c478bd9Sstevel@tonic-gate switch (so_family) { 42727c478bd9Sstevel@tonic-gate case AF_INET: 42737c478bd9Sstevel@tonic-gate case AF_INET6: 42747c478bd9Sstevel@tonic-gate /* 42757c478bd9Sstevel@tonic-gate * if datagram type socket, then just use what is in 42767c478bd9Sstevel@tonic-gate * socket structure for local address. 42777c478bd9Sstevel@tonic-gate * XXX - what do we do for other types? 42787c478bd9Sstevel@tonic-gate */ 42797c478bd9Sstevel@tonic-gate if ((so->so_type == SOCK_DGRAM) || 42807c478bd9Sstevel@tonic-gate (so->so_type == SOCK_RAW)) { 42817c478bd9Sstevel@tonic-gate 42827c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 42837c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 42847c478bd9Sstevel@tonic-gate 42857c478bd9Sstevel@tonic-gate /* get local address */ 42867c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 42877c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 42887c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 42897c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 42907c478bd9Sstevel@tonic-gate 42917c478bd9Sstevel@tonic-gate /* get peer address */ 42927c478bd9Sstevel@tonic-gate STRUCT_INIT(msg, get_udatamodel()); 42937c478bd9Sstevel@tonic-gate 42947c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->msg), 42957c478bd9Sstevel@tonic-gate (caddr_t)STRUCT_BUF(msg), STRUCT_SIZE(msg)) != 0) { 42967c478bd9Sstevel@tonic-gate break; 42977c478bd9Sstevel@tonic-gate } 42987c478bd9Sstevel@tonic-gate msg_name = (caddr_t)STRUCT_FGETP(msg, msg_name); 42997c478bd9Sstevel@tonic-gate if (msg_name == NULL) 43007c478bd9Sstevel@tonic-gate break; 43017c478bd9Sstevel@tonic-gate 43027c478bd9Sstevel@tonic-gate msg_namelen = (socklen_t)STRUCT_FGET(msg, msg_namelen); 43037c478bd9Sstevel@tonic-gate /* length is value from recvmsg - sanity check */ 43047c478bd9Sstevel@tonic-gate if (msg_namelen == 0) 43057c478bd9Sstevel@tonic-gate break; 43067c478bd9Sstevel@tonic-gate 43077c478bd9Sstevel@tonic-gate if (copyin(msg_name, so_faddr, 43087c478bd9Sstevel@tonic-gate sizeof (so_faddr)) != 0) 43097c478bd9Sstevel@tonic-gate break; 43107c478bd9Sstevel@tonic-gate 43117c478bd9Sstevel@tonic-gate add_sock_token = 1; 43127c478bd9Sstevel@tonic-gate 43137c478bd9Sstevel@tonic-gate } else if (so->so_type == SOCK_STREAM) { 43147c478bd9Sstevel@tonic-gate 43157c478bd9Sstevel@tonic-gate /* get path from file struct here */ 43167c478bd9Sstevel@tonic-gate fad = F2A(fp); 43177c478bd9Sstevel@tonic-gate ASSERT(fad); 43187c478bd9Sstevel@tonic-gate 43197c478bd9Sstevel@tonic-gate /* 43207c478bd9Sstevel@tonic-gate * already processed this file for write attempt 43217c478bd9Sstevel@tonic-gate */ 43227c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_WRITE) { 43237c478bd9Sstevel@tonic-gate releasef(fd); 43247c478bd9Sstevel@tonic-gate /* don't want to audit every sendmsg attempt */ 43257c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 43267c478bd9Sstevel@tonic-gate /* free any residual audit data */ 43277c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 43287c478bd9Sstevel@tonic-gate return; 43297c478bd9Sstevel@tonic-gate } 43307c478bd9Sstevel@tonic-gate 43317c478bd9Sstevel@tonic-gate /* 43327c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 43337c478bd9Sstevel@tonic-gate * repeat things 43347c478bd9Sstevel@tonic-gate */ 43357c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 43367c478bd9Sstevel@tonic-gate 43377c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 43387c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 43397c478bd9Sstevel@tonic-gate 43407c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 43417c478bd9Sstevel@tonic-gate 43427c478bd9Sstevel@tonic-gate if (so->so_laddr_len == 0) 43437c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 43447c478bd9Sstevel@tonic-gate if (so->so_faddr_len == 0) 43457c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 43467c478bd9Sstevel@tonic-gate 43477c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 43487c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 43497c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 43507c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 43517c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 43527c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 43537c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 43547c478bd9Sstevel@tonic-gate } 43557c478bd9Sstevel@tonic-gate 43567c478bd9Sstevel@tonic-gate add_sock_token = 1; 43577c478bd9Sstevel@tonic-gate } 43587c478bd9Sstevel@tonic-gate 43597c478bd9Sstevel@tonic-gate /* XXX - what about SOCK_RAW/SOCK_RDM/SOCK_SEQPACKET ??? */ 43607c478bd9Sstevel@tonic-gate 43617c478bd9Sstevel@tonic-gate break; 43627c478bd9Sstevel@tonic-gate 43637c478bd9Sstevel@tonic-gate case AF_UNIX: 43647c478bd9Sstevel@tonic-gate /* 43657c478bd9Sstevel@tonic-gate * first check if this is first time through. Too much 43667c478bd9Sstevel@tonic-gate * duplicate code to put this in an aui_ routine. 43677c478bd9Sstevel@tonic-gate */ 43687c478bd9Sstevel@tonic-gate 43697c478bd9Sstevel@tonic-gate /* get path from file struct here */ 43707c478bd9Sstevel@tonic-gate fad = F2A(fp); 43717c478bd9Sstevel@tonic-gate ASSERT(fad); 43727c478bd9Sstevel@tonic-gate 43737c478bd9Sstevel@tonic-gate /* 43747c478bd9Sstevel@tonic-gate * already processed this file for write attempt 43757c478bd9Sstevel@tonic-gate */ 43767c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_WRITE) { 43777c478bd9Sstevel@tonic-gate releasef(fd); 43787c478bd9Sstevel@tonic-gate /* don't want to audit every sendmsg attempt */ 43797c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 43807c478bd9Sstevel@tonic-gate /* free any residual audit data */ 43817c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 43827c478bd9Sstevel@tonic-gate return; 43837c478bd9Sstevel@tonic-gate } 43847c478bd9Sstevel@tonic-gate /* 43857c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 43867c478bd9Sstevel@tonic-gate * repeat things 43877c478bd9Sstevel@tonic-gate */ 43887c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 43897c478bd9Sstevel@tonic-gate 43907c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 43917c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 43927c478bd9Sstevel@tonic-gate } else { 43937c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 43947c478bd9Sstevel@tonic-gate } 43957c478bd9Sstevel@tonic-gate 43967c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 43977c478bd9Sstevel@tonic-gate 43987c478bd9Sstevel@tonic-gate releasef(fd); 43997c478bd9Sstevel@tonic-gate 44007c478bd9Sstevel@tonic-gate return; 44017c478bd9Sstevel@tonic-gate 44027c478bd9Sstevel@tonic-gate default: 44037c478bd9Sstevel@tonic-gate break; 44047c478bd9Sstevel@tonic-gate } 44057c478bd9Sstevel@tonic-gate 44067c478bd9Sstevel@tonic-gate releasef(fd); 44077c478bd9Sstevel@tonic-gate 44087c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 44097c478bd9Sstevel@tonic-gate 44107c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 44117c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)so_family)); 44127c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)so_type)); 44137c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 44147c478bd9Sstevel@tonic-gate return; 44157c478bd9Sstevel@tonic-gate } 44167c478bd9Sstevel@tonic-gate 44177c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 44187c478bd9Sstevel@tonic-gate 44197c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 44207c478bd9Sstevel@tonic-gate } 44217c478bd9Sstevel@tonic-gate 44227c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 44237c478bd9Sstevel@tonic-gate static void 44247c478bd9Sstevel@tonic-gate auf_sendto(struct t_audit_data *tad, int error, rval_t *rval) 44257c478bd9Sstevel@tonic-gate { 44267c478bd9Sstevel@tonic-gate struct a { 44277c478bd9Sstevel@tonic-gate long fd; 44287c478bd9Sstevel@tonic-gate long msg; /* char */ 44297c478bd9Sstevel@tonic-gate long len; 44307c478bd9Sstevel@tonic-gate long flags; 44317c478bd9Sstevel@tonic-gate long to; /* struct sockaddr */ 44327c478bd9Sstevel@tonic-gate long tolen; 44337c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 44347c478bd9Sstevel@tonic-gate 44357c478bd9Sstevel@tonic-gate struct sonode *so; 44367c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 44377c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 44387c478bd9Sstevel@tonic-gate socklen_t tolen; 44397c478bd9Sstevel@tonic-gate int err; 44407c478bd9Sstevel@tonic-gate int fd; 44417c478bd9Sstevel@tonic-gate int len; 44427c478bd9Sstevel@tonic-gate short so_family, so_type; 44437c478bd9Sstevel@tonic-gate int add_sock_token = 0; 44447c478bd9Sstevel@tonic-gate struct file *fp; 44457c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 44469e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 44477c478bd9Sstevel@tonic-gate 44487c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 44497c478bd9Sstevel@tonic-gate 44507c478bd9Sstevel@tonic-gate /* bail if an error */ 44517c478bd9Sstevel@tonic-gate if (error) { 44527c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 44537c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 44547c478bd9Sstevel@tonic-gate /* XXX include destination address from system call arguments */ 44557c478bd9Sstevel@tonic-gate return; 44567c478bd9Sstevel@tonic-gate } 44577c478bd9Sstevel@tonic-gate 44587c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 44597c478bd9Sstevel@tonic-gate /* 44607c478bd9Sstevel@tonic-gate * not security relevant if doing a sendto using non socket 44617c478bd9Sstevel@tonic-gate * so no extra tokens. Should probably turn off audit record 44627c478bd9Sstevel@tonic-gate * generation here. 44637c478bd9Sstevel@tonic-gate */ 44647c478bd9Sstevel@tonic-gate return; 44657c478bd9Sstevel@tonic-gate } 44667c478bd9Sstevel@tonic-gate 44677c478bd9Sstevel@tonic-gate so_family = so->so_family; 44687c478bd9Sstevel@tonic-gate so_type = so->so_type; 44697c478bd9Sstevel@tonic-gate 44707c478bd9Sstevel@tonic-gate /* 44717c478bd9Sstevel@tonic-gate * only putout SOCKET_EX token if INET/INET6 family. 44727c478bd9Sstevel@tonic-gate * XXX - what do we do about other families? 44737c478bd9Sstevel@tonic-gate */ 44747c478bd9Sstevel@tonic-gate 44757c478bd9Sstevel@tonic-gate switch (so_family) { 44767c478bd9Sstevel@tonic-gate case AF_INET: 44777c478bd9Sstevel@tonic-gate case AF_INET6: 44787c478bd9Sstevel@tonic-gate 44797c478bd9Sstevel@tonic-gate /* 44807c478bd9Sstevel@tonic-gate * if datagram type socket, then just use what is in 44817c478bd9Sstevel@tonic-gate * socket structure for local address. 44827c478bd9Sstevel@tonic-gate * XXX - what do we do for other types? 44837c478bd9Sstevel@tonic-gate */ 44847c478bd9Sstevel@tonic-gate if ((so->so_type == SOCK_DGRAM) || 44857c478bd9Sstevel@tonic-gate (so->so_type == SOCK_RAW)) { 44867c478bd9Sstevel@tonic-gate 44877c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 44887c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 44897c478bd9Sstevel@tonic-gate 44907c478bd9Sstevel@tonic-gate /* get local address */ 44917c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 44927c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 44937c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 44947c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 44957c478bd9Sstevel@tonic-gate 44967c478bd9Sstevel@tonic-gate /* get peer address */ 44977c478bd9Sstevel@tonic-gate 44987c478bd9Sstevel@tonic-gate /* sanity check */ 44997c478bd9Sstevel@tonic-gate if (uap->to == NULL) 45007c478bd9Sstevel@tonic-gate break; 45017c478bd9Sstevel@tonic-gate 45027c478bd9Sstevel@tonic-gate /* sanity checks */ 45037c478bd9Sstevel@tonic-gate if (uap->tolen == 0) 45047c478bd9Sstevel@tonic-gate break; 45057c478bd9Sstevel@tonic-gate 45067c478bd9Sstevel@tonic-gate tolen = (socklen_t)uap->tolen; 45077c478bd9Sstevel@tonic-gate 45087c478bd9Sstevel@tonic-gate /* enforce maximum size */ 45097c478bd9Sstevel@tonic-gate if (tolen > sizeof (so_faddr)) 45107c478bd9Sstevel@tonic-gate tolen = sizeof (so_faddr); 45117c478bd9Sstevel@tonic-gate 45127c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->to), so_faddr, tolen) != 0) 45137c478bd9Sstevel@tonic-gate break; 45147c478bd9Sstevel@tonic-gate 45157c478bd9Sstevel@tonic-gate add_sock_token = 1; 45167c478bd9Sstevel@tonic-gate } else { 45177c478bd9Sstevel@tonic-gate /* 45187c478bd9Sstevel@tonic-gate * check if this is first time through. 45197c478bd9Sstevel@tonic-gate */ 45207c478bd9Sstevel@tonic-gate 45217c478bd9Sstevel@tonic-gate /* get path from file struct here */ 45227c478bd9Sstevel@tonic-gate fad = F2A(fp); 45237c478bd9Sstevel@tonic-gate ASSERT(fad); 45247c478bd9Sstevel@tonic-gate 45257c478bd9Sstevel@tonic-gate /* 45267c478bd9Sstevel@tonic-gate * already processed this file for write attempt 45277c478bd9Sstevel@tonic-gate */ 45287c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_WRITE) { 45297c478bd9Sstevel@tonic-gate /* don't want to audit every sendto attempt */ 45307c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 45317c478bd9Sstevel@tonic-gate /* free any residual audit data */ 45327c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 45337c478bd9Sstevel@tonic-gate releasef(fd); 45347c478bd9Sstevel@tonic-gate return; 45357c478bd9Sstevel@tonic-gate } 45367c478bd9Sstevel@tonic-gate /* 45377c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 45387c478bd9Sstevel@tonic-gate * repeat things 45397c478bd9Sstevel@tonic-gate */ 45407c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 45417c478bd9Sstevel@tonic-gate 45427c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 45437c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 45447c478bd9Sstevel@tonic-gate 45457c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 45467c478bd9Sstevel@tonic-gate 45477c478bd9Sstevel@tonic-gate if (so->so_laddr_len == 0) 45487c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 45497c478bd9Sstevel@tonic-gate if (so->so_faddr_len == 0) 45507c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 45517c478bd9Sstevel@tonic-gate 45527c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 45537c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 45547c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 45557c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 45567c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 45577c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 45587c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 45597c478bd9Sstevel@tonic-gate } 45607c478bd9Sstevel@tonic-gate 45617c478bd9Sstevel@tonic-gate add_sock_token = 1; 45627c478bd9Sstevel@tonic-gate } 45637c478bd9Sstevel@tonic-gate 45647c478bd9Sstevel@tonic-gate /* XXX - what about SOCK_RDM/SOCK_SEQPACKET ??? */ 45657c478bd9Sstevel@tonic-gate 45667c478bd9Sstevel@tonic-gate break; 45677c478bd9Sstevel@tonic-gate 45687c478bd9Sstevel@tonic-gate case AF_UNIX: 45697c478bd9Sstevel@tonic-gate /* 45707c478bd9Sstevel@tonic-gate * first check if this is first time through. Too much 45717c478bd9Sstevel@tonic-gate * duplicate code to put this in an aui_ routine. 45727c478bd9Sstevel@tonic-gate */ 45737c478bd9Sstevel@tonic-gate 45747c478bd9Sstevel@tonic-gate /* get path from file struct here */ 45757c478bd9Sstevel@tonic-gate fad = F2A(fp); 45767c478bd9Sstevel@tonic-gate ASSERT(fad); 45777c478bd9Sstevel@tonic-gate 45787c478bd9Sstevel@tonic-gate /* 45797c478bd9Sstevel@tonic-gate * already processed this file for write attempt 45807c478bd9Sstevel@tonic-gate */ 45817c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_WRITE) { 45827c478bd9Sstevel@tonic-gate /* don't want to audit every sendto attempt */ 45837c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 45847c478bd9Sstevel@tonic-gate /* free any residual audit data */ 45857c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 45867c478bd9Sstevel@tonic-gate releasef(fd); 45877c478bd9Sstevel@tonic-gate return; 45887c478bd9Sstevel@tonic-gate } 45897c478bd9Sstevel@tonic-gate /* 45907c478bd9Sstevel@tonic-gate * mark things so we know what happened and don't 45917c478bd9Sstevel@tonic-gate * repeat things 45927c478bd9Sstevel@tonic-gate */ 45937c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 45947c478bd9Sstevel@tonic-gate 45957c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 45967c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 45977c478bd9Sstevel@tonic-gate } else { 45987c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 45997c478bd9Sstevel@tonic-gate } 46007c478bd9Sstevel@tonic-gate 46017c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 46027c478bd9Sstevel@tonic-gate 46037c478bd9Sstevel@tonic-gate releasef(fd); 46047c478bd9Sstevel@tonic-gate 46057c478bd9Sstevel@tonic-gate return; 46067c478bd9Sstevel@tonic-gate 46077c478bd9Sstevel@tonic-gate default: 46087c478bd9Sstevel@tonic-gate break; 46097c478bd9Sstevel@tonic-gate 46107c478bd9Sstevel@tonic-gate } 46117c478bd9Sstevel@tonic-gate 46127c478bd9Sstevel@tonic-gate releasef(fd); 46137c478bd9Sstevel@tonic-gate 46147c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 46157c478bd9Sstevel@tonic-gate 46167c478bd9Sstevel@tonic-gate if (add_sock_token == 0) { 46177c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)so_family)); 46187c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)so_type)); 46197c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 46207c478bd9Sstevel@tonic-gate return; 46217c478bd9Sstevel@tonic-gate } 46227c478bd9Sstevel@tonic-gate 46237c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "flags", (uint32_t)(uap->flags))); 46247c478bd9Sstevel@tonic-gate 46257c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 46267c478bd9Sstevel@tonic-gate 46277c478bd9Sstevel@tonic-gate } 46287c478bd9Sstevel@tonic-gate 46297c478bd9Sstevel@tonic-gate /* 46307c478bd9Sstevel@tonic-gate * XXX socket(2) may be equivilent to open(2) on a unix domain 46317c478bd9Sstevel@tonic-gate * socket. This needs investigation. 46327c478bd9Sstevel@tonic-gate */ 46337c478bd9Sstevel@tonic-gate 46347c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 46357c478bd9Sstevel@tonic-gate static void 46367c478bd9Sstevel@tonic-gate aus_socket(struct t_audit_data *tad) 46377c478bd9Sstevel@tonic-gate { 46387c478bd9Sstevel@tonic-gate struct a { 46397c478bd9Sstevel@tonic-gate long domain; 46407c478bd9Sstevel@tonic-gate long type; 46417c478bd9Sstevel@tonic-gate long protocol; 46427c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 46437c478bd9Sstevel@tonic-gate 46447c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "domain", (uint32_t)uap->domain)); 46457c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "type", (uint32_t)uap->type)); 46467c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "protocol", (uint32_t)uap->protocol)); 46477c478bd9Sstevel@tonic-gate } 46487c478bd9Sstevel@tonic-gate 46497c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 46507c478bd9Sstevel@tonic-gate static void 46517c478bd9Sstevel@tonic-gate aus_sigqueue(struct t_audit_data *tad) 46527c478bd9Sstevel@tonic-gate { 46537c478bd9Sstevel@tonic-gate struct a { 46547c478bd9Sstevel@tonic-gate long pid; 46557c478bd9Sstevel@tonic-gate long signo; 46567c478bd9Sstevel@tonic-gate long *val; 46577c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 46587c478bd9Sstevel@tonic-gate struct proc *p; 46597c478bd9Sstevel@tonic-gate uid_t uid, ruid; 46607c478bd9Sstevel@tonic-gate gid_t gid, rgid; 46617c478bd9Sstevel@tonic-gate pid_t pid; 46627c478bd9Sstevel@tonic-gate const auditinfo_addr_t *ainfo; 46637c478bd9Sstevel@tonic-gate cred_t *cr; 46647c478bd9Sstevel@tonic-gate 46657c478bd9Sstevel@tonic-gate pid = (pid_t)uap->pid; 46667c478bd9Sstevel@tonic-gate 46677c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "signal", (uint32_t)uap->signo)); 46687c478bd9Sstevel@tonic-gate if (pid > 0) { 46697c478bd9Sstevel@tonic-gate mutex_enter(&pidlock); 46707c478bd9Sstevel@tonic-gate if ((p = prfind(pid)) == (struct proc *)0) { 46717c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 46727c478bd9Sstevel@tonic-gate return; 46737c478bd9Sstevel@tonic-gate } 46747c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock); /* so process doesn't go away */ 46757c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 46767c478bd9Sstevel@tonic-gate 46777c478bd9Sstevel@tonic-gate mutex_enter(&p->p_crlock); 46787c478bd9Sstevel@tonic-gate crhold(cr = p->p_cred); 46797c478bd9Sstevel@tonic-gate mutex_exit(&p->p_crlock); 46807c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock); 46817c478bd9Sstevel@tonic-gate 46827c478bd9Sstevel@tonic-gate ainfo = crgetauinfo(cr); 46837c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 46847c478bd9Sstevel@tonic-gate crfree(cr); 46857c478bd9Sstevel@tonic-gate return; 46867c478bd9Sstevel@tonic-gate } 46877c478bd9Sstevel@tonic-gate 46887c478bd9Sstevel@tonic-gate uid = crgetuid(cr); 46897c478bd9Sstevel@tonic-gate gid = crgetgid(cr); 46907c478bd9Sstevel@tonic-gate ruid = crgetruid(cr); 46917c478bd9Sstevel@tonic-gate rgid = crgetrgid(cr); 46927c478bd9Sstevel@tonic-gate au_uwrite(au_to_process(uid, gid, ruid, rgid, pid, 46937c478bd9Sstevel@tonic-gate ainfo->ai_auid, ainfo->ai_asid, &ainfo->ai_termid)); 46947c478bd9Sstevel@tonic-gate crfree(cr); 46957c478bd9Sstevel@tonic-gate } 46967c478bd9Sstevel@tonic-gate else 46977c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "process ID", (uint32_t)pid)); 46987c478bd9Sstevel@tonic-gate } 46997c478bd9Sstevel@tonic-gate 47007c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 47017c478bd9Sstevel@tonic-gate static void 47027c478bd9Sstevel@tonic-gate aus_inst_sync(struct t_audit_data *tad) 47037c478bd9Sstevel@tonic-gate { 47047c478bd9Sstevel@tonic-gate struct a { 47057c478bd9Sstevel@tonic-gate long name; /* char */ 47067c478bd9Sstevel@tonic-gate long flags; 47077c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 47087c478bd9Sstevel@tonic-gate 47097c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "flags", (uint32_t)uap->flags)); 47107c478bd9Sstevel@tonic-gate } 47117c478bd9Sstevel@tonic-gate 47129acbbeafSnn /*ARGSUSED*/ 47139acbbeafSnn static void 47149acbbeafSnn aus_brandsys(struct t_audit_data *tad) 47159acbbeafSnn { 47169acbbeafSnn klwp_t *clwp = ttolwp(curthread); 47179acbbeafSnn 47189acbbeafSnn struct a { 47199acbbeafSnn long cmd; 47209acbbeafSnn long arg1; 47219acbbeafSnn long arg2; 47229acbbeafSnn long arg3; 47239acbbeafSnn long arg4; 47249acbbeafSnn long arg5; 47259acbbeafSnn long arg6; 47269acbbeafSnn } *uap = (struct a *)clwp->lwp_ap; 47279acbbeafSnn 47289acbbeafSnn au_uwrite(au_to_arg32(1, "cmd", (uint_t)uap->cmd)); 47299acbbeafSnn #ifdef _LP64 47309acbbeafSnn au_uwrite(au_to_arg64(2, "arg1", (uint64_t)uap->arg1)); 47319acbbeafSnn au_uwrite(au_to_arg64(3, "arg2", (uint64_t)uap->arg2)); 47329acbbeafSnn au_uwrite(au_to_arg64(4, "arg3", (uint64_t)uap->arg3)); 47339acbbeafSnn au_uwrite(au_to_arg64(5, "arg4", (uint64_t)uap->arg4)); 47349acbbeafSnn au_uwrite(au_to_arg64(6, "arg5", (uint64_t)uap->arg5)); 47359acbbeafSnn au_uwrite(au_to_arg64(7, "arg6", (uint64_t)uap->arg6)); 47369acbbeafSnn #else 47379acbbeafSnn au_uwrite(au_to_arg32(2, "arg1", (uint32_t)uap->arg1)); 47389acbbeafSnn au_uwrite(au_to_arg32(3, "arg2", (uint32_t)uap->arg2)); 47399acbbeafSnn au_uwrite(au_to_arg32(4, "arg3", (uint32_t)uap->arg3)); 47409acbbeafSnn au_uwrite(au_to_arg32(5, "arg4", (uint32_t)uap->arg4)); 47419acbbeafSnn au_uwrite(au_to_arg32(6, "arg5", (uint32_t)uap->arg5)); 47429acbbeafSnn au_uwrite(au_to_arg32(7, "arg6", (uint32_t)uap->arg6)); 47439acbbeafSnn #endif 47449acbbeafSnn } 47459acbbeafSnn 47467c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 47477c478bd9Sstevel@tonic-gate static void 47487c478bd9Sstevel@tonic-gate aus_p_online(struct t_audit_data *tad) 47497c478bd9Sstevel@tonic-gate { 47507c478bd9Sstevel@tonic-gate struct a { 47517c478bd9Sstevel@tonic-gate long processor_id; 47527c478bd9Sstevel@tonic-gate long flag; 47537c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 47547c478bd9Sstevel@tonic-gate 47557c478bd9Sstevel@tonic-gate struct flags { 47567c478bd9Sstevel@tonic-gate int flag; 47577c478bd9Sstevel@tonic-gate char *cflag; 47587c478bd9Sstevel@tonic-gate } aflags[6] = { 47597c478bd9Sstevel@tonic-gate { P_ONLINE, "P_ONLINE"}, 47607c478bd9Sstevel@tonic-gate { P_OFFLINE, "P_OFFLINE"}, 47617c478bd9Sstevel@tonic-gate { P_NOINTR, "P_NOINTR"}, 47627c478bd9Sstevel@tonic-gate { P_SPARE, "P_SPARE"}, 47637c478bd9Sstevel@tonic-gate { P_FAULTED, "P_FAULTED"}, 47647c478bd9Sstevel@tonic-gate { P_STATUS, "P_STATUS"} 47657c478bd9Sstevel@tonic-gate }; 47667c478bd9Sstevel@tonic-gate int i; 47677c478bd9Sstevel@tonic-gate char *cflag; 47687c478bd9Sstevel@tonic-gate 47697c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "processor ID", (uint32_t)uap->processor_id)); 47707c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "flag", (uint32_t)uap->flag)); 47717c478bd9Sstevel@tonic-gate 47727c478bd9Sstevel@tonic-gate for (i = 0; i < 6; i++) { 47737c478bd9Sstevel@tonic-gate if (aflags[i].flag == uap->flag) 47747c478bd9Sstevel@tonic-gate break; 47757c478bd9Sstevel@tonic-gate } 47767c478bd9Sstevel@tonic-gate cflag = (i == 6) ? "bad flag":aflags[i].cflag; 47777c478bd9Sstevel@tonic-gate 47787c478bd9Sstevel@tonic-gate au_uwrite(au_to_text(cflag)); 47797c478bd9Sstevel@tonic-gate } 47807c478bd9Sstevel@tonic-gate 47817c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 47827c478bd9Sstevel@tonic-gate static void 47837c478bd9Sstevel@tonic-gate aus_processor_bind(struct t_audit_data *tad) 47847c478bd9Sstevel@tonic-gate { 47857c478bd9Sstevel@tonic-gate struct a { 47867c478bd9Sstevel@tonic-gate long id_type; 47877c478bd9Sstevel@tonic-gate long id; 47887c478bd9Sstevel@tonic-gate long processor_id; 47897c478bd9Sstevel@tonic-gate long obind; 47907c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 47917c478bd9Sstevel@tonic-gate 47927c478bd9Sstevel@tonic-gate struct proc *p; 47937c478bd9Sstevel@tonic-gate int lwpcnt; 47947c478bd9Sstevel@tonic-gate uid_t uid, ruid; 47957c478bd9Sstevel@tonic-gate gid_t gid, rgid; 47967c478bd9Sstevel@tonic-gate pid_t pid; 47977c478bd9Sstevel@tonic-gate const auditinfo_addr_t *ainfo; 47987c478bd9Sstevel@tonic-gate cred_t *cr; 47997c478bd9Sstevel@tonic-gate 48007c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "ID type", (uint32_t)uap->id_type)); 48017c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "ID", (uint32_t)uap->id)); 48027c478bd9Sstevel@tonic-gate if (uap->processor_id == PBIND_NONE) 48037c478bd9Sstevel@tonic-gate au_uwrite(au_to_text("PBIND_NONE")); 48047c478bd9Sstevel@tonic-gate else 48057c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "processor_id", 48067c478bd9Sstevel@tonic-gate (uint32_t)uap->processor_id)); 48077c478bd9Sstevel@tonic-gate 48087c478bd9Sstevel@tonic-gate switch (uap->id_type) { 48097c478bd9Sstevel@tonic-gate case P_MYID: 48107c478bd9Sstevel@tonic-gate case P_LWPID: 48117c478bd9Sstevel@tonic-gate mutex_enter(&pidlock); 48127c478bd9Sstevel@tonic-gate p = ttoproc(curthread); 48137c478bd9Sstevel@tonic-gate if (p == NULL || p->p_as == &kas) { 48147c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 48157c478bd9Sstevel@tonic-gate return; 48167c478bd9Sstevel@tonic-gate } 48177c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock); 48187c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 48197c478bd9Sstevel@tonic-gate lwpcnt = p->p_lwpcnt; 48207c478bd9Sstevel@tonic-gate pid = p->p_pid; 48217c478bd9Sstevel@tonic-gate 48227c478bd9Sstevel@tonic-gate mutex_enter(&p->p_crlock); 48237c478bd9Sstevel@tonic-gate crhold(cr = p->p_cred); 48247c478bd9Sstevel@tonic-gate mutex_exit(&p->p_crlock); 48257c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock); 48267c478bd9Sstevel@tonic-gate 48277c478bd9Sstevel@tonic-gate ainfo = crgetauinfo(cr); 48287c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 48297c478bd9Sstevel@tonic-gate crfree(cr); 48307c478bd9Sstevel@tonic-gate return; 48317c478bd9Sstevel@tonic-gate } 48327c478bd9Sstevel@tonic-gate 48337c478bd9Sstevel@tonic-gate uid = crgetuid(cr); 48347c478bd9Sstevel@tonic-gate gid = crgetgid(cr); 48357c478bd9Sstevel@tonic-gate ruid = crgetruid(cr); 48367c478bd9Sstevel@tonic-gate rgid = crgetrgid(cr); 48377c478bd9Sstevel@tonic-gate au_uwrite(au_to_process(uid, gid, ruid, rgid, pid, 48387c478bd9Sstevel@tonic-gate ainfo->ai_auid, ainfo->ai_asid, &ainfo->ai_termid)); 48397c478bd9Sstevel@tonic-gate crfree(cr); 48407c478bd9Sstevel@tonic-gate break; 48417c478bd9Sstevel@tonic-gate case P_PID: 48427c478bd9Sstevel@tonic-gate mutex_enter(&pidlock); 48437c478bd9Sstevel@tonic-gate p = prfind(uap->id); 48447c478bd9Sstevel@tonic-gate if (p == NULL || p->p_as == &kas) { 48457c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 48467c478bd9Sstevel@tonic-gate return; 48477c478bd9Sstevel@tonic-gate } 48487c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock); 48497c478bd9Sstevel@tonic-gate mutex_exit(&pidlock); 48507c478bd9Sstevel@tonic-gate lwpcnt = p->p_lwpcnt; 48517c478bd9Sstevel@tonic-gate pid = p->p_pid; 48527c478bd9Sstevel@tonic-gate 48537c478bd9Sstevel@tonic-gate mutex_enter(&p->p_crlock); 48547c478bd9Sstevel@tonic-gate crhold(cr = p->p_cred); 48557c478bd9Sstevel@tonic-gate mutex_exit(&p->p_crlock); 48567c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock); 48577c478bd9Sstevel@tonic-gate 48587c478bd9Sstevel@tonic-gate ainfo = crgetauinfo(cr); 48597c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 48607c478bd9Sstevel@tonic-gate crfree(cr); 48617c478bd9Sstevel@tonic-gate return; 48627c478bd9Sstevel@tonic-gate } 48637c478bd9Sstevel@tonic-gate 48647c478bd9Sstevel@tonic-gate uid = crgetuid(cr); 48657c478bd9Sstevel@tonic-gate gid = crgetgid(cr); 48667c478bd9Sstevel@tonic-gate ruid = crgetruid(cr); 48677c478bd9Sstevel@tonic-gate rgid = crgetrgid(cr); 48687c478bd9Sstevel@tonic-gate au_uwrite(au_to_process(uid, gid, ruid, rgid, pid, 48697c478bd9Sstevel@tonic-gate ainfo->ai_auid, ainfo->ai_asid, &ainfo->ai_termid)); 48707c478bd9Sstevel@tonic-gate crfree(cr); 48717c478bd9Sstevel@tonic-gate 48727c478bd9Sstevel@tonic-gate break; 48737c478bd9Sstevel@tonic-gate default: 48747c478bd9Sstevel@tonic-gate return; 48757c478bd9Sstevel@tonic-gate } 48767c478bd9Sstevel@tonic-gate 48777c478bd9Sstevel@tonic-gate if (uap->processor_id == PBIND_NONE && 48787c478bd9Sstevel@tonic-gate (!(uap->id_type == P_LWPID && lwpcnt > 1))) 48797c478bd9Sstevel@tonic-gate au_uwrite(au_to_text("PBIND_NONE for process")); 48807c478bd9Sstevel@tonic-gate else 48817c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "processor_id", 48827c478bd9Sstevel@tonic-gate (uint32_t)uap->processor_id)); 48837c478bd9Sstevel@tonic-gate } 48847c478bd9Sstevel@tonic-gate 48857c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 48867c478bd9Sstevel@tonic-gate static au_event_t 48877c478bd9Sstevel@tonic-gate aui_doorfs(au_event_t e) 48887c478bd9Sstevel@tonic-gate { 48897c478bd9Sstevel@tonic-gate uint32_t code; 48907c478bd9Sstevel@tonic-gate 48917c478bd9Sstevel@tonic-gate struct a { /* doorfs */ 48927c478bd9Sstevel@tonic-gate long a1; 48937c478bd9Sstevel@tonic-gate long a2; 48947c478bd9Sstevel@tonic-gate long a3; 48957c478bd9Sstevel@tonic-gate long a4; 48967c478bd9Sstevel@tonic-gate long a5; 48977c478bd9Sstevel@tonic-gate long code; 48987c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 48997c478bd9Sstevel@tonic-gate 49007c478bd9Sstevel@tonic-gate /* 49017c478bd9Sstevel@tonic-gate * audit formats for several of the 49027c478bd9Sstevel@tonic-gate * door calls have not yet been determined 49037c478bd9Sstevel@tonic-gate */ 49047c478bd9Sstevel@tonic-gate code = (uint32_t)uap->code; 49057c478bd9Sstevel@tonic-gate switch (code) { 49067c478bd9Sstevel@tonic-gate case DOOR_CALL: 49077c478bd9Sstevel@tonic-gate e = AUE_DOORFS_DOOR_CALL; 49087c478bd9Sstevel@tonic-gate break; 49097c478bd9Sstevel@tonic-gate case DOOR_RETURN: 49107c478bd9Sstevel@tonic-gate e = AUE_NULL; 49117c478bd9Sstevel@tonic-gate break; 49127c478bd9Sstevel@tonic-gate case DOOR_CREATE: 49137c478bd9Sstevel@tonic-gate e = AUE_DOORFS_DOOR_CREATE; 49147c478bd9Sstevel@tonic-gate break; 49157c478bd9Sstevel@tonic-gate case DOOR_REVOKE: 49167c478bd9Sstevel@tonic-gate e = AUE_DOORFS_DOOR_REVOKE; 49177c478bd9Sstevel@tonic-gate break; 49187c478bd9Sstevel@tonic-gate case DOOR_INFO: 49197c478bd9Sstevel@tonic-gate e = AUE_NULL; 49207c478bd9Sstevel@tonic-gate break; 49217c478bd9Sstevel@tonic-gate case DOOR_UCRED: 49227c478bd9Sstevel@tonic-gate e = AUE_NULL; 49237c478bd9Sstevel@tonic-gate break; 49247c478bd9Sstevel@tonic-gate case DOOR_BIND: 49257c478bd9Sstevel@tonic-gate e = AUE_NULL; 49267c478bd9Sstevel@tonic-gate break; 49277c478bd9Sstevel@tonic-gate case DOOR_UNBIND: 49287c478bd9Sstevel@tonic-gate e = AUE_NULL; 49297c478bd9Sstevel@tonic-gate break; 49307c478bd9Sstevel@tonic-gate case DOOR_GETPARAM: 49317c478bd9Sstevel@tonic-gate e = AUE_NULL; 49327c478bd9Sstevel@tonic-gate break; 49337c478bd9Sstevel@tonic-gate case DOOR_SETPARAM: 49347c478bd9Sstevel@tonic-gate e = AUE_NULL; 49357c478bd9Sstevel@tonic-gate break; 49367c478bd9Sstevel@tonic-gate default: /* illegal system call */ 49377c478bd9Sstevel@tonic-gate e = AUE_NULL; 49387c478bd9Sstevel@tonic-gate break; 49397c478bd9Sstevel@tonic-gate } 49407c478bd9Sstevel@tonic-gate 49417c478bd9Sstevel@tonic-gate return (e); 49427c478bd9Sstevel@tonic-gate } 49437c478bd9Sstevel@tonic-gate 49447c478bd9Sstevel@tonic-gate static door_node_t * 49457c478bd9Sstevel@tonic-gate au_door_lookup(int did) 49467c478bd9Sstevel@tonic-gate { 49477c478bd9Sstevel@tonic-gate vnode_t *vp; 49487c478bd9Sstevel@tonic-gate file_t *fp; 49497c478bd9Sstevel@tonic-gate 49507c478bd9Sstevel@tonic-gate if ((fp = getf(did)) == NULL) 49517c478bd9Sstevel@tonic-gate return (NULL); 49527c478bd9Sstevel@tonic-gate /* 49537c478bd9Sstevel@tonic-gate * Use the underlying vnode (we may be namefs mounted) 49547c478bd9Sstevel@tonic-gate */ 49557c478bd9Sstevel@tonic-gate if (VOP_REALVP(fp->f_vnode, &vp)) 49567c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 49577c478bd9Sstevel@tonic-gate 49587c478bd9Sstevel@tonic-gate if (vp == NULL || vp->v_type != VDOOR) { 49597c478bd9Sstevel@tonic-gate releasef(did); 49607c478bd9Sstevel@tonic-gate return (NULL); 49617c478bd9Sstevel@tonic-gate } 49627c478bd9Sstevel@tonic-gate 49637c478bd9Sstevel@tonic-gate return (VTOD(vp)); 49647c478bd9Sstevel@tonic-gate } 49657c478bd9Sstevel@tonic-gate 49667c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 49677c478bd9Sstevel@tonic-gate static void 49687c478bd9Sstevel@tonic-gate aus_doorfs(struct t_audit_data *tad) 49697c478bd9Sstevel@tonic-gate { 49707c478bd9Sstevel@tonic-gate 49717c478bd9Sstevel@tonic-gate struct a { /* doorfs */ 49727c478bd9Sstevel@tonic-gate long a1; 49737c478bd9Sstevel@tonic-gate long a2; 49747c478bd9Sstevel@tonic-gate long a3; 49757c478bd9Sstevel@tonic-gate long a4; 49767c478bd9Sstevel@tonic-gate long a5; 49777c478bd9Sstevel@tonic-gate long code; 49787c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 49797c478bd9Sstevel@tonic-gate 49807c478bd9Sstevel@tonic-gate door_node_t *dp; 49817c478bd9Sstevel@tonic-gate struct proc *p; 49827c478bd9Sstevel@tonic-gate uint32_t did; 49837c478bd9Sstevel@tonic-gate uid_t uid, ruid; 49847c478bd9Sstevel@tonic-gate gid_t gid, rgid; 49857c478bd9Sstevel@tonic-gate pid_t pid; 49867c478bd9Sstevel@tonic-gate const auditinfo_addr_t *ainfo; 49877c478bd9Sstevel@tonic-gate cred_t *cr; 49887c478bd9Sstevel@tonic-gate 49897c478bd9Sstevel@tonic-gate did = (uint32_t)uap->a1; 49907c478bd9Sstevel@tonic-gate 49917c478bd9Sstevel@tonic-gate switch (tad->tad_event) { 49927c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_CALL: 49937c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "door ID", (uint32_t)did)); 49947c478bd9Sstevel@tonic-gate if ((dp = au_door_lookup(did)) == NULL) 49957c478bd9Sstevel@tonic-gate break; 49967c478bd9Sstevel@tonic-gate 49977c478bd9Sstevel@tonic-gate if (DOOR_INVALID(dp)) { 49987c478bd9Sstevel@tonic-gate releasef(did); 49997c478bd9Sstevel@tonic-gate break; 50007c478bd9Sstevel@tonic-gate } 50017c478bd9Sstevel@tonic-gate 50027c478bd9Sstevel@tonic-gate if ((p = dp->door_target) == NULL) { 50037c478bd9Sstevel@tonic-gate releasef(did); 50047c478bd9Sstevel@tonic-gate break; 50057c478bd9Sstevel@tonic-gate } 50067c478bd9Sstevel@tonic-gate mutex_enter(&p->p_lock); 50077c478bd9Sstevel@tonic-gate releasef(did); 50087c478bd9Sstevel@tonic-gate 50097c478bd9Sstevel@tonic-gate pid = p->p_pid; 50107c478bd9Sstevel@tonic-gate 50117c478bd9Sstevel@tonic-gate mutex_enter(&p->p_crlock); 50127c478bd9Sstevel@tonic-gate crhold(cr = p->p_cred); 50137c478bd9Sstevel@tonic-gate mutex_exit(&p->p_crlock); 50147c478bd9Sstevel@tonic-gate mutex_exit(&p->p_lock); 50157c478bd9Sstevel@tonic-gate 50167c478bd9Sstevel@tonic-gate ainfo = crgetauinfo(cr); 50177c478bd9Sstevel@tonic-gate if (ainfo == NULL) { 50187c478bd9Sstevel@tonic-gate crfree(cr); 50197c478bd9Sstevel@tonic-gate return; 50207c478bd9Sstevel@tonic-gate } 50217c478bd9Sstevel@tonic-gate uid = crgetuid(cr); 50227c478bd9Sstevel@tonic-gate gid = crgetgid(cr); 50237c478bd9Sstevel@tonic-gate ruid = crgetruid(cr); 50247c478bd9Sstevel@tonic-gate rgid = crgetrgid(cr); 50257c478bd9Sstevel@tonic-gate au_uwrite(au_to_process(uid, gid, ruid, rgid, pid, 50267c478bd9Sstevel@tonic-gate ainfo->ai_auid, ainfo->ai_asid, &ainfo->ai_termid)); 50277c478bd9Sstevel@tonic-gate crfree(cr); 50287c478bd9Sstevel@tonic-gate break; 50297c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_RETURN: 50307c478bd9Sstevel@tonic-gate /* 50317c478bd9Sstevel@tonic-gate * We may want to write information about 50327c478bd9Sstevel@tonic-gate * all doors (if any) which will be copied 50337c478bd9Sstevel@tonic-gate * by this call to the user space 50347c478bd9Sstevel@tonic-gate */ 50357c478bd9Sstevel@tonic-gate break; 50367c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_CREATE: 50377c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "door attr", (uint32_t)uap->a3)); 50387c478bd9Sstevel@tonic-gate break; 50397c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_REVOKE: 50407c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "door ID", (uint32_t)did)); 50417c478bd9Sstevel@tonic-gate break; 50427c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_INFO: 50437c478bd9Sstevel@tonic-gate break; 50447c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_CRED: 50457c478bd9Sstevel@tonic-gate break; 50467c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_BIND: 50477c478bd9Sstevel@tonic-gate break; 50487c478bd9Sstevel@tonic-gate case AUE_DOORFS_DOOR_UNBIND: { 50497c478bd9Sstevel@tonic-gate break; 50507c478bd9Sstevel@tonic-gate } 50517c478bd9Sstevel@tonic-gate default: /* illegal system call */ 50527c478bd9Sstevel@tonic-gate break; 50537c478bd9Sstevel@tonic-gate } 50547c478bd9Sstevel@tonic-gate } 50557c478bd9Sstevel@tonic-gate 50567c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 50577c478bd9Sstevel@tonic-gate static au_event_t 50587c478bd9Sstevel@tonic-gate aui_acl(au_event_t e) 50597c478bd9Sstevel@tonic-gate { 50607c478bd9Sstevel@tonic-gate struct a { 50617c478bd9Sstevel@tonic-gate union { 50627c478bd9Sstevel@tonic-gate long name; /* char */ 50637c478bd9Sstevel@tonic-gate long fd; 50647c478bd9Sstevel@tonic-gate } obj; 50657c478bd9Sstevel@tonic-gate 50667c478bd9Sstevel@tonic-gate long cmd; 50677c478bd9Sstevel@tonic-gate long nentries; 50687c478bd9Sstevel@tonic-gate long arg; /* aclent_t */ 50697c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 50707c478bd9Sstevel@tonic-gate 50717c478bd9Sstevel@tonic-gate switch (uap->cmd) { 50727c478bd9Sstevel@tonic-gate case SETACL: 50737c478bd9Sstevel@tonic-gate /* ok, acl(SETACL, ...) and facl(SETACL, ...) are expected. */ 50747c478bd9Sstevel@tonic-gate break; 50757c478bd9Sstevel@tonic-gate case GETACL: 50767c478bd9Sstevel@tonic-gate case GETACLCNT: 50777c478bd9Sstevel@tonic-gate /* do nothing for these two values. */ 50787c478bd9Sstevel@tonic-gate e = AUE_NULL; 50797c478bd9Sstevel@tonic-gate break; 50807c478bd9Sstevel@tonic-gate default: 50817c478bd9Sstevel@tonic-gate /* illegal system call */ 50827c478bd9Sstevel@tonic-gate break; 50837c478bd9Sstevel@tonic-gate } 50847c478bd9Sstevel@tonic-gate 50857c478bd9Sstevel@tonic-gate return (e); 50867c478bd9Sstevel@tonic-gate } 50877c478bd9Sstevel@tonic-gate 50887c478bd9Sstevel@tonic-gate 50897c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 50907c478bd9Sstevel@tonic-gate static void 50917c478bd9Sstevel@tonic-gate aus_acl(struct t_audit_data *tad) 50927c478bd9Sstevel@tonic-gate { 50937c478bd9Sstevel@tonic-gate struct a { 50947c478bd9Sstevel@tonic-gate long fname; 50957c478bd9Sstevel@tonic-gate long cmd; 50967c478bd9Sstevel@tonic-gate long nentries; 50977c478bd9Sstevel@tonic-gate long aclbufp; 50987c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 50997c478bd9Sstevel@tonic-gate struct acl *aclbufp; 51007c478bd9Sstevel@tonic-gate 51017c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "cmd", (uint32_t)uap->cmd)); 51027c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "nentries", (uint32_t)uap->nentries)); 51037c478bd9Sstevel@tonic-gate 51047c478bd9Sstevel@tonic-gate switch (uap->cmd) { 51057c478bd9Sstevel@tonic-gate case GETACL: 51067c478bd9Sstevel@tonic-gate case GETACLCNT: 51077c478bd9Sstevel@tonic-gate break; 51087c478bd9Sstevel@tonic-gate case SETACL: 51097c478bd9Sstevel@tonic-gate if (uap->nentries < 3) 51107c478bd9Sstevel@tonic-gate break; 51117c478bd9Sstevel@tonic-gate else { 51127c478bd9Sstevel@tonic-gate size_t a_size = uap->nentries * sizeof (struct acl); 51137c478bd9Sstevel@tonic-gate int i; 51147c478bd9Sstevel@tonic-gate 51157c478bd9Sstevel@tonic-gate aclbufp = kmem_alloc(a_size, KM_SLEEP); 51167c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->aclbufp), aclbufp, a_size)) { 51177c478bd9Sstevel@tonic-gate kmem_free(aclbufp, a_size); 51187c478bd9Sstevel@tonic-gate break; 51197c478bd9Sstevel@tonic-gate } 51207c478bd9Sstevel@tonic-gate for (i = 0; i < uap->nentries; i++) { 51217c478bd9Sstevel@tonic-gate au_uwrite(au_to_acl(aclbufp + i)); 51227c478bd9Sstevel@tonic-gate } 51237c478bd9Sstevel@tonic-gate kmem_free(aclbufp, a_size); 51247c478bd9Sstevel@tonic-gate break; 51257c478bd9Sstevel@tonic-gate } 51267c478bd9Sstevel@tonic-gate default: 51277c478bd9Sstevel@tonic-gate break; 51287c478bd9Sstevel@tonic-gate } 51297c478bd9Sstevel@tonic-gate } 51307c478bd9Sstevel@tonic-gate 51317c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 51327c478bd9Sstevel@tonic-gate static void 51337c478bd9Sstevel@tonic-gate aus_facl(struct t_audit_data *tad) 51347c478bd9Sstevel@tonic-gate { 51357c478bd9Sstevel@tonic-gate struct a { 51367c478bd9Sstevel@tonic-gate long fd; 51377c478bd9Sstevel@tonic-gate long cmd; 51387c478bd9Sstevel@tonic-gate long nentries; 51397c478bd9Sstevel@tonic-gate long aclbufp; 51407c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 51417c478bd9Sstevel@tonic-gate struct file *fp; 51427c478bd9Sstevel@tonic-gate struct vnode *vp; 51437c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 51447c478bd9Sstevel@tonic-gate struct acl *aclbufp; 51457c478bd9Sstevel@tonic-gate int fd; 51467c478bd9Sstevel@tonic-gate 51477c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(2, "cmd", (uint32_t)uap->cmd)); 51487c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(3, "nentries", (uint32_t)uap->nentries)); 51497c478bd9Sstevel@tonic-gate 51507c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 51517c478bd9Sstevel@tonic-gate 51527c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 51537c478bd9Sstevel@tonic-gate return; 51547c478bd9Sstevel@tonic-gate 51557c478bd9Sstevel@tonic-gate /* get path from file struct here */ 51567c478bd9Sstevel@tonic-gate fad = F2A(fp); 51577c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 51587c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 51597c478bd9Sstevel@tonic-gate } else { 51607c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", (uint32_t)fd)); 51617c478bd9Sstevel@tonic-gate } 51627c478bd9Sstevel@tonic-gate 51637c478bd9Sstevel@tonic-gate vp = fp->f_vnode; 51647c478bd9Sstevel@tonic-gate audit_attributes(vp); 51657c478bd9Sstevel@tonic-gate 51667c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 51677c478bd9Sstevel@tonic-gate releasef(fd); 51687c478bd9Sstevel@tonic-gate 51697c478bd9Sstevel@tonic-gate switch (uap->cmd) { 51707c478bd9Sstevel@tonic-gate case GETACL: 51717c478bd9Sstevel@tonic-gate case GETACLCNT: 51727c478bd9Sstevel@tonic-gate break; 51737c478bd9Sstevel@tonic-gate case SETACL: 51747c478bd9Sstevel@tonic-gate if (uap->nentries < 3) 51757c478bd9Sstevel@tonic-gate break; 51767c478bd9Sstevel@tonic-gate else { 51777c478bd9Sstevel@tonic-gate size_t a_size = uap->nentries * sizeof (struct acl); 51787c478bd9Sstevel@tonic-gate int i; 51797c478bd9Sstevel@tonic-gate 51807c478bd9Sstevel@tonic-gate aclbufp = kmem_alloc(a_size, KM_SLEEP); 51817c478bd9Sstevel@tonic-gate if (copyin((caddr_t)(uap->aclbufp), aclbufp, a_size)) { 51827c478bd9Sstevel@tonic-gate kmem_free(aclbufp, a_size); 51837c478bd9Sstevel@tonic-gate break; 51847c478bd9Sstevel@tonic-gate } 51857c478bd9Sstevel@tonic-gate for (i = 0; i < uap->nentries; i++) { 51867c478bd9Sstevel@tonic-gate au_uwrite(au_to_acl(aclbufp + i)); 51877c478bd9Sstevel@tonic-gate } 51887c478bd9Sstevel@tonic-gate kmem_free(aclbufp, a_size); 51897c478bd9Sstevel@tonic-gate break; 51907c478bd9Sstevel@tonic-gate } 51917c478bd9Sstevel@tonic-gate default: 51927c478bd9Sstevel@tonic-gate break; 51937c478bd9Sstevel@tonic-gate } 51947c478bd9Sstevel@tonic-gate } 51957c478bd9Sstevel@tonic-gate 51967c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 51977c478bd9Sstevel@tonic-gate static void 51987c478bd9Sstevel@tonic-gate auf_read(tad, error, rval) 51997c478bd9Sstevel@tonic-gate struct t_audit_data *tad; 52007c478bd9Sstevel@tonic-gate int error; 52017c478bd9Sstevel@tonic-gate rval_t *rval; 52027c478bd9Sstevel@tonic-gate { 52037c478bd9Sstevel@tonic-gate struct file *fp; 52047c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 52057c478bd9Sstevel@tonic-gate int fd; 52067c478bd9Sstevel@tonic-gate register struct a { 52077c478bd9Sstevel@tonic-gate long fd; 52087c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 52099e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 52107c478bd9Sstevel@tonic-gate 52117c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 52127c478bd9Sstevel@tonic-gate 52137c478bd9Sstevel@tonic-gate /* 52147c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 52157c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 52167c478bd9Sstevel@tonic-gate */ 52177c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 52187c478bd9Sstevel@tonic-gate return; 52197c478bd9Sstevel@tonic-gate 52207c478bd9Sstevel@tonic-gate /* get path from file struct here */ 52217c478bd9Sstevel@tonic-gate fad = F2A(fp); 52227c478bd9Sstevel@tonic-gate ASSERT(fad); 52237c478bd9Sstevel@tonic-gate 52247c478bd9Sstevel@tonic-gate /* 52257c478bd9Sstevel@tonic-gate * already processed this file for read attempt 52267c478bd9Sstevel@tonic-gate * 52277c478bd9Sstevel@tonic-gate * XXX might be better to turn off auditing in a aui_read() routine. 52287c478bd9Sstevel@tonic-gate */ 52297c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_READ) { 52307c478bd9Sstevel@tonic-gate /* don't really want to audit every read attempt */ 52317c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 52327c478bd9Sstevel@tonic-gate /* free any residual audit data */ 52337c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 52347c478bd9Sstevel@tonic-gate releasef(fd); 52357c478bd9Sstevel@tonic-gate return; 52367c478bd9Sstevel@tonic-gate } 52377c478bd9Sstevel@tonic-gate /* mark things so we know what happened and don't repeat things */ 52387c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 52397c478bd9Sstevel@tonic-gate 52407c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 52417c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 52427c478bd9Sstevel@tonic-gate } else { 52437c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", (uint32_t)fd)); 52447c478bd9Sstevel@tonic-gate } 52457c478bd9Sstevel@tonic-gate 52467c478bd9Sstevel@tonic-gate /* include attributes */ 52477c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 52487c478bd9Sstevel@tonic-gate 52497c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 52507c478bd9Sstevel@tonic-gate releasef(fd); 52517c478bd9Sstevel@tonic-gate } 52527c478bd9Sstevel@tonic-gate 52537c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 52547c478bd9Sstevel@tonic-gate static void 52557c478bd9Sstevel@tonic-gate auf_write(tad, error, rval) 52567c478bd9Sstevel@tonic-gate struct t_audit_data *tad; 52577c478bd9Sstevel@tonic-gate int error; 52587c478bd9Sstevel@tonic-gate rval_t *rval; 52597c478bd9Sstevel@tonic-gate { 52607c478bd9Sstevel@tonic-gate struct file *fp; 52617c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 52627c478bd9Sstevel@tonic-gate int fd; 52637c478bd9Sstevel@tonic-gate register struct a { 52647c478bd9Sstevel@tonic-gate long fd; 52657c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 52669e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 52677c478bd9Sstevel@tonic-gate 52687c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 52697c478bd9Sstevel@tonic-gate 52707c478bd9Sstevel@tonic-gate /* 52717c478bd9Sstevel@tonic-gate * convert file pointer to file descriptor 52727c478bd9Sstevel@tonic-gate * Note: fd ref count incremented here. 52737c478bd9Sstevel@tonic-gate */ 52747c478bd9Sstevel@tonic-gate if ((fp = getf(fd)) == NULL) 52757c478bd9Sstevel@tonic-gate return; 52767c478bd9Sstevel@tonic-gate 52777c478bd9Sstevel@tonic-gate /* get path from file struct here */ 52787c478bd9Sstevel@tonic-gate fad = F2A(fp); 52797c478bd9Sstevel@tonic-gate ASSERT(fad); 52807c478bd9Sstevel@tonic-gate 52817c478bd9Sstevel@tonic-gate /* 52827c478bd9Sstevel@tonic-gate * already processed this file for write attempt 52837c478bd9Sstevel@tonic-gate * 52847c478bd9Sstevel@tonic-gate * XXX might be better to turn off auditing in a aus_write() routine. 52857c478bd9Sstevel@tonic-gate */ 52867c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_WRITE) { 52877c478bd9Sstevel@tonic-gate /* don't really want to audit every write attempt */ 52887c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 52897c478bd9Sstevel@tonic-gate /* free any residual audit data */ 52907c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 52917c478bd9Sstevel@tonic-gate releasef(fd); 52927c478bd9Sstevel@tonic-gate return; 52937c478bd9Sstevel@tonic-gate } 52947c478bd9Sstevel@tonic-gate /* mark things so we know what happened and don't repeat things */ 52957c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 52967c478bd9Sstevel@tonic-gate 52977c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 52987c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 52997c478bd9Sstevel@tonic-gate } else { 53007c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", (uint32_t)fd)); 53017c478bd9Sstevel@tonic-gate } 53027c478bd9Sstevel@tonic-gate 53037c478bd9Sstevel@tonic-gate /* include attributes */ 53047c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 53057c478bd9Sstevel@tonic-gate 53067c478bd9Sstevel@tonic-gate /* decrement file descriptor reference count */ 53077c478bd9Sstevel@tonic-gate releasef(fd); 53087c478bd9Sstevel@tonic-gate } 53097c478bd9Sstevel@tonic-gate 53107c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 53117c478bd9Sstevel@tonic-gate static void 53127c478bd9Sstevel@tonic-gate auf_recv(tad, error, rval) 53137c478bd9Sstevel@tonic-gate struct t_audit_data *tad; 53147c478bd9Sstevel@tonic-gate int error; 53157c478bd9Sstevel@tonic-gate rval_t *rval; 53167c478bd9Sstevel@tonic-gate { 53177c478bd9Sstevel@tonic-gate struct sonode *so; 53187c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 53197c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 53207c478bd9Sstevel@tonic-gate struct file *fp; 53217c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 53227c478bd9Sstevel@tonic-gate int fd; 53237c478bd9Sstevel@tonic-gate int err; 53247c478bd9Sstevel@tonic-gate int len; 53257c478bd9Sstevel@tonic-gate short so_family, so_type; 53267c478bd9Sstevel@tonic-gate register struct a { 53277c478bd9Sstevel@tonic-gate long fd; 53287c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 53299e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 53307c478bd9Sstevel@tonic-gate 53317c478bd9Sstevel@tonic-gate /* 53327c478bd9Sstevel@tonic-gate * If there was an error, then nothing to do. Only generate 53337c478bd9Sstevel@tonic-gate * audit record on first successful recv. 53347c478bd9Sstevel@tonic-gate */ 53357c478bd9Sstevel@tonic-gate if (error) { 53367c478bd9Sstevel@tonic-gate /* Turn off audit record generation here. */ 53377c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 53387c478bd9Sstevel@tonic-gate /* free any residual audit data */ 53397c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 53407c478bd9Sstevel@tonic-gate return; 53417c478bd9Sstevel@tonic-gate } 53427c478bd9Sstevel@tonic-gate 53437c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 53447c478bd9Sstevel@tonic-gate 53457c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 53467c478bd9Sstevel@tonic-gate /* Turn off audit record generation here. */ 53477c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 53487c478bd9Sstevel@tonic-gate /* free any residual audit data */ 53497c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 53507c478bd9Sstevel@tonic-gate return; 53517c478bd9Sstevel@tonic-gate } 53527c478bd9Sstevel@tonic-gate 53537c478bd9Sstevel@tonic-gate /* get path from file struct here */ 53547c478bd9Sstevel@tonic-gate fad = F2A(fp); 53557c478bd9Sstevel@tonic-gate ASSERT(fad); 53567c478bd9Sstevel@tonic-gate 53577c478bd9Sstevel@tonic-gate /* 53587c478bd9Sstevel@tonic-gate * already processed this file for read attempt 53597c478bd9Sstevel@tonic-gate */ 53607c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_READ) { 53617c478bd9Sstevel@tonic-gate releasef(fd); 53627c478bd9Sstevel@tonic-gate /* don't really want to audit every recv call */ 53637c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 53647c478bd9Sstevel@tonic-gate /* free any residual audit data */ 53657c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 53667c478bd9Sstevel@tonic-gate return; 53677c478bd9Sstevel@tonic-gate } 53687c478bd9Sstevel@tonic-gate 53697c478bd9Sstevel@tonic-gate /* mark things so we know what happened and don't repeat things */ 53707c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_READ; 53717c478bd9Sstevel@tonic-gate 53727c478bd9Sstevel@tonic-gate so_family = so->so_family; 53737c478bd9Sstevel@tonic-gate so_type = so->so_type; 53747c478bd9Sstevel@tonic-gate 53757c478bd9Sstevel@tonic-gate switch (so_family) { 53767c478bd9Sstevel@tonic-gate case AF_INET: 53777c478bd9Sstevel@tonic-gate case AF_INET6: 53787c478bd9Sstevel@tonic-gate /* 53797c478bd9Sstevel@tonic-gate * Only for connections. 53807c478bd9Sstevel@tonic-gate * XXX - do we need to worry about SOCK_DGRAM or other types??? 53817c478bd9Sstevel@tonic-gate */ 53827c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 53837c478bd9Sstevel@tonic-gate 53847c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 53857c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 53867c478bd9Sstevel@tonic-gate 53877c478bd9Sstevel@tonic-gate /* only done once on a connection */ 53887c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 53897c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 53907c478bd9Sstevel@tonic-gate 53917c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 53927c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 53937c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 53947c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 53957c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 53967c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 53977c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 53987c478bd9Sstevel@tonic-gate 53997c478bd9Sstevel@tonic-gate /* 54007c478bd9Sstevel@tonic-gate * only way to drop out of switch. Note that we 54017c478bd9Sstevel@tonic-gate * we release fd below. 54027c478bd9Sstevel@tonic-gate */ 54037c478bd9Sstevel@tonic-gate 54047c478bd9Sstevel@tonic-gate break; 54057c478bd9Sstevel@tonic-gate } 54067c478bd9Sstevel@tonic-gate 54077c478bd9Sstevel@tonic-gate releasef(fd); 54087c478bd9Sstevel@tonic-gate 54097c478bd9Sstevel@tonic-gate /* don't really want to audit every recv call */ 54107c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 54117c478bd9Sstevel@tonic-gate /* free any residual audit data */ 54127c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 54137c478bd9Sstevel@tonic-gate 54147c478bd9Sstevel@tonic-gate return; 54157c478bd9Sstevel@tonic-gate 54167c478bd9Sstevel@tonic-gate case AF_UNIX: 54177c478bd9Sstevel@tonic-gate 54187c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 54197c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 54207c478bd9Sstevel@tonic-gate } else { 54217c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 54227c478bd9Sstevel@tonic-gate } 54237c478bd9Sstevel@tonic-gate 54247c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 54257c478bd9Sstevel@tonic-gate 54267c478bd9Sstevel@tonic-gate releasef(fd); 54277c478bd9Sstevel@tonic-gate 54287c478bd9Sstevel@tonic-gate return; 54297c478bd9Sstevel@tonic-gate 54307c478bd9Sstevel@tonic-gate default: 54317c478bd9Sstevel@tonic-gate releasef(fd); 54327c478bd9Sstevel@tonic-gate 54337c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 54347c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)so_family)); 54357c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)so_type)); 54367c478bd9Sstevel@tonic-gate 54377c478bd9Sstevel@tonic-gate return; 54387c478bd9Sstevel@tonic-gate } 54397c478bd9Sstevel@tonic-gate 54407c478bd9Sstevel@tonic-gate releasef(fd); 54417c478bd9Sstevel@tonic-gate 54427c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 54437c478bd9Sstevel@tonic-gate 54447c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 54457c478bd9Sstevel@tonic-gate 54467c478bd9Sstevel@tonic-gate } 54477c478bd9Sstevel@tonic-gate 54487c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 54497c478bd9Sstevel@tonic-gate static void 54507c478bd9Sstevel@tonic-gate auf_send(tad, error, rval) 54517c478bd9Sstevel@tonic-gate struct t_audit_data *tad; 54527c478bd9Sstevel@tonic-gate int error; 54537c478bd9Sstevel@tonic-gate rval_t *rval; 54547c478bd9Sstevel@tonic-gate { 54557c478bd9Sstevel@tonic-gate struct sonode *so; 54567c478bd9Sstevel@tonic-gate char so_laddr[sizeof (struct sockaddr_in6)]; 54577c478bd9Sstevel@tonic-gate char so_faddr[sizeof (struct sockaddr_in6)]; 54587c478bd9Sstevel@tonic-gate struct file *fp; 54597c478bd9Sstevel@tonic-gate struct f_audit_data *fad; 54607c478bd9Sstevel@tonic-gate int fd; 54617c478bd9Sstevel@tonic-gate int err; 54627c478bd9Sstevel@tonic-gate int len; 54637c478bd9Sstevel@tonic-gate short so_family, so_type; 54647c478bd9Sstevel@tonic-gate register struct a { 54657c478bd9Sstevel@tonic-gate long fd; 54667c478bd9Sstevel@tonic-gate } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 54679e9e6ab8Spaulson au_kcontext_t *kctx = GET_KCTX_PZ; 54687c478bd9Sstevel@tonic-gate 54697c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 54707c478bd9Sstevel@tonic-gate 54717c478bd9Sstevel@tonic-gate /* 54727c478bd9Sstevel@tonic-gate * If there was an error, then nothing to do. Only generate 54737c478bd9Sstevel@tonic-gate * audit record on first successful send. 54747c478bd9Sstevel@tonic-gate */ 54757c478bd9Sstevel@tonic-gate if (error != 0) { 54767c478bd9Sstevel@tonic-gate /* Turn off audit record generation here. */ 54777c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 54787c478bd9Sstevel@tonic-gate /* free any residual audit data */ 54797c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 54807c478bd9Sstevel@tonic-gate return; 54817c478bd9Sstevel@tonic-gate } 54827c478bd9Sstevel@tonic-gate 54837c478bd9Sstevel@tonic-gate fd = (int)uap->fd; 54847c478bd9Sstevel@tonic-gate 54857c478bd9Sstevel@tonic-gate if ((so = au_getsonode(fd, &err, &fp)) == NULL) { 54867c478bd9Sstevel@tonic-gate /* Turn off audit record generation here. */ 54877c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 54887c478bd9Sstevel@tonic-gate /* free any residual audit data */ 54897c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 54907c478bd9Sstevel@tonic-gate return; 54917c478bd9Sstevel@tonic-gate } 54927c478bd9Sstevel@tonic-gate 54937c478bd9Sstevel@tonic-gate /* get path from file struct here */ 54947c478bd9Sstevel@tonic-gate fad = F2A(fp); 54957c478bd9Sstevel@tonic-gate ASSERT(fad); 54967c478bd9Sstevel@tonic-gate 54977c478bd9Sstevel@tonic-gate /* 54987c478bd9Sstevel@tonic-gate * already processed this file for write attempt 54997c478bd9Sstevel@tonic-gate */ 55007c478bd9Sstevel@tonic-gate if (fad->fad_flags & FAD_WRITE) { 55017c478bd9Sstevel@tonic-gate releasef(fd); 55027c478bd9Sstevel@tonic-gate /* don't really want to audit every send call */ 55037c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 55047c478bd9Sstevel@tonic-gate /* free any residual audit data */ 55057c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 55067c478bd9Sstevel@tonic-gate return; 55077c478bd9Sstevel@tonic-gate } 55087c478bd9Sstevel@tonic-gate 55097c478bd9Sstevel@tonic-gate /* mark things so we know what happened and don't repeat things */ 55107c478bd9Sstevel@tonic-gate fad->fad_flags |= FAD_WRITE; 55117c478bd9Sstevel@tonic-gate 55127c478bd9Sstevel@tonic-gate so_family = so->so_family; 55137c478bd9Sstevel@tonic-gate so_type = so->so_type; 55147c478bd9Sstevel@tonic-gate 55157c478bd9Sstevel@tonic-gate switch (so_family) { 55167c478bd9Sstevel@tonic-gate case AF_INET: 55177c478bd9Sstevel@tonic-gate case AF_INET6: 55187c478bd9Sstevel@tonic-gate /* 55197c478bd9Sstevel@tonic-gate * Only for connections. 55207c478bd9Sstevel@tonic-gate * XXX - do we need to worry about SOCK_DGRAM or other types??? 55217c478bd9Sstevel@tonic-gate */ 55227c478bd9Sstevel@tonic-gate if (so->so_state & SS_ISBOUND) { 55237c478bd9Sstevel@tonic-gate 55247c478bd9Sstevel@tonic-gate bzero((void *)so_laddr, sizeof (so_laddr)); 55257c478bd9Sstevel@tonic-gate bzero((void *)so_faddr, sizeof (so_faddr)); 55267c478bd9Sstevel@tonic-gate 55277c478bd9Sstevel@tonic-gate /* only done once on a connection */ 55287c478bd9Sstevel@tonic-gate (void) SOP_GETSOCKNAME(so); 55297c478bd9Sstevel@tonic-gate (void) SOP_GETPEERNAME(so); 55307c478bd9Sstevel@tonic-gate 55317c478bd9Sstevel@tonic-gate /* get local and foreign addresses */ 55327c478bd9Sstevel@tonic-gate mutex_enter(&so->so_lock); 55337c478bd9Sstevel@tonic-gate len = min(so->so_laddr_len, sizeof (so_laddr)); 55347c478bd9Sstevel@tonic-gate bcopy(so->so_laddr_sa, so_laddr, len); 55357c478bd9Sstevel@tonic-gate len = min(so->so_faddr_len, sizeof (so_faddr)); 55367c478bd9Sstevel@tonic-gate bcopy(so->so_faddr_sa, so_faddr, len); 55377c478bd9Sstevel@tonic-gate mutex_exit(&so->so_lock); 55387c478bd9Sstevel@tonic-gate 55397c478bd9Sstevel@tonic-gate /* 55407c478bd9Sstevel@tonic-gate * only way to drop out of switch. Note that we 55417c478bd9Sstevel@tonic-gate * we release fd below. 55427c478bd9Sstevel@tonic-gate */ 55437c478bd9Sstevel@tonic-gate 55447c478bd9Sstevel@tonic-gate break; 55457c478bd9Sstevel@tonic-gate } 55467c478bd9Sstevel@tonic-gate 55477c478bd9Sstevel@tonic-gate releasef(fd); 55487c478bd9Sstevel@tonic-gate /* don't really want to audit every send call */ 55497c478bd9Sstevel@tonic-gate tad->tad_flag = 0; 55507c478bd9Sstevel@tonic-gate /* free any residual audit data */ 55517c478bd9Sstevel@tonic-gate au_close(kctx, &(u_ad), 0, 0, 0); 55527c478bd9Sstevel@tonic-gate 55537c478bd9Sstevel@tonic-gate return; 55547c478bd9Sstevel@tonic-gate 55557c478bd9Sstevel@tonic-gate case AF_UNIX: 55567c478bd9Sstevel@tonic-gate 55577c478bd9Sstevel@tonic-gate if (fad->fad_aupath != NULL) { 55587c478bd9Sstevel@tonic-gate au_uwrite(au_to_path(fad->fad_aupath)); 55597c478bd9Sstevel@tonic-gate } else { 55607c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "no path: fd", fd)); 55617c478bd9Sstevel@tonic-gate } 55627c478bd9Sstevel@tonic-gate 55637c478bd9Sstevel@tonic-gate audit_attributes(fp->f_vnode); 55647c478bd9Sstevel@tonic-gate 55657c478bd9Sstevel@tonic-gate releasef(fd); 55667c478bd9Sstevel@tonic-gate 55677c478bd9Sstevel@tonic-gate return; 55687c478bd9Sstevel@tonic-gate 55697c478bd9Sstevel@tonic-gate default: 55707c478bd9Sstevel@tonic-gate releasef(fd); 55717c478bd9Sstevel@tonic-gate 55727c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 55737c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "family", (uint32_t)so_family)); 55747c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "type", (uint32_t)so_type)); 55757c478bd9Sstevel@tonic-gate 55767c478bd9Sstevel@tonic-gate return; 55777c478bd9Sstevel@tonic-gate } 55787c478bd9Sstevel@tonic-gate 55797c478bd9Sstevel@tonic-gate releasef(fd); 55807c478bd9Sstevel@tonic-gate 55817c478bd9Sstevel@tonic-gate au_uwrite(au_to_arg32(1, "so", (uint32_t)fd)); 55827c478bd9Sstevel@tonic-gate 55837c478bd9Sstevel@tonic-gate au_uwrite(au_to_socket_ex(so_family, so_type, so_laddr, so_faddr)); 55847c478bd9Sstevel@tonic-gate } 5585657b1f3dSraf 5586657b1f3dSraf static au_event_t 5587657b1f3dSraf aui_forksys(au_event_t e) 5588657b1f3dSraf { 5589657b1f3dSraf struct a { 5590657b1f3dSraf long subcode; 5591657b1f3dSraf long flags; 5592657b1f3dSraf } *uap = (struct a *)ttolwp(curthread)->lwp_ap; 5593657b1f3dSraf 5594657b1f3dSraf switch ((uint_t)uap->subcode) { 5595657b1f3dSraf case 0: 5596657b1f3dSraf e = AUE_FORK1; 5597657b1f3dSraf break; 5598657b1f3dSraf case 1: 5599657b1f3dSraf e = AUE_FORKALL; 5600657b1f3dSraf break; 5601657b1f3dSraf case 2: 5602657b1f3dSraf e = AUE_VFORK; 5603657b1f3dSraf break; 5604657b1f3dSraf default: 5605657b1f3dSraf e = AUE_NULL; 5606657b1f3dSraf break; 5607657b1f3dSraf } 5608657b1f3dSraf 5609657b1f3dSraf return (e); 5610657b1f3dSraf } 5611