From 7a84d4c4b40e1f0f61d9575f8c83221edc372a34 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Fri, 10 Jul 2009 03:48:23 +0200 Subject: [PATCH] --- yaml --- r: 157314 b: refs/heads/master c: 5bb459bb45d1ad3c177485dcf0af01580aa31125 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/sched.h | 2 +- trunk/lib/is_single_threaded.c | 3 ++- trunk/security/keys/process_keys.c | 2 +- trunk/security/selinux/hooks.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 27cb6514b0c7..57ac203ba14f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d2e3ee9b29f5de5b01e611b04e6fb29760589b01 +refs/heads/master: 5bb459bb45d1ad3c177485dcf0af01580aa31125 diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 16a982e389fb..0839a2c9b952 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -2075,7 +2075,7 @@ static inline unsigned long wait_task_inactive(struct task_struct *p, #define for_each_process(p) \ for (p = &init_task ; (p = next_task(p)) != &init_task ; ) -extern bool is_single_threaded(struct task_struct *); +extern bool current_is_single_threaded(void); /* * Careful: do_each_thread/while_each_thread is a double loop so diff --git a/trunk/lib/is_single_threaded.c b/trunk/lib/is_single_threaded.c index 2762516e0a5e..434010980bdf 100644 --- a/trunk/lib/is_single_threaded.c +++ b/trunk/lib/is_single_threaded.c @@ -15,8 +15,9 @@ /* * Returns true if the task does not share ->mm with another thread/process. */ -bool is_single_threaded(struct task_struct *task) +bool current_is_single_threaded(void) { + struct task_struct *task = current; struct mm_struct *mm = task->mm; struct task_struct *p, *t; bool ret; diff --git a/trunk/security/keys/process_keys.c b/trunk/security/keys/process_keys.c index 276d27882ce8..ed929af466d3 100644 --- a/trunk/security/keys/process_keys.c +++ b/trunk/security/keys/process_keys.c @@ -702,7 +702,7 @@ long join_session_keyring(const char *name) /* only permit this if there's a single thread in the thread group - * this avoids us having to adjust the creds on all threads and risking * ENOMEM */ - if (!is_single_threaded(current)) + if (!current_is_single_threaded()) return -EMLINK; new = prepare_creds(); diff --git a/trunk/security/selinux/hooks.c b/trunk/security/selinux/hooks.c index 2081055f6783..e65677da36bd 100644 --- a/trunk/security/selinux/hooks.c +++ b/trunk/security/selinux/hooks.c @@ -5187,7 +5187,7 @@ static int selinux_setprocattr(struct task_struct *p, /* Only allow single threaded processes to change context */ error = -EPERM; - if (!is_single_threaded(p)) { + if (!current_is_single_threaded()) { error = security_bounded_transition(tsec->sid, sid); if (error) goto abort_change;