From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: richard@sigma-star.at, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] Log if a core dump is aborted due to changed file permissions
Date: Mon, 02 Aug 2021 20:47:01 +0000 [thread overview]
Message-ID: <76fdf2e7-272f-8771-3a88-ab387ec8954b@sigma-star.at> (raw)
In-Reply-To: <20210701233151.102720-1-david.oberhollenzer@sigma-star.at>
Friendly ping :-)
On 7/2/21 1:31 AM, David Oberhollenzer wrote:
> For obvious security reasons, a core dump is aborted if the
> filesystem cannot preserve ownership or permissions of the
> dump file.
>
> This affects filesystems like e.g. vfat, but also something like
> a 9pfs share in a Qemu test setup, running as a regular user,
> depending on the security model used. In those cases, the result
> is an empty core file and a confused user.
>
> To hopefully safe other people a lot of time figuring out the
> cause, this patch adds a simple log message for those specific
> cases.
>
> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
> ---
> fs/coredump.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/fs/coredump.c b/fs/coredump.c
> index c3d8fc14b993..3e53d3e18b0e 100644
> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -782,10 +777,17 @@ void do_coredump(const kernel_siginfo_t *siginfo)
> * filesystem.
> */
> mnt_userns = file_mnt_user_ns(cprm.file);
> - if (!uid_eq(i_uid_into_mnt(mnt_userns, inode), current_fsuid()))
> + if (!uid_eq(i_uid_into_mnt(mnt_userns, inode),
> + current_fsuid())) {
> + pr_info_ratelimited("Core dump to |%s aborted: cannot preserve file owner\n",
> + cn.corename);
> goto close_fail;
> - if ((inode->i_mode & 0677) != 0600)
> + }
> + if ((inode->i_mode & 0677) != 0600) {
> + pr_info_ratelimited("Core dump to |%s aborted: cannot preserve file permissions\n",
> + cn.corename);
> goto close_fail;
> + }
> if (!(cprm.file->f_mode & FMODE_CAN_WRITE))
> goto close_fail;
> if (do_truncate(mnt_userns, cprm.file->f_path.dentry,
> --
> 2.31.1
>
next prev parent reply other threads:[~2021-08-02 20:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-01 23:31 [PATCH] Log if a core dump is aborted due to changed file permissions David Oberhollenzer
2021-08-02 20:47 ` David Oberhollenzer [this message]
2021-08-02 21:40 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=76fdf2e7-272f-8771-3a88-ab387ec8954b@sigma-star.at \
--to=david.oberhollenzer@sigma-star.at \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard@sigma-star.at \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.