From 2949597251fea7f17a0e46c1c885e34b53395d18 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 6 Oct 2008 03:07:09 -0400 Subject: PR4886: check build-id if able. This provides sanity check of debuginfo file based on build-id. Many cases are considered, whether build-id exists in debuginfo file or not, whether module is loaded or not, whether build-id exists in runtime kernel/module. It will do work when LD >= 2.18 and kernel >=2.6.23, otherwise no check. --- runtime/transport/symbols.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'runtime/transport/symbols.c') diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index 4bdd0904..faba0986 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -51,8 +51,16 @@ static void _stp_do_relocation(const char __user *buf, size_t count) if (strcmp (_stp_modules[mi]->name, msg.module)) continue; + /* update note section to represent loaded */ + if (_stp_modules[mi]->notes_sect == 0) + _stp_modules[mi]->notes_sect = 1; for (si=0; si<_stp_modules[mi]->num_sections; si++) { + if (!strcmp (".note.gnu.build-id", msg.reloc)) { + _stp_modules[mi]->notes_sect = msg.address; + continue; + } + if (strcmp (_stp_modules[mi]->sections[si].name, msg.reloc)) continue; @@ -134,7 +142,8 @@ static int _stp_section_is_interesting(const char *name) { int ret = 1; if (!strncmp("__", name, 2) - || !strncmp(".note", name, 5) + || (!strncmp(".note", name, 5) + && strncmp(".note.gnu.build-id", name, 18)) || !strncmp(".gnu", name, 4) || !strncmp(".mod", name, 4)) ret = 0; -- cgit From 0d633db21595f7160d0f7a767ab92181284d8adb Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 7 Oct 2008 13:06:17 -0400 Subject: PR4886: weaken build-id failure semantics --- runtime/transport/symbols.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'runtime/transport/symbols.c') diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index faba0986..1cd78724 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -51,20 +51,19 @@ static void _stp_do_relocation(const char __user *buf, size_t count) if (strcmp (_stp_modules[mi]->name, msg.module)) continue; - /* update note section to represent loaded */ - if (_stp_modules[mi]->notes_sect == 0) - _stp_modules[mi]->notes_sect = 1; + if (!strcmp (".note.gnu.build-id", msg.reloc)) { + _stp_modules[mi]->notes_sect = msg.address; /* cache this particular address */ + } + for (si=0; si<_stp_modules[mi]->num_sections; si++) { - if (!strcmp (".note.gnu.build-id", msg.reloc)) { - _stp_modules[mi]->notes_sect = msg.address; - continue; - } - if (strcmp (_stp_modules[mi]->sections[si].name, msg.reloc)) continue; - - _stp_modules[mi]->sections[si].addr = msg.address; + else + { + _stp_modules[mi]->sections[si].addr = msg.address; + break; + } } /* loop over sections */ } /* loop over modules */ } -- cgit