diff options
author | Wenji Huang <wenji.huang@oracle.com> | 2009-04-27 06:12:36 -0400 |
---|---|---|
committer | Wenji Huang <wenji.huang@oracle.com> | 2009-04-26 23:05:17 -0400 |
commit | 097e4a5b397b9e826453e01caa1f8169886128c5 (patch) | |
tree | 74c243f7c29a43cba29104d7df0be0f1a4e54004 /runtime/sym.c | |
parent | c4f51a54acff992cf19902ffd56e8338158c5811 (diff) | |
download | systemtap-steved-097e4a5b397b9e826453e01caa1f8169886128c5.tar.gz systemtap-steved-097e4a5b397b9e826453e01caa1f8169886128c5.tar.xz systemtap-steved-097e4a5b397b9e826453e01caa1f8169886128c5.zip |
PR10081: improve error message for verifying build-id
Output debuginfo file name and build-id if verification
failed.
* runtime/sym.c: Print more info if not matched.
Diffstat (limited to 'runtime/sym.c')
-rw-r--r-- | runtime/sym.c | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/runtime/sym.c b/runtime/sym.c index 013edd0c..63dad1af 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 (memcmp(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 */ |