diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/audit.h | 48 | ||||
| -rw-r--r-- | include/linux/sched.h | 1 | ||||
| -rw-r--r-- | include/linux/tty.h | 6 | ||||
| -rw-r--r-- | include/uapi/linux/audit.h | 4 |
4 files changed, 38 insertions, 21 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 5a6d718adf34..b20b03852f21 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
| @@ -84,8 +84,13 @@ extern int audit_classify_arch(int arch); | |||
| 84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ | 84 | #define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */ |
| 85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ | 85 | #define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */ |
| 86 | 86 | ||
| 87 | /* maximized args number that audit_socketcall can process */ | ||
| 88 | #define AUDITSC_ARGS 6 | ||
| 89 | |||
| 87 | struct filename; | 90 | struct filename; |
| 88 | 91 | ||
| 92 | extern void audit_log_session_info(struct audit_buffer *ab); | ||
| 93 | |||
| 89 | #ifdef CONFIG_AUDITSYSCALL | 94 | #ifdef CONFIG_AUDITSYSCALL |
| 90 | /* These are defined in auditsc.c */ | 95 | /* These are defined in auditsc.c */ |
| 91 | /* Public API */ | 96 | /* Public API */ |
| @@ -120,7 +125,7 @@ static inline void audit_syscall_entry(int arch, int major, unsigned long a0, | |||
| 120 | unsigned long a1, unsigned long a2, | 125 | unsigned long a1, unsigned long a2, |
| 121 | unsigned long a3) | 126 | unsigned long a3) |
| 122 | { | 127 | { |
| 123 | if (unlikely(!audit_dummy_context())) | 128 | if (unlikely(current->audit_context)) |
| 124 | __audit_syscall_entry(arch, major, a0, a1, a2, a3); | 129 | __audit_syscall_entry(arch, major, a0, a1, a2, a3); |
| 125 | } | 130 | } |
| 126 | static inline void audit_syscall_exit(void *pt_regs) | 131 | static inline void audit_syscall_exit(void *pt_regs) |
| @@ -185,12 +190,10 @@ static inline int audit_get_sessionid(struct task_struct *tsk) | |||
| 185 | return tsk->sessionid; | 190 | return tsk->sessionid; |
| 186 | } | 191 | } |
| 187 | 192 | ||
| 188 | extern void audit_log_task_context(struct audit_buffer *ab); | ||
| 189 | extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk); | ||
| 190 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); | 193 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
| 191 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); | 194 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
| 192 | extern int __audit_bprm(struct linux_binprm *bprm); | 195 | extern int __audit_bprm(struct linux_binprm *bprm); |
| 193 | extern void __audit_socketcall(int nargs, unsigned long *args); | 196 | extern int __audit_socketcall(int nargs, unsigned long *args); |
| 194 | extern int __audit_sockaddr(int len, void *addr); | 197 | extern int __audit_sockaddr(int len, void *addr); |
| 195 | extern void __audit_fd_pair(int fd1, int fd2); | 198 | extern void __audit_fd_pair(int fd1, int fd2); |
| 196 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); | 199 | extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr); |
| @@ -224,10 +227,11 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
| 224 | return __audit_bprm(bprm); | 227 | return __audit_bprm(bprm); |
| 225 | return 0; | 228 | return 0; |
| 226 | } | 229 | } |
| 227 | static inline void audit_socketcall(int nargs, unsigned long *args) | 230 | static inline int audit_socketcall(int nargs, unsigned long *args) |
| 228 | { | 231 | { |
| 229 | if (unlikely(!audit_dummy_context())) | 232 | if (unlikely(!audit_dummy_context())) |
| 230 | __audit_socketcall(nargs, args); | 233 | return __audit_socketcall(nargs, args); |
| 234 | return 0; | ||
| 231 | } | 235 | } |
| 232 | static inline int audit_sockaddr(int len, void *addr) | 236 | static inline int audit_sockaddr(int len, void *addr) |
| 233 | { | 237 | { |
| @@ -340,11 +344,6 @@ static inline int audit_get_sessionid(struct task_struct *tsk) | |||
| 340 | { | 344 | { |
| 341 | return -1; | 345 | return -1; |
| 342 | } | 346 | } |
| 343 | static inline void audit_log_task_context(struct audit_buffer *ab) | ||
| 344 | { } | ||
| 345 | static inline void audit_log_task_info(struct audit_buffer *ab, | ||
| 346 | struct task_struct *tsk) | ||
| 347 | { } | ||
| 348 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) | 347 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
| 349 | { } | 348 | { } |
| 350 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, | 349 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, |
| @@ -354,8 +353,10 @@ static inline int audit_bprm(struct linux_binprm *bprm) | |||
| 354 | { | 353 | { |
| 355 | return 0; | 354 | return 0; |
| 356 | } | 355 | } |
| 357 | static inline void audit_socketcall(int nargs, unsigned long *args) | 356 | static inline int audit_socketcall(int nargs, unsigned long *args) |
| 358 | { } | 357 | { |
| 358 | return 0; | ||
| 359 | } | ||
| 359 | static inline void audit_fd_pair(int fd1, int fd2) | 360 | static inline void audit_fd_pair(int fd1, int fd2) |
| 360 | { } | 361 | { } |
| 361 | static inline int audit_sockaddr(int len, void *addr) | 362 | static inline int audit_sockaddr(int len, void *addr) |
| @@ -390,6 +391,11 @@ static inline void audit_ptrace(struct task_struct *t) | |||
| 390 | #define audit_signals 0 | 391 | #define audit_signals 0 |
| 391 | #endif /* CONFIG_AUDITSYSCALL */ | 392 | #endif /* CONFIG_AUDITSYSCALL */ |
| 392 | 393 | ||
| 394 | static inline bool audit_loginuid_set(struct task_struct *tsk) | ||
| 395 | { | ||
| 396 | return uid_valid(audit_get_loginuid(tsk)); | ||
| 397 | } | ||
| 398 | |||
| 393 | #ifdef CONFIG_AUDIT | 399 | #ifdef CONFIG_AUDIT |
| 394 | /* These are defined in audit.c */ | 400 | /* These are defined in audit.c */ |
| 395 | /* Public API */ | 401 | /* Public API */ |
| @@ -429,14 +435,17 @@ static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | |||
| 429 | { } | 435 | { } |
| 430 | #endif | 436 | #endif |
| 431 | 437 | ||
| 438 | extern int audit_log_task_context(struct audit_buffer *ab); | ||
| 439 | extern void audit_log_task_info(struct audit_buffer *ab, | ||
| 440 | struct task_struct *tsk); | ||
| 441 | |||
| 432 | extern int audit_update_lsm_rules(void); | 442 | extern int audit_update_lsm_rules(void); |
| 433 | 443 | ||
| 434 | /* Private API (for audit.c only) */ | 444 | /* Private API (for audit.c only) */ |
| 435 | extern int audit_filter_user(void); | 445 | extern int audit_filter_user(int type); |
| 436 | extern int audit_filter_type(int type); | 446 | extern int audit_filter_type(int type); |
| 437 | extern int audit_receive_filter(int type, int pid, int seq, | 447 | extern int audit_receive_filter(int type, int pid, int seq, |
| 438 | void *data, size_t datasz, kuid_t loginuid, | 448 | void *data, size_t datasz); |
| 439 | u32 sessionid, u32 sid); | ||
| 440 | extern int audit_enabled; | 449 | extern int audit_enabled; |
| 441 | #else /* CONFIG_AUDIT */ | 450 | #else /* CONFIG_AUDIT */ |
| 442 | static inline __printf(4, 5) | 451 | static inline __printf(4, 5) |
| @@ -476,6 +485,13 @@ static inline void audit_log_link_denied(const char *string, | |||
| 476 | { } | 485 | { } |
| 477 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) | 486 | static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid) |
| 478 | { } | 487 | { } |
| 488 | static inline int audit_log_task_context(struct audit_buffer *ab) | ||
| 489 | { | ||
| 490 | return 0; | ||
| 491 | } | ||
| 492 | static inline void audit_log_task_info(struct audit_buffer *ab, | ||
| 493 | struct task_struct *tsk) | ||
| 494 | { } | ||
| 479 | #define audit_enabled 0 | 495 | #define audit_enabled 0 |
| 480 | #endif /* CONFIG_AUDIT */ | 496 | #endif /* CONFIG_AUDIT */ |
| 481 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) | 497 | static inline void audit_log_string(struct audit_buffer *ab, const char *buf) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index caa8f4d0186b..178a8d909f14 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -593,6 +593,7 @@ struct signal_struct { | |||
| 593 | #endif | 593 | #endif |
| 594 | #ifdef CONFIG_AUDIT | 594 | #ifdef CONFIG_AUDIT |
| 595 | unsigned audit_tty; | 595 | unsigned audit_tty; |
| 596 | unsigned audit_tty_log_passwd; | ||
| 596 | struct tty_audit_buf *tty_audit_buf; | 597 | struct tty_audit_buf *tty_audit_buf; |
| 597 | #endif | 598 | #endif |
| 598 | #ifdef CONFIG_CGROUPS | 599 | #ifdef CONFIG_CGROUPS |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 7e92bd86a808..8780bd2a272a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -575,8 +575,7 @@ extern void tty_audit_exit(void); | |||
| 575 | extern void tty_audit_fork(struct signal_struct *sig); | 575 | extern void tty_audit_fork(struct signal_struct *sig); |
| 576 | extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); | 576 | extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); |
| 577 | extern void tty_audit_push(struct tty_struct *tty); | 577 | extern void tty_audit_push(struct tty_struct *tty); |
| 578 | extern int tty_audit_push_task(struct task_struct *tsk, | 578 | extern int tty_audit_push_current(void); |
| 579 | kuid_t loginuid, u32 sessionid); | ||
| 580 | #else | 579 | #else |
| 581 | static inline void tty_audit_add_data(struct tty_struct *tty, | 580 | static inline void tty_audit_add_data(struct tty_struct *tty, |
| 582 | unsigned char *data, size_t size, unsigned icanon) | 581 | unsigned char *data, size_t size, unsigned icanon) |
| @@ -594,8 +593,7 @@ static inline void tty_audit_fork(struct signal_struct *sig) | |||
| 594 | static inline void tty_audit_push(struct tty_struct *tty) | 593 | static inline void tty_audit_push(struct tty_struct *tty) |
| 595 | { | 594 | { |
| 596 | } | 595 | } |
| 597 | static inline int tty_audit_push_task(struct task_struct *tsk, | 596 | static inline int tty_audit_push_current(void) |
| 598 | kuid_t loginuid, u32 sessionid) | ||
| 599 | { | 597 | { |
| 600 | return 0; | 598 | return 0; |
| 601 | } | 599 | } |
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h index 9f096f1c0907..75cef3fd97ad 100644 --- a/include/uapi/linux/audit.h +++ b/include/uapi/linux/audit.h | |||
| @@ -246,6 +246,7 @@ | |||
| 246 | #define AUDIT_OBJ_TYPE 21 | 246 | #define AUDIT_OBJ_TYPE 21 |
| 247 | #define AUDIT_OBJ_LEV_LOW 22 | 247 | #define AUDIT_OBJ_LEV_LOW 22 |
| 248 | #define AUDIT_OBJ_LEV_HIGH 23 | 248 | #define AUDIT_OBJ_LEV_HIGH 23 |
| 249 | #define AUDIT_LOGINUID_SET 24 | ||
| 249 | 250 | ||
| 250 | /* These are ONLY useful when checking | 251 | /* These are ONLY useful when checking |
| 251 | * at syscall exit time (AUDIT_AT_EXIT). */ | 252 | * at syscall exit time (AUDIT_AT_EXIT). */ |
| @@ -369,7 +370,8 @@ struct audit_status { | |||
| 369 | }; | 370 | }; |
| 370 | 371 | ||
| 371 | struct audit_tty_status { | 372 | struct audit_tty_status { |
| 372 | __u32 enabled; /* 1 = enabled, 0 = disabled */ | 373 | __u32 enabled; /* 1 = enabled, 0 = disabled */ |
| 374 | __u32 log_passwd; /* 1 = enabled, 0 = disabled */ | ||
| 373 | }; | 375 | }; |
| 374 | 376 | ||
| 375 | /* audit_rule_data supports filter rules with both integer and string | 377 | /* audit_rule_data supports filter rules with both integer and string |
