Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3013830imm; Sun, 1 Jul 2018 10:18:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI1KDPQN2BbVKzxmIZYDix5y1TpnVDMy8PBEnLlKyTXJOWwHTLkHncj55lcH6hPzEtH/P5J X-Received: by 2002:a63:ac11:: with SMTP id v17-v6mr19355027pge.274.1530465510667; Sun, 01 Jul 2018 10:18:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530465510; cv=none; d=google.com; s=arc-20160816; b=QNRZ64smGdVevSoAkSaPvpZ6XGfHkvG/GCXyQyONKSqCetvW1WR/vDmDCO1nG91/5n 4DXpgrsw3pdtGJ2Kn7522+yyj7uSukRpuV/QjfJqxzP5G3O4YeL2XlZ/dM2sPL2txcQB ekOlhvrm0L8zkxnftzgYzgxKIUAAhFP7P1T6POBdoA6FNbV4yBKHyKP8O3kn4knTKZXT sExoWNhUQmy+1AChM7TUDwz1cZOnV0st+kKrIGU06UAGoLsCQwgnXD9wiI3ygv0vjmpV /6QAt8vVn++ongfot5McGBKwwxu7f4RsMEuTtk2BcG1MjFpVSK7mOII8RqlOMB/KcD+L IKEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yxK0MUqdvltvd0fFNTY7ULmNT/UJWU/+40UNGzJG5o8=; b=l8uPYM5nx+F0vVHF5f0aqQffNlk9SI6Vs3qXWN3AcQIzVI4b9UGucFLDmuql71xqFg XJfTFE0CFJGKbKF8xJzVXslErXqVgWFgxak8zIdb3aJd98vUDndTEyvdCE06KYMiikv8 agVkV3Jd4esEZ9Lq74+WlmtmzNaroyLu5WFDFaTPlYa5OvndZJzfOqybaQNwm9vBlI0t qGRG0dXgjDVEkssTz4iX0FfJ+qPuMNmKqYXBvSktuFVA++4KMEca8HmqX0vWRqSakP1k MLgnr/+Ddys8G/U2/QZtSeugDZOZs05GJUgzaXZtonTbZP0wsr9wRFEfrBS7/zcbtjsl ZwVA== 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 p18-v6si14139960pfe.150.2018.07.01.10.18.16; Sun, 01 Jul 2018 10:18:30 -0700 (PDT) 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 S1031732AbeGAQj1 (ORCPT + 99 others); Sun, 1 Jul 2018 12:39:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36896 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031714AbeGAQjU (ORCPT ); Sun, 1 Jul 2018 12:39:20 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 20C9AAA6; Sun, 1 Jul 2018 16:39:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Rivshin , Rabin Vincent , Daniel Thompson , Russell King Subject: [PATCH 4.17 061/220] ARM: 8764/1: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size Date: Sun, 1 Jul 2018 18:21:25 +0200 Message-Id: <20180701160910.936142562@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable 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") Cc: # 2.6.37+ Signed-off-by: David Rivshin Acked-by: Rabin Vincent Tested-by: Daniel Thompson Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- 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 @@ -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