stub out Berkeley DB binary Runpath

I found out that all Berkeley DB binaries on Solaris x86 have (or had) problem whereby libraries are searched on /net directory.

# /usr/ccs/bin/elfdump -d /usr/lib/bdb/db_verify | grep 'R\*PATH'
       [5]  RUNPATH           0x225               /net/sunserver.loc0a/export/JES/U1/BDB/sbi/20070123.1/builds/solaris_x86/RELEASE/build.4.2.52_solaris_x86_5.10-RELEASE.01.23.2007.0847/usr/lib
       [6]  RPATH             0x225               /net/sunserver.loc0a/export/JES/U1/BDB/sbi/20070123.1/builds/solaris_x86/RELEASE/build.4.2.52_solaris_x86_5.10-RELEASE.01.23.2007.0847/usr/lib


I read this and thought about compiling the attached source. But I couldn't find x86 where SunStudio or gcc was installed.

Changing ELF Runpaths (Code Included) : Ali Bahrami
A recent change to Solaris ELF files makes it possible to change the runpath of a dynamic executable


Then I read this.

Introducing elfedit: A Tool For Modifying Existing ELF Objects : Ali Bahrami
elfedit can indeed modify the runpath in an object, but it is considerably more general than that. elfedit is a tool for examining and modifying the ELF metadata that resides within ELF objects.


So, I extracted elfedit and related libraries from internal Nevada install server onto Solaris 10. Maybe I'm showing my ignorance here. I couldn't make it work on Solaris 10. It could have possibly worked although surely not supported.

So, I decided to hack the binaries. I was a little scared when strings command didn't show it.

# /usr/bin/strings /usr/lib/bdb/db_verify | grep /net


But GNU strings can show it.

# /usr/sfw/bin/gstrings --target=elf32-i386 db_verify | grep /net
/net/sunserver.loc0a/export/JES/U1/BDB/sbi/20070123.1/builds/solaris_x86/RELEASE/build.4.2.52_solaris_x86_5.10-RELEASE.01.23.2007.0847/usr/lib


I used GNU sed to stub out runpath.

# gnused -i.backup 's|\\/net/sunserver.loc0a/export/JES/U1/BDB/sbi/20070123.1/builds/solaris_x86/RELEASE/build.4.2.52_solaris_x86_5.10-RELEASE.01.23.2007.0847/usr/lib|                                                                                                                                              |' db_\*
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today