From patchwork Thu Apr 5 20:09:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Rivshin X-Patchwork-Id: 10325241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1552F60541 for ; Thu, 5 Apr 2018 20:29:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0365829384 for ; Thu, 5 Apr 2018 20:29:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAF3C29388; Thu, 5 Apr 2018 20:29:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F2EA29384 for ; Thu, 5 Apr 2018 20:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=XZGAQ7szqrsPykgEJ9cxiqdSqgWjuamD1cny4IUDDv8=; b=Mlu 8RPyLJpbXmwt9sRiHD5jdmsqVbLSDE9eCOjV1RlSaCzQXJR2CO8dugZ0eNMuEu0anolOqbwMh+Hvv cS7CH8fgOed6lU5DXVDxMOakkRp0C9pSMlSNQG1myNq/+z2Rg9Bosb+ajSEheBpYyqoU0+oQWgEOL f5658HRJpEj9ISoKUAwcT9LT+s4QCi6sEavqnjbVKou/Py9SuBQ+FI+XCYSds5ri8rhUB3Lmh92sd Yi6nnOad58UqIL2kraoRfPeORHTufIzFQKzQaRnWZtrfelgkS39k2JZk4jsW21WCNdIba/hxkUte9 /I7z6/hMJQrmnT+kWpZUl4Fuw0OHdDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f4BVG-00072r-CY; Thu, 05 Apr 2018 20:29:02 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f4BVD-00071X-K4 for linux-arm-kernel@lists.infradead.org; Thu, 05 Apr 2018 20:29:01 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 31C9B20DE5; Thu, 5 Apr 2018 16:28:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 05 Apr 2018 16:28:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=awxrd.com; h=cc :date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=gTuJ8r5NWwBR/5EKxtmhfJrB6wRp8N8A/0G1vu8Ia oY=; b=WC61Rsfzft/GeTwCWaQOsw0p4SdpOSnqVq6ze8p+WSMXu3ihHd2SIUMI/ FLBM8Y6MGJh75xdqJSDIJysZdyNJSZ1B3JtYh+0JRqsbm/qQX079A9tZ7mqIXJ3K 6TQJ8Vf0Wb8feQiJ1pHLVvC6aD688WKGrQ37qx6gZ8WLyIam3/fdM8Xfn9XfC9TU CEbWhWX4zrvYgzr9fQ1hja+mtnVudXCiJLo814DRbIukUNIP3Oz5ps6e1RuN9UZN V41jnK9CM9P+JkWzW8CiAPcWsXt7wzvPrN9KtOOG4YUmxI1Szu1/EVggaNVF5Yog Fi8Ga2zfv7hguBZLcPA8kFxpBoi7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=gTuJ8r5NWwBR/5EKx tmhfJrB6wRp8N8A/0G1vu8IaoY=; b=Lazb3Kbty4FyUOvWaHWzHspynwJvl4bLH 1FCbAbOwC5F206klbcmDvrjuctFa9pmBe7tKrf3QOEK8kJUJzuW4s+3tm01UEcI6 grNoSU3oU2BihrxPInRgGWUR/XipQVJGeKsakGDAXJMZZeE5NP/pAskviF1dznk+ btpYGuzu9HDFRPpJsMEdPoZ2ZNz3k4RkCzYrF9fpJEZVaVJ9fHzRfstHQuE3OjNV 44U8lgZq8OcImQi7ogWTGEUpYJzmenoXeBrrqA/691Is2CQElrGnJ2uXVl1bFCgL xSxq+Wiqz+q5t6ETnwmsg87L2lpn04GnESyyFXVvg6btFVj4ABIiA== X-ME-Sender: Received: from drivshin-linux.inscitek.com (unknown [24.213.148.66]) by mail.messagingengine.com (Postfix) with ESMTPA id 9FD7610251; Thu, 5 Apr 2018 16:28:43 -0400 (EDT) From: David Rivshin To: linux-arm-kernel@lists.infradead.org, kgdb-bugreport@lists.sourceforge.net, Jason Wessel , Daniel Thompson Subject: [PATCH] arm: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size Date: Thu, 5 Apr 2018 16:09:16 -0400 Message-Id: <20180405200916.27964-1-drivshin@awxrd.com> X-Mailer: git-send-email 2.14.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180405_132859_734275_ABC84B90 X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rabin Vincent , linux-kernel@vger.kernel.org, stable@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Rivshin NUMREGBYTES (which is used as the size for gdb_regs[]) is incorrectly based on DBG_MAX_REG_NUM instead of GDB_MAX_REGS. DBG_MAX_REG_NUM is the number of total registers, while GDB_MAX_REGS is the number of 'unsigned longs' it takes to serialize those registers. Since FP registers require 3 'unsigned longs' each, DBG_MAX_REG_NUM is smaller than GDB_MAX_REGS. This causes GDB 8.0 give the following error on connect: "Truncated register 19 in remote 'g' packet" This also causes the register serialization/deserialization logic to overflow gdb_regs[], overwriting whatever follows. Fixes: 834b2964b7ab ("kgdb,arm: fix register dump") Cc: # 2.6.37+ Signed-off-by: David Rivshin Acked-by: Rabin Vincent Tested-by: Daniel Thompson --- arch/arm/include/asm/kgdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 0adb32858b0bddf4ada5f364a84ed60b196dbcda diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h index 3b73fdcf3627a..8de1100d10674 100644 --- a/arch/arm/include/asm/kgdb.h +++ b/arch/arm/include/asm/kgdb.h @@ -77,7 +77,7 @@ extern int kgdb_fault_expected; #define KGDB_MAX_NO_CPUS 1 #define BUFMAX 400 -#define NUMREGBYTES (DBG_MAX_REG_NUM << 2) +#define NUMREGBYTES (GDB_MAX_REGS << 2) #define NUMCRITREGBYTES (32 << 2) #define _R0 0