aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2009-06-10 21:03:14 -0400
committerJames Morris <jmorris@namei.org>2009-06-10 21:03:14 -0400
commit73fbad283cfbbcf02939bdbda31fc4a30e729cca (patch)
tree7c89fe13e1b4a2c7f2d60f4ea6eaf69c14bccab7 /kernel
parent769f3e8c384795cc350e2aae27de2a12374d19d4 (diff)
parent35f2c2f6f6ae13ef23c4f68e6d3073753077ca43 (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cred.c4
-rw-r--r--kernel/exit.c1
-rw-r--r--kernel/module.c7
-rw-r--r--kernel/ptrace.c9
-rw-r--r--kernel/signal.c11
-rw-r--r--kernel/sysctl.c14
6 files changed, 33 insertions, 13 deletions
diff --git a/kernel/cred.c b/kernel/cred.c
index 3a039189d707..1bb4d7e5d616 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -167,7 +167,7 @@ EXPORT_SYMBOL(prepare_creds);
167 167
168/* 168/*
169 * Prepare credentials for current to perform an execve() 169 * Prepare credentials for current to perform an execve()
170 * - The caller must hold current->cred_exec_mutex 170 * - The caller must hold current->cred_guard_mutex
171 */ 171 */
172struct cred *prepare_exec_creds(void) 172struct cred *prepare_exec_creds(void)
173{ 173{
@@ -276,7 +276,7 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags)
276 struct cred *new; 276 struct cred *new;
277 int ret; 277 int ret;
278 278
279 mutex_init(&p->cred_exec_mutex); 279 mutex_init(&p->cred_guard_mutex);
280 280
281 if ( 281 if (
282#ifdef CONFIG_KEYS 282#ifdef CONFIG_KEYS
diff --git a/kernel/exit.c b/kernel/exit.c
index abf9cf3b95c6..036e8d740169 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1476,6 +1476,7 @@ static int wait_consider_task(struct task_struct *parent, int ptrace,
1476 */ 1476 */
1477 if (*notask_error) 1477 if (*notask_error)
1478 *notask_error = ret; 1478 *notask_error = ret;
1479 return 0;
1479 } 1480 }
1480 1481
1481 if (likely(!ptrace) && unlikely(p->ptrace)) { 1482 if (likely(!ptrace) && unlikely(p->ptrace)) {
diff --git a/kernel/module.c b/kernel/module.c
index e797812a4d95..cb3887e770e2 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -72,6 +72,9 @@ DEFINE_MUTEX(module_mutex);
72EXPORT_SYMBOL_GPL(module_mutex); 72EXPORT_SYMBOL_GPL(module_mutex);
73static LIST_HEAD(modules); 73static LIST_HEAD(modules);
74 74
75/* Block module loading/unloading? */
76int modules_disabled = 0;
77
75/* Waiting for a module to finish initializing? */ 78/* Waiting for a module to finish initializing? */
76static DECLARE_WAIT_QUEUE_HEAD(module_wq); 79static DECLARE_WAIT_QUEUE_HEAD(module_wq);
77 80
@@ -777,7 +780,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
777 char name[MODULE_NAME_LEN]; 780 char name[MODULE_NAME_LEN];
778 int ret, forced = 0; 781 int ret, forced = 0;
779 782
780 if (!capable(CAP_SYS_MODULE)) 783 if (!capable(CAP_SYS_MODULE) || modules_disabled)
781 return -EPERM; 784 return -EPERM;
782 785
783 if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) 786 if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)
@@ -2336,7 +2339,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
2336 int ret = 0; 2339 int ret = 0;
2337 2340
2338 /* Must have permission */ 2341 /* Must have permission */
2339 if (!capable(CAP_SYS_MODULE)) 2342 if (!capable(CAP_SYS_MODULE) || modules_disabled)
2340 return -EPERM; 2343 return -EPERM;
2341 2344
2342 /* Only one module load at a time, please */ 2345 /* Only one module load at a time, please */
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 42c317874cfa..43a5a3b0be79 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -185,10 +185,11 @@ int ptrace_attach(struct task_struct *task)
185 if (same_thread_group(task, current)) 185 if (same_thread_group(task, current))
186 goto out; 186 goto out;
187 187
188 /* Protect exec's credential calculations against our interference; 188 /* Protect the target's credential calculations against our
189 * SUID, SGID and LSM creds get determined differently under ptrace. 189 * interference; SUID, SGID and LSM creds get determined differently
190 * under ptrace.
190 */ 191 */
191 retval = mutex_lock_interruptible(&task->cred_exec_mutex); 192 retval = mutex_lock_interruptible(&task->cred_guard_mutex);
192 if (retval < 0) 193 if (retval < 0)
193 goto out; 194 goto out;
194 195
@@ -232,7 +233,7 @@ repeat:
232bad: 233bad:
233 write_unlock_irqrestore(&tasklist_lock, flags); 234 write_unlock_irqrestore(&tasklist_lock, flags);
234 task_unlock(task); 235 task_unlock(task);
235 mutex_unlock(&task->cred_exec_mutex); 236 mutex_unlock(&task->cred_guard_mutex);
236out: 237out:
237 return retval; 238 return retval;
238} 239}
diff --git a/kernel/signal.c b/kernel/signal.c
index d8034737db4c..d2dd9cf5dcc6 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -249,14 +249,19 @@ void flush_sigqueue(struct sigpending *queue)
249/* 249/*
250 * Flush all pending signals for a task. 250 * Flush all pending signals for a task.
251 */ 251 */
252void __flush_signals(struct task_struct *t)
253{
254 clear_tsk_thread_flag(t, TIF_SIGPENDING);
255 flush_sigqueue(&t->pending);
256 flush_sigqueue(&t->signal->shared_pending);
257}
258
252void flush_signals(struct task_struct *t) 259void flush_signals(struct task_struct *t)
253{ 260{
254 unsigned long flags; 261 unsigned long flags;
255 262
256 spin_lock_irqsave(&t->sighand->siglock, flags); 263 spin_lock_irqsave(&t->sighand->siglock, flags);
257 clear_tsk_thread_flag(t, TIF_SIGPENDING); 264 __flush_signals(t);
258 flush_sigqueue(&t->pending);
259 flush_sigqueue(&t->signal->shared_pending);
260 spin_unlock_irqrestore(&t->sighand->siglock, flags); 265 spin_unlock_irqrestore(&t->sighand->siglock, flags);
261} 266}
262 267
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 6a463716ecbf..944ba03cae19 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -114,6 +114,7 @@ static int ngroups_max = NGROUPS_MAX;
114 114
115#ifdef CONFIG_MODULES 115#ifdef CONFIG_MODULES
116extern char modprobe_path[]; 116extern char modprobe_path[];
117extern int modules_disabled;
117#endif 118#endif
118#ifdef CONFIG_CHR_DEV_SG 119#ifdef CONFIG_CHR_DEV_SG
119extern int sg_big_buff; 120extern int sg_big_buff;
@@ -534,6 +535,17 @@ static struct ctl_table kern_table[] = {
534 .proc_handler = &proc_dostring, 535 .proc_handler = &proc_dostring,
535 .strategy = &sysctl_string, 536 .strategy = &sysctl_string,
536 }, 537 },
538 {
539 .ctl_name = CTL_UNNUMBERED,
540 .procname = "modules_disabled",
541 .data = &modules_disabled,
542 .maxlen = sizeof(int),
543 .mode = 0644,
544 /* only handle a transition from default "0" to "1" */
545 .proc_handler = &proc_dointvec_minmax,
546 .extra1 = &one,
547 .extra2 = &one,
548 },
537#endif 549#endif
538#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) 550#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
539 { 551 {
@@ -1233,7 +1245,6 @@ static struct ctl_table vm_table[] = {
1233 .strategy = &sysctl_jiffies, 1245 .strategy = &sysctl_jiffies,
1234 }, 1246 },
1235#endif 1247#endif
1236#ifdef CONFIG_SECURITY
1237 { 1248 {
1238 .ctl_name = CTL_UNNUMBERED, 1249 .ctl_name = CTL_UNNUMBERED,
1239 .procname = "mmap_min_addr", 1250 .procname = "mmap_min_addr",
@@ -1242,7 +1253,6 @@ static struct ctl_table vm_table[] = {
1242 .mode = 0644, 1253 .mode = 0644,
1243 .proc_handler = &proc_doulongvec_minmax, 1254 .proc_handler = &proc_doulongvec_minmax,
1244 }, 1255 },
1245#endif
1246#ifdef CONFIG_NUMA 1256#ifdef CONFIG_NUMA
1247 { 1257 {
1248 .ctl_name = CTL_UNNUMBERED, 1258 .ctl_name = CTL_UNNUMBERED,