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


Groups > linux.kernel > #1485288

Re: Runtime failure running sh:qemu in -next due to 'sh: fix copy_from_user()'

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: Runtime failure running sh:qemu in -next due to 'sh: fix copy_from_user()'
Date 2016-09-16 21:50 +0200
Message-ID <si7j4-FB-31@gated-at.bofh.it> (permalink)
References <si6Q2-uW-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Sep 16, 2016 at 12:12:18PM -0700, Guenter Roeck wrote:
> Hi,
> 
> I see the following runtime failure when running a 'sh' image with qemu in -next.

> Bisect points to commit 6e050503a150 ("sh: fix copy_from_user()"). Bisect log is
> attached.

Does reverting it recover the thing?

The change in question is
        if (__copy_size && __access_ok(__copy_from, __copy_size))
-               return __copy_user(to, from, __copy_size);
+               __copy_size = __copy_user(to, from, __copy_size);
+
+       if (unlikely(__copy_size))
+               memset(to + (n - __copy_size), 0, __copy_size);
 
        return __copy_size;

so the only difference is zeroing the tail of destination; return value
remains the same in all cases (what used to be return foo(); becomes
__copy_size = foo(); /* operations not modifying __copy_size */
return __copy_size;) and that memset is 100% legitimate -
copy_from_user(to, from, n) returning m means that the last m bytes of
[to .. to + n - 1] have not been copied into and must be zeroed.

If it affects anything at all, we have a serious problem somewhere in the
caller.

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


Thread

Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-16 21:20 +0200
  Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-16 21:50 +0200
    Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-16 23:00 +0200
      Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-16 23:40 +0200
        Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Rich Felker <dalias@libc.org> - 2016-09-16 23:50 +0200
          Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-17 00:50 +0200
            Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Rich Felker <dalias@libc.org> - 2016-09-17 01:40 +0200
              Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-17 04:30 +0200
              Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-17 04:30 +0200
                Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Rob Landley <rob@landley.net> - 2016-09-18 06:50 +0200
                Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Rich Felker <dalias@libc.org> - 2016-09-18 17:20 +0200
        Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-17 00:50 +0200
          Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-17 01:10 +0200
  Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-16 22:10 +0200
    Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Guenter Roeck <linux@roeck-us.net> - 2016-09-16 22:40 +0200
      Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' lsorense@csclub.uwaterloo.ca (Lennart Sorensen) - 2016-09-16 22:50 +0200
      Re: Runtime failure running sh:qemu in -next due to 'sh: fix  copy_from_user()' Al Viro <viro@ZenIV.linux.org.uk> - 2016-09-16 23:30 +0200

csiph-web