3 ms·
There's a few utilities in the FreeBSD base system which use MAP_NOCORE -- I think mostly as a "this isn't useful so don't waste time dumping it" flag: mkimg, s
by cperciva 7y ago
There's a few utilities in the FreeBSD base system which use MAP_NOCORE -- I think mostly as a "this isn't useful so don't waste time dumping it" flag: mkimg, sort, grep. The libsodium we have imported into sys/contrib also mention it, but I don't know if those parts of libsodium are ever used by the FreeBSD userland.
Grepping the ports distfiles on my laptop, I see MAP_NOCORE mentioned in Cython, rust, qemu, firefox, and thunderbird; again, no idea how it's being used in those.
In the interest of compatibility, can I suggest
#define MAP_NOCORE MAP_CONCEAL
for now, and in the future if MAP_CONCEAL adds new functionality define it as MAP_NOCORE|MAP_CONCEAL_EXTRA? Since you have the capability to exclude regions from core dumps, you might as well expose it to programs which are aware of MAP_NOCORE.
PS. Linux has MADV_DONTDUMP and FreeBSD has MADV_NOCORE; I'd suggest handling those as well if you don't already do so.
- tedunangst 7y agoI don't think the intention was to be incompatible. I'll see about adding aliases.
- cperciva 7y agoThanks!
- hedora 7y agoClarification in the documentation about what happens with swap files would be nice, especially as aliases are added. “Conceal” (but not the manpage) suggests it won’t ever be written to swap, but “nocore” as a performance optimization suggests paging to swap is fine. If dirty concealed pages can’t be swapped, then it starts to look like mlock(), which requires escalated privileges on linux, at least... (Though, paging dirty mmapped pages to swap is kind of confusing in the first place.)
- tedunangst 7y agoSo the name conceal was chosen to allow some flexibility, like prohibiting ptrace. The idea is to keep secrets from escaping into other programs. Other programs generally can't read swap, so that's not a concern.
- darkhelmet 7y agoIt dates back to a hack at Yahoo. We originally excluded all mmap data from core dumps, but switched to using MAP_NOCORE extensively when it came in from upstream FreeBSD. For us it was a performance issue as we used large mmap files in our distributed shared memory system.