From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757259AbcIPXAY (ORCPT ); Fri, 16 Sep 2016 19:00:24 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:59936 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752812AbcIPXAO (ORCPT ); Fri, 16 Sep 2016 19:00:14 -0400 Date: Sat, 17 Sep 2016 00:00:08 +0100 From: Al Viro To: Guenter Roeck Cc: linux-kernel@vger.kernel.org, Yoshinori Sato , linux-sh@vger.kernel.org, Rich Felker Subject: Re: Runtime failure running sh:qemu in -next due to 'sh: fix copy_from_user()' Message-ID: <20160916230008.GC2356@ZenIV.linux.org.uk> References: <20160916191218.GA12104@roeck-us.net> <20160916194532.GY2356@ZenIV.linux.org.uk> <20160916205938.GB29767@roeck-us.net> <20160916213141.GB2356@ZenIV.linux.org.uk> <20160916224704.GA21916@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160916224704.GA21916@roeck-us.net> User-Agent: Mutt/1.6.1 (2016-04-27) 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:04PM -0700, Guenter Roeck wrote: > Adding pr_info() just before the "if (unlikely..." fixes the problem. > > Commenting out the "if (unlikely())" code fixes the problem. > > Using a new variable "unsigned long x" for the return code instead of > re-using __copy_size fixes the problem. > > Replacing "return __copy_size;" with "return __copy_size & 0xffffffff;" > fixes the problem. > > The problem only seems to be seen if the copy size length is odd (more > specifically, the failing copy always has a length of 25 bytes). > > No idea what is going on. Bug in __copy_user() ? Compiler bug ? Definitely a compiler bug. __kernel_size_t is 32 bits on sh; that & 0xffffffff should've been optimized away, for crying out loud!