aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/tty_audit.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 7c5866920622..b0b39b823ccf 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -61,7 +61,7 @@ static void tty_audit_buf_put(struct tty_audit_buf *buf)
61} 61}
62 62
63static void tty_audit_log(const char *description, struct task_struct *tsk, 63static void tty_audit_log(const char *description, struct task_struct *tsk,
64 uid_t loginuid, unsigned sessionid, int major, 64 kuid_t loginuid, unsigned sessionid, int major,
65 int minor, unsigned char *data, size_t size) 65 int minor, unsigned char *data, size_t size)
66{ 66{
67 struct audit_buffer *ab; 67 struct audit_buffer *ab;
@@ -69,11 +69,14 @@ static void tty_audit_log(const char *description, struct task_struct *tsk,
69 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY); 69 ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_TTY);
70 if (ab) { 70 if (ab) {
71 char name[sizeof(tsk->comm)]; 71 char name[sizeof(tsk->comm)];
72 uid_t uid = task_uid(tsk); 72 kuid_t uid = task_uid(tsk);
73 73
74 audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u " 74 audit_log_format(ab, "%s pid=%u uid=%u auid=%u ses=%u "
75 "major=%d minor=%d comm=", description, 75 "major=%d minor=%d comm=", description,
76 tsk->pid, uid, loginuid, sessionid, 76 tsk->pid,
77 from_kuid(&init_user_ns, uid),
78 from_kuid(&init_user_ns, loginuid),
79 sessionid,
77 major, minor); 80 major, minor);
78 get_task_comm(name, tsk); 81 get_task_comm(name, tsk);
79 audit_log_untrustedstring(ab, name); 82 audit_log_untrustedstring(ab, name);
@@ -89,7 +92,7 @@ static void tty_audit_log(const char *description, struct task_struct *tsk,
89 * Generate an audit message from the contents of @buf, which is owned by 92 * Generate an audit message from the contents of @buf, which is owned by
90 * @tsk with @loginuid. @buf->mutex must be locked. 93 * @tsk with @loginuid. @buf->mutex must be locked.
91 */ 94 */
92static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid, 95static void tty_audit_buf_push(struct task_struct *tsk, kuid_t loginuid,
93 unsigned int sessionid, 96 unsigned int sessionid,
94 struct tty_audit_buf *buf) 97 struct tty_audit_buf *buf)
95{ 98{
@@ -112,7 +115,7 @@ static void tty_audit_buf_push(struct task_struct *tsk, uid_t loginuid,
112 */ 115 */
113static void tty_audit_buf_push_current(struct tty_audit_buf *buf) 116static void tty_audit_buf_push_current(struct tty_audit_buf *buf)
114{ 117{
115 uid_t auid = audit_get_loginuid(current); 118 kuid_t auid = audit_get_loginuid(current);
116 unsigned int sessionid = audit_get_sessionid(current); 119 unsigned int sessionid = audit_get_sessionid(current);
117 tty_audit_buf_push(current, auid, sessionid, buf); 120 tty_audit_buf_push(current, auid, sessionid, buf);
118} 121}
@@ -179,7 +182,7 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch)
179 } 182 }
180 183
181 if (should_audit && audit_enabled) { 184 if (should_audit && audit_enabled) {
182 uid_t auid; 185 kuid_t auid;
183 unsigned int sessionid; 186 unsigned int sessionid;
184 187
185 auid = audit_get_loginuid(current); 188 auid = audit_get_loginuid(current);
@@ -199,7 +202,7 @@ void tty_audit_tiocsti(struct tty_struct *tty, char ch)
199 * reference to the tty audit buffer if available. 202 * reference to the tty audit buffer if available.
200 * Flush the buffer or return an appropriate error code. 203 * Flush the buffer or return an appropriate error code.
201 */ 204 */
202int tty_audit_push_task(struct task_struct *tsk, uid_t loginuid, u32 sessionid) 205int tty_audit_push_task(struct task_struct *tsk, kuid_t loginuid, u32 sessionid)
203{ 206{
204 struct tty_audit_buf *buf = ERR_PTR(-EPERM); 207 struct tty_audit_buf *buf = ERR_PTR(-EPERM);
205 unsigned long flags; 208 unsigned long flags;