Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1650672

Re: [PATCH] [iov_iter] use memmove() when copying to/from user page

From Eric Dumazet <edumazet@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] [iov_iter] use memmove() when copying to/from user page
Date 2017-05-25 19:20 +0200
Message-ID <tL4Ay-2z5-5@gated-at.bofh.it> (permalink)
References (6 earlier) <tHRTc-2nV-13@gated-at.bofh.it> <tHSme-2zE-21@gated-at.bofh.it> <tHSYX-371-27@gated-at.bofh.it> <tHTrX-3gi-11@gated-at.bofh.it> <tL4qS-2vP-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, May 25, 2017 at 10:04 AM, Pavel Machek <pavel@ucw.cz> wrote:
> Hi!
>
> On Tue 2017-05-16 23:48:54, Al Viro wrote:
>> On Tue, May 16, 2017 at 03:15:16PM -0700, Dmitry Vyukov wrote:
>> > > Because it's not going to be *one* call of memcpy() or memmove().  It's
>> > > one per page.
>> >
>> >
>> > I missed that.
>> >
>> > I assumed that in the case of sendfile from memfd to memfd data will
>> > be copied directly. But it goes through a pipe with multiple buffers.
>> > Does not look easily fixable.
>>
>> Which leaves us only with "will nasal demons really fly there?".
>
> It seems so:
>
> Date: Tue, 16 May 2017 14:27:34 +0200
> From: Alexander Potapenko <glider@google.com>
> Subject: [PATCH] [iov_iter] use memmove() when copying to/from user
> page
>
> BUG: memcpy-param-overlap in generic_perform_write+0x551/0xa20
> __msan_memcpy(ffff88013c6e3001, ffff88013c6e3000, 105)
> CPU: 0 PID: 1040 Comm: probe Not tainted 4.11.0-rc5+ #2562
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
> 01/01/2011
>
> At the very least, we do not want userland to trigger kernel
> BUG()s... so this needs fixes beyond documentation.

To be fair, this BUG() only happens because Alexander added one in memcpy() ,
testing for the cases where memmove() should have been used.

Kind of a debugging trap if you prefer.

This is not something that a pristine kernel would do.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] [iov_iter] use memmove() when copying to/from user page Pavel Machek <pavel@ucw.cz> - 2017-05-25 19:10 +0200
  Re: [PATCH] [iov_iter] use memmove() when copying to/from user page Eric Dumazet <edumazet@google.com> - 2017-05-25 19:20 +0200
    Re: [PATCH] [iov_iter] use memmove() when copying to/from user page Pavel Machek <pavel@ucw.cz> - 2017-05-25 23:30 +0200
  Re: [PATCH] [iov_iter] use memmove() when copying to/from user page Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-25 20:30 +0200
    Re: [PATCH] [iov_iter] use memmove() when copying to/from user page Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-25 21:20 +0200

csiph-web