All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] use memcpy_mcsafe() for copy_to_iter()
@ 2018-05-01 20:45 ` Dan Williams
  0 siblings, 0 replies; 56+ messages in thread
From: Dan Williams @ 2018-05-01 20:45 UTC (permalink / raw)
  To: linux-nvdimm
  Cc: tony.luck, Peter Zijlstra, x86, linux-kernel, Andy Lutomirski,
	Ingo Molnar, Borislav Petkov, Al Viro, Thomas Gleixner,
	Linus Torvalds, Andrew Morton

Currently memcpy_mcsafe() is only deployed in the pmem driver when
reading through a /dev/pmemX block device. However, a filesystem in dax
mode mounted on a /dev/pmemX block device will bypass the block layer
and the driver for reads. The filesystem-dax (fsdax) read case uses
dax_direct_access() and copy_to_iter() to bypass the block layer.

The result of the bypass is that the kernel treats machine checks during
read as system fatal (reboot) when they could simply be flagged as an
I/O error, similar to performing reads through the pmem driver. Prevent
this fatal condition by deploying memcpy_mcsafe() in the fsdax read
path.

The main differences between this copy_to_user_mcsafe() and
copy_user_generic_unrolled() are:

* Typical tail/residue handling after a fault retries the copy
  byte-by-byte until the fault happens again. Re-triggering machine
  checks is potentially fatal so the implementation uses source alignment
  and poison alignment assumptions to limit the residue copying to known
  good bytes.

* SMAP coordination is handled external to the assembly with
  __uaccess_begin() and __uaccess_end().

* ITER_KVEC and ITER_BVEC can now end prematurely with an error.

The new MCSAFE_DEBUG facility is proposed as a way to unit test the
exception handling without requiring an ACPI EINJ capable platform.

Thanks to Tony Luck for his review, test, and implementation ideas on
initial versions of this patchset.

---

Dan Williams (6):
      x86, memcpy_mcsafe: update labels in support of write fault handling
      x86, memcpy_mcsafe: return bytes remaining
      x86, memcpy_mcsafe: add write-protection-fault handling
      x86, memcpy_mcsafe: define copy_to_iter_mcsafe()
      dax: use copy_to_iter_mcsafe() in dax_iomap_actor()
      x86, nfit_test: unit test for memcpy_mcsafe()


 arch/x86/Kconfig.debug              |    3 +
 arch/x86/include/asm/mcsafe_debug.h |   50 ++++++++++
 arch/x86/include/asm/string_64.h    |    8 +-
 arch/x86/include/asm/uaccess_64.h   |   14 +++
 arch/x86/lib/memcpy_64.S            |  178 ++++++++++++++++++++++++++++-------
 arch/x86/lib/usercopy_64.c          |   12 ++
 drivers/nvdimm/claim.c              |    3 -
 drivers/nvdimm/pmem.c               |    6 +
 fs/dax.c                            |   20 ++--
 include/linux/string.h              |    4 -
 include/linux/uio.h                 |   10 ++
 lib/iov_iter.c                      |   59 ++++++++++++
 tools/testing/nvdimm/test/nfit.c    |   48 +++++++++
 13 files changed, 360 insertions(+), 55 deletions(-)
 create mode 100644 arch/x86/include/asm/mcsafe_debug.h
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

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

end of thread, other threads:[~2018-05-02 17:47 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-01 20:45 [PATCH 0/6] use memcpy_mcsafe() for copy_to_iter() Dan Williams
2018-05-01 20:45 ` Dan Williams
2018-05-01 20:45 ` [PATCH 1/6] x86, memcpy_mcsafe: update labels in support of write fault handling Dan Williams
2018-05-01 20:45   ` Dan Williams
2018-05-01 20:45 ` [PATCH 2/6] x86, memcpy_mcsafe: return bytes remaining Dan Williams
2018-05-01 20:45   ` Dan Williams
2018-05-01 20:45 ` [PATCH 3/6] x86, memcpy_mcsafe: add write-protection-fault handling Dan Williams
2018-05-01 20:45   ` Dan Williams
2018-05-01 20:45 ` [PATCH 4/6] x86, memcpy_mcsafe: define copy_to_iter_mcsafe() Dan Williams
2018-05-01 20:45   ` Dan Williams
2018-05-01 22:17   ` kbuild test robot
2018-05-01 22:17     ` kbuild test robot
2018-05-01 22:49   ` kbuild test robot
2018-05-01 22:49     ` kbuild test robot
2018-05-01 20:45 ` [PATCH 5/6] dax: use copy_to_iter_mcsafe() in dax_iomap_actor() Dan Williams
2018-05-01 20:45   ` Dan Williams
2018-05-01 20:45 ` [PATCH 6/6] x86, nfit_test: unit test for memcpy_mcsafe() Dan Williams
2018-05-01 20:45   ` Dan Williams
2018-05-01 21:05 ` [PATCH 0/6] use memcpy_mcsafe() for copy_to_iter() Linus Torvalds
2018-05-01 21:05   ` Linus Torvalds
2018-05-01 23:02   ` Dan Williams
2018-05-01 23:02     ` Dan Williams
2018-05-01 23:28     ` Andy Lutomirski
2018-05-01 23:28       ` Andy Lutomirski
2018-05-01 23:31       ` Dan Williams
2018-05-01 23:31         ` Dan Williams
2018-05-02  0:09     ` Linus Torvalds
2018-05-02  0:09       ` Linus Torvalds
2018-05-02  2:25       ` Dan Williams
2018-05-02  2:25         ` Dan Williams
2018-05-02  2:53         ` Linus Torvalds
2018-05-02  2:53           ` Linus Torvalds
2018-05-02  3:02           ` Dan Williams
2018-05-02  3:02             ` Dan Williams
2018-05-02  3:13             ` Linus Torvalds
2018-05-02  3:13               ` Linus Torvalds
2018-05-02  3:20               ` Dan Williams
2018-05-02  3:20                 ` Dan Williams
2018-05-02  3:22                 ` Dan Williams
2018-05-02  3:22                   ` Dan Williams
2018-05-02  3:33                   ` Linus Torvalds
2018-05-02  3:33                     ` Linus Torvalds
2018-05-02  4:00                     ` Dan Williams
2018-05-02  4:00                       ` Dan Williams
2018-05-02  4:14                       ` Linus Torvalds
2018-05-02  4:14                         ` Linus Torvalds
2018-05-02  5:37                         ` Dan Williams
2018-05-02  5:37                           ` Dan Williams
2018-05-02 16:19                     ` Andy Lutomirski
2018-05-02 16:19                       ` Andy Lutomirski
2018-05-02 17:47                       ` Dan Williams
2018-05-02 17:47                         ` Dan Williams
2018-05-02  8:30         ` Borislav Petkov
2018-05-02  8:30           ` Borislav Petkov
2018-05-02 13:52           ` Dan Williams
2018-05-02 13:52             ` Dan Williams

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.