diff options
-rw-r--r-- | include/linux/audit.h | 24 | ||||
-rw-r--r-- | kernel/audit.c | 17 | ||||
-rw-r--r-- | kernel/audit.h | 4 | ||||
-rw-r--r-- | kernel/auditsc.c | 1 |
4 files changed, 21 insertions, 25 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index 32cdafb312d8..b40ed5df5542 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
27 | #include <linux/ptrace.h> | 27 | #include <linux/ptrace.h> |
28 | #include <uapi/linux/audit.h> | 28 | #include <uapi/linux/audit.h> |
29 | #include <linux/tty.h> | ||
30 | 29 | ||
31 | #define AUDIT_INO_UNSET ((unsigned long)-1) | 30 | #define AUDIT_INO_UNSET ((unsigned long)-1) |
32 | #define AUDIT_DEV_UNSET ((dev_t)-1) | 31 | #define AUDIT_DEV_UNSET ((dev_t)-1) |
@@ -344,23 +343,6 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) | |||
344 | return tsk->sessionid; | 343 | return tsk->sessionid; |
345 | } | 344 | } |
346 | 345 | ||
347 | static inline struct tty_struct *audit_get_tty(struct task_struct *tsk) | ||
348 | { | ||
349 | struct tty_struct *tty = NULL; | ||
350 | unsigned long flags; | ||
351 | |||
352 | spin_lock_irqsave(&tsk->sighand->siglock, flags); | ||
353 | if (tsk->signal) | ||
354 | tty = tty_kref_get(tsk->signal->tty); | ||
355 | spin_unlock_irqrestore(&tsk->sighand->siglock, flags); | ||
356 | return tty; | ||
357 | } | ||
358 | |||
359 | static inline void audit_put_tty(struct tty_struct *tty) | ||
360 | { | ||
361 | tty_kref_put(tty); | ||
362 | } | ||
363 | |||
364 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); | 346 | extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); |
365 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); | 347 | extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); |
366 | extern void __audit_bprm(struct linux_binprm *bprm); | 348 | extern void __audit_bprm(struct linux_binprm *bprm); |
@@ -518,12 +500,6 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk) | |||
518 | { | 500 | { |
519 | return -1; | 501 | return -1; |
520 | } | 502 | } |
521 | static inline struct tty_struct *audit_get_tty(struct task_struct *tsk) | ||
522 | { | ||
523 | return NULL; | ||
524 | } | ||
525 | static inline void audit_put_tty(struct tty_struct *tty) | ||
526 | { } | ||
527 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) | 503 | static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) |
528 | { } | 504 | { } |
529 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, | 505 | static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, |
diff --git a/kernel/audit.c b/kernel/audit.c index 384374a1d232..d5971010e44a 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -1866,6 +1866,23 @@ out_null: | |||
1866 | audit_log_format(ab, " exe=(null)"); | 1866 | audit_log_format(ab, " exe=(null)"); |
1867 | } | 1867 | } |
1868 | 1868 | ||
1869 | struct tty_struct *audit_get_tty(struct task_struct *tsk) | ||
1870 | { | ||
1871 | struct tty_struct *tty = NULL; | ||
1872 | unsigned long flags; | ||
1873 | |||
1874 | spin_lock_irqsave(&tsk->sighand->siglock, flags); | ||
1875 | if (tsk->signal) | ||
1876 | tty = tty_kref_get(tsk->signal->tty); | ||
1877 | spin_unlock_irqrestore(&tsk->sighand->siglock, flags); | ||
1878 | return tty; | ||
1879 | } | ||
1880 | |||
1881 | void audit_put_tty(struct tty_struct *tty) | ||
1882 | { | ||
1883 | tty_kref_put(tty); | ||
1884 | } | ||
1885 | |||
1869 | void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) | 1886 | void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk) |
1870 | { | 1887 | { |
1871 | const struct cred *cred; | 1888 | const struct cred *cred; |
diff --git a/kernel/audit.h b/kernel/audit.h index cbbe6bb6496e..a492f4c4e710 100644 --- a/kernel/audit.h +++ b/kernel/audit.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/audit.h> | 23 | #include <linux/audit.h> |
24 | #include <linux/skbuff.h> | 24 | #include <linux/skbuff.h> |
25 | #include <uapi/linux/mqueue.h> | 25 | #include <uapi/linux/mqueue.h> |
26 | #include <linux/tty.h> | ||
26 | 27 | ||
27 | /* AUDIT_NAMES is the number of slots we reserve in the audit_context | 28 | /* AUDIT_NAMES is the number of slots we reserve in the audit_context |
28 | * for saving names from getname(). If we get more names we will allocate | 29 | * for saving names from getname(). If we get more names we will allocate |
@@ -262,6 +263,9 @@ extern struct audit_entry *audit_dupe_rule(struct audit_krule *old); | |||
262 | extern void audit_log_d_path_exe(struct audit_buffer *ab, | 263 | extern void audit_log_d_path_exe(struct audit_buffer *ab, |
263 | struct mm_struct *mm); | 264 | struct mm_struct *mm); |
264 | 265 | ||
266 | extern struct tty_struct *audit_get_tty(struct task_struct *tsk); | ||
267 | extern void audit_put_tty(struct tty_struct *tty); | ||
268 | |||
265 | /* audit watch functions */ | 269 | /* audit watch functions */ |
266 | #ifdef CONFIG_AUDIT_WATCH | 270 | #ifdef CONFIG_AUDIT_WATCH |
267 | extern void audit_put_watch(struct audit_watch *watch); | 271 | extern void audit_put_watch(struct audit_watch *watch); |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 33dafa70229d..60a354eed2fa 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -63,7 +63,6 @@ | |||
63 | #include <asm/unistd.h> | 63 | #include <asm/unistd.h> |
64 | #include <linux/security.h> | 64 | #include <linux/security.h> |
65 | #include <linux/list.h> | 65 | #include <linux/list.h> |
66 | #include <linux/tty.h> | ||
67 | #include <linux/binfmts.h> | 66 | #include <linux/binfmts.h> |
68 | #include <linux/highmem.h> | 67 | #include <linux/highmem.h> |
69 | #include <linux/syscalls.h> | 68 | #include <linux/syscalls.h> |