diff options
author | Jann Horn <jann@thejh.net> | 2016-01-21 00:00:08 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-21 02:09:18 +0100 |
commit | ac94b6e3ba858b8de1dfe3f77ad215af7b648545 (patch) | |
tree | dbff6b9854c3d300c21ce6e9b1627a035909bd30 /kernel | |
parent | ptrace: use fsuid, fsgid, effective creds for fs access checks (diff) | |
download | linux-ac94b6e3ba858b8de1dfe3f77ad215af7b648545.tar.xz linux-ac94b6e3ba858b8de1dfe3f77ad215af7b648545.zip |
fs/coredump: prevent "" / "." / ".." core path components
Let %h and %e print empty values as "!", "." as "!" and
".." as "!.".
This prevents hostnames and comm values that are empty or consist of one
or two dots from changing the directory level at which the corefile will
be stored.
Consider the case where someone decides to sort coredumps by hostname
with a core pattern like "/cores/%h/core.%e.%p.%t" or so. In this
case, hostnames "" and "." would cause the coredump to land directly in
/cores, which is not what the intent behind the core pattern is, and
".." would cause the coredump to land in /.
Yeah, there probably aren't many people who do that, but I still don't
want this edgecase to be kind of broken.
It seems very unlikely that this caused security issues anywhere, so I'm
not requesting a stable backport.
[akpm@linux-foundation.org: tweak code comment]
Signed-off-by: Jann Horn <jann@thejh.net>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions