mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: mingo@kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Borislav Petkov <bp@alien8.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Tony Luck <tony.luck@intel.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	x86@kernel.org
Subject: Re: [PATCH] x86/asm/memcpy_mcsafe: Fix copy_to_user_mcsafe() exception handling
Date: Tue, 3 Jul 2018 10:47:54 -0600	[thread overview]
Message-ID: <20180703164754.GB30451@linux.intel.com> (raw)
In-Reply-To: <153056565378.3420.295180898468362039.stgit@dwillia2-desk3.amr.corp.intel.com>

On Mon, Jul 02, 2018 at 02:16:10PM -0700, Dan Williams wrote:
> All copy_to_user() implementations need to be prepared to handle faults
> accessing userspace. The __memcpy_mcsafe() implementation handles both
> mmu-faults on the user destination and machine-check-exceptions on the
> source buffer. However, the memcpy_mcsafe() wrapper may silently
> fallback to memcpy() depending on build options and cpu-capabilities.
> 
> Force copy_to_user_mcsafe() to always use __memcpy_mcsafe() when
> available, and otherwise disable all of the copy_to_user_mcsafe()
> infrastructure when __memcpy_mcsafe() is not available, i.e.
> CONFIG_X86_MCE=n.
> 
> This fixes crashes of the form:
>     run fstests generic/323 at 2018-07-02 12:46:23
>     BUG: unable to handle kernel paging request at 00007f0d50001000
>     RIP: 0010:__memcpy+0x12/0x20
>     [..]
>     Call Trace:
>      copyout_mcsafe+0x3a/0x50
>      _copy_to_iter_mcsafe+0xa1/0x4a0
>      ? dax_alive+0x30/0x50
>      dax_iomap_actor+0x1f9/0x280
>      ? dax_iomap_rw+0x100/0x100
>      iomap_apply+0xba/0x130
>      ? dax_iomap_rw+0x100/0x100
>      dax_iomap_rw+0x95/0x100
>      ? dax_iomap_rw+0x100/0x100
>      xfs_file_dax_read+0x7b/0x1d0 [xfs]
>      xfs_file_read_iter+0xa7/0xc0 [xfs]
>      aio_read+0x11c/0x1a0
> 
> Fixes: 8780356ef630 ("x86/asm/memcpy_mcsafe: Define copy_to_iter_mcsafe()")
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Tony Luck <tony.luck@intel.com>
> Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>

  parent reply	other threads:[~2018-07-03 16:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 15:52 [PATCH] lib/iov_iter: Fix pipe handling in _copy_to_iter_mcsafe Dan Williams
2018-07-02 16:58 ` Ross Zwisler
2018-07-02 17:17   ` Dan Williams
2018-07-02 21:16   ` [PATCH] x86/asm/memcpy_mcsafe: Fix copy_to_user_mcsafe() exception handling Dan Williams
2018-07-03  8:30     ` Ingo Molnar
2018-07-04 22:38       ` Al Viro
2018-07-04 23:02         ` Dan Williams
2018-07-05  7:02           ` Ingo Molnar
2018-07-03 16:47     ` Ross Zwisler [this message]
2018-07-03 16:47 ` [PATCH] lib/iov_iter: Fix pipe handling in _copy_to_iter_mcsafe Ross Zwisler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180703164754.GB30451@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome