News for hackers. Stuff that matters.
Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @08:22PM (#20110403)
Do you know of anything using it? I haven't seen it come up before.
Re:OpenBSD Recent Security Innovations by cperciva on Wednesday June 05, 2019 @08:45PM (#20110531)
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.

Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @08:55PM (#20110583)
I don't think the intention was to be incompatible. I'll see about adding aliases.
Re:OpenBSD Recent Security Innovations by hedora on Wednesday June 05, 2019 @10:06PM (#20110928)
Clarification 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.)

Re:OpenBSD Recent Security Innovations by tedunangst on Wednesday June 05, 2019 @10:57PM (#20111195)
So 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.
Re:OpenBSD Recent Security Innovations by cperciva on Wednesday June 05, 2019 @08:58PM (#20110598)
Thanks!
Re:OpenBSD Recent Security Innovations by darkhelmet on Thursday June 06, 2019 @03:50AM (#20112429)
It 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.

Re:OpenBSD Recent Security Innovations by notaplumber on Wednesday June 05, 2019 @08:37PM (#20110489)
Survey says, in the past ~20 years..

https://github.com/freebsd/freebsd/search?q=MAP_NOCORE&unsco...

Pretty much bupkis. But still more than Capsicum!

Re:OpenBSD Recent Security Innovations by mjg59 on Thursday June 06, 2019 @12:00AM (#20111467)
https://codesearch.debian.net/search?q=MADV_DONTDUMP suggests MADV_DONTDUMP is used in various places, including OpenSSL.
Re:OpenBSD Recent Security Innovations by jedisct1 on Thursday June 06, 2019 @05:50AM (#20112989)
libsodium uses it.