Skip to contentSkip to conversation

Patch "MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)" has been added to the 4.6-stable tree

PATCH [email protected] 1 participant 1 message Jun 4, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)

to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-disable-preemption-during-prctl-pr_set_fp_mode.patch
and it can be found in the queue-4.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From bd239f1e1429e7781096bf3884bdb1b2b1bb4f28 Mon Sep 17 00:00:00 2001

From: Paul Burton <[email protected]>
Date: Thu, 21 Apr 2016 12:43:57 +0100
Subject: MIPS: Disable preemption during prctl(PR_SET_FP_MODE, ...)

From: Paul Burton <[email protected]>

commit bd239f1e1429e7781096bf3884bdb1b2b1bb4f28 upstream.

Whilst a PR_SET_FP_MODE prctl is performed there are decisions made based upon whether the task is executing on the current CPU. This may change if we're preempted, so disable preemption to avoid such changes for the lifetime of the mode switch.

Fixes 9791554b45a2 ("MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS")
Cc Adam Buchbinder <[email protected]>
Cc James Hogan <[email protected]>

Patchwork: https://patchwork.linux-mips.org/patch/13144/

---
 arch/mips/kernel/process.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/mips/kernel/process.c +4 -0
@@ -609,6 +609,9 @@ int mips_set_process_fp_mode(struct task
 	if (!(value & PR_FP_MODE_FR) && cpu_has_fpu && cpu_has_mips_r6)
 		return -EOPNOTSUPP;
 
+	/* Proceed with the mode switch */
+	preempt_disable();
+
 	/* Save FP & vector context, then disable FPU & MSA */
 	if (task->signal == current->signal)
 		lose_fpu(1);
@@ -653,6 +656,7 @@ int mips_set_process_fp_mode(struct task
 
 	/* Allow threads to use FP again */
 	atomic_set(&task->mm->context.fp_mode_switching, 0);
+	preempt_enable();
 
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.6/mips-disable-preemption-during-prctl-pr_set_fp_mode.patch queue-4.6/mips-fix-sigreturn-via-vdso-on-micromips-kernel.patch queue-4.6/mips-force-cpus-to-lose-fp-context-during-mode-switches.patch queue-4.6/mips-handle-highmem-pages-in-__update_cache.patch queue-4.6/mips-fix-watchpoint-restoration.patch queue-4.6/mips-build-micromips-vdso-for-micromips-kernels.patch queue-4.6/mips-math-emu-fix-jalr-emulation-when-rd-0.patch queue-4.6/mips-sync-icache-dcache-in-set_pte_at.patch queue-4.6/mips-fix-msa-ld_-st_-asm-macros-to-use-ptr_addu.patch queue-4.6/mips-prevent-restoration-of-msa-context-in-non-msa-kernels.patch queue-4.6/mips-use-copy_s.fmt-rather-than-copy_u.fmt.patch