OSDN Git Service

openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI
authorStafford Horne <shorne@gmail.com>
Wed, 28 Jun 2023 16:54:40 +0000 (17:54 +0100)
committerStafford Horne <shorne@gmail.com>
Mon, 10 Jul 2023 21:03:26 +0000 (22:03 +0100)
commitdceaafd668812115037fc13a1893d068b7b880f5
treec86ff80abbd5c25188a044278116f4f66e600937
parent45a3e24f65e90a047bef86f927ebdc4c710edaa1
openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI

With commit 27267655c531 ("openrisc: Support floating point user api") I
added an entry to the struct sigcontext which caused an unwanted change
to the userspace ABI.

To fix this we use the previously unused oldmask field space for the
floating point fpcsr state.  We do this with a union to restore the ABI
back to the pre kernel v6.4 ABI and keep API compatibility.

This does mean if there is some code somewhere that is setting oldmask
in an OpenRISC specific userspace sighandler it would end up setting the
floating point register status, but I think it's unlikely as oldmask was
never functional before.

Fixes: 27267655c531 ("openrisc: Support floating point user api")
Reported-by: Szabolcs Nagy <nsz@port70.net>
Closes: https://lore.kernel.org/openrisc/20230626213840.GA1236108@port70.net/
Signed-off-by: Stafford Horne <shorne@gmail.com>
arch/openrisc/include/uapi/asm/sigcontext.h
arch/openrisc/kernel/signal.c