linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RT 0/3] Linux v4.19.152-rt66-rc1
@ 2020-11-17 17:19 zanussi
  2020-11-17 17:19 ` [PATCH RT 1/3] mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state() zanussi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zanussi @ 2020-11-17 17:19 UTC (permalink / raw)
  To: LKML, linux-rt-users, Steven Rostedt, Thomas Gleixner,
	Carsten Emde, John Kacur, Sebastian Andrzej Siewior,
	Daniel Wagner, Clark Williams, Pavel Machek, Tom Zanussi

From: Tom Zanussi <zanussi@kernel.org>

Dear RT Folks,

This is the RT stable review cycle of patch 4.19.152-rt66-rc1.

Please scream at me if I messed something up. Please test the patches
too.

The -rc release will be uploaded to kernel.org and will be deleted
when the final release is out. This is just a review release (or
release candidate).

The pre-releases will not be pushed to the git repository, only the
final release is.

If all goes well, this patch will be converted to the next main
release on 2020-11-20.

To build 4.19.152-rt66-rc1 directly, the following patches should be applied:

  https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.19.tar.xz

  https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.19.152.xz

  https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/patch-4.19.152-rt66-rc1.patch.xz

You can also build from 4.19.152-rt65 by applying the incremental patch:

  https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/incr/patch-4.19.152-rt65-rt66-rc1.patch.xz


Enjoy,

-- Tom


Oleg Nesterov (1):
  ptrace: fix ptrace_unfreeze_traced() race with rt-lock

Sebastian Andrzej Siewior (1):
  mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state()

Tom Zanussi (1):
  Linux 4.19.152-rt66-rc1

 include/linux/memcontrol.h |  2 ++
 kernel/ptrace.c            | 23 +++++++++++++++--------
 localversion-rt            |  2 +-
 3 files changed, 18 insertions(+), 9 deletions(-)

-- 
2.17.1


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

* [PATCH RT 1/3] mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state()
  2020-11-17 17:19 [PATCH RT 0/3] Linux v4.19.152-rt66-rc1 zanussi
@ 2020-11-17 17:19 ` zanussi
  2020-11-17 17:19 ` [PATCH RT 2/3] ptrace: fix ptrace_unfreeze_traced() race with rt-lock zanussi
  2020-11-17 17:19 ` [PATCH RT 3/3] Linux 4.19.152-rt66-rc1 zanussi
  2 siblings, 0 replies; 4+ messages in thread
From: zanussi @ 2020-11-17 17:19 UTC (permalink / raw)
  To: LKML, linux-rt-users, Steven Rostedt, Thomas Gleixner,
	Carsten Emde, John Kacur, Sebastian Andrzej Siewior,
	Daniel Wagner, Clark Williams, Pavel Machek, Tom Zanussi
  Cc: stable-rt

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

v4.19.152-rt66-rc1 stable review patch.
If anyone has any objections, please let me know.

-----------


[ Upstream commit 74858f0d38a8d3c069a0745ff53ae084c8e7cabb ]

The callers expect disabled preemption/interrupts while invoking
__mod_memcg_lruvec_state(). This works mainline because a lock of
somekind is acquired.

Use preempt_disable_rt() where per-CPU variables are accessed and a
stable pointer is expected. This is also done in __mod_zone_page_state()
for the same reason.

Cc: stable-rt@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>

 Conflicts:
	mm/memcontrol.c
---
 include/linux/memcontrol.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index cc6b6532eb56..dbb2c4e27277 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -665,6 +665,7 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec,
 
 	pn = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
 
+	preempt_disable_rt();
 	/* Update memcg */
 	__mod_memcg_state(pn->memcg, idx, val);
 
@@ -675,6 +676,7 @@ static inline void __mod_lruvec_state(struct lruvec *lruvec,
 		x = 0;
 	}
 	__this_cpu_write(pn->lruvec_stat_cpu->count[idx], x);
+	preempt_enable_rt();
 }
 
 static inline void mod_lruvec_state(struct lruvec *lruvec,
-- 
2.17.1


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

* [PATCH RT 2/3] ptrace: fix ptrace_unfreeze_traced() race with rt-lock
  2020-11-17 17:19 [PATCH RT 0/3] Linux v4.19.152-rt66-rc1 zanussi
  2020-11-17 17:19 ` [PATCH RT 1/3] mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state() zanussi
@ 2020-11-17 17:19 ` zanussi
  2020-11-17 17:19 ` [PATCH RT 3/3] Linux 4.19.152-rt66-rc1 zanussi
  2 siblings, 0 replies; 4+ messages in thread
From: zanussi @ 2020-11-17 17:19 UTC (permalink / raw)
  To: LKML, linux-rt-users, Steven Rostedt, Thomas Gleixner,
	Carsten Emde, John Kacur, Sebastian Andrzej Siewior,
	Daniel Wagner, Clark Williams, Pavel Machek, Tom Zanussi
  Cc: Oleg Nesterov, stable-rt

From: Oleg Nesterov <oleg@redhat.com>

v4.19.152-rt66-rc1 stable review patch.
If anyone has any objections, please let me know.

-----------


[ Upstream commit 0fdc91971b34cf6857b4cfd8c322ae936cfc189b ]

The patch "ptrace: fix ptrace vs tasklist_lock race" changed
ptrace_freeze_traced() to take task->saved_state into account, but
ptrace_unfreeze_traced() has the same problem and needs a similar fix:
it should check/update both ->state and ->saved_state.

Reported-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Fixes: "ptrace: fix ptrace vs tasklist_lock race"
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: stable-rt@vger.kernel.org
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
---
 kernel/ptrace.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index a38b304fb9fd..cbefb0234be3 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -191,8 +191,8 @@ static bool ptrace_freeze_traced(struct task_struct *task)
 
 static void ptrace_unfreeze_traced(struct task_struct *task)
 {
-	if (task->state != __TASK_TRACED)
-		return;
+	unsigned long flags;
+	bool frozen = true;
 
 	WARN_ON(!task->ptrace || task->parent != current);
 
@@ -201,12 +201,19 @@ static void ptrace_unfreeze_traced(struct task_struct *task)
 	 * Recheck state under the lock to close this race.
 	 */
 	spin_lock_irq(&task->sighand->siglock);
-	if (task->state == __TASK_TRACED) {
-		if (__fatal_signal_pending(task))
-			wake_up_state(task, __TASK_TRACED);
-		else
-			task->state = TASK_TRACED;
-	}
+
+	raw_spin_lock_irqsave(&task->pi_lock, flags);
+	if (task->state == __TASK_TRACED)
+		task->state = TASK_TRACED;
+	else if (task->saved_state == __TASK_TRACED)
+		task->saved_state = TASK_TRACED;
+	else
+		frozen = false;
+	raw_spin_unlock_irqrestore(&task->pi_lock, flags);
+
+	if (frozen && __fatal_signal_pending(task))
+		wake_up_state(task, __TASK_TRACED);
+
 	spin_unlock_irq(&task->sighand->siglock);
 }
 
-- 
2.17.1


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

* [PATCH RT 3/3] Linux 4.19.152-rt66-rc1
  2020-11-17 17:19 [PATCH RT 0/3] Linux v4.19.152-rt66-rc1 zanussi
  2020-11-17 17:19 ` [PATCH RT 1/3] mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state() zanussi
  2020-11-17 17:19 ` [PATCH RT 2/3] ptrace: fix ptrace_unfreeze_traced() race with rt-lock zanussi
@ 2020-11-17 17:19 ` zanussi
  2 siblings, 0 replies; 4+ messages in thread
From: zanussi @ 2020-11-17 17:19 UTC (permalink / raw)
  To: LKML, linux-rt-users, Steven Rostedt, Thomas Gleixner,
	Carsten Emde, John Kacur, Sebastian Andrzej Siewior,
	Daniel Wagner, Clark Williams, Pavel Machek, Tom Zanussi

From: Tom Zanussi <zanussi@kernel.org>

v4.19.152-rt66-rc1 stable review patch.
If anyone has any objections, please let me know.

-----------


Signed-off-by: Tom Zanussi <zanussi@kernel.org>
---
 localversion-rt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/localversion-rt b/localversion-rt
index e2eb19782d4c..8def1daec031 100644
--- a/localversion-rt
+++ b/localversion-rt
@@ -1 +1 @@
--rt65
+-rt66-rc1
-- 
2.17.1


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

end of thread, other threads:[~2020-11-17 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 17:19 [PATCH RT 0/3] Linux v4.19.152-rt66-rc1 zanussi
2020-11-17 17:19 ` [PATCH RT 1/3] mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state() zanussi
2020-11-17 17:19 ` [PATCH RT 2/3] ptrace: fix ptrace_unfreeze_traced() race with rt-lock zanussi
2020-11-17 17:19 ` [PATCH RT 3/3] Linux 4.19.152-rt66-rc1 zanussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).