1ff8560ac9
Fix CMP.Sxxx.<D|S> SIGILL crashes by fixing main switch/case statement in fpu_emul() function so that inadvertent fall-troughs are prevented. Consider, let's say, CMP.SAF.S instruction when one of inputs is zero and another input is a signaling NaN. The desired output is zero, and the exception flag "invalid operation" set. For such case, the main portion of the implementation is within "d_fmt" case of the main "switch/case" statement in fpu_emul() function. The execution will follow one of "if-else" branches that doesn't contain "goto cop1scr;" statement, and will therefore reach the end of "d_fmt" case. It will subsequently fall through to the next case, "l_fmt". After following similar pattern, the execution will fall through to the succeeding case, which is "default". The "default" case contains "return SIGILL;" statement only. This means that the caller application will crash with "illegal instruction" message. It is obvious that above described fall-throughs are unnecessary and harmful. This patch rectifies that behavior by providing "break;" statements at the end of cases "d_fmt" and "l_fmt". There are 22 instructions affected by this problem: CMP.<SAF|SEQ|SLE|SLT|SNE|SOR|SUEQ|SULE|SULT|SUN|SUNE>.<D|S>. Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Cc: Douglas Leung <douglas.leung@imgtec.com> Cc: James Hogan <james.hogan@imgtec.com> Cc: Maciej W. Rozycki <macro@imgtec.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Petar Jovanovic <petar.jovanovic@imgtec.com> Cc: Raghu Gandham <raghu.gandham@imgtec.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/17140/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> |
||
---|---|---|
.. | ||
cp1emu.c | ||
dp_2008class.c | ||
dp_add.c | ||
dp_cmp.c | ||
dp_div.c | ||
dp_fint.c | ||
dp_flong.c | ||
dp_fmax.c | ||
dp_fmin.c | ||
dp_fsp.c | ||
dp_maddf.c | ||
dp_mul.c | ||
dp_simple.c | ||
dp_sqrt.c | ||
dp_sub.c | ||
dp_tint.c | ||
dp_tlong.c | ||
dsemul.c | ||
ieee754.c | ||
ieee754.h | ||
ieee754d.c | ||
ieee754dp.c | ||
ieee754dp.h | ||
ieee754int.h | ||
ieee754sp.c | ||
ieee754sp.h | ||
Makefile | ||
me-debugfs.c | ||
sp_2008class.c | ||
sp_add.c | ||
sp_cmp.c | ||
sp_div.c | ||
sp_fdp.c | ||
sp_fint.c | ||
sp_flong.c | ||
sp_fmax.c | ||
sp_fmin.c | ||
sp_maddf.c | ||
sp_mul.c | ||
sp_simple.c | ||
sp_sqrt.c | ||
sp_sub.c | ||
sp_tint.c | ||
sp_tlong.c |