From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Jann Horn <jannh@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Bill Messmer <wmessmer@microsoft.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Randy Dunlap <rdunlap@infradead.org>,
stable@vger.kernel.org, Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] coredump: Also dump first pages of non-executable ELF libraries
Date: Wed, 02 Feb 2022 09:19:45 -0600 [thread overview]
Message-ID: <87czk5l2i6.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <20220126025739.2014888-1-jannh@google.com> (Jann Horn's message of "Wed, 26 Jan 2022 03:57:39 +0100")
Jann Horn <jannh@google.com> writes:
> When I rewrote the VMA dumping logic for coredumps, I changed it to
> recognize ELF library mappings based on the file being executable instead
> of the mapping having an ELF header. But turns out, distros ship many ELF
> libraries as non-executable, so the heuristic goes wrong...
>
> Restore the old behavior where FILTER(ELF_HEADERS) dumps the first page of
> any offset-0 readable mapping that starts with the ELF magic.
>
> This fix is technically layer-breaking a bit, because it checks for
> something ELF-specific in fs/coredump.c; but since we probably want to
> share this between standard ELF and FDPIC ELF anyway, I guess it's fine?
> And this also keeps the change small for backporting.
In light of the conflict with my other changes, and in light of the pain
of calling get_user.
Is there any reason why the doesn't unconditionally dump all headers?
Something like the diff below?
I looked in the history and the code was filtering for ELF headers
there already. I am just thinking this feels like a good idea
regardless of the file format to help verify the file on-disk
is the file we think was mapped.
Eric
diff --git a/fs/coredump.c b/fs/coredump.c
index 6a97a8ea7295..ef3b03e4cf59 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -1047,8 +1047,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
* dump the first page to aid in determining what was mapped here.
*/
if (FILTER(ELF_HEADERS) &&
- vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ) &&
- (READ_ONCE(file_inode(vma->vm_file)->i_mode) & 0111) != 0)
+ vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ))
return PAGE_SIZE;
#undef FILTER
next prev parent reply other threads:[~2022-02-02 15:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-26 2:57 [PATCH] coredump: Also dump first pages of non-executable ELF libraries Jann Horn
2022-01-26 21:19 ` [EXTERNAL] " Bill Messmer
2022-02-02 15:19 ` Eric W. Biederman [this message]
2022-02-02 17:43 ` Jann Horn
2022-02-03 23:59 ` Jann Horn
2022-02-04 22:44 ` 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=87czk5l2i6.fsf@email.froward.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wmessmer@microsoft.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox