From: David Rivshin <drivshin@awxrd.com>
To: linux-arm-kernel@lists.infradead.org,
kgdb-bugreport@lists.sourceforge.net,
Jason Wessel <jason.wessel@windriver.com>,
Daniel Thompson <daniel.thompson@linaro.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Rabin Vincent <rabin@rab.in>
Subject: [PATCH] arm: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size
Date: Thu, 5 Apr 2018 16:09:16 -0400 [thread overview]
Message-ID: <20180405200916.27964-1-drivshin@awxrd.com> (raw)
From: David Rivshin <DRivshin@allworx.com>
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: <stable@vger.kernel.org> # 2.6.37+
Signed-off-by: David Rivshin <drivshin@allworx.com>
---
arch/arm/include/asm/kgdb.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
base-commit: 0adb32858b0bddf4ada5f364a84ed60b196dbcda
--
2.14.3
next reply other threads:[~2018-04-05 20:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-05 20:09 David Rivshin [this message]
2018-04-05 20:48 ` [PATCH] arm: kgdb: fix NUMREGBYTES so that gdb_regs[] is the correct size Rabin Vincent
2018-04-06 13:25 ` Daniel Thompson
2018-04-06 13:49 ` Daniel Thompson
2018-04-06 16:36 ` David Rivshin
2018-04-10 13:51 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180405200916.27964-1-drivshin@awxrd.com \
--to=drivshin@awxrd.com \
--cc=daniel.thompson@linaro.org \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rabin@rab.in \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).