Bug 20102 - malloc(3) should document MALLOC_PERTURB_ env option
Summary: malloc(3) should document MALLOC_PERTURB_ env option
Status: RESOLVED CODE_FIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: man-pages (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Michael Kerrisk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 19:00 UTC by Mike Frysinger
Modified: 2012-04-14 20:54 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Mike Frysinger 2010-10-11 19:00:13 UTC
setting MALLOC_PERTURB_ in the env will take that number and initialize all malloc's with that value (and the inverse when freeing).  this should be documented in malloc(3) (and noted in free(3)).

e.g. if you set MALLOC_PERTURB_=123, glibc will do memset((123 ^ 0xff) & 0xff) when doing malloc(), and then glibc will do memset(123 & 0xff) when doing free()
Comment 1 Michael Kerrisk 2010-10-23 12:31:55 UTC
Mike,

Thanks for the heads-up on this. Looking closer, there are a bunch of these environment variables that are undocumented, and they're also closely related to the mallopt() library function, which is also undocumented. I think it would be best to document all of this stuff together, and best done on a mallopt(3) page, rather that in the existing malloc(3). (And yes, the MALLOC_TRACE_ info that is currently in mallopt(3) should probably also move to the to-be-created mallopt(3) page.) I'll get onto this.

Thanks,

Michael
Comment 2 Michael Kerrisk 2012-04-14 20:54:29 UTC
man-pages-3.38 added mallopt(3) page which covers MALLOC_PERTURB_ and other malloc-related environment variables. With respect to mentions in malloc(3) and free(3), I've elected simply to use SEE ALSO.

For 3.39, I've just fixed a small error in the discussion of M_PERTURB and free().

Note You need to log in before you can comment on or make changes to this bug.