The patch titled Subject: fs: Don't dump core if the corefile would become world-readable. has been added to the -mm tree. Its filename is fs-dont-dump-core-if-the-corefile-would-become-world-readable.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fs-dont-dump-core-if-the-corefile-would-become-world-readable.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fs-dont-dump-core-if-the-corefile-would-become-world-readable.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Jann Horn <jann@xxxxxxxxx> Subject: fs: Don't dump core if the corefile would become world-readable. On a filesystem like vfat, all files are created with the same owner and mode independent of who created the file. When a vfat filesystem is mounted with root as owner of all files and read access for everyone, root's processes left world-readable coredumps on it (but other users' processes only left empty corefiles when given write access because of the uid mismatch). Given that the old behavior was inconsistent and insecure, I don't see a problem with changing it. Now, all processes refuse to dump core unless the resulting corefile will only be readable by their owner. Signed-off-by: Jann Horn <jann@xxxxxxxxx> Acked-by: Kees Cook <keescook@xxxxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/coredump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff -puN fs/coredump.c~fs-dont-dump-core-if-the-corefile-would-become-world-readable fs/coredump.c --- a/fs/coredump.c~fs-dont-dump-core-if-the-corefile-would-become-world-readable +++ a/fs/coredump.c @@ -685,11 +685,15 @@ void do_coredump(const siginfo_t *siginf if (!S_ISREG(inode->i_mode)) goto close_fail; /* - * Dont allow local users get cute and trick others to coredump - * into their pre-created files. + * Don't dump core if the filesystem changed owner or mode + * of the file during file creation. This is an issue when + * a process dumps core while its cwd is e.g. on a vfat + * filesystem. */ if (!uid_eq(inode->i_uid, current_fsuid())) goto close_fail; + if ((inode->i_mode & 0677) != 0600) + goto close_fail; if (!(cprm.file->f_mode & FMODE_CAN_WRITE)) goto close_fail; if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file)) _ Patches currently in -mm which might be from jann@xxxxxxxxx are fs-if-a-coredump-already-exists-unlink-and-recreate-with-o_excl.patch fs-dont-dump-core-if-the-corefile-would-become-world-readable.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html