Re: [linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH] optee: Suppress false positive kmemleak report in optee_handle_rpc()

2023-12-04 Thread Bruce Ashfield
I'm getting conflicts with the latest 6.1 branches that
I pushed last night.

Can you double check the patch and send a v2 ?

Bruce

In message: [linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & 
v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH] optee: Suppress false 
positive kmemleak report in optee_handle_rpc()
on 04/12/2023 Xiaolei Wang wrote:

> We observed the following kmemleak report:
> unreferenced object 0x07904500 (size 128):
>   comm "swapper/0", pid 1, jiffies 4294892671 (age 44.036s)
>   hex dump (first 32 bytes):
> 00 47 90 07 00 00 ff ff 60 00 c0 ff 00 00 00 00  .G..`...
> 60 00 80 13 00 80 ff ff a0 00 00 00 00 00 00 00  `...
>   backtrace:
> [<4c12b1c7>] kmem_cache_alloc+0x1ac/0x2f4
> [<5d23eb4f>] tee_shm_alloc+0x78/0x230
> [<794dd22c>] optee_handle_rpc+0x60/0x6f0
> [<d9f7c52d>] optee_do_call_with_arg+0x17c/0x1dc
> [<c35884da>] optee_open_session+0x128/0x1ec
> [<1748f2ff>] tee_client_open_session+0x28/0x40
> [<aecb5389>] optee_enumerate_devices+0x84/0x2a0
> [<3df18bf1>] optee_probe+0x674/0x6cc
> [<3a4a534a>] platform_drv_probe+0x54/0xb0
> [<0c51ce7d>] really_probe+0xe4/0x4d0
> [<2f04c865>] driver_probe_device+0x58/0xc0
> [<b485397d>] device_driver_attach+0xc0/0xd0
> [<c835f0df>] __driver_attach+0x84/0x124
> [<8e5a429c>] bus_for_each_dev+0x70/0xc0
> [<1735e8a8>] driver_attach+0x24/0x30
> [<6d94b04f>] bus_add_driver+0x104/0x1ec
> 
> This is not a memory leak because we pass the share memory pointer
> to secure world and would get it from secure world before releasing it.
> 
> Signed-off-by: Xiaolei Wang 
> ---
>  drivers/tee/optee/rpc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
> index 456833d82007..b04988d54ad9 100644
> --- a/drivers/tee/optee/rpc.c
> +++ b/drivers/tee/optee/rpc.c
> @@ -13,6 +13,7 @@
>  #include "optee_private.h"
>  #include "optee_smc.h"
>  #include "optee_rpc_cmd.h"
> +#include 
>  
>  struct wq_entry {
>   struct list_head link;
> @@ -516,6 +517,7 @@ void optee_handle_rpc(struct tee_context *ctx, struct 
> optee_rpc_param *param,
>   param->a4 = 0;
>   param->a5 = 0;
>   }
> + kmemleak_not_leak(shm);
>   break;
>   case OPTEE_SMC_RPC_FUNC_FREE:
>   shm = reg_pair_to_ptr(param->a1, param->a2);
> -- 
> 2.25.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13363): 
https://lists.yoctoproject.org/g/linux-yocto/message/13363
Mute This Topic: https://lists.yoctoproject.org/mt/102967011/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy
 [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto][linux-yocto v6.1/standard/nxp-sdk-6.1/nxp-soc & v6.1/standard/preempt-rt/nxp-sdk-6.1/nxp-soc][PATCH] optee: Suppress false positive kmemleak report in optee_handle_rpc()

2023-12-04 Thread Xiaolei Wang via lists.yoctoproject.org
We observed the following kmemleak report:
unreferenced object 0x07904500 (size 128):
  comm "swapper/0", pid 1, jiffies 4294892671 (age 44.036s)
  hex dump (first 32 bytes):
00 47 90 07 00 00 ff ff 60 00 c0 ff 00 00 00 00  .G..`...
60 00 80 13 00 80 ff ff a0 00 00 00 00 00 00 00  `...
  backtrace:
[<4c12b1c7>] kmem_cache_alloc+0x1ac/0x2f4
[<5d23eb4f>] tee_shm_alloc+0x78/0x230
[<794dd22c>] optee_handle_rpc+0x60/0x6f0
[] optee_do_call_with_arg+0x17c/0x1dc
[] optee_open_session+0x128/0x1ec
[<1748f2ff>] tee_client_open_session+0x28/0x40
[] optee_enumerate_devices+0x84/0x2a0
[<3df18bf1>] optee_probe+0x674/0x6cc
[<3a4a534a>] platform_drv_probe+0x54/0xb0
[<0c51ce7d>] really_probe+0xe4/0x4d0
[<2f04c865>] driver_probe_device+0x58/0xc0
[] device_driver_attach+0xc0/0xd0
[] __driver_attach+0x84/0x124
[<8e5a429c>] bus_for_each_dev+0x70/0xc0
[<1735e8a8>] driver_attach+0x24/0x30
[<6d94b04f>] bus_add_driver+0x104/0x1ec

This is not a memory leak because we pass the share memory pointer
to secure world and would get it from secure world before releasing it.

Signed-off-by: Xiaolei Wang 
---
 drivers/tee/optee/rpc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c
index 456833d82007..b04988d54ad9 100644
--- a/drivers/tee/optee/rpc.c
+++ b/drivers/tee/optee/rpc.c
@@ -13,6 +13,7 @@
 #include "optee_private.h"
 #include "optee_smc.h"
 #include "optee_rpc_cmd.h"
+#include 
 
 struct wq_entry {
struct list_head link;
@@ -516,6 +517,7 @@ void optee_handle_rpc(struct tee_context *ctx, struct 
optee_rpc_param *param,
param->a4 = 0;
param->a5 = 0;
}
+   kmemleak_not_leak(shm);
break;
case OPTEE_SMC_RPC_FUNC_FREE:
shm = reg_pair_to_ptr(param->a1, param->a2);
-- 
2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13354): 
https://lists.yoctoproject.org/g/linux-yocto/message/13354
Mute This Topic: https://lists.yoctoproject.org/mt/102967011/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-