Skip to content

RFC Fix machine check recovery for copy_from_user

Tony Luck linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4x86/mce: Fix copyin code to return -EFAULT on machine check.arch/x86/lib/copy_user_64.S+11 -71 reply
2/4mce/iter: Check for copyin failure & return error up stackfs/iomap/buffered-io.c include/linux/uio.h lib/iov_iter.c+21 -40 replies
3/4mce/copyin: fix to not SIGBUS when copying from user hits poisonarch/x86/kernel/cpu/mce/core.c arch/x86/kernel/cpu/mce/severity.c include/linux/sched.h+19 -197 replies
4/4x86/mce: Avoid infinite loop for copy from user recoveryarch/x86/kernel/cpu/mce/core.c include/linux/sched.h+32 -92 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/4] Fix machine check recovery for copy_from_user

Maybe this is the way forward? I made some poor choices before to treat poison consumption in the kernel when accessing user data (get_user() or copy_from_user()) ... in particular assuming that the right action was sending a SIGBUS to the task as if it had synchronously accessed the poison location.

First three patches may need to be combined (or broken up differently) for bisectablilty. But they are presented separately here since they touch separate parts of the problem.

Second part is definitley incomplete. But I'd like to check that it is the right approach before expending more brain cells in the maze of nested macros that is lib/iov_iter.c

Last part has been posted before. It covers the case where the kernel takes more than one swing at reading poison data before returning to user.

Tony Luck (4):
x86/mce: Fix copyin code to return -EFAULT on machine check. mce/iter: Check for copyin failure & return error up stack mce/copyin: fix to not SIGBUS when copying from user hits poison x86/mce: Avoid infinite loop for copy from user recovery

 arch/x86/kernel/cpu/mce/core.c     | 63 +++++++++++++++++++++---------
 arch/x86/kernel/cpu/mce/severity.c |  2 -
 arch/x86/lib/copy_user_64.S        | 18 +++++----
 fs/iomap/buffered-io.c             |  8 +++-
 include/linux/sched.h              |  2 +-
 include/linux/uio.h                |  2 +-
 lib/iov_iter.c                     | 15 ++++++-
 7 files changed, 77 insertions(+), 33 deletions(-)
Signature · 1 line
2.29.2