[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-readline] [PATCH] Enable visibility annotations

From: Pedro Alves
Subject: Re: [Bug-readline] [PATCH] Enable visibility annotations
Date: Thu, 14 Apr 2016 19:04:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 04/14/2016 05:42 PM, Yury Gribov wrote:
> On 04/14/2016 06:49 PM, Pedro Alves wrote:
>> On 04/14/2016 03:41 PM, Yury Gribov wrote:
>>> # Find all imported symbols in rootfs
>>> for f in $(find /bin /sbin /usr/bin /usr/sbin /usr/lib* /lib*); do if
>>> file $f | grep -q ELF; then readelf -sDW $f | awk '/UND/{print $9}'; fi
>> This doesn't seem right -- does it catch references to global variables?
>> Those won't be UND, I believe?
> You mean that linker generates copies of imported globals and then
> resolves them via copy relocations? Yeah, to detect those I'll need to
> examine copy relocations though, will do that tomorrow.

Right.  For example, running:

# Find all programs/libraries linked to libreadline.so
find /bin /sbin /usr/bin /usr/sbin /usr/lib* /lib* | while read f; do if file 
$f | grep -q ELF; then match=`readelf -a $f 2>&1 | grep -v "Not an ELF" | grep 
NEEDED | grep readline`; if [ -n "$match" ]; then echo "$f"; fi; fi; done > 

# Look for all symbols that start with "_rl_" in those binaries.
cat rl-bins | while read f; do match=`readelf -s $f | grep " _rl_"`; if [ -n 
"$match" ] ; then echo $f; readelf --dyn-syms $f | grep " _rl_"; fi ; done

On my Fedora 23 box, I get:

   135: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND 
   514: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _rl_erase_entire_line
  2636: 0000000000b12b10     4 OBJECT  GLOBAL DEFAULT   26 _rl_echoing_p
  4521: 0000000000b11440     4 OBJECT  GLOBAL DEFAULT   26 
  5345: 0000000000b11228     4 OBJECT  GLOBAL DEFAULT   26 
  5734: 0000000000b11968     4 OBJECT  GLOBAL DEFAULT   26 
   272: 000000000020f598     4 OBJECT  GLOBAL DEFAULT   25 
   160: 0000000000212690     4 OBJECT  GLOBAL DEFAULT   25 

Note that that catches "_rl_echoing_p" etc, which Mike's scan missed too.

Funny how even rlwrap uses private symbols...

readline has probably more private symbols that are not _rl_-prefixed (e.g., 
from the history library?), so we'd need to search for the full set of symbols
your patch hides for a complete picture.

Pedro Alves

reply via email to

[Prev in Thread] Current Thread [Next in Thread]