* [PATCH 3/3] PR 10081: improve error message for verifying build-id
@ 2009-04-24 10:42 Wenji Huang
2009-04-24 20:23 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Wenji Huang @ 2009-04-24 10:42 UTC (permalink / raw)
To: systemtap; +Cc: Wenji Huang
* runtime/sym.c: Print build-id if not matched.
---
runtime/sym.c | 51 +++++++++++++++++++++++----------------------------
1 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/runtime/sym.c b/runtime/sym.c
index 013edd0..aeff70d 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -271,34 +271,29 @@ static int _stp_module_check(void)
dwfl_module_build_id was not intended to return the end address. */
notes_addr -= m->build_id_len;
- if (notes_addr > base_addr) {
- for (j = 0; j < m->build_id_len; j++)
- {
- unsigned char theory, practice;
- theory = m->build_id_bits [j];
- practice = ((unsigned char*) notes_addr) [j];
- /* XXX: consider using kread() instead of above. */
- if (theory != practice)
- {
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
- _stp_error ("%s: inconsistent %s build-id byte #%d "
- "(0x%x [actual] vs. 0x%x [debuginfo])\n",
- THIS_MODULE->name, m->name, j,
- practice, theory);
- return 1;
- #else
- /* This branch is a surrogate for
- kernels affected by Fedora bug
- #465873. */
- printk(KERN_WARNING
- "%s: inconsistent %s build-id byte #%d "
- "(0x%x [actual] vs. 0x%x [debuginfo])\n",
- THIS_MODULE->name, m->name, j,
- practice, theory);
- break; /* Note just the first mismatch. */
- #endif
- }
- }
+ if (notes_addr <= base_addr) /* shouldn't happen */
+ continue;
+ if (strncmp(m->build_id_bits, (unsigned char*) notes_addr, m->build_id_len)) {
+ const char *basename;
+
+ basename = strrchr(m->path, '/');
+ if (basename)
+ basename++;
+ else
+ basename = m->path;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+ _stp_error ("Build-id mismatch: \"%s\" %.*M"
+ " vs. \"%s\" %.*M\n",
+ m->name, m->build_id_len, notes_addr,
+ basename, m->build_id_len, m->build_id_bits);
+ return 1;
+#else
+ /* This branch is a surrogate for kernels
+ * affected by Fedora bug #465873. */
+ printk(KERN_WARNING
+ "Build-id mismatch: \"%s\" vs. \"%s\"\n",
+ m->name, basename);
+#endif
}
} /* end checking */
} /* end loop */
--
1.5.6
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 3/3] PR 10081: improve error message for verifying build-id
2009-04-24 10:42 [PATCH 3/3] PR 10081: improve error message for verifying build-id Wenji Huang
@ 2009-04-24 20:23 ` Roland McGrath
0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2009-04-24 20:23 UTC (permalink / raw)
To: Wenji Huang; +Cc: systemtap
> + if (strncmp(m->build_id_bits, (unsigned char*) notes_addr, m->build_id_len)) {
They are not strings. This should be memcmp.
Thanks,
Roland
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-24 20:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 10:42 [PATCH 3/3] PR 10081: improve error message for verifying build-id Wenji Huang
2009-04-24 20:23 ` Roland McGrath
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).