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]
Date:   Fri, 3 Dec 2021 16:08:02 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Ming Lei <ming.lei@...hat.com>
Cc:     Petr Mladek <pmladek@...e.com>, linux-kernel@...r.kernel.org,
        Luis Chamberlain <mcgrof@...nel.org>
Subject: Re: [PATCH V2 1/2] kobject: don't delay to cleanup module kobject

On Mon, Nov 29, 2021 at 11:45:08AM +0800, Ming Lei wrote:
> CONFIG_DEBUG_KOBJECT_RELEASE is used for debugging kobject release and
> cleanup issue. The module kobject is released after module_exit() returns.
> If this kobject is delayed too much, and may cause other kobjects cleaned
> up a bit earlier before freeing module, then real issue is hidden.
> 
> So don't delay module kobject's cleanup, meantime module kobject is
> always cleaned up synchronously, and CONFIG_DEBUG_KOBJECT_RELEASE is
> actually needless for module kobject.
> 
> Signed-off-by: Ming Lei <ming.lei@...hat.com>
> ---
>  lib/kobject.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/lib/kobject.c b/lib/kobject.c
> index 4a56f519139d..b81319b0bd5a 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -16,6 +16,7 @@
>  #include <linux/stat.h>
>  #include <linux/slab.h>
>  #include <linux/random.h>
> +#include <linux/module.h>
>  
>  /**
>   * kobject_namespace() - Return @kobj's namespace tag.
> @@ -727,6 +728,19 @@ static void kobject_release(struct kref *kref)
>  	struct kobject *kobj = container_of(kref, struct kobject, kref);
>  #ifdef CONFIG_DEBUG_KOBJECT_RELEASE
>  	unsigned long delay = HZ + HZ * (get_random_int() & 0x3);
> +
> +	/*
> +	 * Don't delay to release module kobject so that we can detect late
> +	 * kobject release more effectively because module unloading waits
> +	 * for completion of module kobject release, see mod_kobject_put.
> +	 *
> +	 * Meantime mod_kobject_put() always waits for completion of module
> +	 * kobject's release, CONFIG_DEBUG_KOBJECT_RELEASE is basically
> +	 * useless for debugging module kobject's release.
> +	 */
> +	if (kobj->ktype == &module_ktype)
> +		delay = 0;

again, no, module kobjects are not more special than anything else.

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ