From: Michael Ellerman <patch-notifications@ellerman•id.au>
To: Michael Neuling <mikey@neuling•org>
Cc: mikey@neuling•org, "Nicholas Piggin" <npiggin@gmail•com>,
"Michal Suchánek" <msuchanek@suse•de>,
linuxppc-dev@lists•ozlabs.org,
"Haren Myneni" <haren@linux•vnet.ibm.com>
Subject: Re: [v4] powerpc: Avoid code patching freed init sections
Date: Fri, 21 Sep 2018 21:59:39 +1000 (AEST) [thread overview]
Message-ID: <42GsbJ0Knkz9sCh@ozlabs.org> (raw)
In-Reply-To: <20180914011411.3184-1-mikey@neuling.org>
On Fri, 2018-09-14 at 01:14:11 UTC, Michael Neuling wrote:
> This stops us from doing code patching in init sections after they've
> been freed.
>
> In this chain:
> kvm_guest_init() ->
> kvm_use_magic_page() ->
> fault_in_pages_readable() ->
> __get_user() ->
> __get_user_nocheck() ->
> barrier_nospec();
>
> We have a code patching location at barrier_nospec() and
> kvm_guest_init() is an init function. This whole chain gets inlined,
> so when we free the init section (hence kvm_guest_init()), this code
> goes away and hence should no longer be patched.
>
> We seen this as userspace memory corruption when using a memory
> checker while doing partition migration testing on powervm (this
> starts the code patching post migration via
> /sys/kernel/mobility/migration). In theory, it could also happen when
> using /sys/kernel/debug/powerpc/barrier_nospec.
>
> cc: stable@vger•kernel.org # 4.13+
> Signed-off-by: Michael Neuling <mikey@neuling•org>
> Reviewed-by: Nicholas Piggin <npiggin@gmail•com>
> Reviewed-by: Christophe Leroy <christophe.leroy@c-s•fr>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/51c3c62b58b357e8d35e4cc32f7b4e
cheers
next prev parent reply other threads:[~2018-09-21 11:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-14 1:14 [PATCH v4] powerpc: Avoid code patching freed init sections Michael Neuling
2018-09-14 4:22 ` Nicholas Piggin
2018-09-18 8:52 ` Christophe LEROY
2018-09-18 11:35 ` Michal Suchánek
2018-09-14 5:32 ` Christophe LEROY
2018-09-21 11:59 ` Michael Ellerman [this message]
2018-10-01 11:25 ` [v4] " Christophe LEROY
2018-10-01 22:57 ` Michael Neuling
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=42GsbJ0Knkz9sCh@ozlabs.org \
--to=patch-notifications@ellerman$(echo .)id.au \
--cc=haren@linux$(echo .)vnet.ibm.com \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=mikey@neuling$(echo .)org \
--cc=msuchanek@suse$(echo .)de \
--cc=npiggin@gmail$(echo .)com \
/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