Commit | Line | Data |
---|---|---|
85c8721f | 1 | /* audit.h -- Auditing support |
1da177e4 LT |
2 | * |
3 | * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina. | |
4 | * All Rights Reserved. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 | * | |
20 | * Written by Rickard E. (Rik) Faith <faith@redhat.com> | |
21 | * | |
22 | */ | |
1da177e4 LT |
23 | #ifndef _LINUX_AUDIT_H_ |
24 | #define _LINUX_AUDIT_H_ | |
25 | ||
f001e47f | 26 | #include <linux/sched.h> |
c0a3a20b | 27 | #include <linux/ptrace.h> |
607ca46e | 28 | #include <uapi/linux/audit.h> |
db0a6fb5 | 29 | #include <linux/tty.h> |
1da177e4 | 30 | |
84cb777e RGB |
31 | #define AUDIT_INO_UNSET ((unsigned long)-1) |
32 | #define AUDIT_DEV_UNSET ((dev_t)-1) | |
33 | ||
c2f0c7c3 SG |
34 | struct audit_sig_info { |
35 | uid_t uid; | |
36 | pid_t pid; | |
e1396065 | 37 | char ctx[0]; |
c2f0c7c3 SG |
38 | }; |
39 | ||
1da177e4 LT |
40 | struct audit_buffer; |
41 | struct audit_context; | |
42 | struct inode; | |
5bb289b5 | 43 | struct netlink_skb_parms; |
37721e1b | 44 | struct path; |
473ae30b | 45 | struct linux_binprm; |
20ca73bc GW |
46 | struct mq_attr; |
47 | struct mqstat; | |
9d57a7f9 AD |
48 | struct audit_watch; |
49 | struct audit_tree; | |
099dd235 | 50 | struct sk_buff; |
9d57a7f9 AD |
51 | |
52 | struct audit_krule { | |
041d7b98 | 53 | u32 pflags; |
9d57a7f9 AD |
54 | u32 flags; |
55 | u32 listnr; | |
56 | u32 action; | |
57 | u32 mask[AUDIT_BITMASK_SIZE]; | |
58 | u32 buflen; /* for data alloc on list rules */ | |
59 | u32 field_count; | |
60 | char *filterkey; /* ties events to rules */ | |
61 | struct audit_field *fields; | |
62 | struct audit_field *arch_f; /* quick access to arch field */ | |
63 | struct audit_field *inode_f; /* quick access to an inode field */ | |
64 | struct audit_watch *watch; /* associated watch */ | |
65 | struct audit_tree *tree; /* associated watched tree */ | |
34d99af5 | 66 | struct audit_fsnotify_mark *exe; |
9d57a7f9 | 67 | struct list_head rlist; /* entry in audit_{watch,tree}.rules list */ |
e45aa212 | 68 | struct list_head list; /* for AUDIT_LIST* purposes only */ |
0590b933 | 69 | u64 prio; |
9d57a7f9 AD |
70 | }; |
71 | ||
041d7b98 RGB |
72 | /* Flag to indicate legacy AUDIT_LOGINUID unset usage */ |
73 | #define AUDIT_LOGINUID_LEGACY 0x1 | |
74 | ||
9d57a7f9 AD |
75 | struct audit_field { |
76 | u32 type; | |
219ca394 RGB |
77 | union { |
78 | u32 val; | |
79 | kuid_t uid; | |
80 | kgid_t gid; | |
81 | struct { | |
82 | char *lsm_str; | |
83 | void *lsm_rule; | |
84 | }; | |
85 | }; | |
9d57a7f9 | 86 | u32 op; |
9d57a7f9 | 87 | }; |
1da177e4 | 88 | |
b0fed402 EP |
89 | extern int is_audit_feature_set(int which); |
90 | ||
b915543b | 91 | extern int __init audit_register_class(int class, unsigned *list); |
55669bfa | 92 | extern int audit_classify_syscall(int abi, unsigned syscall); |
e54dc243 | 93 | extern int audit_classify_arch(int arch); |
4b588411 AT |
94 | /* only for compat system calls */ |
95 | extern unsigned compat_write_class[]; | |
96 | extern unsigned compat_read_class[]; | |
97 | extern unsigned compat_dir_class[]; | |
98 | extern unsigned compat_chattr_class[]; | |
99 | extern unsigned compat_signal_class[]; | |
100 | ||
9e8beeb7 | 101 | extern int audit_classify_compat_syscall(int abi, unsigned syscall); |
78e2e802 JL |
102 | |
103 | /* audit_names->type values */ | |
104 | #define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ | |
105 | #define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */ | |
bfcec708 | 106 | #define AUDIT_TYPE_PARENT 2 /* a parent audit record */ |
4fa6b5ec JL |
107 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ |
108 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ | |
78e2e802 | 109 | |
2950fa9d CG |
110 | /* maximized args number that audit_socketcall can process */ |
111 | #define AUDITSC_ARGS 6 | |
112 | ||
2e28d38a PH |
113 | /* bit values for ->signal->audit_tty */ |
114 | #define AUDIT_TTY_ENABLE BIT(0) | |
115 | #define AUDIT_TTY_LOG_PASSWD BIT(1) | |
116 | ||
91a27b2a JL |
117 | struct filename; |
118 | ||
4d3fb709 EP |
119 | extern void audit_log_session_info(struct audit_buffer *ab); |
120 | ||
96368701 PM |
121 | #ifdef CONFIG_AUDIT |
122 | /* These are defined in audit.c */ | |
123 | /* Public API */ | |
124 | extern __printf(4, 5) | |
125 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, | |
126 | const char *fmt, ...); | |
127 | ||
128 | extern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type); | |
129 | extern __printf(2, 3) | |
130 | void audit_log_format(struct audit_buffer *ab, const char *fmt, ...); | |
131 | extern void audit_log_end(struct audit_buffer *ab); | |
132 | extern bool audit_string_contains_control(const char *string, | |
133 | size_t len); | |
134 | extern void audit_log_n_hex(struct audit_buffer *ab, | |
135 | const unsigned char *buf, | |
136 | size_t len); | |
137 | extern void audit_log_n_string(struct audit_buffer *ab, | |
138 | const char *buf, | |
139 | size_t n); | |
140 | extern void audit_log_n_untrustedstring(struct audit_buffer *ab, | |
141 | const char *string, | |
142 | size_t n); | |
143 | extern void audit_log_untrustedstring(struct audit_buffer *ab, | |
144 | const char *string); | |
145 | extern void audit_log_d_path(struct audit_buffer *ab, | |
146 | const char *prefix, | |
147 | const struct path *path); | |
148 | extern void audit_log_key(struct audit_buffer *ab, | |
149 | char *key); | |
150 | extern void audit_log_link_denied(const char *operation, | |
151 | struct path *link); | |
152 | extern void audit_log_lost(const char *message); | |
153 | #ifdef CONFIG_SECURITY | |
154 | extern void audit_log_secctx(struct audit_buffer *ab, u32 secid); | |
155 | #else | |
156 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | |
157 | { } | |
158 | #endif | |
159 | ||
160 | extern int audit_log_task_context(struct audit_buffer *ab); | |
161 | extern void audit_log_task_info(struct audit_buffer *ab, | |
162 | struct task_struct *tsk); | |
163 | ||
164 | extern int audit_update_lsm_rules(void); | |
165 | ||
166 | /* Private API (for audit.c only) */ | |
167 | extern int audit_filter_user(int type); | |
168 | extern int audit_filter_type(int type); | |
169 | extern int audit_rule_change(int type, __u32 portid, int seq, | |
170 | void *data, size_t datasz); | |
171 | extern int audit_list_rules_send(struct sk_buff *request_skb, int seq); | |
172 | ||
173 | extern u32 audit_enabled; | |
174 | #else /* CONFIG_AUDIT */ | |
175 | static inline __printf(4, 5) | |
176 | void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, | |
177 | const char *fmt, ...) | |
178 | { } | |
179 | static inline struct audit_buffer *audit_log_start(struct audit_context *ctx, | |
180 | gfp_t gfp_mask, int type) | |
181 | { | |
182 | return NULL; | |
183 | } | |
184 | static inline __printf(2, 3) | |
185 | void audit_log_format(struct audit_buffer *ab, const char *fmt, ...) | |
186 | { } | |
187 | static inline void audit_log_end(struct audit_buffer *ab) | |
188 | { } | |
189 | static inline void audit_log_n_hex(struct audit_buffer *ab, | |
190 | const unsigned char *buf, size_t len) | |
191 | { } | |
192 | static inline void audit_log_n_string(struct audit_buffer *ab, | |
193 | const char *buf, size_t n) | |
194 | { } | |
195 | static inline void audit_log_n_untrustedstring(struct audit_buffer *ab, | |
196 | const char *string, size_t n) | |
197 | { } | |
198 | static inline void audit_log_untrustedstring(struct audit_buffer *ab, | |
199 | const char *string) | |
200 | { } | |
201 | static inline void audit_log_d_path(struct audit_buffer *ab, | |
202 | const char *prefix, | |
203 | const struct path *path) | |
204 | { } | |
205 | static inline void audit_log_key(struct audit_buffer *ab, char *key) | |
206 | { } | |
207 | static inline void audit_log_link_denied(const char *string, | |
208 | const struct path *link) | |
209 | { } | |
210 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | |
211 | { } | |
212 | static inline int audit_log_task_context(struct audit_buffer *ab) | |
213 | { | |
214 | return 0; | |
215 | } | |
216 | static inline void audit_log_task_info(struct audit_buffer *ab, | |
217 | struct task_struct *tsk) | |
218 | { } | |
219 | #define audit_enabled 0 | |
220 | #endif /* CONFIG_AUDIT */ | |
221 | ||
312103d6 | 222 | #ifdef CONFIG_AUDIT_COMPAT_GENERIC |
356750e3 EP |
223 | #define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT)) |
224 | #else | |
225 | #define audit_is_compat(arch) false | |
226 | #endif | |
227 | ||
1da177e4 | 228 | #ifdef CONFIG_AUDITSYSCALL |
a9ebe0b9 EP |
229 | #include <asm/syscall.h> /* for syscall_get_arch() */ |
230 | ||
1da177e4 LT |
231 | /* These are defined in auditsc.c */ |
232 | /* Public API */ | |
233 | extern int audit_alloc(struct task_struct *task); | |
a4ff8dba | 234 | extern void __audit_free(struct task_struct *task); |
b4f0d375 | 235 | extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1, |
b05d8447 | 236 | unsigned long a2, unsigned long a3); |
d7e7528b | 237 | extern void __audit_syscall_exit(int ret_success, long ret_value); |
7ac86265 | 238 | extern struct filename *__audit_reusename(const __user char *uptr); |
91a27b2a | 239 | extern void __audit_getname(struct filename *name); |
79f6530c JL |
240 | |
241 | #define AUDIT_INODE_PARENT 1 /* dentry represents the parent */ | |
242 | #define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ | |
adb5c247 | 243 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, |
79f6530c | 244 | unsigned int flags); |
9f45f5bf | 245 | extern void __audit_file(const struct file *); |
d6335d77 | 246 | extern void __audit_inode_child(struct inode *parent, |
4fa6b5ec JL |
247 | const struct dentry *dentry, |
248 | const unsigned char type); | |
3dc1c1b2 | 249 | extern void __audit_seccomp(unsigned long syscall, long signr, int code); |
a5cb013d AV |
250 | extern void __audit_ptrace(struct task_struct *t); |
251 | ||
36734810 | 252 | static inline bool audit_dummy_context(void) |
d51374ad AV |
253 | { |
254 | void *p = current->audit_context; | |
255 | return !p || *(int *)p; | |
256 | } | |
a4ff8dba EP |
257 | static inline void audit_free(struct task_struct *task) |
258 | { | |
259 | if (unlikely(task->audit_context)) | |
260 | __audit_free(task); | |
261 | } | |
91397401 | 262 | static inline void audit_syscall_entry(int major, unsigned long a0, |
b05d8447 EP |
263 | unsigned long a1, unsigned long a2, |
264 | unsigned long a3) | |
265 | { | |
cdee3904 | 266 | if (unlikely(current->audit_context)) |
b4f0d375 | 267 | __audit_syscall_entry(major, a0, a1, a2, a3); |
b05d8447 | 268 | } |
d7e7528b EP |
269 | static inline void audit_syscall_exit(void *pt_regs) |
270 | { | |
271 | if (unlikely(current->audit_context)) { | |
272 | int success = is_syscall_success(pt_regs); | |
06bdadd7 | 273 | long return_code = regs_return_value(pt_regs); |
d7e7528b EP |
274 | |
275 | __audit_syscall_exit(success, return_code); | |
276 | } | |
277 | } | |
7ac86265 JL |
278 | static inline struct filename *audit_reusename(const __user char *name) |
279 | { | |
280 | if (unlikely(!audit_dummy_context())) | |
281 | return __audit_reusename(name); | |
282 | return NULL; | |
283 | } | |
91a27b2a | 284 | static inline void audit_getname(struct filename *name) |
d8945bb5 | 285 | { |
5ac3a9c2 | 286 | if (unlikely(!audit_dummy_context())) |
d8945bb5 AV |
287 | __audit_getname(name); |
288 | } | |
79f6530c JL |
289 | static inline void audit_inode(struct filename *name, |
290 | const struct dentry *dentry, | |
bfcec708 | 291 | unsigned int parent) { |
79f6530c JL |
292 | if (unlikely(!audit_dummy_context())) { |
293 | unsigned int flags = 0; | |
294 | if (parent) | |
295 | flags |= AUDIT_INODE_PARENT; | |
296 | __audit_inode(name, dentry, flags); | |
297 | } | |
298 | } | |
9f45f5bf AV |
299 | static inline void audit_file(struct file *file) |
300 | { | |
301 | if (unlikely(!audit_dummy_context())) | |
302 | __audit_file(file); | |
303 | } | |
79f6530c JL |
304 | static inline void audit_inode_parent_hidden(struct filename *name, |
305 | const struct dentry *dentry) | |
306 | { | |
5ac3a9c2 | 307 | if (unlikely(!audit_dummy_context())) |
79f6530c JL |
308 | __audit_inode(name, dentry, |
309 | AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN); | |
73241ccc | 310 | } |
d6335d77 | 311 | static inline void audit_inode_child(struct inode *parent, |
4fa6b5ec JL |
312 | const struct dentry *dentry, |
313 | const unsigned char type) { | |
5ac3a9c2 | 314 | if (unlikely(!audit_dummy_context())) |
4fa6b5ec | 315 | __audit_inode_child(parent, dentry, type); |
73241ccc | 316 | } |
0a4ff8c2 | 317 | void audit_core_dumps(long signr); |
1da177e4 | 318 | |
3dc1c1b2 | 319 | static inline void audit_seccomp(unsigned long syscall, long signr, int code) |
85e7bac3 | 320 | { |
96368701 PM |
321 | if (!audit_enabled) |
322 | return; | |
323 | ||
7b9205bd KC |
324 | /* Force a record to be reported if a signal was delivered. */ |
325 | if (signr || unlikely(!audit_dummy_context())) | |
3dc1c1b2 | 326 | __audit_seccomp(syscall, signr, code); |
85e7bac3 EP |
327 | } |
328 | ||
a5cb013d AV |
329 | static inline void audit_ptrace(struct task_struct *t) |
330 | { | |
331 | if (unlikely(!audit_dummy_context())) | |
332 | __audit_ptrace(t); | |
333 | } | |
334 | ||
1da177e4 | 335 | /* Private API (for audit.c only) */ |
bfb4496e | 336 | extern unsigned int audit_serial(void); |
48887e63 | 337 | extern int auditsc_get_stamp(struct audit_context *ctx, |
bfb4496e | 338 | struct timespec *t, unsigned int *serial); |
9321d526 KC |
339 | extern int audit_set_loginuid(kuid_t loginuid); |
340 | ||
341 | static inline kuid_t audit_get_loginuid(struct task_struct *tsk) | |
342 | { | |
343 | return tsk->loginuid; | |
344 | } | |
345 | ||
b6cfee4c | 346 | static inline unsigned int audit_get_sessionid(struct task_struct *tsk) |
9321d526 KC |
347 | { |
348 | return tsk->sessionid; | |
349 | } | |
350 | ||
db0a6fb5 RGB |
351 | static inline struct tty_struct *audit_get_tty(struct task_struct *tsk) |
352 | { | |
353 | struct tty_struct *tty = NULL; | |
354 | unsigned long flags; | |
355 | ||
356 | spin_lock_irqsave(&tsk->sighand->siglock, flags); | |
357 | if (tsk->signal) | |
358 | tty = tty_kref_get(tsk->signal->tty); | |
359 | spin_unlock_irqrestore(&tsk->sighand->siglock, flags); | |
360 | return tty; | |
361 | } | |
362 | ||
363 | static inline void audit_put_tty(struct tty_struct *tty) | |
364 | { | |
365 | tty_kref_put(tty); | |
366 | } | |
367 | ||
a33e6751 | 368 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
2570ebbd | 369 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
d9cfea91 | 370 | extern void __audit_bprm(struct linux_binprm *bprm); |
2950fa9d | 371 | extern int __audit_socketcall(int nargs, unsigned long *args); |
07c49417 | 372 | extern int __audit_sockaddr(int len, void *addr); |
157cf649 | 373 | extern void __audit_fd_pair(int fd1, int fd2); |
df0a4283 | 374 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); |
c32c8af4 | 375 | extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout); |
20114f71 | 376 | extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification); |
7392906e | 377 | extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); |
d84f4f99 DH |
378 | extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm, |
379 | const struct cred *new, | |
380 | const struct cred *old); | |
ca24a23e | 381 | extern void __audit_log_capset(const struct cred *new, const struct cred *old); |
120a795d | 382 | extern void __audit_mmap_fd(int fd, int flags); |
d8945bb5 | 383 | |
a33e6751 | 384 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
d8945bb5 | 385 | { |
5ac3a9c2 | 386 | if (unlikely(!audit_dummy_context())) |
a33e6751 | 387 | __audit_ipc_obj(ipcp); |
db349509 | 388 | } |
157cf649 | 389 | static inline void audit_fd_pair(int fd1, int fd2) |
d8945bb5 | 390 | { |
5ac3a9c2 | 391 | if (unlikely(!audit_dummy_context())) |
157cf649 | 392 | __audit_fd_pair(fd1, fd2); |
d8945bb5 | 393 | } |
2570ebbd | 394 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode) |
20ca73bc | 395 | { |
5ac3a9c2 | 396 | if (unlikely(!audit_dummy_context())) |
e816f370 | 397 | __audit_ipc_set_perm(qbytes, uid, gid, mode); |
20ca73bc | 398 | } |
9410d228 | 399 | static inline void audit_bprm(struct linux_binprm *bprm) |
07c49417 EP |
400 | { |
401 | if (unlikely(!audit_dummy_context())) | |
d9cfea91 | 402 | __audit_bprm(bprm); |
07c49417 | 403 | } |
2950fa9d | 404 | static inline int audit_socketcall(int nargs, unsigned long *args) |
07c49417 EP |
405 | { |
406 | if (unlikely(!audit_dummy_context())) | |
2950fa9d CG |
407 | return __audit_socketcall(nargs, args); |
408 | return 0; | |
07c49417 EP |
409 | } |
410 | static inline int audit_sockaddr(int len, void *addr) | |
411 | { | |
412 | if (unlikely(!audit_dummy_context())) | |
413 | return __audit_sockaddr(len, addr); | |
414 | return 0; | |
415 | } | |
df0a4283 | 416 | static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr) |
20ca73bc | 417 | { |
5ac3a9c2 | 418 | if (unlikely(!audit_dummy_context())) |
564f6993 | 419 | __audit_mq_open(oflag, mode, attr); |
20ca73bc | 420 | } |
c32c8af4 | 421 | static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout) |
20ca73bc | 422 | { |
5ac3a9c2 | 423 | if (unlikely(!audit_dummy_context())) |
c32c8af4 | 424 | __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout); |
20ca73bc | 425 | } |
20114f71 | 426 | static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification) |
20ca73bc | 427 | { |
5ac3a9c2 | 428 | if (unlikely(!audit_dummy_context())) |
20114f71 | 429 | __audit_mq_notify(mqdes, notification); |
20ca73bc | 430 | } |
7392906e | 431 | static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) |
20ca73bc | 432 | { |
5ac3a9c2 | 433 | if (unlikely(!audit_dummy_context())) |
7392906e | 434 | __audit_mq_getsetattr(mqdes, mqstat); |
20ca73bc | 435 | } |
3fc689e9 | 436 | |
d84f4f99 DH |
437 | static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm, |
438 | const struct cred *new, | |
439 | const struct cred *old) | |
3fc689e9 EP |
440 | { |
441 | if (unlikely(!audit_dummy_context())) | |
d84f4f99 DH |
442 | return __audit_log_bprm_fcaps(bprm, new, old); |
443 | return 0; | |
3fc689e9 EP |
444 | } |
445 | ||
ca24a23e | 446 | static inline void audit_log_capset(const struct cred *new, |
d84f4f99 | 447 | const struct cred *old) |
e68b75a0 EP |
448 | { |
449 | if (unlikely(!audit_dummy_context())) | |
ca24a23e | 450 | __audit_log_capset(new, old); |
e68b75a0 EP |
451 | } |
452 | ||
120a795d AV |
453 | static inline void audit_mmap_fd(int fd, int flags) |
454 | { | |
455 | if (unlikely(!audit_dummy_context())) | |
456 | __audit_mmap_fd(fd, flags); | |
457 | } | |
458 | ||
471a5c7c | 459 | extern int audit_n_rules; |
e54dc243 | 460 | extern int audit_signals; |
d7e7528b | 461 | #else /* CONFIG_AUDITSYSCALL */ |
9321d526 KC |
462 | static inline int audit_alloc(struct task_struct *task) |
463 | { | |
464 | return 0; | |
465 | } | |
466 | static inline void audit_free(struct task_struct *task) | |
467 | { } | |
91397401 | 468 | static inline void audit_syscall_entry(int major, unsigned long a0, |
9321d526 KC |
469 | unsigned long a1, unsigned long a2, |
470 | unsigned long a3) | |
471 | { } | |
472 | static inline void audit_syscall_exit(void *pt_regs) | |
473 | { } | |
36734810 | 474 | static inline bool audit_dummy_context(void) |
9321d526 | 475 | { |
36734810 | 476 | return true; |
9321d526 | 477 | } |
7ac86265 JL |
478 | static inline struct filename *audit_reusename(const __user char *name) |
479 | { | |
480 | return NULL; | |
481 | } | |
91a27b2a | 482 | static inline void audit_getname(struct filename *name) |
9321d526 | 483 | { } |
adb5c247 JL |
484 | static inline void __audit_inode(struct filename *name, |
485 | const struct dentry *dentry, | |
79f6530c | 486 | unsigned int flags) |
9321d526 | 487 | { } |
d6335d77 | 488 | static inline void __audit_inode_child(struct inode *parent, |
4fa6b5ec JL |
489 | const struct dentry *dentry, |
490 | const unsigned char type) | |
9321d526 | 491 | { } |
adb5c247 JL |
492 | static inline void audit_inode(struct filename *name, |
493 | const struct dentry *dentry, | |
bfcec708 | 494 | unsigned int parent) |
9321d526 | 495 | { } |
9f45f5bf AV |
496 | static inline void audit_file(struct file *file) |
497 | { | |
498 | } | |
79f6530c JL |
499 | static inline void audit_inode_parent_hidden(struct filename *name, |
500 | const struct dentry *dentry) | |
501 | { } | |
d6335d77 | 502 | static inline void audit_inode_child(struct inode *parent, |
4fa6b5ec JL |
503 | const struct dentry *dentry, |
504 | const unsigned char type) | |
9321d526 KC |
505 | { } |
506 | static inline void audit_core_dumps(long signr) | |
507 | { } | |
508 | static inline void __audit_seccomp(unsigned long syscall, long signr, int code) | |
509 | { } | |
510 | static inline void audit_seccomp(unsigned long syscall, long signr, int code) | |
511 | { } | |
512 | static inline int auditsc_get_stamp(struct audit_context *ctx, | |
513 | struct timespec *t, unsigned int *serial) | |
514 | { | |
515 | return 0; | |
516 | } | |
517 | static inline kuid_t audit_get_loginuid(struct task_struct *tsk) | |
518 | { | |
519 | return INVALID_UID; | |
520 | } | |
b6cfee4c | 521 | static inline unsigned int audit_get_sessionid(struct task_struct *tsk) |
9321d526 KC |
522 | { |
523 | return -1; | |
524 | } | |
db0a6fb5 RGB |
525 | static inline struct tty_struct *audit_get_tty(struct task_struct *tsk) |
526 | { | |
527 | return NULL; | |
528 | } | |
529 | static inline void audit_put_tty(struct tty_struct *tty) | |
530 | { } | |
9321d526 KC |
531 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
532 | { } | |
533 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, | |
534 | gid_t gid, umode_t mode) | |
535 | { } | |
9410d228 RGB |
536 | static inline void audit_bprm(struct linux_binprm *bprm) |
537 | { } | |
2950fa9d CG |
538 | static inline int audit_socketcall(int nargs, unsigned long *args) |
539 | { | |
540 | return 0; | |
541 | } | |
9321d526 KC |
542 | static inline void audit_fd_pair(int fd1, int fd2) |
543 | { } | |
544 | static inline int audit_sockaddr(int len, void *addr) | |
545 | { | |
546 | return 0; | |
547 | } | |
548 | static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr) | |
549 | { } | |
550 | static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, | |
551 | unsigned int msg_prio, | |
552 | const struct timespec *abs_timeout) | |
553 | { } | |
554 | static inline void audit_mq_notify(mqd_t mqdes, | |
555 | const struct sigevent *notification) | |
556 | { } | |
557 | static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) | |
558 | { } | |
559 | static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm, | |
560 | const struct cred *new, | |
561 | const struct cred *old) | |
562 | { | |
563 | return 0; | |
564 | } | |
ca24a23e EB |
565 | static inline void audit_log_capset(const struct cred *new, |
566 | const struct cred *old) | |
9321d526 KC |
567 | { } |
568 | static inline void audit_mmap_fd(int fd, int flags) | |
569 | { } | |
570 | static inline void audit_ptrace(struct task_struct *t) | |
571 | { } | |
471a5c7c | 572 | #define audit_n_rules 0 |
e54dc243 | 573 | #define audit_signals 0 |
d7e7528b | 574 | #endif /* CONFIG_AUDITSYSCALL */ |
1da177e4 | 575 | |
780a7654 EB |
576 | static inline bool audit_loginuid_set(struct task_struct *tsk) |
577 | { | |
578 | return uid_valid(audit_get_loginuid(tsk)); | |
579 | } | |
580 | ||
9321d526 KC |
581 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) |
582 | { | |
583 | audit_log_n_string(ab, buf, strlen(buf)); | |
584 | } | |
585 | ||
1da177e4 | 586 | #endif |