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

mstats() crashes under ASan #109

Closed
ramosian-glider opened this issue Aug 31, 2015 · 5 comments
Closed

mstats() crashes under ASan #109

ramosian-glider opened this issue Aug 31, 2015 · 5 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 109

* Mac OS X 10.7
* LLVM r160364 and r163674
* Without -faddress-sanitizer, the program runs fine.
* This affects Firefox's "about:memory" feature.
* ASan doesn't print a stack trace for this crash.

#include <malloc/malloc.h>
int main()
{
    struct mstats stats = mstats();
    return 0;
}

clang++ -faddress-sanitizer && ./a.out

==68231== ERROR: AddressSanitizer crashed on unknown address 0x000000000000 (pc 0x000000000000
sp 0x7fff6b3ce9a8 bp 0x7fff6b3ce9f0 T0)

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007fff882524fe in malloc_zone_statistics ()
#2  0x00007fff88252555 in mstats ()
#3  0x0000000100000f30 in main ()

Reported by jruderman on 2012-09-12 02:25:24

@ramosian-glider
Copy link
Member Author

I've committed a dummy implementation of stats callback in Clang r163690, so your code
shouldn't crash now.
This will populate malloc_statistics_t with zeroes.
Will need to dive into ASan's allocator to return reasonable counters.

Reported by ramosian.glider on 2012-09-12 09:42:14

  • Status changed: Started
  • Labels added: OpSys-OSX

@ramosian-glider
Copy link
Member Author

As of r163716 malloc_zone_statistics() returns reasonable results.

Reported by ramosian.glider on 2012-09-12 15:35:11

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

Firefox's about:memory works under ASan now. (Sometimes it calculates a negative heap-unused,
but that could just as easily be a Firefox bug as an ASan bug.)

Thanks!

Reported by jruderman on 2012-09-12 17:33:29

@ramosian-glider
Copy link
Member Author

I believe ASan always returns positive numbers, but if you have a good test to assess
the sanity of the numbers returned by mstat, I'd appreciate that.

Reported by ramosian.glider on 2012-09-12 17:50:41

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:13:00

  • Labels added: ProjectAddressSanitizer

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

No branches or pull requests

1 participant