stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address
@ 2022-06-14 13:49 Andrew Donnellan
  2022-06-14 15:21 ` Nathan Lynch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Donnellan @ 2022-06-14 13:49 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nathan Lynch, stable, Sathvika Vasireddy

Add a special case to block_rtas_call() to allow the ibm,platform-dump RTAS
call through the RTAS filter if the buffer address is 0.

According to PAPR, ibm,platform-dump is called with a null buffer address
to notify the platform firmware that processing of a particular dump is
finished.

Without this, on a pseries machine with CONFIG_PPC_RTAS_FILTER enabled, an
application such as rtas_errd that is attempting to retrieve a dump will
encounter an error at the end of the retrieval process.

Fixes: bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace")
Cc: stable@vger.kernel.org
Reported-by: Sathvika Vasireddy <sathvika@linux.ibm.com>
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
---
 arch/powerpc/kernel/rtas.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index a6fce3106e02..693133972294 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1071,7 +1071,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = {
 	{ "get-time-of-day", -1, -1, -1, -1, -1 },
 	{ "ibm,get-vpd", -1, 0, -1, 1, 2 },
 	{ "ibm,lpar-perftools", -1, 2, 3, -1, -1 },
-	{ "ibm,platform-dump", -1, 4, 5, -1, -1 },
+	{ "ibm,platform-dump", -1, 4, 5, -1, -1 },		/* Special cased */
 	{ "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 },
 	{ "ibm,scan-log-dump", -1, 0, 1, -1, -1 },
 	{ "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 },
@@ -1120,6 +1120,15 @@ static bool block_rtas_call(int token, int nargs,
 				size = 1;
 
 			end = base + size - 1;
+
+			/*
+			 * Special case for ibm,platform-dump - NULL buffer
+			 * address is used to indicate end of dump processing
+			 */
+			if (!strcmp(f->name, "ibm,platform-dump") &&
+			    base == 0)
+				return false;
+
 			if (!in_rmo_buf(base, end))
 				goto err;
 		}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address
  2022-06-14 13:49 [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Andrew Donnellan
@ 2022-06-14 15:21 ` Nathan Lynch
  2022-06-14 16:28 ` Tyrel Datwyler
  2022-06-19 11:55 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Nathan Lynch @ 2022-06-14 15:21 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev; +Cc: stable, Sathvika Vasireddy

Andrew Donnellan <ajd@linux.ibm.com> writes:
> Add a special case to block_rtas_call() to allow the ibm,platform-dump RTAS
> call through the RTAS filter if the buffer address is 0.
>
> According to PAPR, ibm,platform-dump is called with a null buffer address
> to notify the platform firmware that processing of a particular dump is
> finished.
>
> Without this, on a pseries machine with CONFIG_PPC_RTAS_FILTER enabled, an
> application such as rtas_errd that is attempting to retrieve a dump will
> encounter an error at the end of the retrieval process.
>
> Fixes: bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace")
> Cc: stable@vger.kernel.org
> Reported-by: Sathvika Vasireddy <sathvika@linux.ibm.com>
> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>

I agree this allows ibm,platform-dump to work without weakening the
filter for other calls. Thanks.

Reviewed-by: Nathan Lynch <nathanl@linux.ibm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address
  2022-06-14 13:49 [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Andrew Donnellan
  2022-06-14 15:21 ` Nathan Lynch
@ 2022-06-14 16:28 ` Tyrel Datwyler
  2022-06-19 11:55 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Tyrel Datwyler @ 2022-06-14 16:28 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev; +Cc: Nathan Lynch, Sathvika Vasireddy, stable

On 6/14/22 06:49, Andrew Donnellan wrote:
> Add a special case to block_rtas_call() to allow the ibm,platform-dump RTAS
> call through the RTAS filter if the buffer address is 0.
> 
> According to PAPR, ibm,platform-dump is called with a null buffer address
> to notify the platform firmware that processing of a particular dump is
> finished.
> 
> Without this, on a pseries machine with CONFIG_PPC_RTAS_FILTER enabled, an
> application such as rtas_errd that is attempting to retrieve a dump will
> encounter an error at the end of the retrieval process.
> 
> Fixes: bd59380c5ba4 ("powerpc/rtas: Restrict RTAS requests from userspace")
> Cc: stable@vger.kernel.org
> Reported-by: Sathvika Vasireddy <sathvika@linux.ibm.com>
> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>

Similar to what is done for ibm,configure-connector with idx_buf2 and a NULL
address.

Reviewed-by: Tyrel Datwyler <tyreld@linux.ibm.com>

> ---
>  arch/powerpc/kernel/rtas.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index a6fce3106e02..693133972294 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -1071,7 +1071,7 @@ static struct rtas_filter rtas_filters[] __ro_after_init = {
>  	{ "get-time-of-day", -1, -1, -1, -1, -1 },
>  	{ "ibm,get-vpd", -1, 0, -1, 1, 2 },
>  	{ "ibm,lpar-perftools", -1, 2, 3, -1, -1 },
> -	{ "ibm,platform-dump", -1, 4, 5, -1, -1 },
> +	{ "ibm,platform-dump", -1, 4, 5, -1, -1 },		/* Special cased */
>  	{ "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 },
>  	{ "ibm,scan-log-dump", -1, 0, 1, -1, -1 },
>  	{ "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 },
> @@ -1120,6 +1120,15 @@ static bool block_rtas_call(int token, int nargs,
>  				size = 1;
> 
>  			end = base + size - 1;
> +
> +			/*
> +			 * Special case for ibm,platform-dump - NULL buffer
> +			 * address is used to indicate end of dump processing
> +			 */
> +			if (!strcmp(f->name, "ibm,platform-dump") &&
> +			    base == 0)
> +				return false;
> +
>  			if (!in_rmo_buf(base, end))
>  				goto err;
>  		}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address
  2022-06-14 13:49 [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Andrew Donnellan
  2022-06-14 15:21 ` Nathan Lynch
  2022-06-14 16:28 ` Tyrel Datwyler
@ 2022-06-19 11:55 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-06-19 11:55 UTC (permalink / raw)
  To: linuxppc-dev, Andrew Donnellan; +Cc: Sathvika Vasireddy, stable, Nathan Lynch

On Tue, 14 Jun 2022 23:49:52 +1000, Andrew Donnellan wrote:
> Add a special case to block_rtas_call() to allow the ibm,platform-dump RTAS
> call through the RTAS filter if the buffer address is 0.
> 
> According to PAPR, ibm,platform-dump is called with a null buffer address
> to notify the platform firmware that processing of a particular dump is
> finished.
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address
      https://git.kernel.org/powerpc/c/7bc08056a6dabc3a1442216daf527edf61ac24b6

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-19 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 13:49 [PATCH] powerpc/rtas: Allow ibm,platform-dump RTAS call with null buffer address Andrew Donnellan
2022-06-14 15:21 ` Nathan Lynch
2022-06-14 16:28 ` Tyrel Datwyler
2022-06-19 11:55 ` Michael Ellerman

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).