4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
31 #include <sys/types.h>
39 * Define all auditing structures.
41 * A shared object may be a client of one or more audit libraries. Calls to an
42 * auditor are accompanied with cookies that identify an object being audited.
43 * These cookies are initialized to the link-map pointers of the object being
44 * audited, however the auditor is free to re-allocate these cookies, and thus
45 * associate their own data with each object being audited.
47 * With auditing version LAV_VERSION5, local auditors can provide la_preinit()
48 * and la_activity() routines, each of which should be passed a cookie that
49 * represents the link-map of the head of the associated link-map list. These
50 * cookies are maintained on the associated link-map list, using the lm_cookies
51 * alist. These cookies are created by _audit_add_head(), and dynamically
52 * retrieved by the _audit_preinit() and _audit_activity() routines.
54 * Having these cookies kept on the link-map list decouples these cookies from
55 * the Audit_client structure of the object being locally audited. In addition,
56 * this model ensures that multiple objects, undergoing local auditing from the
57 * same auditor, receive the same head link-map cookie.
60 Rt_map
*ac_lmp
; /* audit library identifier */
61 uintptr_t ac_cookie
; /* cookie assigned to audit library */
62 Word ac_flags
; /* and its associated flags */
65 #define FLG_AC_BINDTO 0x00001
66 #define FLG_AC_BINDFROM 0x00002
69 * Each shared object being audited may provide a list of client structures
70 * and dynamic plts (one per auditor).
73 uint_t ai_cnt
; /* no. of clients */
74 Audit_client
*ai_clients
; /* array of client structures */
75 void *ai_dynplts
; /* array of dynamic plts */
79 * Define an Audit Descriptor - each audit object is added to this descriptor
80 * as an Audit Interface. There is one global audit descriptor - auditors,
81 * and a specific object my require its own - AUDITORS(lmp).
84 char *ad_name
; /* originating audit names */
85 APlist
*ad_list
; /* audit objs Audit Interface list */
86 uint_t ad_cnt
; /* no. of audit objs in this desc. */
87 uint_t ad_flags
; /* audit capabilities found. See */
88 /* LML_TFLG_AUD_* flags */
92 * Define an Audit List descriptor for each audit object.
95 const char *al_libname
; /* object name for diagnostics */
96 Rt_map
*al_lmp
; /* object link-map */
97 Grp_hdl
*al_ghp
; /* object handle */
98 uint_t al_flags
; /* audit capabilities found */
99 uint_t (*al_version
)(uint_t
);
100 void (*al_preinit
)(uintptr_t *);
101 char *(*al_objsearch
)(const char *, uintptr_t *, uint_t
);
102 uint_t (*al_objopen
)(Link_map
*, Lmid_t
, uintptr_t *);
103 int (*al_objfilter
)(uintptr_t *, const char *, uintptr_t *,
105 uint_t (*al_objclose
)(uintptr_t *);
106 void (*al_activity
)(uintptr_t *, uint_t
);
108 uintptr_t (*al_pltenter
)(Sym
*, uint_t
, uintptr_t *, uintptr_t *,
109 void *, uint_t
*, const char *);
110 uintptr_t (*al_pltexit
)(Sym
*, uint_t
, uintptr_t *, uintptr_t *,
111 uintptr_t, const char *);
112 uintptr_t (*al_symbind
)(Sym
*, uint_t
, uintptr_t *,
113 uintptr_t *, uint_t
*, const char *);
115 uintptr_t (*al_pltenter
)(Sym
*, uint_t
, uintptr_t *, uintptr_t *,
117 uintptr_t (*al_pltexit
)(Sym
*, uint_t
, uintptr_t *, uintptr_t *,
119 uintptr_t (*al_symbind
)(Sym
*, uint_t
, uintptr_t *,
120 uintptr_t *, uint_t
*);
122 uint_t al_vernum
; /* object version */
126 * Link-Edit audit functions
128 extern int audit_setup(Rt_map
*, Audit_desc
*, uint_t
, int *);
130 extern void audit_desc_cleanup(Rt_map
*);
131 extern void audit_info_cleanup(Rt_map
*);
133 extern int audit_objopen(Rt_map
*, Rt_map
*);
134 extern int audit_objfilter(Rt_map
*, const char *, Rt_map
*,
136 extern void audit_activity(Rt_map
*, uint_t
);
137 extern void audit_preinit(Rt_map
*);
138 extern char *audit_objsearch(Rt_map
*, const char *, uint_t
);
139 extern void audit_objclose(Rt_map
*, Rt_map
*);
140 extern void _audit_objclose(APlist
*, Rt_map
*);
141 extern Addr
audit_symbind(Rt_map
*, Rt_map
*, Sym
*, uint_t
,
142 Addr value
, uint_t
*);
143 extern Addr
audit_pltenter(Rt_map
*, Rt_map
*, Sym
*, uint_t
,
145 extern Addr
audit_pltexit(uintptr_t, Rt_map
*, Rt_map
*, Sym
*,
148 extern uint_t audit_flags
;
153 * Values for audit_flags. Intended to be the same as the LML equivalents
154 * but kept in a separate variable to simplify boot_elf.s coding.
156 #define AF_PLTENTER 0x01 /* same as LML_AUD_PLTENTER */
157 #define AF_PLTEXIT 0x02 /* Same as LML_AUD_PLTEXIT */
163 #endif /* __AUDIT_DOT_H */