linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] arm64: Fix invalid si_codes for fault signals
@ 2018-01-22 12:23 Dave Martin
  2018-01-22 12:23 ` [RFC PATCH 1/2] arm64: fpsimd: Fix bad si_code for undiagnosed SIGFPE Dave Martin
       [not found] ` <1516623798-25001-1-git-send-email-Dave.Martin-5wv7dgnIgG8@public.gmane.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Dave Martin @ 2018-01-22 12:23 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-api-u79uwXL29TY76Z2rM5mHXA, Eric W. Biederman, Will Deacon,
	Catalin Marinas, Russell King

As reported by Eric Biederman, [1], [2], [3] etc., several architectures
are inappropriately setting si_code to 0 when signaling faults to
userspace, which will interpret this value as SI_USER leading to garbage
being read out of siginfo fields that the kernel doesn't initialise.

This seems not to be a huge problem in practice, since many affected
faults should only happen if the kernel or hardware is buggy or broken.
However, there are some cases that don't fall under this.

This RFC series proposes fixes to eliminate these si_code == 0 cases
from arm64.  Some of the changes may be controversial.

There are two main headlines here, which may be applicable to other
architectures:

 * addition of a new code FPE_UNKNOWN for undiagnosable floating-point
   exception traps;

 * delivering SIGKILL instead of SIGSEGV/BUS/TRAP etc. for "impossible"
   exceptions that are not feasible to recover from and likely indicate
   a kernel or system bug or failure.

In particular there is likely to be a fair amount of overlap between arm
and arm64 here, but due to the longer history and evolution of the arm
tree and 32-bit architecture I'm less confident in making correct
judgements for that case.  This series doesn't touch arm, for now.

This series has been build-tested only.

[1] [PATCH 00/11] siginfo fixes/cleanups esp SI_USER
https://marc.info/?l=linux-kernel&m=151571871109016&w=2

[2] [PATCH 08/11] signal/arm: Document conflicts with SI_USER and SIGFPE
http://lists.infradead.org/pipermail/linux-arm-kernel/2018-January/553574.html

[3] [PATCH 07/11] signal/arm64: Document conflicts with SI_USER and SIGFPE, SIGTRAP, SIGBUS
lists.infradead.org/pipermail/linux-arm-kernel/2018-January/553573.html

Dave Martin (2):
  arm64: fpsimd: Fix bad si_code for undiagnosed SIGFPE
  arm64: signal: Ensure si_code is valid for all fault signals

 arch/arm64/include/asm/esr.h       |   9 +++
 arch/arm64/kernel/fpsimd.c         |  31 +++++-----
 arch/arm64/mm/fault.c              | 114 ++++++++++++++++++-------------------
 include/uapi/asm-generic/siginfo.h |   3 +-
 4 files changed, 85 insertions(+), 72 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-01-24 17:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 12:23 [RFC PATCH 0/2] arm64: Fix invalid si_codes for fault signals Dave Martin
2018-01-22 12:23 ` [RFC PATCH 1/2] arm64: fpsimd: Fix bad si_code for undiagnosed SIGFPE Dave Martin
2018-01-22 21:13   ` Eric W. Biederman
2018-01-23 10:14     ` Dave Martin
     [not found]       ` <20180123101446.GP22781-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2018-01-23 18:27         ` Eric W. Biederman
     [not found]           ` <87tvvc77nf.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-01-23 18:29             ` David Miller
2018-01-23 19:44               ` Eric W. Biederman
     [not found]                 ` <87lggo7430.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-01-24  9:53                   ` Dave Martin
     [not found]     ` <878tcp8umz.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-01-24 10:57       ` Dave Martin
     [not found]         ` <20180124105704.GD5862-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2018-01-24 16:47           ` Eric W. Biederman
2018-01-24 17:12             ` Dave Martin
2018-01-24 17:17               ` Eric W. Biederman
     [not found] ` <1516623798-25001-1-git-send-email-Dave.Martin-5wv7dgnIgG8@public.gmane.org>
2018-01-22 12:23   ` [RFC PATCH 2/2] arm64: signal: Ensure si_code is valid for all fault signals Dave Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).