lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 14 Aug 2019 11:41:27 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     linux-kernel@...r.kernel.org
Cc:     ak@...ux.intel.com, akpm@...ux-foundation.org,
        bigeasy@...utronix.de, bp@...e.de, catalin.marinas@....com,
        davem@...emloft.net, hch@....de, kan.liang@...el.com,
        mark.rutland@....com, mingo@...nel.org, peterz@...radead.org,
        riel@...riel.com, will@...nel.org
Subject: [PATCH 5/9] arm64: correctly check for ktrheads

Since commit:

  6eb6c80187c55b7f ("arm64: kernel thread don't need to save fpsimd context.")

... we skip saving the fpsimd state for kernel threads in
arch_dup_task_struct(). We determine whether current is a kthread by
looking at current->mm.

In general, a non-NULL current->mm doesn't imply that current is a
kthread, as kthreads can install an mm via use_mm(), and so it's
preferable to use is_kthread() to determine whether a thread is a
kthread.

For consistency, let's use is_kthread() here.

Signed-off-by: Mark Rutland <mark.rutland@....com>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will@...nel.org>
---
 arch/arm64/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 288012687c29..82b0a7a257cd 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -335,7 +335,7 @@ void arch_release_task_struct(struct task_struct *tsk)
  */
 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
-	if (current->mm)
+	if (!is_kthread(current))
 		fpsimd_preserve_current_state();
 	*dst = *src;
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ