public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Rapoport <rppt@kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Peter Zijlstra <peterz@infradead.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Jeff Layton <jlayton@kernel.org>,
	Ilya Dryomov <idryomov@gmail.com>,
	ceph-devel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	clang-built-linux <llvm@lists.linux.dev>,
	Dave Hansen <dave.hansen@linux.intel.com>
Subject: Re: Simplify load_unaligned_zeropad() (was Re: [GIT PULL] Ceph updates for 5.20-rc1)
Date: Wed, 24 Aug 2022 12:02:10 -0700	[thread overview]
Message-ID: <08cda8cc-1a0f-9577-0e2d-ed6ccd10c174@intel.com> (raw)
In-Reply-To: <20220815041232.kypaxhhnvobgb35t@box.shutemov.name>

On 8/14/22 21:12, Kirill A. Shutemov wrote:
> But if somebody would try to be clever -- allocate memory and vmap() as
> shared (with proper VMM notification), but leave direct mapping intact --
> we have a problem. load_unaligned_zeropad() can step onto private mapping
> of the shared memory in direct mapping and crash whole TD guest.
> 
> The worst part is that for somebody who is not aware about
> load_unaligned_zeropad(), the vmap() trick is totally reasonable approach:
> it helps to avoid direct mapping fragmentation. We considered the trick
> for one of TDX-specific drivers.

This can also be fixed with guard pages.  It means allocating a
physically contiguous page to precede each one you want to vmap(), but
that's not the end of the world.

We're going to have to be *VERY* careful with any private->shared
conversion code.

  reply	other threads:[~2022-08-24 19:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-14 21:14 Simplify load_unaligned_zeropad() (was Re: [GIT PULL] Ceph updates for 5.20-rc1) Linus Torvalds
2022-08-14 22:54 ` Kirill A. Shutemov
2022-08-14 22:59   ` Linus Torvalds
2022-08-15  3:43     ` Linus Torvalds
2022-08-15  4:12       ` Kirill A. Shutemov
2022-08-24 19:02         ` Dave Hansen [this message]
2022-08-15  8:26       ` Mike Rapoport
2022-08-15  7:17 ` Peter Zijlstra
2022-08-15 15:58   ` Linus Torvalds
2022-08-15 17:53     ` Peter Zijlstra
2022-08-15 20:09     ` Peter Zijlstra
2022-08-15 22:49       ` Linus Torvalds
2022-08-16  8:02         ` Peter Zijlstra
2022-08-16 17:57           ` Linus Torvalds
2022-08-17  7:45             ` Peter Zijlstra

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=08cda8cc-1a0f-9577-0e2d-ed6ccd10c174@intel.com \
    --to=dave.hansen@intel.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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