Contributed by tbert on 2014-06-03 from the loading-the-dice dept.

Otto Moerbeek (otto@) continues his mastery of all things memory allocation, extending some of the libc malloc features to ld.so(1):

ld.so has a very basic malloc. This diff changes it to use a (somewhat stripped) libc malloc with all the randomization and other goodness.

The diff has malloc, free and calloc, no realloc. A next sweep would actually use calloc (and reallocarray) in ld.so. It currently only uses malloc (with zero filling!), but there's room for improvement here.

I only tested this on sparc64. Please help and test this on various platforms.

Keep a root shell and a copy of ld.so handy in case it blows up.