On Fri, Nov 13, 2015 at 09:11:46AM +0000, David CARLIER wrote:
> Hi all,
>
> I ve tried to discuss this point with Otto Moerbeek but he might be
> very busy so I throw the topic here if you do not mind ...
>
> I have the habit to enable MALLOC_STATS but with the recent pledge
> feature, it s now difficult to debug some pledged applications with
> MALLOC_OPTIONS=D as, for malloc_dump, wpath and rpath are needed ...
> and it is fore sure not wishable to enable those in those userland
> apps.
>
> Is there a way, somehow, to succeed ? For the moment I ve slighty
> modified malloc_dump to only write on stderr and then I redirect the
> output myself.
>
> Thanks in advance.
>
> Kind regards.
you're too fast...
I do not like writing to stderr. The idea is that malloc writes the
info only if a writable malloc.out file already exists in the cwd.
An idea would be to open the fd at init time, which should be early
enough for most cases (i.e. before the first pledge(2) call). Big
drawback is the open fd all the time until program exits.
Another way would be to special case malloc.out in in the kernel. Not
too nice either.
-Otto