public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: gdb-patches@sourceware.org
Subject: [PATCH v3 1/8] Use KF_PATH to verify the size of a struct kinfo_file.
Date: Tue, 18 Sep 2018 18:55:00 -0000	[thread overview]
Message-ID: <20180918185444.89533-2-jhb@FreeBSD.org> (raw)
In-Reply-To: <20180918185444.89533-1-jhb@FreeBSD.org>

fbsd_core_vnode_path needs to use the offset of the kf_path member of
struct kinfo_file as the minimum size of a struct kinfo_file object.
However, it was using KVE_PATH instead due to a copy and paste bug.

While here, fix another copy and paste bug in the error message for a
truncated kinfo_file object.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
	KVE_PATH.
---
 gdb/ChangeLog   | 5 +++++
 gdb/fbsd-tdep.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a468d8dc32..14ac0dae52 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-17  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-tdep.c (fbsd_core_vnode_path): Use KF_PATH instead of
+	KVE_PATH.
+
 2018-09-17  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
 	* python/lib/gdb/command/frame_filters.py (EnableFrameFilter):
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index ed43087169..48544b5370 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -781,13 +781,13 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
   /* Skip over the structure size.  */
   descdata += 4;
 
-  while (descdata + KVE_PATH < descend)
+  while (descdata + KF_PATH < descend)
     {
       ULONGEST structsize;
 
       structsize = bfd_get_32 (core_bfd, descdata + KF_STRUCTSIZE);
-      if (structsize < KVE_PATH)
-	error (_("malformed core note - vmmap entry too small"));
+      if (structsize < KF_PATH)
+	error (_("malformed core note - file structure too small"));
 
       if (bfd_get_32 (core_bfd, descdata + KF_TYPE) == KINFO_FILE_TYPE_VNODE
 	  && bfd_get_signed_32 (core_bfd, descdata + KF_FD) == fd)
-- 
2.18.0

  parent reply	other threads:[~2018-09-18 18:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 18:55 [PATCH v3 0/8] Add a new 'info proc files' command John Baldwin
2018-09-18 18:55 ` [PATCH v3 2/8] Generate aclocal-m4-deps.mk more deterministically and portably John Baldwin
2018-09-18 20:27   ` Simon Marchi
2018-09-19  3:01     ` Sergio Durigan Junior
2018-09-18 18:55 ` [PATCH v3 8/8] Make the "info proc" documentation more consistent John Baldwin
2018-09-18 19:16   ` Eli Zaretskii
2018-10-06 15:26   ` [PATCH] Update string expected from "help info proc" on gdb.base/info-proc.exp Sergio Durigan Junior
2018-10-08 15:55     ` John Baldwin
2018-09-18 18:55 ` [PATCH v3 7/8] Document the 'info proc files' command John Baldwin
2018-09-18 19:16   ` Eli Zaretskii
2018-09-18 18:55 ` John Baldwin [this message]
2018-09-18 18:55 ` [PATCH v3 3/8] Import gnulib's inet_ntop module John Baldwin
2018-09-18 18:55 ` [PATCH v3 6/8] Support 'info proc files' on live FreeBSD processes John Baldwin
2018-09-18 19:04 ` [PATCH v3 5/8] Add support for 'info proc files' on FreeBSD core dumps John Baldwin
2018-09-18 19:04 ` [PATCH v3 4/8] Add a new 'info proc files' subcommand of 'info proc' John Baldwin

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=20180918185444.89533-2-jhb@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).