Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3061775imm; Sun, 1 Jul 2018 11:20:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcOAnjOUoVMtyJWNqG4vFy3EllkXXhPrYeT+voduZH4IjF30ziHWpRWieDDW8yOLrr0JiSE X-Received: by 2002:a62:d693:: with SMTP id a19-v6mr17818341pfl.248.1530469233596; Sun, 01 Jul 2018 11:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530469233; cv=none; d=google.com; s=arc-20160816; b=vqte276DmpYt312flDkgE0u6nZhU0JcyeBQqJEKcG9oWipDQaVXFmPh6eM0jO4KUOD Pn5qhJVpyQtxSXSBUVXo790Xibjq0vuhWRGJgWBfK7qBa+nW9af39xgyXASqGREElyma suE0q6SHrlGbdsw9MJJPQDcBi9jQOGJ67uUYJ2OoXUF7Jxhb0NQkKDGsP3dsoDVJHnpH v3SA7ZpRf9DGH44XDFEt064mUglCWladZf29JH6VUIAyjlbfyWqeSuT8SWnlIkI/xF9J yvSY9wl+2tF12EZNJeiMiwBDdoywADMWmEeE0QIF6MWfj+N/yesj6eC1n3LzbnzX1tPt euog== 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=+SJnoiCqxu4jdPiDLArfrulGijenumXYUOe9apPELwY=; b=MsV7Yo+aM7s83+4Int+i/iDEO/avBhxfD5XEF8IUAoGAYLqYa5OPvSciso35Q/ANtD 2mNRmZ9QAoCzxNuuKOpx1v/xVz5KvgE6ddSX/1rxI/Dr1L0B+pn1fQ6gvFBEHsdunA3W jkpprWTXtO0Cu1KkWI+DyVEAJxYyGzu//kQFVqf8EWrHQVYJzZmedfa3bO2Wjiu1GJMc X1aigKLXNFSi1AAetUWVMozKvlmhibkm40TGB1LHP0WdGNORKHs+3nIrsbDDVlMGqPA0 g7Fn7bDbZbNGRncctmzMVkowvNc99ZXhhpbUbdCPe3Y17pCKaZon3QYDTGRMsXfpwKw/ sgsA== 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 h2-v6si9315048pfg.126.2018.07.01.11.20.19; Sun, 01 Jul 2018 11:20:33 -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 S965222AbeGAQZf (ORCPT + 99 others); Sun, 1 Jul 2018 12:25:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33680 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932790AbeGAQZ3 (ORCPT ); Sun, 1 Jul 2018 12:25:29 -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 82B9CAD8; Sun, 1 Jul 2018 16:25:28 +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.9 030/101] ARM: 8764/1: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size Date: Sun, 1 Jul 2018 18:21:16 +0200 Message-Id: <20180701160758.361937930@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@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.9-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 @@ -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