Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifying .PLT.GOT section not found with warn or error message? #529

Closed
DanielTimLee opened this issue Oct 5, 2018 · 3 comments
Closed

Comments

@DanielTimLee
Copy link
Contributor

DanielTimLee commented Oct 5, 2018

Any chance of notifying .PLT.GOT section not found with warn or error message?

I was kinda hard to find out why my /bin/ls is not traceable with plt_hooking.

$ uftrace --force --no-pager /bin/ls -l
total 24
-rw-r--r-- 1 vagrant vagrant    84 10월  5 01:37 a.c
-rwxr-xr-x 1 vagrant vagrant 17000 10월  5 01:37 a.out
WARN: cannot open record data: /tmp/uftrace-live-yAytxj: No data available

$ uftrace -vv --force --no-pager /bin/ls -l
mcount: setup PLT hooking                                                                                                                                                                              
mcount: setup plthook data for /usr/bin/ls (offset: 56386399e000)                                                                                                                                      
mcount: opening executable image: /usr/bin/ls                                                                                                                                                          
mcount: no PLTGOT nor BIND-NOW.. ignoring...                                                                                                                                                           
mcount: mcount setup done                                                                                                                                                                              
total 24
-rw-r--r-- 1 vagrant vagrant    84 10월  5 01:37 a.c
-rwxr-xr-x 1 vagrant vagrant 17000 10월  5 01:37 a.out
uftrace: MSG FINISH
uftrace: all process/thread exited                                                                                                                                                                     
uftrace: child terminated with exit code: 0   
...
uftrace: live-record finished.. 
uftrace: start live-replaying...
WARN: cannot open record data: /tmp/uftrace-live-kENa1j: No data available
uftrace: removing /tmp/uftrace-live-kENa1j directory

How about notifying with
WARN: cannot find .PLT.GOT in ELF. Is your executable compiled with --no-plt?

(+ I think this message should be ERROR not WARN. Cause the execution of this command has been failed completely.)

@DanielTimLee DanielTimLee changed the title Notifying Notifying no .PLT.GOT section found with debug message? Oct 5, 2018
@DanielTimLee DanielTimLee changed the title Notifying no .PLT.GOT section found with debug message? Notifying no .PLT.GOT section found with error message? Oct 5, 2018
@DanielTimLee DanielTimLee changed the title Notifying no .PLT.GOT section found with error message? Notifying no .PLT.GOT section found with warn or error message? Oct 5, 2018
@DanielTimLee DanielTimLee reopened this Oct 5, 2018
@DanielTimLee DanielTimLee changed the title Notifying no .PLT.GOT section found with warn or error message? Notifying no .PLT.GOT section not found with warn or error message? Oct 5, 2018
@DanielTimLee DanielTimLee changed the title Notifying no .PLT.GOT section not found with warn or error message? Notifying .PLT.GOT section not found with warn or error message? Oct 5, 2018
@namhyung
Copy link
Owner

namhyung commented Oct 5, 2018

Having no PLT itself is not a problem so I don't think we need a warning or an error for it. Your application can be built with --no-plt and uftrace can trace it as long as it's built with -pg or -finstrument-functions. In this case you tried to trace /bin/ls (with --force) which has no traceable functions.

@DanielTimLee
Copy link
Contributor Author

DanielTimLee commented Oct 5, 2018

Just out of curiosity,

I'm totally aware that this project will not explain everything about .PLT.GOT or compiler options.
If this Project directional doesn't match with adding a bunch of comments about the desired functionality, It's totally fine. I stand up for that idea.

But in this case, with all due respect,
doesn't program has to inform about why it won't work as it desired unless it is a bug?

uftrace offers tracing functionality,
however, for now, it doesn't support library call hooking with --no-plt compiled program.

Wouldn't it be more user friendly to inform users about why it won't work correctly?
Or at least, simply shows users about whether the result is desired or not with WARN or ERROR?

In my experience,
when the uftrace result just shows me a WARN message (which means it's desired result) and with no tracing result, I start to think about what I have been doing wrong (maybe missing args with gcc?).

I'm not saying this tool have to explain bits and pieces about why it won't work as it is.

But if command results provide some more informative messages, it would be a lot more helpful for users to debug.

@namhyung
Copy link
Owner

namhyung commented Oct 9, 2018

Users can use -v option to see detailed messages when something goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants