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

check return value of dladdr #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lugia-kun
Copy link

@lugia-kun lugia-kun commented May 1, 2020

dladdr leave unchanged for info (on Linux), when it returns error (0).

This can be checked easily with following C code, which causes a segmentation fault before this change.

#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char** argv)
{
  Dl_info info;
  memset(&info, 0xfe, sizeof(info)); /* fill with inaccessible address */
  dladdr(NULL, &info);
  return 0;
}

@rdp
Copy link

rdp commented Nov 9, 2021

Any way this could get applied?

@josch
Copy link

josch commented Nov 9, 2021

@rdp Which distro are you using? You might have more luck approaching the package maintainers of your distro and ask them if they can apply that patch.

@rdp
Copy link

rdp commented Nov 9, 2021

Ahh its unmaintained #84 durn...

@rdp
Copy link

rdp commented Nov 11, 2021

@josch Ubuntu so maybe you could help? :)

@josch
Copy link

josch commented Nov 11, 2021

I'm the package maintainer in Debian. So I can apply this fix and then Ubuntu will (hopefully) copy it over from Debian unstable for the jammy release. I am not a Ubuntu developer, so I cannot directly make changes there.

@josch
Copy link

josch commented Nov 11, 2021

@rdp I now added the changes from this pull request to the version that Debian ships. It should end up in Ubuntu at some point as well.

@lugia-kun I also added a test case using your code above. Please consider adding the test case to this pull request as well: https://sources.debian.org/src/fakechroot/2.20.1+ds-1/debian/patches/0008-check-return-value-of-dladdr.patch/

@rdp
Copy link

rdp commented Nov 12, 2021 via email

@lugia-kun
Copy link
Author

Fixes crystal-lang/crystal#9209

Thanks for adding a test case.

josch pushed a commit to josch/fakechroot that referenced this pull request Aug 24, 2022
josch pushed a commit to josch/fakechroot that referenced this pull request Aug 24, 2022
@josch
Copy link

josch commented Aug 24, 2022

Hi @lugia-kun, could you mark test/t/dladdr.t as executable with chmod +x test/t/dladdr.t and add this change to this pull request? Thanks!

josch pushed a commit to josch/fakechroot that referenced this pull request Aug 24, 2022
josch pushed a commit to josch/fakechroot that referenced this pull request Aug 25, 2022
josch pushed a commit to josch/fakechroot that referenced this pull request Oct 28, 2022
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

Successfully merging this pull request may close these issues.

3 participants