Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: recent changes to pthread_fork.c:fork() cause static linking to fail if the app provides its own malloc()



At Tue, 14 Jul 2020 20:05:57 -0000 (UTC), christos%astron.com@localhost (Christos Zoulas) wrote:
Subject: Re: recent changes to pthread_fork.c:fork() cause static linking to fail if the app provides its own malloc()
>
> It is not only _malloc_prefork(), it is also _malloc_postfork() and
> _malloc_postfork_child(). The easiest way to fix things is to provide
> them as no-op.

Indeed.

I guess this will have to be the way.  Perhaps some proper documentation
could/should be written about how to do this and exactly what APIs are
necessary to override the internal malloc() entirely.

Note that this is necessary in cases of malloc() et al in particular
for both static-linked and dynamic linked programs.

The difference is that with static linking one gets a linker error and
cannot continue, but with dynamic linking one silently invokes
"Undefined Behaviour" (i.e. depending on what the internal malloc() uses
to obtain heap space).

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpTkfSXrDq_Q.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index