linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Du Changbin" <changbin.du@gmail.com>,
	"Kieran Bingham" <kbingham@kernel.org>,
	"Jan Kiszka" <jan.kiszka@siemens.com>,
	"Jason Wessel" <jason.wessel@windriver.com>,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Kieran Bingham" <kieran@ksquared.org.uk>,
	"Leonard Crestez" <leonard.crestez@nxp.com>,
	"André Draszik" <git@andred.net>
Subject: [stable 4.9.y 4/4] scripts/gdb: fix lx-version string output
Date: Thu,  7 Jan 2021 14:52:29 -0800	[thread overview]
Message-ID: <20210107225229.1502459-5-f.fainelli@gmail.com> (raw)
In-Reply-To: <20210107225229.1502459-1-f.fainelli@gmail.com>

From: Du Changbin <changbin.du@gmail.com>

commit b058809bfc8faeb7b7cae047666e23375a060059 upstream

A bug is present in GDB which causes early string termination when
parsing variables.  This has been reported [0], but we should ensure
that we can support at least basic printing of the core kernel strings.

For current gdb version (has been tested with 7.3 and 8.1), 'lx-version'
only prints one character.

  (gdb) lx-version
  L(gdb)

This can be fixed by casting 'linux_banner' as (char *).

  (gdb) lx-version
  Linux version 4.19.0-rc1+ (changbin@acer) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #21 SMP Sat Sep 1 21:43:30 CST 2018

[0] https://sourceware.org/bugzilla/show_bug.cgi?id=20077

[kbingham@kernel.org: add detail to commit message]
Link: http://lkml.kernel.org/r/20181111162035.8356-1-kieran.bingham@ideasonboard.com
Fixes: 2d061d999424 ("scripts/gdb: add version command")
Signed-off-by: Du Changbin <changbin.du@gmail.com>
Signed-off-by: Kieran Bingham <kbingham@kernel.org>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
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/proc.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py
index 38b1f09d1cd9..822e3767bc05 100644
--- a/scripts/gdb/linux/proc.py
+++ b/scripts/gdb/linux/proc.py
@@ -40,7 +40,7 @@ class LxVersion(gdb.Command):
 
     def invoke(self, arg, from_tty):
         # linux_banner should contain a newline
-        gdb.write(gdb.parse_and_eval("linux_banner").string())
+        gdb.write(gdb.parse_and_eval("(char *)linux_banner").string())
 
 LxVersion()
 
-- 
2.25.1


  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 ` [stable 4.9.y 2/4] scripts/gdb: lx-dmesg: cast log_buf to void* for addr fetch Florian Fainelli
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 ` Florian Fainelli [this message]
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-5-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=changbin.du@gmail.com \
    --cc=daniel.thompson@linaro.org \
    --cc=git@andred.net \
    --cc=jan.kiszka@siemens.com \
    --cc=jason.wessel@windriver.com \
    --cc=kbingham@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).