Skip to content

Commit

Permalink
MIPS: fix EVA & non-SMP non-FPU FP context signal handling
Browse files Browse the repository at this point in the history
The save_fp_context & restore_fp_context pointers were being assigned
to the wrong variables if either:

  - The kernel is configured for UP & runs on a system without an FPU,
    since b2ead52 "MIPS: Move & rename
    fpu_emulator_{save,restore}_context".

  - The kernel is configured for EVA, since ca75064 "MIPS: kernel:
    signal: Prevent save/restore FPU context in user memory".

This would lead to FP context being clobbered incorrectly when setting
up a sigcontext, then the garbage values being saved uselessly when
returning from the signal.

Fix by swapping the pointer assignments appropriately.

Signed-off-by: Paul Burton <[email protected]>
Cc: [email protected] # v3.15+
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/8230/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
paulburton authored and ralfbaechle committed Nov 24, 2014
1 parent cf0a8aa commit 14fa12d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/mips/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,13 +658,13 @@ static int signal_setup(void)
save_fp_context = _save_fp_context;
restore_fp_context = _restore_fp_context;
} else {
save_fp_context = copy_fp_from_sigcontext;
restore_fp_context = copy_fp_to_sigcontext;
save_fp_context = copy_fp_to_sigcontext;
restore_fp_context = copy_fp_from_sigcontext;
}
#endif /* CONFIG_SMP */
#else
save_fp_context = copy_fp_from_sigcontext;;
restore_fp_context = copy_fp_to_sigcontext;
save_fp_context = copy_fp_to_sigcontext;
restore_fp_context = copy_fp_from_sigcontext;
#endif

return 0;
Expand Down

0 comments on commit 14fa12d

Please sign in to comment.