From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935072AbcIPXd4 (ORCPT ); Fri, 16 Sep 2016 19:33:56 -0400 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:60103 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933782AbcIPXdq (ORCPT ); Fri, 16 Sep 2016 19:33:46 -0400 Date: Fri, 16 Sep 2016 19:32:36 -0400 From: Rich Felker To: Guenter Roeck Cc: Al Viro , linux-kernel@vger.kernel.org, Yoshinori Sato , linux-sh@vger.kernel.org Subject: Re: Runtime failure running sh:qemu in -next due to 'sh: fix copy_from_user()' Message-ID: <20160916233236.GU15995@brightrain.aerifal.cx> References: <20160916191218.GA12104@roeck-us.net> <20160916194532.GY2356@ZenIV.linux.org.uk> <20160916205938.GB29767@roeck-us.net> <20160916213141.GB2356@ZenIV.linux.org.uk> <20160916213918.GO15995@brightrain.aerifal.cx> <20160916224744.GB21916@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160916224744.GB21916@roeck-us.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 16, 2016 at 03:47:44PM -0700, Guenter Roeck wrote: > On Fri, Sep 16, 2016 at 05:39:18PM -0400, Rich Felker wrote: > > On Fri, Sep 16, 2016 at 10:31:41PM +0100, Al Viro wrote: > > > On Fri, Sep 16, 2016 at 01:59:38PM -0700, Guenter Roeck wrote: > > > > Yes, reverting 6e050503a150 fixes the problem. > > > > > > > > I added a BUG() into the "if (unlikely())" below, but it doesn't catch, > > > > and I still get the ip: OVERRUN errors. Which leaves me a bit puzzled. > > > > > > > > Guenter > > > > > > > > > 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 we don't even hit that memset()? What the hell? __copy_user() is > > > declared as > > > __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); > > > > > > and __copy_size copy_from_user() is > > > > > > __kernel_size_t __copy_size = (__kernel_size_t) n; > > > > > > So > > > return __copy_user(to, from, __copy_size); > > > and > > > __copy_size = __copy_user(to, from, __copy_size); > > > return __copy_size; > > > ought to be doing exactly the same thing. At that point it's starting to > > > smell like a compiler bug somewhere in there. > > > > > > Try to remove that (not triggered) if (unlikely(__copy_size)) memset(...) > > > and see if that's enough to recover. And it would be nice to see what > > > all three variants (as it is, with commit reverted and with just that if > > > removed) generate in e.g. sys_utimensat() (fs/utimes.s) > > > > It would be useful to know what compiler version was used to build the > > kernel. I wouldn't be surprised if some are buggy. > > > 4.6.3 from kernel.org. That is utterly ancient and probaby very buggy. I would recommend 5.x+ or at the very least 4.7 or 4.8. Rich