Re: [PATCH v4 04/14] arm64: Kill 32-bit applications scheduled on 64-bit-only CPUs
From: Qais Yousef <hidden>
Date: 2020-11-27 13:12:39
Also in:
linux-arm-kernel, lkml
From: Qais Yousef <hidden>
Date: 2020-11-27 13:12:39
Also in:
linux-arm-kernel, lkml
On 11/24/20 15:50, Will Deacon wrote:
Scheduling a 32-bit application on a 64-bit-only CPU is a bad idea. Ensure that 32-bit applications always take the slow-path when returning to userspace on a system with mismatched support at EL0, so that we can avoid trying to run on a 64-bit-only CPU and force a SIGKILL instead. Signed-off-by: Will Deacon <will@kernel.org> ---
nit: We drop this patch at the end. Can't we avoid it altogether instead? [...]
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index a8184cad8890..bcb6ca2d9a7c 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c@@ -911,6 +911,19 @@ static void do_signal(struct pt_regs *regs) restore_saved_sigmask(); } +static bool cpu_affinity_invalid(struct pt_regs *regs) +{ + if (!compat_user_mode(regs)) + return false;
Silly question. Is there an advantage of using compat_user_mode() vs is_compat_task()? I see the latter used in the file although struct pt_regs *regs is passed to the functions calling it. Nothing's wrong with it, just curious. Thanks -- Qais Yousef
+ + /* + * We're preemptible, but a reschedule will cause us to check the + * affinity again. + */ + return !cpumask_test_cpu(raw_smp_processor_id(), + system_32bit_el0_cpumask()); +}