mimalloc icon indicating copy to clipboard operation
mimalloc copied to clipboard

Why is `mimalloc-redirect` closed-source?

Open p0358 opened this issue 1 year ago • 5 comments

While searching the definition of MIMALLOC_DISABLE_REDIRECT, I realized this part of the project isn't open-sourced and resides just in the form of a binary in bin/ dir, why is that?

I reverse engineered the file and found out PDB path at C:\Users\daan\dev\mimalloc-redirect\out\msvc-x64\Release\mimalloc-redirect.pdb which points at @daanx being its author. Could you please possibly open source its code? The reason is that I want to analyze how it performs the hooks and which functions it exactly hooks (even though I can mostly see it form decompilation). And again the reason for that is that some binaries out there are compiled with static CRT, I want to find out if it's viable to reverse engineer them to find the same functions and hook them up manually to mimalloc...

Having that part closed-source also prevents users from doing any kind of customization there...

p0358 avatar Jan 05 '24 19:01 p0358

Seconded, I'm tired of microsoft's closed source nonsense

9inefold avatar Jan 15 '24 04:01 9inefold

See also: https://github.com/microsoft/mimalloc/issues/171

DianaNites avatar Jul 23 '24 22:07 DianaNites

I've fully reverse engineered the dll for version 1.8.8, and I'll (maybe) do a write up soon. For now, here's the source (I rewrote it in C++): https://github.com/8ightfold/exiCPP/tree/main/redirect On MinSizeRel it's only about 10kb larger than the provided binaries :)

You could definitely set something up to extend the hooks. The most relevant files are DetoursSetup.cpp, DetoursImpl.cpp, and Patches.cpp.

Not 100% sure if some of the later patches' redirects even exist, but they seem to work in their dll, so I'll look into that later.

9inefold avatar Jan 25 '25 03:01 9inefold

Not 100% sure if some of the later patches' redirects even exist, but they seem to work in their dll, so I'll look into that later.

I found and fixed the issue. Turns out they were providing function stubs, so I implemented those (Interception.hpp and Patches.cpp). No more warnings/errors, and it doesn't crash.

It should give you an idea for how to do your own patches.

9inefold avatar Jan 27 '25 03:01 9inefold

@9inefold This goes far beyond "Microsoft's closed source nonsense."

It's completely unprofessional and frowned upon by every closed source project to even distribute compiled binaries within the source vcs (git repo). Binaries are always provided separately via unrelated channels, e.g. from an official website or Github releases. There's many reasons for this; ideologically, avoiding compiled binaries in the vcs expresses the explicit intent that this project should compile just fine for you with minimal hassle, so there's not even a need for compiled binaries.

Infact, I'd go so far as to say the inclusion of compiled binaries in the vcs—never mind that they're closed source—, bring into question the genuinity of Microsoft's intentions: is Microsoft really here to play ball with FOSS and help us promote world goodness or are they here for some quickie PR marketing?

anonyco avatar Jun 26 '25 01:06 anonyco