fakechroot icon indicating copy to clipboard operation
fakechroot copied to clipboard

check return value of dladdr

Open lugia-kun opened this issue 4 years ago • 9 comments

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;
}

lugia-kun avatar May 01 '20 12:05 lugia-kun

Any way this could get applied?

rdp avatar Nov 09 '21 13:11 rdp

@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.

josch avatar Nov 09 '21 13:11 josch

Ahh its unmaintained #84 durn...

rdp avatar Nov 09 '21 15:11 rdp

@josch Ubuntu so maybe you could help? :)

rdp avatar Nov 11 '21 02:11 rdp

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 avatar Nov 11 '21 06:11 josch

@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/

josch avatar Nov 11 '21 20:11 josch

Thanks!

On Thu, Nov 11, 2021 at 1:05 PM josch @.***> wrote:

@rdp https://github.com/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 https://github.com/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/

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dex4er/fakechroot/pull/70#issuecomment-966588898, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADBUHZZRXHPYFYGG3KOVDULQO2FANCNFSM4MXCJ7WA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rdp avatar Nov 12 '21 02:11 rdp

Fixes crystal-lang/crystal#9209

Thanks for adding a test case.

lugia-kun avatar Nov 12 '21 14:11 lugia-kun

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 avatar Aug 24 '22 10:08 josch