audit.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* audit.h -- Auditing support
  3. *
  4. * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
  5. * All Rights Reserved.
  6. *
  7. * Written by Rickard E. (Rik) Faith <faith@redhat.com>
  8. */
  9. #ifndef _LINUX_AUDIT_H_
  10. #define _LINUX_AUDIT_H_
  11. #include <linux/sched.h>
  12. #include <linux/ptrace.h>
  13. #include <linux/audit_arch.h>
  14. #include <uapi/linux/audit.h>
  15. #include <uapi/linux/netfilter/nf_tables.h>
  16. #define AUDIT_INO_UNSET ((unsigned long)-1)
  17. #define AUDIT_DEV_UNSET ((dev_t)-1)
  18. struct audit_sig_info {
  19. uid_t uid;
  20. pid_t pid;
  21. char ctx[];
  22. };
  23. struct audit_buffer;
  24. struct audit_context;
  25. struct inode;
  26. struct netlink_skb_parms;
  27. struct path;
  28. struct linux_binprm;
  29. struct mq_attr;
  30. struct mqstat;
  31. struct audit_watch;
  32. struct audit_tree;
  33. struct sk_buff;
  34. struct audit_krule {
  35. u32 pflags;
  36. u32 flags;
  37. u32 listnr;
  38. u32 action;
  39. u32 mask[AUDIT_BITMASK_SIZE];
  40. u32 buflen; /* for data alloc on list rules */
  41. u32 field_count;
  42. char *filterkey; /* ties events to rules */
  43. struct audit_field *fields;
  44. struct audit_field *arch_f; /* quick access to arch field */
  45. struct audit_field *inode_f; /* quick access to an inode field */
  46. struct audit_watch *watch; /* associated watch */
  47. struct audit_tree *tree; /* associated watched tree */
  48. struct audit_fsnotify_mark *exe;
  49. struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
  50. struct list_head list; /* for AUDIT_LIST* purposes only */
  51. u64 prio;
  52. };
  53. /* Flag to indicate legacy AUDIT_LOGINUID unset usage */
  54. #define AUDIT_LOGINUID_LEGACY 0x1
  55. struct audit_field {
  56. u32 type;
  57. union {
  58. u32 val;
  59. kuid_t uid;
  60. kgid_t gid;
  61. struct {
  62. char *lsm_str;
  63. void *lsm_rule;
  64. };
  65. };
  66. u32 op;
  67. };
  68. enum audit_ntp_type {
  69. AUDIT_NTP_OFFSET,
  70. AUDIT_NTP_FREQ,
  71. AUDIT_NTP_STATUS,
  72. AUDIT_NTP_TAI,
  73. AUDIT_NTP_TICK,
  74. AUDIT_NTP_ADJUST,
  75. AUDIT_NTP_NVALS /* count */
  76. };
  77. #ifdef CONFIG_AUDITSYSCALL
  78. struct audit_ntp_val {
  79. long long oldval, newval;
  80. };
  81. struct audit_ntp_data {
  82. struct audit_ntp_val vals[AUDIT_NTP_NVALS];
  83. };
  84. #else
  85. struct audit_ntp_data {};
  86. #endif
  87. enum audit_nfcfgop {
  88. AUDIT_XT_OP_REGISTER,
  89. AUDIT_XT_OP_REPLACE,
  90. AUDIT_XT_OP_UNREGISTER,
  91. AUDIT_NFT_OP_TABLE_REGISTER,
  92. AUDIT_NFT_OP_TABLE_UNREGISTER,
  93. AUDIT_NFT_OP_CHAIN_REGISTER,
  94. AUDIT_NFT_OP_CHAIN_UNREGISTER,
  95. AUDIT_NFT_OP_RULE_REGISTER,
  96. AUDIT_NFT_OP_RULE_UNREGISTER,
  97. AUDIT_NFT_OP_SET_REGISTER,
  98. AUDIT_NFT_OP_SET_UNREGISTER,
  99. AUDIT_NFT_OP_SETELEM_REGISTER,
  100. AUDIT_NFT_OP_SETELEM_UNREGISTER,
  101. AUDIT_NFT_OP_GEN_REGISTER,
  102. AUDIT_NFT_OP_OBJ_REGISTER,
  103. AUDIT_NFT_OP_OBJ_UNREGISTER,
  104. AUDIT_NFT_OP_OBJ_RESET,
  105. AUDIT_NFT_OP_FLOWTABLE_REGISTER,
  106. AUDIT_NFT_OP_FLOWTABLE_UNREGISTER,
  107. AUDIT_NFT_OP_INVALID,
  108. };
  109. extern int __init audit_register_class(int class, unsigned *list);
  110. extern int audit_classify_syscall(int abi, unsigned syscall);
  111. extern int audit_classify_arch(int arch);
  112. /* only for compat system calls */
  113. extern unsigned compat_write_class[];
  114. extern unsigned compat_read_class[];
  115. extern unsigned compat_dir_class[];
  116. extern unsigned compat_chattr_class[];
  117. extern unsigned compat_signal_class[];
  118. extern int audit_classify_compat_syscall(int abi, unsigned syscall);
  119. /* audit_names->type values */
  120. #define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
  121. #define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */
  122. #define AUDIT_TYPE_PARENT 2 /* a parent audit record */
  123. #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */
  124. #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */
  125. /* maximized args number that audit_socketcall can process */
  126. #define AUDITSC_ARGS 6
  127. /* bit values for ->signal->audit_tty */
  128. #define AUDIT_TTY_ENABLE BIT(0)
  129. #define AUDIT_TTY_LOG_PASSWD BIT(1)
  130. struct filename;
  131. #define AUDIT_OFF 0
  132. #define AUDIT_ON 1
  133. #define AUDIT_LOCKED 2
  134. #ifdef CONFIG_AUDIT
  135. /* These are defined in audit.c */
  136. /* Public API */
  137. extern __printf(4, 5)
  138. void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
  139. const char *fmt, ...);
  140. extern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type);
  141. extern __printf(2, 3)
  142. void audit_log_format(struct audit_buffer *ab, const char *fmt, ...);
  143. extern void audit_log_end(struct audit_buffer *ab);
  144. extern bool audit_string_contains_control(const char *string,
  145. size_t len);
  146. extern void audit_log_n_hex(struct audit_buffer *ab,
  147. const unsigned char *buf,
  148. size_t len);
  149. extern void audit_log_n_string(struct audit_buffer *ab,
  150. const char *buf,
  151. size_t n);
  152. extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
  153. const char *string,
  154. size_t n);
  155. extern void audit_log_untrustedstring(struct audit_buffer *ab,
  156. const char *string);
  157. extern void audit_log_d_path(struct audit_buffer *ab,
  158. const char *prefix,
  159. const struct path *path);
  160. extern void audit_log_key(struct audit_buffer *ab,
  161. char *key);
  162. extern void audit_log_path_denied(int type,
  163. const char *operation);
  164. extern void audit_log_lost(const char *message);
  165. extern int audit_log_task_context(struct audit_buffer *ab);
  166. extern void audit_log_task_info(struct audit_buffer *ab);
  167. extern int audit_update_lsm_rules(void);
  168. /* Private API (for audit.c only) */
  169. extern int audit_rule_change(int type, int seq, void *data, size_t datasz);
  170. extern int audit_list_rules_send(struct sk_buff *request_skb, int seq);
  171. extern int audit_set_loginuid(kuid_t loginuid);
  172. static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
  173. {
  174. return tsk->loginuid;
  175. }
  176. static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
  177. {
  178. return tsk->sessionid;
  179. }
  180. extern u32 audit_enabled;
  181. extern int audit_signal_info(int sig, struct task_struct *t);
  182. #else /* CONFIG_AUDIT */
  183. static inline __printf(4, 5)
  184. void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
  185. const char *fmt, ...)
  186. { }
  187. static inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
  188. gfp_t gfp_mask, int type)
  189. {
  190. return NULL;
  191. }
  192. static inline __printf(2, 3)
  193. void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
  194. { }
  195. static inline void audit_log_end(struct audit_buffer *ab)
  196. { }
  197. static inline void audit_log_n_hex(struct audit_buffer *ab,
  198. const unsigned char *buf, size_t len)
  199. { }
  200. static inline void audit_log_n_string(struct audit_buffer *ab,
  201. const char *buf, size_t n)
  202. { }
  203. static inline void audit_log_n_untrustedstring(struct audit_buffer *ab,
  204. const char *string, size_t n)
  205. { }
  206. static inline void audit_log_untrustedstring(struct audit_buffer *ab,
  207. const char *string)
  208. { }
  209. static inline void audit_log_d_path(struct audit_buffer *ab,
  210. const char *prefix,
  211. const struct path *path)
  212. { }
  213. static inline void audit_log_key(struct audit_buffer *ab, char *key)
  214. { }
  215. static inline void audit_log_path_denied(int type, const char *operation)
  216. { }
  217. static inline int audit_log_task_context(struct audit_buffer *ab)
  218. {
  219. return 0;
  220. }
  221. static inline void audit_log_task_info(struct audit_buffer *ab)
  222. { }
  223. static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
  224. {
  225. return INVALID_UID;
  226. }
  227. static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
  228. {
  229. return AUDIT_SID_UNSET;
  230. }
  231. #define audit_enabled AUDIT_OFF
  232. static inline int audit_signal_info(int sig, struct task_struct *t)
  233. {
  234. return 0;
  235. }
  236. #endif /* CONFIG_AUDIT */
  237. #ifdef CONFIG_AUDIT_COMPAT_GENERIC
  238. #define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT))
  239. #else
  240. #define audit_is_compat(arch) false
  241. #endif
  242. #define AUDIT_INODE_PARENT 1 /* dentry represents the parent */
  243. #define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */
  244. #define AUDIT_INODE_NOEVAL 4 /* audit record incomplete */
  245. #ifdef CONFIG_AUDITSYSCALL
  246. #include <asm/syscall.h> /* for syscall_get_arch() */
  247. /* These are defined in auditsc.c */
  248. /* Public API */
  249. extern int audit_alloc(struct task_struct *task);
  250. extern void __audit_free(struct task_struct *task);
  251. extern void __audit_uring_entry(u8 op);
  252. extern void __audit_uring_exit(int success, long code);
  253. extern void __audit_syscall_entry(int major, unsigned long a0, unsigned long a1,
  254. unsigned long a2, unsigned long a3);
  255. extern void __audit_syscall_exit(int ret_success, long ret_value);
  256. extern struct filename *__audit_reusename(const __user char *uptr);
  257. extern void __audit_getname(struct filename *name);
  258. extern void __audit_inode(struct filename *name, const struct dentry *dentry,
  259. unsigned int flags);
  260. extern void __audit_file(const struct file *);
  261. extern void __audit_inode_child(struct inode *parent,
  262. const struct dentry *dentry,
  263. const unsigned char type);
  264. extern void audit_seccomp(unsigned long syscall, long signr, int code);
  265. extern void audit_seccomp_actions_logged(const char *names,
  266. const char *old_names, int res);
  267. extern void __audit_ptrace(struct task_struct *t);
  268. static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
  269. {
  270. task->audit_context = ctx;
  271. }
  272. static inline struct audit_context *audit_context(void)
  273. {
  274. return current->audit_context;
  275. }
  276. static inline bool audit_dummy_context(void)
  277. {
  278. void *p = audit_context();
  279. return !p || *(int *)p;
  280. }
  281. static inline void audit_free(struct task_struct *task)
  282. {
  283. if (unlikely(task->audit_context))
  284. __audit_free(task);
  285. }
  286. static inline void audit_uring_entry(u8 op)
  287. {
  288. /*
  289. * We intentionally check audit_context() before audit_enabled as most
  290. * Linux systems (as of ~2021) rely on systemd which forces audit to
  291. * be enabled regardless of the user's audit configuration.
  292. */
  293. if (unlikely(audit_context() && audit_enabled))
  294. __audit_uring_entry(op);
  295. }
  296. static inline void audit_uring_exit(int success, long code)
  297. {
  298. if (unlikely(audit_context()))
  299. __audit_uring_exit(success, code);
  300. }
  301. static inline void audit_syscall_entry(int major, unsigned long a0,
  302. unsigned long a1, unsigned long a2,
  303. unsigned long a3)
  304. {
  305. if (unlikely(audit_context()))
  306. __audit_syscall_entry(major, a0, a1, a2, a3);
  307. }
  308. static inline void audit_syscall_exit(void *pt_regs)
  309. {
  310. if (unlikely(audit_context())) {
  311. int success = is_syscall_success(pt_regs);
  312. long return_code = regs_return_value(pt_regs);
  313. __audit_syscall_exit(success, return_code);
  314. }
  315. }
  316. static inline struct filename *audit_reusename(const __user char *name)
  317. {
  318. if (unlikely(!audit_dummy_context()))
  319. return __audit_reusename(name);
  320. return NULL;
  321. }
  322. static inline void audit_getname(struct filename *name)
  323. {
  324. if (unlikely(!audit_dummy_context()))
  325. __audit_getname(name);
  326. }
  327. static inline void audit_inode(struct filename *name,
  328. const struct dentry *dentry,
  329. unsigned int aflags) {
  330. if (unlikely(!audit_dummy_context()))
  331. __audit_inode(name, dentry, aflags);
  332. }
  333. static inline void audit_file(struct file *file)
  334. {
  335. if (unlikely(!audit_dummy_context()))
  336. __audit_file(file);
  337. }
  338. static inline void audit_inode_parent_hidden(struct filename *name,
  339. const struct dentry *dentry)
  340. {
  341. if (unlikely(!audit_dummy_context()))
  342. __audit_inode(name, dentry,
  343. AUDIT_INODE_PARENT | AUDIT_INODE_HIDDEN);
  344. }
  345. static inline void audit_inode_child(struct inode *parent,
  346. const struct dentry *dentry,
  347. const unsigned char type) {
  348. if (unlikely(!audit_dummy_context()))
  349. __audit_inode_child(parent, dentry, type);
  350. }
  351. void audit_core_dumps(long signr);
  352. static inline void audit_ptrace(struct task_struct *t)
  353. {
  354. if (unlikely(!audit_dummy_context()))
  355. __audit_ptrace(t);
  356. }
  357. /* Private API (for audit.c only) */
  358. extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
  359. extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
  360. extern void __audit_bprm(struct linux_binprm *bprm);
  361. extern int __audit_socketcall(int nargs, unsigned long *args);
  362. extern int __audit_sockaddr(int len, void *addr);
  363. extern void __audit_fd_pair(int fd1, int fd2);
  364. extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
  365. extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout);
  366. extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
  367. extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
  368. extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
  369. const struct cred *new,
  370. const struct cred *old);
  371. extern void __audit_log_capset(const struct cred *new, const struct cred *old);
  372. extern void __audit_mmap_fd(int fd, int flags);
  373. extern void __audit_openat2_how(struct open_how *how);
  374. extern void __audit_log_kern_module(char *name);
  375. extern void __audit_fanotify(unsigned int response);
  376. extern void __audit_tk_injoffset(struct timespec64 offset);
  377. extern void __audit_ntp_log(const struct audit_ntp_data *ad);
  378. extern void __audit_log_nfcfg(const char *name, u8 af, unsigned int nentries,
  379. enum audit_nfcfgop op, gfp_t gfp);
  380. static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
  381. {
  382. if (unlikely(!audit_dummy_context()))
  383. __audit_ipc_obj(ipcp);
  384. }
  385. static inline void audit_fd_pair(int fd1, int fd2)
  386. {
  387. if (unlikely(!audit_dummy_context()))
  388. __audit_fd_pair(fd1, fd2);
  389. }
  390. static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode)
  391. {
  392. if (unlikely(!audit_dummy_context()))
  393. __audit_ipc_set_perm(qbytes, uid, gid, mode);
  394. }
  395. static inline void audit_bprm(struct linux_binprm *bprm)
  396. {
  397. if (unlikely(!audit_dummy_context()))
  398. __audit_bprm(bprm);
  399. }
  400. static inline int audit_socketcall(int nargs, unsigned long *args)
  401. {
  402. if (unlikely(!audit_dummy_context()))
  403. return __audit_socketcall(nargs, args);
  404. return 0;
  405. }
  406. static inline int audit_socketcall_compat(int nargs, u32 *args)
  407. {
  408. unsigned long a[AUDITSC_ARGS];
  409. int i;
  410. if (audit_dummy_context())
  411. return 0;
  412. for (i = 0; i < nargs; i++)
  413. a[i] = (unsigned long)args[i];
  414. return __audit_socketcall(nargs, a);
  415. }
  416. static inline int audit_sockaddr(int len, void *addr)
  417. {
  418. if (unlikely(!audit_dummy_context()))
  419. return __audit_sockaddr(len, addr);
  420. return 0;
  421. }
  422. static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
  423. {
  424. if (unlikely(!audit_dummy_context()))
  425. __audit_mq_open(oflag, mode, attr);
  426. }
  427. static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout)
  428. {
  429. if (unlikely(!audit_dummy_context()))
  430. __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
  431. }
  432. static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
  433. {
  434. if (unlikely(!audit_dummy_context()))
  435. __audit_mq_notify(mqdes, notification);
  436. }
  437. static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
  438. {
  439. if (unlikely(!audit_dummy_context()))
  440. __audit_mq_getsetattr(mqdes, mqstat);
  441. }
  442. static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
  443. const struct cred *new,
  444. const struct cred *old)
  445. {
  446. if (unlikely(!audit_dummy_context()))
  447. return __audit_log_bprm_fcaps(bprm, new, old);
  448. return 0;
  449. }
  450. static inline void audit_log_capset(const struct cred *new,
  451. const struct cred *old)
  452. {
  453. if (unlikely(!audit_dummy_context()))
  454. __audit_log_capset(new, old);
  455. }
  456. static inline void audit_mmap_fd(int fd, int flags)
  457. {
  458. if (unlikely(!audit_dummy_context()))
  459. __audit_mmap_fd(fd, flags);
  460. }
  461. static inline void audit_openat2_how(struct open_how *how)
  462. {
  463. if (unlikely(!audit_dummy_context()))
  464. __audit_openat2_how(how);
  465. }
  466. static inline void audit_log_kern_module(char *name)
  467. {
  468. if (!audit_dummy_context())
  469. __audit_log_kern_module(name);
  470. }
  471. static inline void audit_fanotify(unsigned int response)
  472. {
  473. if (!audit_dummy_context())
  474. __audit_fanotify(response);
  475. }
  476. static inline void audit_tk_injoffset(struct timespec64 offset)
  477. {
  478. /* ignore no-op events */
  479. if (offset.tv_sec == 0 && offset.tv_nsec == 0)
  480. return;
  481. if (!audit_dummy_context())
  482. __audit_tk_injoffset(offset);
  483. }
  484. static inline void audit_ntp_init(struct audit_ntp_data *ad)
  485. {
  486. memset(ad, 0, sizeof(*ad));
  487. }
  488. static inline void audit_ntp_set_old(struct audit_ntp_data *ad,
  489. enum audit_ntp_type type, long long val)
  490. {
  491. ad->vals[type].oldval = val;
  492. }
  493. static inline void audit_ntp_set_new(struct audit_ntp_data *ad,
  494. enum audit_ntp_type type, long long val)
  495. {
  496. ad->vals[type].newval = val;
  497. }
  498. static inline void audit_ntp_log(const struct audit_ntp_data *ad)
  499. {
  500. if (!audit_dummy_context())
  501. __audit_ntp_log(ad);
  502. }
  503. static inline void audit_log_nfcfg(const char *name, u8 af,
  504. unsigned int nentries,
  505. enum audit_nfcfgop op, gfp_t gfp)
  506. {
  507. if (audit_enabled)
  508. __audit_log_nfcfg(name, af, nentries, op, gfp);
  509. }
  510. extern int audit_n_rules;
  511. extern int audit_signals;
  512. #else /* CONFIG_AUDITSYSCALL */
  513. static inline int audit_alloc(struct task_struct *task)
  514. {
  515. return 0;
  516. }
  517. static inline void audit_free(struct task_struct *task)
  518. { }
  519. static inline void audit_uring_entry(u8 op)
  520. { }
  521. static inline void audit_uring_exit(int success, long code)
  522. { }
  523. static inline void audit_syscall_entry(int major, unsigned long a0,
  524. unsigned long a1, unsigned long a2,
  525. unsigned long a3)
  526. { }
  527. static inline void audit_syscall_exit(void *pt_regs)
  528. { }
  529. static inline bool audit_dummy_context(void)
  530. {
  531. return true;
  532. }
  533. static inline void audit_set_context(struct task_struct *task, struct audit_context *ctx)
  534. { }
  535. static inline struct audit_context *audit_context(void)
  536. {
  537. return NULL;
  538. }
  539. static inline struct filename *audit_reusename(const __user char *name)
  540. {
  541. return NULL;
  542. }
  543. static inline void audit_getname(struct filename *name)
  544. { }
  545. static inline void audit_inode(struct filename *name,
  546. const struct dentry *dentry,
  547. unsigned int aflags)
  548. { }
  549. static inline void audit_file(struct file *file)
  550. {
  551. }
  552. static inline void audit_inode_parent_hidden(struct filename *name,
  553. const struct dentry *dentry)
  554. { }
  555. static inline void audit_inode_child(struct inode *parent,
  556. const struct dentry *dentry,
  557. const unsigned char type)
  558. { }
  559. static inline void audit_core_dumps(long signr)
  560. { }
  561. static inline void audit_seccomp(unsigned long syscall, long signr, int code)
  562. { }
  563. static inline void audit_seccomp_actions_logged(const char *names,
  564. const char *old_names, int res)
  565. { }
  566. static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
  567. { }
  568. static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
  569. gid_t gid, umode_t mode)
  570. { }
  571. static inline void audit_bprm(struct linux_binprm *bprm)
  572. { }
  573. static inline int audit_socketcall(int nargs, unsigned long *args)
  574. {
  575. return 0;
  576. }
  577. static inline int audit_socketcall_compat(int nargs, u32 *args)
  578. {
  579. return 0;
  580. }
  581. static inline void audit_fd_pair(int fd1, int fd2)
  582. { }
  583. static inline int audit_sockaddr(int len, void *addr)
  584. {
  585. return 0;
  586. }
  587. static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
  588. { }
  589. static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len,
  590. unsigned int msg_prio,
  591. const struct timespec64 *abs_timeout)
  592. { }
  593. static inline void audit_mq_notify(mqd_t mqdes,
  594. const struct sigevent *notification)
  595. { }
  596. static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
  597. { }
  598. static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
  599. const struct cred *new,
  600. const struct cred *old)
  601. {
  602. return 0;
  603. }
  604. static inline void audit_log_capset(const struct cred *new,
  605. const struct cred *old)
  606. { }
  607. static inline void audit_mmap_fd(int fd, int flags)
  608. { }
  609. static inline void audit_openat2_how(struct open_how *how)
  610. { }
  611. static inline void audit_log_kern_module(char *name)
  612. {
  613. }
  614. static inline void audit_fanotify(unsigned int response)
  615. { }
  616. static inline void audit_tk_injoffset(struct timespec64 offset)
  617. { }
  618. static inline void audit_ntp_init(struct audit_ntp_data *ad)
  619. { }
  620. static inline void audit_ntp_set_old(struct audit_ntp_data *ad,
  621. enum audit_ntp_type type, long long val)
  622. { }
  623. static inline void audit_ntp_set_new(struct audit_ntp_data *ad,
  624. enum audit_ntp_type type, long long val)
  625. { }
  626. static inline void audit_ntp_log(const struct audit_ntp_data *ad)
  627. { }
  628. static inline void audit_ptrace(struct task_struct *t)
  629. { }
  630. static inline void audit_log_nfcfg(const char *name, u8 af,
  631. unsigned int nentries,
  632. enum audit_nfcfgop op, gfp_t gfp)
  633. { }
  634. #define audit_n_rules 0
  635. #define audit_signals 0
  636. #endif /* CONFIG_AUDITSYSCALL */
  637. static inline bool audit_loginuid_set(struct task_struct *tsk)
  638. {
  639. return uid_valid(audit_get_loginuid(tsk));
  640. }
  641. #endif