lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50551f21-6e90-3556-7a3d-8b81a042f99c@huawei.com>
Date: Thu, 5 Sep 2024 11:34:24 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: Thomas Gleixner <tglx@...utronix.de>, <linux-kernel@...r.kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>, Christophe Leroy
	<christophe.leroy@...roup.eu>, Josh Poimboeuf <jpoimboe@...nel.org>
Subject: Re: [PATCH] static_call: Handle module init failure correctly in
 static_call_del_module()



On 2024/9/4 16:51, Thomas Gleixner wrote:
> On Wed, Sep 04 2024 at 16:03, Jinjie Ruan wrote:
>> On 2024/9/4 15:08, Thomas Gleixner wrote:
>>> So the check must be:
>>>
>>> 	if (!static_call_key_has_mods(key))
>>>         	break;
>>
>> Hi, Thomas,
>>
>> with this patch, the issue not occurs again,
>>
>> but there are some memory leak here same to the following problem:
> 
> That has absolutely nothing to do with static calls and the memory
> allocation failure case there.
> 
> The module passed all preparatory steps, otherwise it would not be able
> to create a kmem_cache from the module init() function:
> 
>      kmem_cache_create+0x11/0x20
>      do_one_initcall+0xdc/0x550
>      do_init_module+0x241/0x630
> 
> amdgpu_init()
> 
> 	r = amdgpu_sync_init();
> 	if (r)
> 		goto error_sync;
> 
> 	r = amdgpu_fence_slab_init();
> 	if (r)
> 		goto error_fence;
> 
>         <SNIP>
>         
> 	return pci_register_driver(&amdgpu_kms_pci_driver);
> 
> error_fence:
> 	amdgpu_sync_fini();
> error_sync:
>         return r;
> 
> Can you spot the problem?

Hi, Thomas,

It seems that it is not the memory leak source,

I test with the following patch, the memory leak also occurs,

but with the Link patch, the problem solved and the memory leak missed.

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 094498a0964b..3589e4768bd6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -3032,11 +3032,11 @@ static int __init amdgpu_init(void)

        r = amdgpu_sync_init();
        if (r)
-               goto error_sync;
+               return r;

        r = amdgpu_fence_slab_init();
        if (r)
-               goto error_fence;
+               goto error_sync;

        DRM_INFO("amdgpu kernel modesetting enabled.\n");
        amdgpu_register_atpx_handler();
@@ -3046,12 +3046,18 @@ static int __init amdgpu_init(void)
        amdgpu_amdkfd_init();

        /* let modprobe override vga console setting */
-       return pci_register_driver(&amdgpu_kms_pci_driver);
+       r = pci_register_driver(&amdgpu_kms_pci_driver);
+       if (r)
+               goto error_fence;
+
+       return 0;

 error_fence:
-       amdgpu_sync_fini();
+       amdgpu_fence_slab_fini();

 error_sync:
+       amdgpu_sync_fini();
+
        return r;
 }


> 
> Thanks,
> 
>         tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ