/hg/release/icedtea7-forest-2.4/hotspot: 8038392: Generating pre...

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Wed May 21 18:02:04 UTC 2014


changeset ffef4049ab32 in /hg/release/icedtea7-forest-2.4/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.4/hotspot?cmd=changeset;node=ffef4049ab32
author: andrew
date: Fri May 16 16:39:47 2014 +0100

	8038392: Generating prelink cache breaks JAVA 'jinfo' utility normal behavior
	Summary: See RH1064383 (https://bugzilla.redhat.com/show_bug.cgi?id=1064383)
	Contributed-by: Carlos Santos <casantos at redhat.com>


diffstat:

 agent/src/os/linux/ps_proc.c |  52 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 47 insertions(+), 5 deletions(-)

diffs (69 lines):

diff -r 0c479601fd12 -r ffef4049ab32 agent/src/os/linux/ps_proc.c
--- a/agent/src/os/linux/ps_proc.c	Thu Apr 17 17:20:17 2014 +0100
+++ b/agent/src/os/linux/ps_proc.c	Fri May 16 16:39:47 2014 +0100
@@ -261,7 +261,7 @@
 
 static bool read_lib_info(struct ps_prochandle* ph) {
   char fname[32];
-  char buf[256];
+  char buf[PATH_MAX];
   FILE *fp = NULL;
 
   sprintf(fname, "/proc/%d/maps", ph->pid);
@@ -271,10 +271,52 @@
     return false;
   }
 
-  while(fgets_no_cr(buf, 256, fp)){
-    char * word[6];
-    int nwords = split_n_str(buf, 6, word, ' ', '\0');
-    if (nwords > 5 && find_lib(ph, word[5]) == false) {
+  while(fgets_no_cr(buf, PATH_MAX, fp)){
+    char * word[7];
+    int nwords = split_n_str(buf, 7, word, ' ', '\0');
+
+    if (nwords < 6) {
+      // not a shared library entry. ignore.
+      continue;
+    }
+
+    if (word[5][0] == '[') {
+        // not a shared library entry. ignore.
+      if (strncmp(word[5],"[stack",6) == 0) {
+        continue;
+      }
+      if (strncmp(word[5],"[heap]",6) == 0) {
+        continue;
+      }
+
+      // SA don't handle VDSO
+      if (strncmp(word[5],"[vdso]",6) == 0) {
+        continue;
+      }
+      if (strncmp(word[5],"[vsyscall]",6) == 0) {
+        continue;
+      }
+    }
+
+    if (nwords > 6) {
+      // prelink altered mapfile when the program is running.
+      // Entries like one below have to be skipped
+      //  /lib64/libc-2.15.so (deleted)
+      // SO name in entries like one below have to be stripped.
+      //  /lib64/libpthread-2.15.so.#prelink#.EECVts
+      char *s = strstr(word[5],".#prelink#");
+      if (s == NULL) {
+        // No prelink keyword. skip deleted library
+        print_debug("skip shared object %s deleted by prelink\n", word[5]);
+        continue;
+      }
+
+      // Fall through
+      print_debug("rectifing shared object name %s changed by prelink\n", word[5]);
+      *s = 0;
+    }
+
+    if (find_lib(ph, word[5]) == false) {
        intptr_t base;
        lib_info* lib;
 #ifdef _LP64


More information about the distro-pkg-dev mailing list