public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
	luto@kernel.org, peterz@infradead.org, ak@linux.intel.com,
	dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com,
	linux-kernel@vger.kernel.org,
	sathyanarayanan.kuppuswamy@linux.intel.com,
	thomas.lendacky@amd.com, x86@kernel.org
Subject: Re: [PATCHv3 3/3] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page
Date: Thu, 26 May 2022 21:00:38 +0000	[thread overview]
Message-ID: <Yo/qduyX33XHFVjK@google.com> (raw)
In-Reply-To: <bb94beeb-061d-c795-7ed6-3c9d2c73191c@intel.com>

On Thu, May 26, 2022, Dave Hansen wrote:
> On 5/26/22 13:36, Kirill A. Shutemov wrote:
> > On Thu, May 26, 2022 at 09:20:56AM -0700, Dave Hansen wrote:
> >> On 5/24/22 15:10, Kirill A. Shutemov wrote:
> >>> +	/*
> >>> +	 * MMIO accesses suppose to be naturally aligned and therefore never
> >>> +	 * cross a page boundary. Seeing unaligned accesses indicates a bug or
> >>> +	 * load_unaligned_zeropad() that steps into unmapped shared page.
> >> Wait a sec though...
> >>
> >> We've been talking all along about how MMIO accesses are in some cases
> >> just plain old compiler-generated memory accesses.  It's *probably* bad
> >> code that does this, but it's not necessarily a bug.
> > Compiler-generated memory accesses tend to be aligned too. You need to do
> > something make them unalinged, like __packed or pointer trickery.
> 
> I totally agree.  But, the point is that __packed or pointer trickery is
> goofy, but it's not necessarily a bug.  This might crash the kernel on
> goofy stuff, not bugs.

Yeah, I don't think it's worth exploding on unaligned accesses, it's specifically
page splits that are a mess and are an absolutely nightmare to handle.  E.g. for
VirtIO kicks, the data and page offset are completely ignored/irrelevant, so a
multi-byte write to any random byte in the page should work, even though it's all
kinds of goofy.

      reply	other threads:[~2022-05-26 21:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 22:10 [PATCHv3 0/3] Fix for load_unaligned_zeropad() in TDX guest Kirill A. Shutemov
2022-05-24 22:10 ` [PATCHv3 1/3] x86/tdx: Fix early #VE handling Kirill A. Shutemov
2022-05-24 22:10 ` [PATCHv3 2/3] x86/tdx: Clarify RIP adjustments in #VE handler Kirill A. Shutemov
2022-05-25 16:02   ` Dave Hansen
2022-05-26 20:13     ` Kirill A. Shutemov
2022-05-26 20:18       ` Dave Hansen
2022-05-24 22:10 ` [PATCHv3 3/3] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page Kirill A. Shutemov
2022-05-26 16:20   ` Dave Hansen
2022-05-26 20:36     ` Kirill A. Shutemov
2022-05-26 20:39       ` Dave Hansen
2022-05-26 21:00         ` Sean Christopherson [this message]

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=Yo/qduyX33XHFVjK@google.com \
    --to=seanjc@google.com \
    --cc=ak@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.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