All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] arm64: Fix invalid si_codes for fault signals
@ 2018-03-01 17:44 ` Dave Martin
  0 siblings, 0 replies; 41+ messages in thread
From: Dave Martin @ 2018-03-01 17:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-arch, linux-api, Will Deacon, James Morse,
	Eric W. Biederman, Catalin Marinas

Changes since v1:

 * Fixed failing BUILD_BUG_ON() sanity check on NSIGFPE done by x86.
   (Thanks to James Morse for spotting.)

   The addition of FPE_FLTUNK is harmless to x86, since only arm64
   uses this code right now.

Changes since RFC v2:

 * Fold in reverts of the relevant parts of Eric's *_FIXME changes,
   since this series removes all cases of those dummy si_code values
   from arm64.

 * Propagated the new signal/si_code assignments for synchronous
   external aborts correctly to signals thrown from do_sea().

Original blurb:

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.

Boot-tested on Arm Juno r0.
Floating-point exception traps tested on the Arm Fast Model.

[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 (3):
  signal: Add FPE_FLTUNK si_code for undiagnosable fp exceptions
  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/include/uapi/asm/siginfo.h |  21 ------
 arch/arm64/kernel/fpsimd.c            |  31 +++++----
 arch/arm64/mm/fault.c                 | 116 +++++++++++++++++-----------------
 arch/x86/kernel/signal_compat.c       |   2 +-
 include/uapi/asm-generic/siginfo.h    |   3 +-
 kernel/signal.c                       |   4 --
 7 files changed, 87 insertions(+), 99 deletions(-)

-- 
2.1.4

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

end of thread, other threads:[~2018-03-20 10:04 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 17:44 [PATCH v2 0/3] arm64: Fix invalid si_codes for fault signals Dave Martin
2018-03-01 17:44 ` Dave Martin
2018-03-01 17:44 ` Dave Martin
2018-03-01 17:44 ` [PATCH v2 1/3] signal: Add FPE_FLTUNK si_code for undiagnosable fp exceptions Dave Martin
2018-03-01 17:44   ` Dave Martin
2018-03-01 17:44   ` Dave Martin
2018-03-08 17:11   ` Will Deacon
2018-03-08 17:11     ` Will Deacon
2018-03-08 22:35   ` Eric W. Biederman
2018-03-08 22:35     ` Eric W. Biederman
2018-03-08 22:35     ` Eric W. Biederman
2018-03-01 17:44 ` [PATCH v2 2/3] arm64: fpsimd: Fix bad si_code for undiagnosed SIGFPE Dave Martin
2018-03-01 17:44   ` Dave Martin
2018-03-01 17:44   ` Dave Martin
2018-03-08 17:11   ` Will Deacon
2018-03-08 17:11     ` Will Deacon
2018-03-08 17:11     ` Will Deacon
2018-03-08 22:40     ` Eric W. Biederman
2018-03-08 22:40       ` Eric W. Biederman
2018-03-08 22:40       ` Eric W. Biederman
2018-03-09 13:10       ` Will Deacon
2018-03-09 13:10         ` Will Deacon
2018-03-09 13:10         ` Will Deacon
2018-03-09 14:25         ` Dave Martin
2018-03-09 14:25           ` Dave Martin
2018-03-09 14:25           ` Dave Martin
2018-03-15 21:13           ` Eric W. Biederman
2018-03-15 21:13             ` Eric W. Biederman
2018-03-15 21:13             ` Eric W. Biederman
2018-03-20 10:04             ` Will Deacon
2018-03-20 10:04               ` Will Deacon
2018-03-20 10:04               ` Will Deacon
2018-03-08 22:37   ` Eric W. Biederman
2018-03-08 22:37     ` Eric W. Biederman
2018-03-08 22:37     ` Eric W. Biederman
2018-03-01 17:44 ` [PATCH v2 3/3] arm64: signal: Ensure si_code is valid for all fault signals Dave Martin
2018-03-01 17:44   ` Dave Martin
2018-03-01 17:44   ` Dave Martin
2018-03-08 16:37   ` Will Deacon
2018-03-08 16:37     ` Will Deacon
2018-03-08 16:37     ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.