[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 >
rl-bins
# 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:
/usr/bin/gdb
135: 0000000000000000 0 FUNC GLOBAL DEFAULT UND
_rl_qsort_string_compare
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
_rl_completion_prefix_dis
5345: 0000000000b11228 4 OBJECT GLOBAL DEFAULT 26
_rl_print_completions_hor
5734: 0000000000b11968 4 OBJECT GLOBAL DEFAULT 26
_rl_complete_mark_directo
/usr/bin/lftp
272: 000000000020f598 4 OBJECT GLOBAL DEFAULT 25
_rl_mark_modified_lines
/usr/bin/rlwrap
160: 0000000000212690 4 OBJECT GLOBAL DEFAULT 25
_rl_horizontal_scroll_mod
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.,
sumbols
from the history library?), so we'd need to search for the full set of symbols
your patch hides for a complete picture.
Thanks,
Pedro Alves
- Re: [Bug-readline] [PATCH] Enable visibility annotations, (continued)
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Mike Frysinger, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Mike Frysinger, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Chet Ramey, 2016/04/15
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Pedro Alves, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Pedro Alves, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/14
- Re: [Bug-readline] [PATCH] Enable visibility annotations,
Pedro Alves <=
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/15
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Pedro Alves, 2016/04/15
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/15
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Pedro Alves, 2016/04/18
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/18
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Pedro Alves, 2016/04/18
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Pedro Alves, 2016/04/18
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/19
- [Bug-readline] Fwd: Re: [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/19
- Re: [Bug-readline] [PATCH] Enable visibility annotations, Yury Gribov, 2016/04/20