12 #include <linux/audit.h>
13 #include <linux/slab.h>
14 #include <linux/tty.h>
60 tty_audit_buf_free(buf);
75 "major=%d minor=%d comm=", description,
96 unsigned int sessionid,
105 tty_audit_log(
"tty", tsk, loginuid, sessionid, buf->
major, buf->
minor,
116 static void tty_audit_buf_push_current(
struct tty_audit_buf *buf)
119 unsigned int sessionid = audit_get_sessionid(
current);
120 tty_audit_buf_push(
current, auid, sessionid, buf);
133 spin_lock_irq(&
current->sighand->siglock);
134 buf =
current->signal->tty_audit_buf;
136 spin_unlock_irq(&
current->sighand->siglock);
141 tty_audit_buf_push_current(buf);
144 tty_audit_buf_put(buf);
154 spin_lock_irq(&
current->sighand->siglock);
155 sig->audit_tty =
current->signal->audit_tty;
156 spin_unlock_irq(&
current->sighand->siglock);
167 spin_lock_irq(&
current->sighand->siglock);
168 should_audit =
current->signal->audit_tty;
169 buf =
current->signal->tty_audit_buf;
172 spin_unlock_irq(&
current->sighand->siglock);
174 major = tty->
driver->major;
178 if (buf->
major == major && buf->
minor == minor)
179 tty_audit_buf_push_current(buf);
181 tty_audit_buf_put(buf);
186 unsigned int sessionid;
188 auid = audit_get_loginuid(
current);
189 sessionid = audit_get_sessionid(
current);
190 tty_audit_log(
"ioctl=TIOCSTI",
current, auid, sessionid, major,
210 if (!lock_task_sighand(tsk, &flags))
213 if (tsk->
signal->audit_tty) {
214 buf = tsk->
signal->tty_audit_buf;
218 unlock_task_sighand(tsk, &flags);
224 if (!buf || IS_ERR(buf))
228 tty_audit_buf_push(tsk, loginuid, sessionid, buf);
231 tty_audit_buf_put(buf);
248 spin_lock_irq(&
current->sighand->siglock);
251 buf =
current->signal->tty_audit_buf;
256 spin_unlock_irq(&
current->sighand->siglock);
258 buf2 = tty_audit_buf_alloc(tty->
driver->major,
266 spin_lock_irq(&
current->sighand->siglock);
267 if (!
current->signal->audit_tty)
269 buf =
current->signal->tty_audit_buf;
271 current->signal->tty_audit_buf = buf2;
278 spin_unlock_irq(&
current->sighand->siglock);
280 tty_audit_buf_free(buf2);
302 buf = tty_audit_buf_get(tty);
307 major = tty->
driver->major;
309 if (buf->
major != major || buf->
minor != minor
311 tty_audit_buf_push_current(buf);
327 tty_audit_buf_push_current(buf);
330 tty_audit_buf_put(buf);
342 spin_lock_irq(&
current->sighand->siglock);
344 spin_unlock_irq(&
current->sighand->siglock);
347 buf =
current->signal->tty_audit_buf;
350 spin_unlock_irq(&
current->sighand->siglock);
355 major = tty->
driver->major;
358 if (buf->
major == major && buf->
minor == minor)
359 tty_audit_buf_push_current(buf);
361 tty_audit_buf_put(buf);