public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: joel.schopp@amd•com (Joel Schopp)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3] arm64: fix VTTBR_BADDR_MASK
Date: Mon, 11 Aug 2014 15:21:41 -0500	[thread overview]
Message-ID: <53E925D5.4050102@amd.com> (raw)
In-Reply-To: <20140811191938.GJ10550@cbox>


>>> That said, I don't think this is doing the right thing.  I think you
>>> want to refuse running the VM and avoid any stage-2 entried being
>>> created if this is not the case (actually, we may want to check this
>>> after set_vttbr_baddr_mask() or right aftert allocating the stage-2
>>> pgd), because otherwise I think we may be overwriting memory not
>>> belonging to us with concatenated page tables in a 42-bit 4KB system,
>>> for example.
>> My experience here was that the hardware actually catches the error on
>> the first instruction load of the guest kernel and does a stage 2
>> translation abort.  However, to be extra safe we could just log the
>> error with the address of the vttbr and then zero out the pgd_phys part
>> of vttbr altogether, leaving only the vmid.  The guest would then die of
>> natural causes and we wouldn't have to worry about the outside
>> possibility of memory getting overwritten.
> uh, putting zero in the pgd_phys part will just point to random memory
> if you happen to have memory based at address 0 though, right?
>
> I think we should check when we allocate the pgd that it is indeed of
> the right size and alignment, and if it isn't at this point, it truly is
> a BUG() and your kernel is terribly busted.
If I can't rely on 0 to be an invalid address I can't think of what I
could rely on to be invalid.  I'll just change this to BUG_ON(pgd_phys &
~vttbr_baddr_mask); and give up on my dream of the host kernel surviving
the bug.

      reply	other threads:[~2014-08-11 20:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 14:38 [PATCH v3] arm64: fix VTTBR_BADDR_MASK Joel Schopp
2014-08-04 14:42 ` Joel Schopp
2014-08-04 15:18   ` Christoffer Dall
2014-08-08 20:46 ` Christoffer Dall
2014-08-11 15:20   ` Joel Schopp
2014-08-11 19:19     ` Christoffer Dall
2014-08-11 20:21       ` Joel Schopp [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=53E925D5.4050102@amd.com \
    --to=joel.schopp@amd$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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