This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Handle mallinfo2
ClosedPublic

Authored by vitalybuka on Nov 15 2021, 3:39 PM.

Details

Summary

mallinfo is deprecated by GLIBC

Diff Detail

Event Timeline

vitalybuka requested review of this revision.Nov 15 2021, 3:39 PM
vitalybuka created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2021, 3:39 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
pcc added a subscriber: pcc.Nov 15 2021, 3:44 PM

Doesn't this require a wrapper for mallinfo2() as well that returns a struct mallinfo2?

pcc added inline comments.Nov 15 2021, 3:46 PM
compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
263

It doesn't look like glibc's headers define a macro named mallinfo2, so this will always be false.

vitalybuka planned changes to this revision.Nov 15 2021, 3:50 PM

Doesn't this require a wrapper for mallinfo2() as well that returns a struct mallinfo2?

Thanks, it does.

compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
263
vitalybuka marked an inline comment as not done.Nov 15 2021, 3:55 PM
vitalybuka added inline comments.
compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp
263

I mean, you are correct, I need to do something better. Probably check GLIBC version,
It was speculative fix without trying on the bot.

https://lab.llvm.org/staging/#/builders/97/builds/560/steps/37/logs/stdio

vitalybuka marked an inline comment as not done.

handle mallinfo2

vitalybuka marked an inline comment as done.Nov 15 2021, 5:22 PM
vitalybuka added a reviewer: pcc.
cryptoad added inline comments.Nov 16 2021, 8:31 AM
compiler-rt/lib/scudo/standalone/wrappers_c.inc
61 ↗(On Diff #387451)

While the test requires the check, is there something that always prevents us from defining mallinfo2? I don't think it would conflict with anything, and it would be there for people to use it if they want.

vitalybuka marked an inline comment as done.

define always

cryptoad accepted this revision.Nov 16 2021, 1:34 PM
This revision is now accepted and ready to land.Nov 16 2021, 1:34 PM
vitalybuka retitled this revision from [NFC][scudo] Use mallinfo2 if availible to [scudo] Use mallinfo2 if availible.Nov 16 2021, 7:29 PM
vitalybuka retitled this revision from [scudo] Use mallinfo2 if availible to [scudo] Handle mallinfo2.
This revision was automatically updated to reflect the committed changes.