Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3318548imu; Sun, 11 Nov 2018 12:15:35 -0800 (PST) X-Google-Smtp-Source: AJdET5eZ/KX+4vraRvyt4b1/shAGNSu55KUdkxximCDHYdiG374J3qg5uGsVC0szTk3ICeBatDUf X-Received: by 2002:a63:4e41:: with SMTP id o1mr15370913pgl.282.1541967335168; Sun, 11 Nov 2018 12:15:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541967335; cv=none; d=google.com; s=arc-20160816; b=ngHj42w3WgXvTa8Kdi0bdnyIBNF7Gd0wZtAMgBHj3U9zm9v4/27bnYBSPEBayAxMh8 OJNIzW+JLdAtDIsAkEPxHhiP2nFjOjwd+IljjyLsRm8a5d8dx4RXyydwTUADqO/y6zDp jP2dFm6vH8Helpavk9oWDzLWlAmdOEKuBqICo0P6rIGZBq6T2dEA3+8jlMukMk0krN+W wUT7D4DFHes2RxD6ulIOewsF6zlwFuBpy5kwqIPLBgQ1QErBgU2TQUO8AXhXCstr4VlZ ycq3BweFwlRtovzt2JdxdJ1Y1WVr9Mn7w+rO+62FJfOGGSKSytUXBYxbi7fSmIV+rlNS tYtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=W1WJLm0TLY+vgoBmkvcIi5BAX3ZWMF02GpcIpCIxg3E=; b=Ik5lCLtALVHp7zfauc7oU6KigtV2nSMBIGXOfGA1RVJHB0HmecEby+OWmmSMAaYsZZ 8eeC5m/dhkBitsqE75OAgBVtX+AN0kxiVxlsWw+1tjGouv8DPgOoMK78mFE7F/Xy/nzp aLANYQ6REcNOFRnf9ZJgbIFaqB8ZljNjZ5c9xWXq8Tr7sgcBX7k5Rtvpfyz1hR2Xs3MG lNMy4abl8pHCerN3NHkfANkCBVCBirhLIPeodUFlGAsfmubRPSd9l7o6Akr6x/MoxK0d btDtRz9mPIjXL+lf58h6QnOemAjNWOCPTqajEhe+X7M7P00WwnmucKnxxjl2BQKHKb/l 5LPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj7-v6si15280852plb.193.2018.11.11.12.15.20; Sun, 11 Nov 2018 12:15:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731746AbeKLGE3 (ORCPT + 99 others); Mon, 12 Nov 2018 01:04:29 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:52930 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729602AbeKLGE2 (ORCPT ); Mon, 12 Nov 2018 01:04:28 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt9-0000l5-7F; Sun, 11 Nov 2018 19:59:19 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsP-0001RV-Kd; Sun, 11 Nov 2018 19:58:33 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "David Rivshin" , "Rabin Vincent" , "David Rivshin" , "Daniel Thompson" , "Russell King" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 068/366] ARM: 8764/1: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: David Rivshin commit 76ed0b803a2ab793a1b27d1dfe0de7955282cd34 upstream. 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") Signed-off-by: David Rivshin Acked-by: Rabin Vincent Tested-by: Daniel Thompson Signed-off-by: Russell King Signed-off-by: Ben Hutchings --- arch/arm/include/asm/kgdb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/include/asm/kgdb.h +++ b/arch/arm/include/asm/kgdb.h @@ -76,7 +76,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