Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

out of memory failures in xtest due to tee_shm_free() from Linux not unregistering SHM DMA buffer in kexec path #3637

Closed
RajeshRavi-brcm opened this issue Feb 27, 2020 · 27 comments
Labels

Comments

@RajeshRavi-brcm
Copy link

RajeshRavi-brcm commented Feb 27, 2020

Problem Description

Case A
If tee_shm_free() is called in shutdown() of Linux tee_client_driver and kexec kernel is booted, shutdown() & tee_shm_free() are invoked but tee_shm_release() is not invoked on DMA SHM buffer.

Case B
If tee_shm_free() is called on SHM DMA buffer previously allocated from rmmod path[module_exit()]
It unregisters the SHM memory and sends OPTEE_MSG_CMD_UNREGISTER_SHM to optee_os through optee_shm_unregister().

Call Sequence

Case A: kexec path
.shutdown()-->tee_shm_free()-->dma_buf_put()

Case B: rmmod path
.shutdown()-->tee_shm_free()-->dma_buf_put()()-->tee_shm_release()-->optee_shm_unregister()
-->optee_do_call_with_arg() [cmd = OPTEE_MSG_CMD_UNREGISTER_SHM]

Repercussions of the issue: xtest failure due to out of memory

If we register a big buffer of say 8MB in Linux tee client driver, if the same memory is not unregistered, it can cause overhead of 210248 = 16KB memory overhead for shm page book keeping data structures calloc'd in optee_os. After kexec it causes 16 +16=32KB which significant memory on a minimal heap of size, say 64KB. This causes failures with asymmetric crypto operations of xtest due to out of memory error.

Context
In Linux kernel tee_client_driver probe() we 're calling tee_shm_alloc() with flags=TEE_SHM_MAPPED | TEE_SHM_DMA_BUF

In remove() & shutdown() functions of the driver: we 're calling tee_shm_free() on shm reference allocated in probe.

@RajeshRavi-brcm RajeshRavi-brcm changed the title tee_shm_free() Linux driver API does not unregister SHM DMA buffer in kexec path out of memory failures in xtest due to tee_shm_free() from Linux not unregistering SHM DMA buffer in kexec path Feb 27, 2020
@jenswi-linaro
Copy link
Contributor

In tee_shm_free() when shm->flags & TEE_SHM_DMA_BUF we rely on dma_buf_put() to do the release. The actual release is done once the dmabuf has lost all references. So perhaps something else is referencing this dmabuf?

@vikasbrcm
Copy link
Contributor

We can see only one reference is there that too should go away with dma_buf_put(). The same code path works when rmmod is called. This issue is seen in kexec execution case as shutdown in drivers is called.
Shutdown eventually land to dma_buf_put(). All TEE drivers will leak memory on OPTEE side if kexec is executed.
It looks like dma_buf_put() is not doing favor here, which could be related to dma_buf_put() only as it could not call release before shutdown(triggered by kexec) was hit.

@jenswi-linaro
Copy link
Contributor

Perhaps we need a way to tell OP-TEE that normal world is starting over?

@github-actions
Copy link

This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 5 days. Note, that you can always re-open a closed issue at any time.

@samliddicott
Copy link

It's a strange optimism that supposes bugs can fix themselves by being left alone for 35 days.

I believe that I have a related scenario where after kexec, use of tee-os either causes a kernel panic (either null de-reference or Unable to handle kernel paging request at virtual address) or a more sane:

[ 415.656408] optee: handle_rpc_func_cmd: tee_shm_get_va ffff80013af83e80 failed
[ 415.663709] optee: handle_rpc_func_cmd: tee_shm_get_va ffff80013af83e80 failed
[ 415.670990] optee: handle_rpc_func_cmd: tee_shm_get_va ffff80013af83e80 failed
E/LD: init_elf:238 sys_open_ta_bin(f4e750bb-1437-4fbf-8785-8d3580c34994)
E/TC:? 0 init_with_ldelf:279 ldelf failed with res: 0xffff000c
E/TC:? 0 tee_ta_open_session:725 Failed. Return error 0xffff000c

I'm going to try building optee as a kernel module and unloading before kexec to see if that fixes that problem

@jforissier
Copy link
Contributor

jforissier commented Jun 24, 2020

It's a strange optimism that supposes bugs can fix themselves by being left alone for 35 days.

Haha who knows? 😆

Seriously though, the reason for marking issues "stale" and auto-closing is that we want the list of open issues to be somewhat representative of what people are either working on, or concerned about (so that others can possibly pick up meaningful tasks and contribute). By that logic, a closed issue is not necessarily a fixed one. [Edit] Also note that issues are not always bugs: they may be questions or configuration mistakes etc.

I'm going to try building optee as a kernel module and unloading before kexec to see if that fixes that problem

Sure, as always, contributions are welcome. Please do not hesitate to re-open this issue if you are actively investigating it.

@jbech-linaro
Copy link
Contributor

I second what @jforissier said, but I have thought about updating the bot to not close things that have a certain label ("bug" for example). The core team of OP-TEE are just a few persons, who are involved in other things too at the companies where they are working. So even if we want too, it's impossible to jump on every single issue being mentioned. Therefore we and the OP-TEE project as such are very grateful when other developers pick up certain issues and try to chime in.

This is also one of the reasons starting with the bot, we had too many questions and open issues that never got closed, so it was almost impossible to keep track of what made sense to look into. A common theme is that people ask questions, but don't close the issue when they've got the answer or that we ask for more information and we never hear anything again. A pure bug report happens more seldom. Pure bugs should have the "bug" label I think.

@jforissier
Copy link
Contributor

I have thought about updating the bot to not close things that have a certain label ("bug" for example)

+1 that's a good idea IMO

@samliddicott
Copy link

I confirm that unloaded the optee module before kexec means that optee works for me again after kexec.

I don't know if there is a kernel -pre-kexec subscription that optee module could register with, which would give it time to say goodbye to tee-os nicely. I would hope tee-os would accept a synchronous "I'm outta here" message from linux kernel.

I think that leaving tee-supplicant running during kexec may be what led to the kernel segfault and merely leaving optee module loaded may be what led to non-fatal failure to function, but that needs more testing.

But certainly, making optee a loadable module, and stopping tee-supplicant and unloading the modules before kexec appears to have solved the immediate problem for me.

@jforissier
Copy link
Contributor

I confirm that unloaded the optee module before kexec means that optee works for me again after kexec.

OK, good.

I don't know if there is a kernel -pre-kexec subscription that optee module could register with, which would give it time to say goodbye to tee-os nicely. I would hope tee-os would accept a synchronous "I'm outta here" message from linux kernel.

What about this?

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 99698b8a3a74..5426b07a80cb 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -710,6 +710,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
 static struct platform_driver optee_driver = {
	.probe  = optee_probe,
	.remove = optee_remove,
+	.shutdown = optee_remove,
	.driver = {
		.name = "optee",
		.of_match_table = optee_dt_match,

From https://patchwork.kernel.org/patch/9568549/ and http://lkml.iu.edu/hypermail/linux/kernel/1607.2/04442.html I believe it is what we're after here.

Perhaps a more optimized version would be to release only secure world resources, something like that:

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 99698b8a3a74..00b893a51222 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -584,6 +584,15 @@ static int optee_remove(struct platform_device *pdev)
	return 0;
 }
 
+static int optee_shutdown(struct platform_device *pdev)
+{
+	struct optee *optee = platform_get_drvdata(pdev);
+
+	optee_disable_shm_cache(optee);
+
+	return 0;
+}
+
 static int optee_probe(struct platform_device *pdev)
 {
	optee_invoke_fn *invoke_fn;
@@ -710,6 +719,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
 static struct platform_driver optee_driver = {
	.probe  = optee_probe,
	.remove = optee_remove,
+	.shutdown = optee_shutdown,
	.driver = {
		.name = "optee",
		.of_match_table = optee_dt_match,

@samliddicott
Copy link

Great comments @jforissier and some good lkml conversation there.

Things seem to have moved on considerably since then, and optee module is no longer a platform module with a platform_driver struct registered with module_platform_driver

The init and exit functions are registered with module_init() and module_exit() macros with no module_shutdown or use other useful macro variants available.

I guess the module_exit() ought to have appropriate effect with kexec but doesn't (lklm mailing list discussion bore no fruit).

the rmmod shutdown path naturally requires that all device instances are already closed and so the exit function is sufficient.

So after a few hours, I can't find any way or anywhere even to link in optee_disable_shm_cache(optee) on a kexec path.

No doubt the cdev is a clue, but I don't see how to attach a shutdown handler there yet either; and I'm not sure that it would easily help as we'd only want to invoke optee_disable_shm_cache once but there could possibly be multiple cdev registered.

@jforissier
Copy link
Contributor

Things seem to have moved on considerably since then, and optee module is no longer a platform module with a platform_driver struct registered with module_platform_driver

What is your reference? The patches I have proposed are based on upstream master (v5.8-rc2-64-g8be3a53e18e0).

@samliddicott
Copy link

Thanks for the correction.

I'm using a 4.14 marvell branch.

elixir.bootlin.com doesn't go beyond 5.7 right now which explains why I couldn't find anything that looked like yours.

@jforissier
Copy link
Contributor

elixir.bootlin.com doesn't go beyond 5.7 right now which explains why I couldn't find anything that looked like yours.

No, you did not look closely enough instead ;-)
https://elixir.bootlin.com/linux/v5.7.2/source/drivers/tee/optee/core.c#L710

@samliddicott
Copy link

How right you are! Nothing I said appears to have been reliable.

I'll slink away in shame.

I can't trust myself to safely work out what could have been going through my mind.

thanks for being nice about it

@jforissier
Copy link
Contributor

@samliddicott haha don't be too hard on yourself! ;-)

Anyway, If something needs to be fixed in the OP-TEE driver for kexec support, it should preferably go to the LKML directly. Thanks.

@bgooty
Copy link

bgooty commented Jul 13, 2020

@jforissier Would like to know if you have plans to push the optimized optee_shutdown() to LKML?
Thanks,
-Bharat

@sbranden
Copy link

@jforissier Would like to know if you have plans to push the optimized optee_shutdown() to LKML?
Thanks,
-Bharat

This patch does appear to solve our issues.

@bgooty
Copy link

bgooty commented Jul 20, 2020

I confirm that unloaded the optee module before kexec means that optee works for me again after kexec.

OK, good.

I don't know if there is a kernel -pre-kexec subscription that optee module could register with, which would give it time to say goodbye to tee-os nicely. I would hope tee-os would accept a synchronous "I'm outta here" message from linux kernel.

What about this?

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 99698b8a3a74..5426b07a80cb 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -710,6 +710,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
 static struct platform_driver optee_driver = {
	.probe  = optee_probe,
	.remove = optee_remove,
+	.shutdown = optee_remove,
	.driver = {
		.name = "optee",
		.of_match_table = optee_dt_match,

From https://patchwork.kernel.org/patch/9568549/ and http://lkml.iu.edu/hypermail/linux/kernel/1607.2/04442.html I believe it is what we're after here.

Perhaps a more optimized version would be to release only secure world resources, something like that:

diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 99698b8a3a74..00b893a51222 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -584,6 +584,15 @@ static int optee_remove(struct platform_device *pdev)
	return 0;
 }
 
+static int optee_shutdown(struct platform_device *pdev)
+{
+	struct optee *optee = platform_get_drvdata(pdev);
+
+	optee_disable_shm_cache(optee);
+
+	return 0;
+}
+
 static int optee_probe(struct platform_device *pdev)
 {
	optee_invoke_fn *invoke_fn;
@@ -710,6 +719,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
 static struct platform_driver optee_driver = {
	.probe  = optee_probe,
	.remove = optee_remove,
+	.shutdown = optee_shutdown,
	.driver = {
		.name = "optee",
		.of_match_table = optee_dt_match,

@jforissier I am not sure whether you have seen my previous message.
Do you have any plans to push this changes to LKML?
Thanks,
-Bharat

@jforissier
Copy link
Contributor

@bgooty sorry for the late reply :-/
Please feel free to send the patch to LKML yourself -- you will probably provide a better description than me. If you want you may add a Suggested-by: Jerome Forissier <jerome@forissier.org>.

@bgooty
Copy link

bgooty commented Jul 21, 2020

@bgooty sorry for the late reply :-/
Please feel free to send the patch to LKML yourself -- you will probably provide a better description than me. If you want you may add a Suggested-by: Jerome Forissier <jerome@forissier.org>.
Thanks @jforissier . Let me attempt to push to LKML and keep you in CC.
As you suggested, I will add "Suggested-by: Jerome Forissier jerome@forissier.org" in the commit

@tyhicks
Copy link

tyhicks commented Aug 27, 2020

@bgooty hey - I don't see the patch submission on LKML or the optee list archives so I wanted to give you a poke. Please cc me (Tyler Hicks tyhicks@linux.microsoft.com) on your submission and I'll give it a review. Thanks!

@bgooty
Copy link

bgooty commented Aug 28, 2020

@bgooty hey - I don't see the patch submission on LKML or the optee list archives so I wanted to give you a poke. Please cc me (Tyler Hicks tyhicks@linux.microsoft.com) on your submission and I'll give it a review. Thanks!

Sorry, adding optee_shutdown() does not fix the issue.

@allenpais
Copy link

@bgooty Is an alternate fix in the works considering optee_shutdown() did not solve the problem. Thanks.

fengguang pushed a commit to 0day-ci/linux that referenced this issue Feb 17, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Signed-off-by: Allen Pais <apais@linux.microsoft.com>
fengguang pushed a commit to 0day-ci/linux that referenced this issue Feb 25, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Signed-off-by: Allen Pais <apais@linux.microsoft.com>
fengguang pushed a commit to 0day-ci/linux that referenced this issue Jun 9, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
@tyhicks
Copy link

tyhicks commented Jun 15, 2021

A fix for this and other kexec/kdump related issues with OP-TEE is available here:

https://lore.kernel.org/lkml/20210614223317.999867-1-tyhicks@linux.microsoft.com/

@jforissier
Copy link
Contributor

@tyhicks thanks for the update. I intend to apply the series onto linaro-swg/linux branch optee as soon as it reaches mainline.

fengguang pushed a commit to 0day-ci/linux that referenced this issue Jun 16, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
jenswi-linaro pushed a commit to jenswi-linaro/linux-1 that referenced this issue Jun 16, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
@jenswi-linaro
Copy link
Contributor

I created linaro-swg/linux#94 to get some more automated testing of these patches.

fengguang pushed a commit to 0day-ci/linux that referenced this issue Jun 16, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
jessfraz pushed a commit to jessfraz/linux that referenced this issue Aug 3, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue Aug 12, 2021
commit f25889f upstream.

The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Whissi pushed a commit to Whissi/linux-stable that referenced this issue Aug 12, 2021
commit f25889f upstream.

The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
starnight pushed a commit to endlessm/linux that referenced this issue Sep 14, 2021
BugLink: https://bugs.launchpad.net/bugs/1942123

commit f25889f upstream.

The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
vchong pushed a commit to vchong/linux that referenced this issue Oct 11, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
vchong pushed a commit to vchong/linux that referenced this issue Oct 11, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
vchong pushed a commit to vchong/linux that referenced this issue Oct 11, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
it-is-a-robot pushed a commit to openeuler-mirror/kernel that referenced this issue Oct 16, 2021
stable inclusion
from stable-5.10.58
commit 2a879ff9719fdb75bdedfca029a381105aea6d72
bugzilla: 176984 https://gitee.com/openeuler/kernel/issues/I4E2P4

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2a879ff9719fdb75bdedfca029a381105aea6d72

--------------------------------

commit f25889f upstream.

The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chen Jun <chenjun102@huawei.com>
Acked-by: Weilong Chen <chenweilong@huawei.com>
Signed-off-by: Chen Jun <chenjun102@huawei.com>
Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com>
skruven96 pushed a commit to skruven96/linux that referenced this issue Oct 31, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
vlsunil pushed a commit to ventana-micro-systems/RISC-V-Linux that referenced this issue Nov 23, 2021
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
OP-TEE/optee_os#3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants