Skip to contentSkip to conversation

debug-for-missing-loader-and-libc

PATCH In review Maninder Singh 2 participants 2 messages Apr 6, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 debug-for-missing-loader-and-libc

Hi,

During cross prelink if we miss out ld-linux.so.* or libc.so.* It prints below info:
./prelink: /test_binary: Could not parse `prelink-rtld: dl-version.c:219: rtld_check_map_versions:
Assertion `needed != ((void *)0)' failed.'

And thus we miss actual cause for this failure, by this patch we will know failure reason. ./prelink: /test_binary: Could not parse `./prelink-rtld: error while loading shared libraries: ld-linux.so.3' (In this case ld-linux.so.3 was missing)

---
 src/rtld/dl-version.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
src/rtld/dl-version.c +6 -1
index e4040a6..eb62943 100644
@@ -216,6 +216,12 @@ _dl_check_map_versions (struct ldlibs_link_map *map, int verbose, int trace_mode
      /* If NEEDED is NULL this means a dependency was not found
         and no stub entry was created.  This should never happen.  */
+     if(needed == NULL)
+       {
+         _dl_signal_error (errval, NULL, NULL, strtab + ent->vn_file);
+         printf("error while loading shared libraries: %s", strtab + ent->vn_file);
+         exit(0);
+       }
      assert (needed != NULL);
      /* Make sure this is no stub we created because of a missing
--

1.7.1

And also if it is ok we can remove this one --- assert (needed != NULL); because we are using exit(0) for (needed==NULL)

Thanks,
Maninder Singh

#1 lore raw
Quoted 22 lines · Maninder Singh

Hi,

During cross prelink if we miss out ld-linux.so.* or libc.so.* It prints below info:
./prelink: /test_binary: Could not parse `prelink-rtld: dl-version.c:219: rtld_check_map_versions:
Assertion `needed != ((void *)0)' failed.'

And thus we miss actual cause for this failure, by this patch we will know failure reason. ./prelink: /test_binary: Could not parse `./prelink-rtld: error while loading shared libraries: ld-linux.so.3' (In this case ld-linux.so.3 was missing)

---
 src/rtld/dl-version.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
src/rtld/dl-version.c +0 -0
index e4040a6..eb62943 100644

src/rtld/dl-version.c _dl_check_map_versions (struct ldlibs_link_map *map, int verbose, int trace_mode · line 222

Quoted 7 lines
src/rtld/dl-version.c +5 -0
@@ -216,6 +216,12 @@ _dl_check_map_versions (struct ldlibs_link_map *map, int verbose, int trace_mode
      /* If NEEDED is NULL this means a dependency was not found
         and no stub entry was created.  This should never happen.  */
+     if(needed == NULL)
+       {
+         _dl_signal_error (errval, NULL, NULL, strtab + ent->vn_file);
+         printf("error while loading shared libraries: %s", strtab + ent->vn_file);
+         exit(0);

I'm likely to change this to an exit 1. As I want to make sure that any failures have a non 0 return code.

I believe the assert is in the original rtld code, but I'll check that and remove it if it's something I added.

--Mark

Quoted 12 lines
src/rtld/dl-version.c +1 -1
+       }
      assert (needed != NULL);
      /* Make sure this is no stub we created because of a missing
--

1.7.1

And also if it is ok we can remove this one --- assert (needed != NULL); because we are using exit(0) for (needed==NULL)

Thanks,
Maninder Singh