Skip to contentSkip to conversation

Linux v4.19.152-rt66-rc1

PATCH New [email protected] 1 participant 4 messages Nov 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Linux v4.19.152-rt66-rc1

From: Tom Zanussi <[email protected]>

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(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 mm/memcontrol: Disable preemption in __mod_memcg_lruvec_state()

From: Sebastian Andrzej Siewior <[email protected]>

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.

Conflicts:
mm/memcontrol.c

---
 include/linux/memcontrol.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/memcontrol.h +2 -0
index cc6b6532eb56..dbb2c4e27277 100644
@@ -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,
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 ptrace: fix ptrace_unfreeze_traced() race with rt-lock

In reply to [email protected]

From: Oleg Nesterov <[email protected]>

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.

---
 kernel/ptrace.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
kernel/ptrace.c +15 -8
index a38b304fb9fd..cbefb0234be3 100644
@@ -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);
 }
 
Signature · 1 line
2.17.1