8000 audit: move audit_get_tty to reduce scope and kabi changes · bsd-unix/linux@3f5be2d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f5be2d

Browse files
rgbriggspcmoore
authored andcommitted
audit: move audit_get_tty to reduce scope and kabi changes
The only users of audit_get_tty and audit_put_tty are internal to audit, so move it out of include/linux/audit.h to kernel.h and create a proper function rather than inlining it. This also reduces kABI changes. Suggested-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Richard Guy Briggs <rgb@redhat.com> [PM: line wrapped description] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 76a658c commit 3f5be2d

File tree

4 files changed

+21
-25
lines changed

4 files changed

+21
-25
lines changed

include/linux/audit.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <linux/sched.h>
2727
#include <linux/ptrace.h>
2828
#include <uapi/linux/audit.h>
29-
#include <linux/tty.h>
3029

3130
#define AUDIT_INO_UNSET ((unsigned long)-1)
3231
#define AUDIT_DEV_UNSET ((dev_t)-1)
@@ -344,23 +343,6 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
344343
return tsk->sessionid;
345344
}
346345

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-
364346
extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
365347
extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
366348
extern void __audit_bprm(struct linux_binprm *bprm);
@@ -518,12 +500,6 @@ static inline unsigned int audit_get_sessionid(struct task_struct *tsk)
518500
{
519501
return -1;
520502
}
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-
{ }
527503
static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
528504
{ }
529505
static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,

kernel/audit.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,23 @@ void audit_log_d_path_exe(struct audit_buffer *ab,
18661866
audit_log_format(ab, " exe=(null)");
18671867
}
18681868

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+
18691886
void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
18701887
{
18711888
const struct cred *cred;

kernel/audit.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/audit.h>
2424
#include <linux/skbuff.h>
2525
#include <uapi/linux/mqueue.h>
26+
#include <linux/tty.h>
2627

2728
/* AUDIT_NAMES is the number of slots we reserve in the audit_context
2829
* 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);
262263
extern void audit_log_d_path_exe(struct audit_buffer *ab,
263264
struct mm_struct *mm);
264265

266+
extern struct tty_struct *audit_get_tty(struct task_struct *tsk);
267+
extern void audit_put_tty(struct tty_struct *tty);
268+
265269
/* audit watch functions */
266270
#ifdef CONFIG_AUDIT_WATCH
267271
extern void audit_put_watch(struct audit_watch *watch);

kernel/auditsc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
#include <asm/unistd.h>
6464
#include <linux/security.h>
6565
#include <linux/list.h>
66-
#include <linux/tty.h>
6766
#include <linux/binfmts.h>
6867
#include <linux/highmem.h>
6968
#include <linux/syscalls.h>

0 commit comments

Comments
 (0)
0