linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Russell Currey <ruscur@russell.cc>
To: Benjamin Gray <bgray@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: jniethe5@gmail.com, cmr@bluescreens.de, npiggin@gmail.com,
	ajd@linux.ibm.com
Subject: Re: [PATCH v8 3/6] powerpc/code-patching: Verify instruction patch succeeded
Date: Mon, 24 Oct 2022 14:20:11 +1100	[thread overview]
Message-ID: <d5febacfc792876848bd4ba58f43b0e24450f250.camel@russell.cc> (raw)
In-Reply-To: <20221021052238.580986-4-bgray@linux.ibm.com>

On Fri, 2022-10-21 at 16:22 +1100, Benjamin Gray wrote:
> Verifies that if the instruction patching did not return an error
> then
> the value stored at the given address to patch is now equal to the
> instruction we patched it to.
> 
> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
> ---
>  arch/powerpc/lib/code-patching.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/powerpc/lib/code-patching.c
> b/arch/powerpc/lib/code-patching.c
> index 34fc7ac34d91..9b9eba574d7e 100644
> --- a/arch/powerpc/lib/code-patching.c
> +++ b/arch/powerpc/lib/code-patching.c
> @@ -186,6 +186,8 @@ static int do_patch_instruction(u32 *addr,
> ppc_inst_t instr)
>         err = __do_patch_instruction(addr, instr);
>         local_irq_restore(flags);
>  
> +       WARN_ON(!err && !ppc_inst_equal(instr, ppc_inst_read(addr)));
> +

As a side note, I had a look at test-code-patching.c and it doesn't
look like we don't have a test for ppc_inst_equal() with prefixed
instructions.  We should fix that.

>         return err;
>  }
>  #else /* !CONFIG_STRICT_KERNEL_RWX */


  reply	other threads:[~2022-10-24  3:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21  5:22 [PATCH v8 0/6] Use per-CPU temporary mappings for patching Benjamin Gray
2022-10-21  5:22 ` [PATCH v8 1/6] powerpc: Allow clearing and restoring registers independent of saved breakpoint state Benjamin Gray
2022-10-24  3:06   ` Russell Currey
2022-10-21  5:22 ` [PATCH v8 2/6] powerpc/code-patching: Use WARN_ON and fix check in poking_init Benjamin Gray
2022-10-24  3:08   ` Russell Currey
2022-10-21  5:22 ` [PATCH v8 3/6] powerpc/code-patching: Verify instruction patch succeeded Benjamin Gray
2022-10-24  3:20   ` Russell Currey [this message]
2022-10-25  3:30     ` Benjamin Gray
2022-10-21  5:22 ` [PATCH v8 4/6] powerpc/tlb: Add local flush for page given mm_struct and psize Benjamin Gray
2022-10-24  3:30   ` Russell Currey
2022-10-24  5:22     ` Benjamin Gray
2022-10-24  4:22   ` Russell Currey
2022-10-21  5:22 ` [PATCH v8 5/6] powerpc/code-patching: Use temporary mm for Radix MMU Benjamin Gray
2022-10-24  3:45   ` Russell Currey
2022-10-24  5:17     ` Benjamin Gray
2022-10-24 15:39       ` Christopher M. Riedl
2022-10-24  8:46   ` kernel test robot
2022-10-21  5:22 ` [PATCH v8 6/6] powerpc/code-patching: Use CPU local patch address directly Benjamin Gray

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=d5febacfc792876848bd4ba58f43b0e24450f250.camel@russell.cc \
    --to=ruscur@russell.cc \
    --cc=ajd@linux.ibm.com \
    --cc=bgray@linux.ibm.com \
    --cc=cmr@bluescreens.de \
    --cc=jniethe5@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.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;
as well as URLs for NNTP newsgroup(s).