linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Cc: Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 1/3] powerpc: Properly return error code from do_patch_instruction()
Date: Fri, 14 Jan 2022 17:19:13 +0100	[thread overview]
Message-ID: <ef6785d1-2c0d-24f5-e63f-9be29f5d41e8@csgroup.eu> (raw)
In-Reply-To: <b1dbbb34a389a6f59eb6c99102d94c0070ddaf98.1587654213.git.naveen.n.rao@linux.vnet.ibm.com>



Le 23/04/2020 à 17:09, Naveen N. Rao a écrit :
> With STRICT_KERNEL_RWX, we are currently ignoring return value from
> __patch_instruction() in do_patch_instruction(), resulting in the error
> not being propagated back. Fix the same.
> 
> Fixes: 37bc3e5fd764f ("powerpc/lib/code-patching: Use alternate map for patch_instruction()")
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

A similar patch was merged as 
https://github.com/linuxppc/linux/commit/a3483c3dd18c136785a31406fe27210649fc4fba#diff-e084bb6dc223aec74e7fc4208b7b260acc571bd5b50c9b709ec3de175cb1a979

Christophe


> ---
>   arch/powerpc/lib/code-patching.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
> index 3345f039a876..5c713a6c0bd8 100644
> --- a/arch/powerpc/lib/code-patching.c
> +++ b/arch/powerpc/lib/code-patching.c
> @@ -138,7 +138,7 @@ static inline int unmap_patch_area(unsigned long addr)
>   
>   static int do_patch_instruction(unsigned int *addr, unsigned int instr)
>   {
> -	int err;
> +	int err, rc = 0;
>   	unsigned int *patch_addr = NULL;
>   	unsigned long flags;
>   	unsigned long text_poke_addr;
> @@ -163,7 +163,7 @@ static int do_patch_instruction(unsigned int *addr, unsigned int instr)
>   	patch_addr = (unsigned int *)(text_poke_addr) +
>   			((kaddr & ~PAGE_MASK) / sizeof(unsigned int));
>   
> -	__patch_instruction(addr, instr, patch_addr);
> +	rc = __patch_instruction(addr, instr, patch_addr);
>   
>   	err = unmap_patch_area(text_poke_addr);
>   	if (err)
> @@ -172,7 +172,7 @@ static int do_patch_instruction(unsigned int *addr, unsigned int instr)
>   out:
>   	local_irq_restore(flags);
>   
> -	return err;
> +	return rc ? rc : err;
>   }
>   #else /* !CONFIG_STRICT_KERNEL_RWX */
>   

  parent reply	other threads:[~2022-01-14 16:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-23 15:09 [PATCH 0/3] powerpc: Enhance error handling with patch_instruction() Naveen N. Rao
2020-04-23 15:09 ` [PATCH 1/3] powerpc: Properly return error code from do_patch_instruction() Naveen N. Rao
2020-04-23 16:21   ` Christophe Leroy
2020-04-24 13:15     ` Steven Rostedt
2020-04-24 18:07       ` Naveen N. Rao
2020-04-24 18:29         ` Steven Rostedt
2020-04-24 19:26       ` Christopher M. Riedl
2020-04-25 14:10         ` Steven Rostedt
2020-04-25 14:11           ` Steven Rostedt
2020-04-27 17:14         ` Naveen N. Rao
2020-04-24 18:02     ` Naveen N. Rao
2022-01-14 16:19   ` Christophe Leroy [this message]
2020-04-23 15:09 ` [PATCH 2/3] powerpc/ftrace: Simplify error checking when patching instructions Naveen N. Rao
2020-04-23 15:44   ` Christophe Leroy
2020-04-23 15:09 ` [PATCH 3/3] powerpc/kprobes: Check return value of patch_instruction() Naveen N. Rao
2020-04-23 15:41   ` Christophe Leroy
2020-04-24 13:22     ` Steven Rostedt
2020-04-24 18:26       ` Naveen N. Rao
2020-04-24 18:31         ` Steven Rostedt
2020-04-24 19:38           ` Naveen N. Rao
2020-04-25 10:11         ` Christophe Leroy
2020-04-25 14:06           ` Steven Rostedt
2020-04-27 17:13             ` Naveen N. Rao
2020-04-27 17:11           ` Naveen N. Rao

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=ef6785d1-2c0d-24f5-e63f-9be29f5d41e8@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).