Patch "openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI

to the 6.4-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:
     openrisc-union-fpcsr-and-oldmask-in-sigcontext-to-un.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 696ca48d335bae7910f2e1abae3078b90a63c6aa
Author: Stafford Horne <shorne@xxxxxxxxx>
Date:   Wed Jun 28 17:54:40 2023 +0100

    openrisc: Union fpcsr and oldmask in sigcontext to unbreak userspace ABI
    
    [ Upstream commit dceaafd668812115037fc13a1893d068b7b880f5 ]
    
    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@xxxxxxxxxx>
    Closes: https://lore.kernel.org/openrisc/20230626213840.GA1236108@xxxxxxxxxx/
    Signed-off-by: Stafford Horne <shorne@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/openrisc/include/uapi/asm/sigcontext.h b/arch/openrisc/include/uapi/asm/sigcontext.h
index ca585e4af6b8e..e7ffb58ff58fb 100644
--- a/arch/openrisc/include/uapi/asm/sigcontext.h
+++ b/arch/openrisc/include/uapi/asm/sigcontext.h
@@ -28,8 +28,10 @@
 
 struct sigcontext {
 	struct user_regs_struct regs;  /* needs to be first */
-	struct __or1k_fpu_state fpu;
-	unsigned long oldmask;
+	union {
+		unsigned long fpcsr;
+		unsigned long oldmask;	/* unused */
+	};
 };
 
 #endif /* __ASM_OPENRISC_SIGCONTEXT_H */
diff --git a/arch/openrisc/kernel/signal.c b/arch/openrisc/kernel/signal.c
index 4664a18f0787d..2e7257a433ff4 100644
--- a/arch/openrisc/kernel/signal.c
+++ b/arch/openrisc/kernel/signal.c
@@ -50,7 +50,7 @@ static int restore_sigcontext(struct pt_regs *regs,
 	err |= __copy_from_user(regs, sc->regs.gpr, 32 * sizeof(unsigned long));
 	err |= __copy_from_user(&regs->pc, &sc->regs.pc, sizeof(unsigned long));
 	err |= __copy_from_user(&regs->sr, &sc->regs.sr, sizeof(unsigned long));
-	err |= __copy_from_user(&regs->fpcsr, &sc->fpu.fpcsr, sizeof(unsigned long));
+	err |= __copy_from_user(&regs->fpcsr, &sc->fpcsr, sizeof(unsigned long));
 
 	/* make sure the SM-bit is cleared so user-mode cannot fool us */
 	regs->sr &= ~SPR_SR_SM;
@@ -113,7 +113,7 @@ static int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
 	err |= __copy_to_user(sc->regs.gpr, regs, 32 * sizeof(unsigned long));
 	err |= __copy_to_user(&sc->regs.pc, &regs->pc, sizeof(unsigned long));
 	err |= __copy_to_user(&sc->regs.sr, &regs->sr, sizeof(unsigned long));
-	err |= __copy_to_user(&sc->fpu.fpcsr, &regs->fpcsr, sizeof(unsigned long));
+	err |= __copy_to_user(&sc->fpcsr, &regs->fpcsr, sizeof(unsigned long));
 
 	return err;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux