[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20170630123906.8865-4-ebiederm@xmission.com>
Date: Fri, 30 Jun 2017 07:39:02 -0500
From: "Eric W. Biederman" <ebiederm@...ssion.com>
To: linux-kernel@...r.kernel.org
Cc: Andy Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Al Viro <viro@...iv.linux.org.uk>,
Oleg Nesterov <oleg@...hat.com>,
Andrei Vagin <avagin@...tuozzo.com>,
Thomas Gleixner <tglx@...utronix.de>, Greg KH <greg@...ah.com>,
Andrey Vagin <avagin@...nvz.org>,
Serge Hallyn <serge@...lyn.com>,
Pavel Emelyanov <xemul@...tuozzo.com>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Peter Zijlstra <peterz@...radead.org>,
Willy Tarreau <w@....eu>, linux-arch@...r.kernel.org,
linux-api@...r.kernel.org,
Linux Containers <containers@...ts.linux-foundation.org>,
Michael Kerrisk <mtk.manpages@...il.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Thiemo Seufer <ths@...ux-mips.org>,
Ralf Baechle <ralf@...ux-mips.org>
Subject: [PATCH 4/8] signal/mips: Document a conflict with SI_USER with SIGFPE
Setting si_code to __SI_FAULT results in a userspace seeing
an si_code of 0. This is the same si_code as SI_USER. Posix
and common sense requires that SI_USER not be a signal specific
si_code. As such this use of 0 for the si_code is a pretty
horribly broken ABI.
This use of of __SI_FAULT is only a decade old. Which compared
to the other pieces of kernel code that has made this mistake
is almost yesterday.
This is probably worth fixing but I don't know mips well enough
to know what si_code to would be the proper one to use.
Cc: Thiemo Seufer <ths@...ux-mips.org>
Cc: Ralf Baechle <ralf@...ux-mips.org>
Ref: 948a34cf3988 ("[MIPS] Maintain si_code field properly for FP exceptions")
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
arch/mips/include/uapi/asm/siginfo.h | 5 +++++
arch/mips/kernel/traps.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h
index 8069cf766603..0d80df888325 100644
--- a/arch/mips/include/uapi/asm/siginfo.h
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -123,4 +123,9 @@ typedef struct siginfo {
#define SI_TIMER __SI_CODE(__SI_TIMER, -3) /* sent by timer expiration */
#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4) /* sent by real time mesq state change */
+/*
+ * SIGFPE si_codes
+ */
+#define FPE_FIXME (__SI_FAULT|0) /* Broken dup of SI_USER */
+
#endif /* _UAPI_ASM_SIGINFO_H */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 9681b5877140..477dfca99147 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -732,7 +732,7 @@ void force_fcr31_sig(unsigned long fcr31, void __user *fault_addr,
else if (fcr31 & FPU_CSR_INE_X)
si.si_code = FPE_FLTRES;
else
- si.si_code = __SI_FAULT;
+ si.si_code = FPE_FIXME;
force_sig_info(SIGFPE, &si, tsk);
}
--
2.10.1
Powered by blists - more mailing lists