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

kcov: error: Cannot open linux-vdso.so.1 #26

Closed
gsingh93 opened this Issue Aug 24, 2014 · 14 comments

Comments

Projects
None yet
3 participants
@gsingh93

gsingh93 commented Aug 24, 2014

I get this error when running kcov on Arch Linux:

kcov: error: Cannot open linux-vdso.so.1

ldd shows the shared library exists. The kcov folder is generated, but the HTML shows that the binary was never run.

Any ideas?

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented Aug 25, 2014

Are you sure the binary has debug symbols (compiled with -g)? And that the source code can be found?

I believe this error (really a warning) can be triggered if you run a 32-bit binary with a 64-bit kcov. kcov won't be able to collect information from shared libraries then, but the normal collection (i.e., from the program itself) should still work fine.

@gsingh93

This comment has been minimized.

gsingh93 commented Aug 25, 2014

Yea, this turned out to be a makefile bug forgetting the -g flag. For the record, I was running 64-bit kcov on a 64-bit binary, and the warning still appeared. Thanks for the help.

@gsingh93 gsingh93 closed this Aug 25, 2014

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented Aug 25, 2014

Is this the git HEAD or an older version from arch? kcov should warn if a binary doesn't have any symbols (albeit only since v20).

@gsingh93

This comment has been minimized.

gsingh93 commented Aug 26, 2014

The AUR package pulls from Git, so it should be the latest version. I was using kcov with a program written in Rust, not a normal C/C++ binary. I assume rustc doing something differently than gcc is related to why no error was shown.

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented Aug 27, 2014

Could you just try with a binary compiled from C,

int main(int argc, const char *argv[])
{
    return 0;
}

compiled with gcc -g and run that? Or perhaps run your rust binary with kcov --skip-solibs first? The linux-vdso.1 error still nags me a bit :-)

@remram44

This comment has been minimized.

remram44 commented May 24, 2015

I'm running into this. Initially for Rust but I see the same thing with a C program.

remram@missy:/tmp$ cat > test.c
int main(int argc, const char *argv[])
{
    return 0;
}
remram@missy:/tmp$ gcc -g test.c -o test
remram@missy:/tmp$ kcov test_kcov ./test
Error: Cannot open linux-vdso.so.1

remram@missy:/tmp$

I'm using v27 built today on Debian Jessie x86_64.

@remram44

This comment has been minimized.

remram44 commented May 24, 2015

Note that surprisingly, this doesn't prevent the generation of a report for the C program (although the Rust programs gets 0% reported coverage).

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented May 24, 2015

Hmm... And in your case, both programs are 64-bit binaries?

If I run a 32-bit program on a 64-bit system (with a 32-bit kcov), I see the linux-vdso.so.1 problem as well.

Do you see anything special if you run kcov under strace? Note that the coverage collection will not work in that case, but I think the linux-vdso.so.1 issue happens at startup. Reopening for now.

@SimonKagstrom SimonKagstrom reopened this May 24, 2015

@remram44

This comment has been minimized.

remram44 commented May 24, 2015

Everything is 64bit here. I can reproduce this on Vagrant so you should have no problem troubleshooting it.

Here is the result from strace anyway

I don't think this is what prevents me from getting coverage reports from my Rust program though, since I get the report for a C program... I must be missing something else.

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented May 24, 2015

Unfortunately, I don't know rust Is there something akin to -g missing from the compilation command line there? If you run kcov with --debug=15 you'll get debug output for e.g., where it tries to set breakpoints and where they are hit afterwards.

I'll take a look at the issue again. I didn't know about vagrant before, looks useful, thanks!

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented May 26, 2015

I'm working on reproducing this - having had some problems with Vagrant. I'm hoping I can look at this tonight though.

@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented May 26, 2015

Narrowing it down for a bit, this is caused by the solib handling. This is done through using a LD_PRELOAD:ed library, and if this is omitted through running kcov with --skip-solibs, the warning/error goes away.

I suspect this will not help with your rust issue though.

@remram44

This comment has been minimized.

remram44 commented May 26, 2015

I got Rust code to work fine, on both Ubuntu (where the error is not shown) and Debian (where the error is still shown) 😃

So definitely not a critical issue, although since it always happens you probably want to do something about it.

SimonKagstrom added a commit that referenced this issue May 26, 2015

Issue #26: elf-parser: Don't warn for non-existing ELFs (linux-vdso.s…
…o.1)

linux-vdso.so.1 is inserted by the kernel into the binary, and thus
can't be opened or parsed. This is no problem, so don't print a scary
warning for it.
@SimonKagstrom

This comment has been minimized.

Owner

SimonKagstrom commented May 26, 2015

Fixed with b61c93e.

It turns out that this was just a spurious issue anyway. kcov tries to parse linux-vdso.so.1 since it's part of the memory map (as a loaded library). However, this library is just inserted by the kernel, and is not present in the file system and it can't be opened because of that. So the fix just turns the error message into a debug warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment