aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sched.h2
-rw-r--r--lib/is_single_threaded.c3
-rw-r--r--security/keys/process_keys.c2
-rw-r--r--security/selinux/hooks.c2
4 files changed, 5 insertions, 4 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 16a982e389fb..0839a2c9b952 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2075,7 +2075,7 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2075#define for_each_process(p) \ 2075#define for_each_process(p) \
2076 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 2076 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
2077 2077
2078extern bool is_single_threaded(struct task_struct *); 2078extern bool current_is_single_threaded(void);
2079 2079
2080/* 2080/*
2081 * Careful: do_each_thread/while_each_thread is a double loop so 2081 * Careful: do_each_thread/while_each_thread is a double loop so
diff --git a/lib/is_single_threaded.c b/lib/is_single_threaded.c
index 2762516e0a5e..434010980bdf 100644
--- a/lib/is_single_threaded.c
+++ b/lib/is_single_threaded.c
@@ -15,8 +15,9 @@
15/* 15/*
16 * Returns true if the task does not share ->mm with another thread/process. 16 * Returns true if the task does not share ->mm with another thread/process.
17 */ 17 */
18bool is_single_threaded(struct task_struct *task) 18bool current_is_single_threaded(void)
19{ 19{
20 struct task_struct *task = current;
20 struct mm_struct *mm = task->mm; 21 struct mm_struct *mm = task->mm;
21 struct task_struct *p, *t; 22 struct task_struct *p, *t;
22 bool ret; 23 bool ret;
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 276d27882ce8..ed929af466d3 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -702,7 +702,7 @@ long join_session_keyring(const char *name)
702 /* only permit this if there's a single thread in the thread group - 702 /* only permit this if there's a single thread in the thread group -
703 * this avoids us having to adjust the creds on all threads and risking 703 * this avoids us having to adjust the creds on all threads and risking
704 * ENOMEM */ 704 * ENOMEM */
705 if (!is_single_threaded(current)) 705 if (!current_is_single_threaded())
706 return -EMLINK; 706 return -EMLINK;
707 707
708 new = prepare_creds(); 708 new = prepare_creds();
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 2081055f6783..e65677da36bd 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -5187,7 +5187,7 @@ static int selinux_setprocattr(struct task_struct *p,
5187 5187
5188 /* Only allow single threaded processes to change context */ 5188 /* Only allow single threaded processes to change context */
5189 error = -EPERM; 5189 error = -EPERM;
5190 if (!is_single_threaded(p)) { 5190 if (!current_is_single_threaded()) {
5191 error = security_bounded_transition(tsec->sid, sid); 5191 error = security_bounded_transition(tsec->sid, sid);
5192 if (error) 5192 if (error)
5193 goto abort_change; 5193 goto abort_change;