linux - Avoid dumping information in a core file -
i want avoid dumping information program core file in case of crash.
for that, can use coredump_filter (http://man7.org/linux/man-pages/man5/core.5.html)
the man page provides following description
the value in file bit mask of memory mapping types (see mmap(2)). if bit set in mask, memory mappings of corresponding type dumped; otherwise not dumped. bits in file have following meanings:
bit 0 dump anonymous private mappings. bit 1 dump anonymous shared mappings. bit 2 dump file-backed private mappings. bit 3 dump file-backed shared mappings. bit 4 (since linux 2.6.24) dump elf headers. bit 5 (since linux 2.6.28) dump private huge pages. bit 6 (since linux 2.6.28) dump shared huge pages.
i looking know bit set , reset in case. not clear these fields specially private , shared.
i have buffer (unsigned char*) memory. not want dumped core file in case of crash. there specific flag have use mmap? please help. in advance.
coredump_filter
set process-global settings, allow dump memory or none, basically.
however, there flag madvise
closer want: madv_dontdump
. flag specific memory pages not appearing in coredump. program need run madvise
itself, though; can't set outside process (except using gdb
, guess).
do note madvise
operates on entire pages, however. can't set flag "these 193 bytes" or somesuch not dumped. if flag page buffer in, rest of same page won't dumped either. if problem you, think you'll have mmap
in buffer instead of malloc
ing it, alone in page.
Comments
Post a Comment