From 08b74a000942a380fe028845f92cd3a0dee827d5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 03:02:38 +0200 Subject: Adding debian version 4.19.249-2. Signed-off-by: Daniel Baumann --- ...activate_mm-by-preempt_-disable-enable-_r.patch | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch (limited to 'debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch') diff --git a/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch b/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch new file mode 100644 index 000000000..f39bdbeba --- /dev/null +++ b/debian/patches-rt/0170-mm-Protect-activate_mm-by-preempt_-disable-enable-_r.patch @@ -0,0 +1,82 @@ +From 67c3a14d6fbac8e692c9e7a999b7fe8d062529bc Mon Sep 17 00:00:00 2001 +From: Yong Zhang +Date: Tue, 15 May 2012 13:53:56 +0800 +Subject: [PATCH 170/347] mm: Protect activate_mm() by + preempt_[disable&enable]_rt() +Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz + +User preempt_*_rt instead of local_irq_*_rt or otherwise there will be +warning on ARM like below: + +WARNING: at build/linux/kernel/smp.c:459 smp_call_function_many+0x98/0x264() +Modules linked in: +[] (unwind_backtrace+0x0/0xe4) from [] (warn_slowpath_common+0x4c/0x64) +[] (warn_slowpath_common+0x4c/0x64) from [] (warn_slowpath_null+0x18/0x1c) +[] (warn_slowpath_null+0x18/0x1c) from [](smp_call_function_many+0x98/0x264) +[] (smp_call_function_many+0x98/0x264) from [] (smp_call_function+0x44/0x6c) +[] (smp_call_function+0x44/0x6c) from [] (__new_context+0xbc/0x124) +[] (__new_context+0xbc/0x124) from [] (flush_old_exec+0x460/0x5e4) +[] (flush_old_exec+0x460/0x5e4) from [] (load_elf_binary+0x2e0/0x11ac) +[] (load_elf_binary+0x2e0/0x11ac) from [] (search_binary_handler+0x94/0x2a4) +[] (search_binary_handler+0x94/0x2a4) from [] (do_execve+0x254/0x364) +[] (do_execve+0x254/0x364) from [] (sys_execve+0x34/0x54) +[] (sys_execve+0x34/0x54) from [] (ret_fast_syscall+0x0/0x30) +---[ end trace 0000000000000002 ]--- + +The reason is that ARM need irq enabled when doing activate_mm(). +According to mm-protect-activate-switch-mm.patch, actually +preempt_[disable|enable]_rt() is sufficient. + +Inspired-by: Steven Rostedt +Signed-off-by: Yong Zhang +Cc: Steven Rostedt +Link: http://lkml.kernel.org/r/1337061236-1766-1-git-send-email-yong.zhang0@gmail.com +Signed-off-by: Thomas Gleixner +--- + fs/exec.c | 2 ++ + mm/mmu_context.c | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/fs/exec.c b/fs/exec.c +index 28e3b5eb2f4a..2c15772a1feb 100644 +--- a/fs/exec.c ++++ b/fs/exec.c +@@ -1028,6 +1028,7 @@ static int exec_mmap(struct mm_struct *mm) + } + } + task_lock(tsk); ++ preempt_disable_rt(); + + local_irq_disable(); + active_mm = tsk->active_mm; +@@ -1047,6 +1048,7 @@ static int exec_mmap(struct mm_struct *mm) + local_irq_enable(); + tsk->mm->vmacache_seqnum = 0; + vmacache_flush(tsk); ++ preempt_enable_rt(); + task_unlock(tsk); + if (old_mm) { + up_read(&old_mm->mmap_sem); +diff --git a/mm/mmu_context.c b/mm/mmu_context.c +index 3e612ae748e9..d0ccc070979f 100644 +--- a/mm/mmu_context.c ++++ b/mm/mmu_context.c +@@ -25,6 +25,7 @@ void use_mm(struct mm_struct *mm) + struct task_struct *tsk = current; + + task_lock(tsk); ++ preempt_disable_rt(); + active_mm = tsk->active_mm; + if (active_mm != mm) { + mmgrab(mm); +@@ -32,6 +33,7 @@ void use_mm(struct mm_struct *mm) + } + tsk->mm = mm; + switch_mm(active_mm, mm, tsk); ++ preempt_enable_rt(); + task_unlock(tsk); + #ifdef finish_arch_post_lock_switch + finish_arch_post_lock_switch(); +-- +2.36.1 + -- cgit v1.2.3