aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-01-10 04:53:18 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-02-01 14:05:28 -0500
commitbfef93a5d1fb5654fe2025276c55e202d10b5255 (patch)
tree573d8153c5d5216b0c4007b652286eeddd3c0987 /include/linux
parent0c11b9428f619ab377c92eff2f160a834a6585dd (diff)
[PATCH] get rid of loginuid races
Keeping loginuid in audit_context is racy and results in messier code. Taken to task_struct, out of the way of ->audit_context changes. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/init_task.h7
-rw-r--r--include/linux/sched.h3
3 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h
index f63117fab305..d7c6a12f4d1c 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -409,7 +409,7 @@ extern unsigned int audit_serial(void);
409extern void auditsc_get_stamp(struct audit_context *ctx, 409extern void auditsc_get_stamp(struct audit_context *ctx,
410 struct timespec *t, unsigned int *serial); 410 struct timespec *t, unsigned int *serial);
411extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 411extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
412extern uid_t audit_get_loginuid(struct task_struct *task); 412#define audit_get_loginuid(t) ((t)->loginuid)
413extern void audit_log_task_context(struct audit_buffer *ab); 413extern void audit_log_task_context(struct audit_buffer *ab);
414extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 414extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
415extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 415extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index e6b3f7080679..ea3e9efd7396 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -114,6 +114,12 @@ extern struct group_info init_groups;
114 .pid = &init_struct_pid, \ 114 .pid = &init_struct_pid, \
115} 115}
116 116
117#ifdef CONFIG_AUDITSYSCALL
118#define INIT_IDS \
119 .loginuid = -1,
120#else
121#define INIT_IDS
122#endif
117/* 123/*
118 * INIT_TASK is used to set up the first task table, touch at 124 * INIT_TASK is used to set up the first task table, touch at
119 * your own risk!. Base=0, limit=0x1fffff (=2MB) 125 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -173,6 +179,7 @@ extern struct group_info init_groups;
173 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 179 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
174 }, \ 180 }, \
175 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 181 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
182 INIT_IDS \
176 INIT_TRACE_IRQFLAGS \ 183 INIT_TRACE_IRQFLAGS \
177 INIT_LOCKDEP \ 184 INIT_LOCKDEP \
178} 185}
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 6c333579d9da..5e2730389089 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1139,6 +1139,9 @@ struct task_struct {
1139 void *security; 1139 void *security;
1140#endif 1140#endif
1141 struct audit_context *audit_context; 1141 struct audit_context *audit_context;
1142#ifdef CONFIG_AUDITSYSCALL
1143 uid_t loginuid;
1144#endif
1142 seccomp_t seccomp; 1145 seccomp_t seccomp;
1143 1146
1144/* Thread group tracking */ 1147/* Thread group tracking */