public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [tip:sched/core] sched/core: Fix unserialized r-m-w scribbling stuff
       [not found] <20151125150207.GM11639@twins.programming.kicks-ass.net>
@ 2016-01-06 18:48 ` tip-bot for Peter Zijlstra
  2016-01-06 20:17   ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: tip-bot for Peter Zijlstra @ 2016-01-06 18:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, tj, hpa, sasha.levin, torvalds, mingo, peterz, dvyukov,
	linux-kernel

Commit-ID:  be958bdc96f18bc1356177bbb79d46ea0c037b96
Gitweb:     http://git.kernel.org/tip/be958bdc96f18bc1356177bbb79d46ea0c037b96
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 25 Nov 2015 16:02:07 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 6 Jan 2016 11:01:07 +0100

sched/core: Fix unserialized r-m-w scribbling stuff

Some of the sched bitfieds (notably sched_reset_on_fork) can be set
on other than current, this can cause the r-m-w to race with other
updates.

Since all the sched bits are serialized by scheduler locks, pull them
in a separate word.

Reported-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: akpm@linux-foundation.org
Cc: hannes@cmpxchg.org
Cc: mhocko@kernel.org
Cc: vdavydov@parallels.com
Link: http://lkml.kernel.org/r/20151125150207.GM11639@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/sched.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9cf9dd1..fa39434 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1455,14 +1455,15 @@ struct task_struct {
 	/* Used for emulating ABI behavior of previous Linux versions */
 	unsigned int personality;
 
-	unsigned in_execve:1;	/* Tell the LSMs that the process is doing an
-				 * execve */
-	unsigned in_iowait:1;
-
-	/* Revert to default priority/policy when forking */
+	/* scheduler bits, serialized by scheduler locks */
 	unsigned sched_reset_on_fork:1;
 	unsigned sched_contributes_to_load:1;
 	unsigned sched_migrated:1;
+	unsigned :0; /* force alignment to the next boundary */
+
+	/* unserialized, strictly 'current' */
+	unsigned in_execve:1; /* bit to tell LSMs we're in execve */
+	unsigned in_iowait:1;
 #ifdef CONFIG_MEMCG
 	unsigned memcg_may_oom:1;
 #endif

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [tip:sched/core] sched/core: Fix unserialized r-m-w scribbling stuff
  2016-01-06 18:48 ` [tip:sched/core] sched/core: Fix unserialized r-m-w scribbling stuff tip-bot for Peter Zijlstra
@ 2016-01-06 20:17   ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2016-01-06 20:17 UTC (permalink / raw)
  To: linux-kernel, dvyukov, mingo, peterz, sasha.levin, torvalds, hpa,
	tglx
  Cc: linux-tip-commits

On Wed, Jan 06, 2016 at 10:48:15AM -0800, tip-bot for Peter Zijlstra wrote:
> Commit-ID:  be958bdc96f18bc1356177bbb79d46ea0c037b96
> Gitweb:     http://git.kernel.org/tip/be958bdc96f18bc1356177bbb79d46ea0c037b96
> Author:     Peter Zijlstra <peterz@infradead.org>
> AuthorDate: Wed, 25 Nov 2015 16:02:07 +0100
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Wed, 6 Jan 2016 11:01:07 +0100
> 
> sched/core: Fix unserialized r-m-w scribbling stuff
> 
> Some of the sched bitfieds (notably sched_reset_on_fork) can be set
> on other than current, this can cause the r-m-w to race with other
> updates.
> 
> Since all the sched bits are serialized by scheduler locks, pull them
> in a separate word.
> 
> Reported-by: Tejun Heo <tj@kernel.org>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: akpm@linux-foundation.org
> Cc: hannes@cmpxchg.org
> Cc: mhocko@kernel.org
> Cc: vdavydov@parallels.com
> Link: http://lkml.kernel.org/r/20151125150207.GM11639@twins.programming.kicks-ass.net
> Signed-off-by: Ingo Molnar <mingo@kernel.org>

cc stable?

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-06 20:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20151125150207.GM11639@twins.programming.kicks-ass.net>
2016-01-06 18:48 ` [tip:sched/core] sched/core: Fix unserialized r-m-w scribbling stuff tip-bot for Peter Zijlstra
2016-01-06 20:17   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox