From: Florian Fainelli <f.fainelli@gmail.com>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Leonard Crestez" <leonard.crestez@nxp.com>,
"Jan Kiszka" <jan.kiszka@siemens.com>,
"Jason Wessel" <jason.wessel@windriver.com>,
"Kieran Bingham" <kieran@ksquared.org.uk>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Kieran Bingham" <kieran@ksquared.org.uk>,
"André Draszik" <git@andred.net>,
"Du Changbin" <changbin.du@gmail.com>
Subject: [stable 4.9.y 2/4] scripts/gdb: lx-dmesg: cast log_buf to void* for addr fetch
Date: Thu, 7 Jan 2021 14:52:27 -0800 [thread overview]
Message-ID: <20210107225229.1502459-3-f.fainelli@gmail.com> (raw)
In-Reply-To: <20210107225229.1502459-1-f.fainelli@gmail.com>
From: Leonard Crestez <leonard.crestez@nxp.com>
commit c454756f47277b651ad41a5a163499294529e35d upstream
In some cases it is possible for the str() conversion here to throw
encoding errors because log_buf might not point to valid ascii. For
example:
(gdb) python print str(gdb.parse_and_eval("log_buf"))
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0303' in
position 24: ordinal not in range(128)
Avoid this by explicitly casting to (void *) inside the gdb expression.
Link: http://lkml.kernel.org/r/ba6f85dbb02ca980ebd0e2399b0649423399b565.1498481469.git.leonard.crestez@nxp.com
Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Kieran Bingham <kieran@ksquared.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
scripts/gdb/linux/dmesg.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py
index 5afd1098e33a..f5a030333dfd 100644
--- a/scripts/gdb/linux/dmesg.py
+++ b/scripts/gdb/linux/dmesg.py
@@ -24,7 +24,7 @@ class LxDmesg(gdb.Command):
def invoke(self, arg, from_tty):
log_buf_addr = int(str(gdb.parse_and_eval(
- "'printk.c'::log_buf")).split()[0], 16)
+ "(void *)'printk.c'::log_buf")).split()[0], 16)
log_first_idx = int(gdb.parse_and_eval("'printk.c'::log_first_idx"))
log_next_idx = int(gdb.parse_and_eval("'printk.c'::log_next_idx"))
log_buf_len = int(gdb.parse_and_eval("'printk.c'::log_buf_len"))
--
2.25.1
next prev parent reply other threads:[~2021-01-07 22:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 22:52 [stable 4.9.y 0/4] scripts/gdb Fixes for stable 4.9 Florian Fainelli
2021-01-07 22:52 ` [stable 4.9.y 1/4] scripts/gdb: make lx-dmesg command work (reliably) Florian Fainelli
2021-01-07 22:52 ` Florian Fainelli [this message]
2021-01-07 22:52 ` [stable 4.9.y 3/4] scripts/gdb: lx-dmesg: use explicit encoding=utf8 errors=replace Florian Fainelli
2021-01-07 22:52 ` [stable 4.9.y 4/4] scripts/gdb: fix lx-version string output Florian Fainelli
2021-01-10 12:14 ` [stable 4.9.y 0/4] scripts/gdb Fixes for stable 4.9 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=20210107225229.1502459-3-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=changbin.du@gmail.com \
--cc=git@andred.net \
--cc=jan.kiszka@siemens.com \
--cc=jason.wessel@windriver.com \
--cc=kieran@ksquared.org.uk \
--cc=leonard.crestez@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®