From patchwork Fri Aug 4 16:48:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Miller X-Patchwork-Id: 797913 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xPCYR3y9yz9sxR for ; Sat, 5 Aug 2017 02:48:43 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565AbdHDQsm (ORCPT ); Fri, 4 Aug 2017 12:48:42 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:35862 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752389AbdHDQsl (ORCPT ); Fri, 4 Aug 2017 12:48:41 -0400 Received: from localhost (74-93-104-98-Washington.hfc.comcastbusiness.net [74.93.104.98]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id C66D112125303; Fri, 4 Aug 2017 09:48:40 -0700 (PDT) Date: Fri, 04 Aug 2017 09:48:38 -0700 (PDT) Message-Id: <20170804.094838.2078149548154257211.davem@davemloft.net> To: mikpelinux@gmail.com Cc: sam@ravnborg.org, matorola@gmail.com, sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: strace-4.18 test suite oopses sparc64 4.12 and 4.13-rc kernels From: David Miller In-Reply-To: <22916.10769.43405.588851@gargle.gargle.HOWL> References: <22915.33137.173101.458489@gargle.gargle.HOWL> <20170803.145748.1255019771865320896.davem@davemloft.net> <22916.10769.43405.588851@gargle.gargle.HOWL> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 04 Aug 2017 09:48:41 -0700 (PDT) Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org From: Mikael Pettersson Date: Fri, 4 Aug 2017 10:02:25 +0200 > David Miller writes: > > From: Mikael Pettersson > > Date: Thu, 3 Aug 2017 22:02:57 +0200 > > > > > With that in place the kernel booted fine. > > > When I then ran the `poll' strace test binary, the OOPS was replaced by: > > > > > > [ 140.589913] _copy_from_user(fff000123c8dfa7c, (null), 240) res 240 > > > [ 140.753162] _copy_from_user(fff000123c8dfa7c, 00000000f7e4a000, 8) res 8 > > > [ 140.824155] _copy_from_user(fff000123c8dfa7c, 00000000f7e49ff8, 16) res 18442240552407530112 > > > > > > That last `res' doesn't look good. > > > > Please test this patch: > > > > diff --git a/arch/sparc/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S > > index 54f9870..5a8cb37 100644 > > --- a/arch/sparc/lib/U3memcpy.S > > +++ b/arch/sparc/lib/U3memcpy.S > > @@ -145,13 +145,13 @@ ENDPROC(U3_retl_o2_plus_GS_plus_0x08) > > ENTRY(U3_retl_o2_and_7_plus_GS) > > and %o2, 7, %o2 > > retl > > - add %o2, GLOBAL_SPARE, %o2 > > + add %o2, GLOBAL_SPARE, %o0 > > ENDPROC(U3_retl_o2_and_7_plus_GS) > > ENTRY(U3_retl_o2_and_7_plus_GS_plus_8) > > add GLOBAL_SPARE, 8, GLOBAL_SPARE > > and %o2, 7, %o2 > > retl > > - add %o2, GLOBAL_SPARE, %o2 > > + add %o2, GLOBAL_SPARE, %o0 > > ENDPROC(U3_retl_o2_and_7_plus_GS_plus_8) > > #endif > > > > Backing out my debugging patch and adding this one instead > gave me a working kernel that doesn't OOPS. Thanks. > > Tested-by: Mikael Pettersson Great, thanks for testing. This is the final patch I committed: ==================== From 0ede1c401332173ab0693121dc6cde04a4dbf131 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 4 Aug 2017 09:47:52 -0700 Subject: [PATCH] sparc64: Fix exception handling in UltraSPARC-III memcpy. Mikael Pettersson reported that some test programs in the strace-4.18 testsuite cause an OOPS. After some debugging it turns out that garbage values are returned when an exception occurs, causing the fixup memset() to be run with bogus arguments. The problem is that two of the exception handler stubs write the successfully copied length into the wrong register. Fixes: ee841d0aff64 ("sparc64: Convert U3copy_{from,to}_user to accurate exception reporting.") Reported-by: Mikael Pettersson Tested-by: Mikael Pettersson Reviewed-by: Sam Ravnborg Signed-off-by: David S. Miller --- arch/sparc/lib/U3memcpy.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/lib/U3memcpy.S b/arch/sparc/lib/U3memcpy.S index 54f98706b03b..5a8cb37f0a3b 100644 --- a/arch/sparc/lib/U3memcpy.S +++ b/arch/sparc/lib/U3memcpy.S @@ -145,13 +145,13 @@ ENDPROC(U3_retl_o2_plus_GS_plus_0x08) ENTRY(U3_retl_o2_and_7_plus_GS) and %o2, 7, %o2 retl - add %o2, GLOBAL_SPARE, %o2 + add %o2, GLOBAL_SPARE, %o0 ENDPROC(U3_retl_o2_and_7_plus_GS) ENTRY(U3_retl_o2_and_7_plus_GS_plus_8) add GLOBAL_SPARE, 8, GLOBAL_SPARE and %o2, 7, %o2 retl - add %o2, GLOBAL_SPARE, %o2 + add %o2, GLOBAL_SPARE, %o0 ENDPROC(U3_retl_o2_and_7_plus_GS_plus_8) #endif