kobject: avoid to cleanup kobject after module is unloaded
Subsystems (2)
cover kobject: avoid to cleanup kobject after module is unloaded
Hello,
The 1st patch improves CONFIG_DEBUG_KOBJECT_RELEASE, so that kobject cleanup after unloading module can be triggered easily. With this patch, 'modprobe kset-example' can trigger the issue very quickly.
The 2nd patch fixes the issue of cleaning up object after module is unloaded, since kobj->ktype and related callbacks are often allocated as module static variable. We need to make sure kobject is really cleaned up before freeing module. This issue is reported by Petr Mladek.
Ming Lei (2):
kobject: don't delay to cleanup module kobject
kobject: wait until kobject is cleaned up before freeing module
include/linux/kobject.h | 1 + lib/kobject.c | 67 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+)
Signature · 1 line
2.31.1
PATCH 1/2 kobject: don't delay to cleanup module kobject
CONFIG_DEBUG_KOBJECT_RELEASE is used for debugging kobject release/cleanup issue. The module kobject is released after module_exit() returns. If this kobject is delayed too much, and may cause other kobject's 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 we needn't module kobject's cleanup.
--- lib/kobject.c | 5 +++++ 1 file changed, 5 insertions(+)
lib/kobject.c +5 -0
@@ -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,10 @@ 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 ); + +if (kobj->ktype == &module_ktype) + delay =0 ; +pr_info ("kobject: '%s' (%p): %s, parent %p (delayed %ld)\n" ,kobject_name (kobj), kobj, __func__, kobj->parent, delay);INIT_DELAYED_WORK (&kobj->release, kobject_delayed_cleanup);
Signature · 1 line
2.31.1
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] kobject: don't delay to cleanup module kobject
Quoted 28 lines · Ming Lei
CONFIG_DEBUG_KOBJECT_RELEASEis used for debugging kobject release/cleanup issue. The module kobject is released aftermodule_exit()returns. If this kobject is delayed too much, and may cause other kobject's 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 we needn't module kobject's cleanup.
Signed-off-by Ming Lei <[email protected]>--- lib/kobject.c | 5 +++++ 1 file changed, 5 insertions(+)lib/kobject.c +1
-0@@ -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.
lib/kobject.c static void kobject_release(struct kref *kref) · line 733
Quoted 6 lines
lib/kobject.c +3
-0@@ -727,6 +728,10 @@ 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 ); + +if (kobj->ktype == &module_ktype) + delay =0 ;
No, there should not be anything "special" about module kobjects to get this kind of treatment. They should work like any other kobject and clean up properly when needed.
thanks,
greg k-h
Re: [PATCH 1/2] kobject: don't delay to cleanup module kobject
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Ming Lei
CONFIG_DEBUG_KOBJECT_RELEASEis used for debugging kobject release/cleanup issue. The module kobject is released aftermodule_exit()returns. If this kobject is delayed too much, and may cause other kobject's 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 we needn't module kobject's cleanup.
Signed-off-by Ming Lei <[email protected]>--- lib/kobject.c | 5 +++++ 1 file changed, 5 insertions(+)lib/kobject.c +1
-0@@ -16,6 +16,7 @@#include <linux/stat.h> #include <linux/slab.h> #include <linux/random.h> +#include <linux/module.h>
Quoted 13 lines
lib/kobject.c static void kobject_release(struct kref *kref) · line 733
Quoted 9 lines
lib/kobject.c +3
-0/** * kobject_namespace() - Return @kobj's namespace tag. @@ -727,6 +728,10 @@ 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 ); + +if (kobj->ktype == &module_ktype) + delay =0 ;No, there should not be anything "special" about module kobjects to get this kind of treatment. They should work like any other kobject and clean up properly when needed.
Here setting 0 delay for module kobject is just for making DEBUG_KOBJECT_RELEASE reliable to detect/report issues. Otherwise if the random delay for module kobject is bigger than other kobjects, potential use-after-after won't be exposed.
Thanks,
Ming
Greg Kroah-Hartman
maintainerRe: [PATCH 1/2] kobject: don't delay to cleanup module kobject
Quoted 41 lines · Ming Lei
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Ming Lei
CONFIG_DEBUG_KOBJECT_RELEASEis used for debugging kobject release/cleanup issue. The module kobject is released aftermodule_exit()returns. If this kobject is delayed too much, and may cause other kobject's 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 we needn't module kobject's cleanup.
Signed-off-by Ming Lei <[email protected]>--- lib/kobject.c | 5 +++++ 1 file changed, 5 insertions(+)lib/kobject.c +1
-0@@ -16,6 +16,7 @@#include <linux/stat.h> #include <linux/slab.h> #include <linux/random.h> +#include <linux/module.h> Quoted 13 lines
lib/kobject.c static void kobject_release(struct kref *kref) · line 733
Quoted 9 lines
lib/kobject.c +3
-0/** * kobject_namespace() - Return @kobj's namespace tag. @@ -727,6 +728,10 @@ 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 ); + +if (kobj->ktype == &module_ktype) + delay =0 ;No, there should not be anything "special" about module kobjects to get this kind of treatment. They should work like any other kobject and clean up properly when needed.
Quoted 4 lines
Here setting 0 delay for module kobject is just for making
DEBUG_KOBJECT_RELEASEreliable to detect/report issues. Otherwise if the random delay for module kobject is bigger than other kobjects, potential use-after-after won't be exposed.
So you now can not debug the module kobject code?
This needs to be documented really really really well why this kobject type is somehow "special" in the code. We should not special-case these things unless you have a great reason, and I am not yet convinced.
thanks,
greg k-h
Re: [PATCH 1/2] kobject: don't delay to cleanup module kobject
Quoted 42 lines · Greg Kroah-Hartman
Quoted 41 lines · Ming Lei
Quoted 39 lines · Greg Kroah-Hartman
Quoted 28 lines · Ming Lei
CONFIG_DEBUG_KOBJECT_RELEASEis used for debugging kobject release/cleanup issue. The module kobject is released aftermodule_exit()returns. If this kobject is delayed too much, and may cause other kobject's 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 we needn't module kobject's cleanup.
Signed-off-by Ming Lei <[email protected]>--- lib/kobject.c | 5 +++++ 1 file changed, 5 insertions(+)lib/kobject.c +1
-0@@ -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. lib/kobject.c static void kobject_release(struct kref *kref) · line 733
Quoted 6 lines
lib/kobject.c +3
-0@@ -727,6 +728,10 @@ 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 ); + +if (kobj->ktype == &module_ktype) + delay =0 ;No, there should not be anything "special" about module kobjects to get this kind of treatment. They should work like any other kobject and clean up properly when needed.
Quoted 6 lines
Quoted 4 lines
Here setting 0 delay for module kobject is just for making
DEBUG_KOBJECT_RELEASEreliable to detect/report issues. Otherwise if the random delay for module kobject is bigger than other kobjects, potential use-after-after won't be exposed.So you now can not debug the module kobject code?
So far, module kobject code is always released in sync way, see mod_kobject_put(), and CONFIG_DEBUG_KOBJECT_RELEASE is basically useless for module kobject.
Quoted 4 lines
This needs to be documented really really really well why this kobject type is somehow "special" in the code. We should not special-case these things unless you have a great reason, and I am not yet convinced.
OK, I will add comment on this special usage in V2 so that you can review it further.
Thanks,
Ming
PATCH 2/2 kobject: wait until kobject is cleaned up before freeing module
In reply to Ming Leikobject_put() may become asynchronously because of CONFIG_DEBUG_KOBJECT_RELEASE, so once kobject_put() returns, the caller may expect the kobject is released after the last refcnt is dropped, however CONFIG_DEBUG_KOBJECT_RELEASE just schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler, kobj->ktype and kobj->ktype->release are required.
It is supposed that no activity is on kobject itself any more since module_exit() is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run of kobject_put() in module_exit() code path. Otherwise, it can be thought as one driver's bug since the module is going away.
When the ->ktype and ->ktype->release are allocated as module static variable, it can cause trouble because the delayed cleanup handler may be run after the module is unloaded.
Fixes the issue by flushing scheduled kobject cleanup work before freeing module.
--- include/linux/kobject.h | 1 + lib/kobject.c | 62 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+)
include/linux/kobject.h +1 -0
@@ -70,6 +70,7 @@ struct kobject {struct kernfs_node *sd;/* sysfs directory entry */ struct kref kref;#ifdef CONFIG_DEBUG_KOBJECT_RELEASE +struct list_head node;struct delayed_work release;#endif unsigned int state_initialized:1;
lib/kobject.c +62 -0
100 lines not on this page · raw message
Signature · 1 line
2.31.1
kernel test robot
build botRe: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Thank you for the patch! Yet something to improve:
Hi Ming,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on driver-core/driver-core-testing] [also build test ERROR on v5.15 next-20211105]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Ming-Lei/kobject-avoid-to-cleanup-kobject-after-module-is-unloaded/20211105-144026 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 27e0bcd02990f7291adb0f111e300f06c495d509 config: mips-buildonly-randconfig-r003-20211105 (attached as .config) compiler: mipsel-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4a9e015dd3d3e39d5723ea46579ba21f5394806a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ming-Lei/kobject-avoid-to-cleanup-kobject-after-module-is-unloaded/20211105-144026 git checkout 4a9e015dd3d3e39d5723ea46579ba21f5394806a
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
lib/kobject.c: In function 'kobj_module_callback':
>> lib/kobject.c:741:20: error: 'MODULE_STATE_GOING' undeclared (first use in this function)
741 | if (val != MODULE_STATE_GOING)
| ^~~~~~~~~~~~~~~~~~ lib/kobject.c:741:20: note: each undeclared identifier is reported only once for each function it appears in
vim +/MODULE_STATE_GOING +741 lib/kobject.c
730
731 #ifdef CONFIG_DEBUG_KOBJECT_RELEASE
732 /*
733 * Module notifier call back, flushing scheduled kobject cleanup work
734 * before freeing module
735 */
736 static int kobj_module_callback(struct notifier_block *nb,
737 unsigned long val, void *data)
738 {
739 LIST_HEAD(pending);
740
> 741 if (val != MODULE_STATE_GOING)
742 return NOTIFY_DONE;
743
744 spin_lock_irq(&kobj_cleanup_lock);
745 list_splice_init(&kobj_cleanup_list, &pending);
746 spin_unlock_irq(&kobj_cleanup_lock);
747
748 while (!list_empty_careful(&pending))
749 msleep(jiffies_to_msecs(HZ / 10));
750
751 flush_scheduled_work();
752 return NOTIFY_DONE;
753 }
754
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 28 lines · kernel test robot
Hi Ming,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on driver-core/driver-core-testing] [also build test ERROR on v5.15 next-20211105]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]url: https://github.com/0day-ci/linux/commits/Ming-Lei/kobject-avoid-to-cleanup-kobject-after-module-is-unloaded/20211105-144026 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 27e0bcd02990f7291adb0f111e300f06c495d509 config: mips-buildonly-randconfig-r003-20211105 (attached as .config) compiler: mipsel-linux-gcc (GCC) 11.2.0reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4a9e015dd3d3e39d5723ea46579ba21f5394806a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ming-Lei/kobject-avoid-to-cleanup-kobject-after-module-is-unloaded/20211105-144026 git checkout4a9e015dd3d3e39d5723ea46579ba21f5394806a
# save the attached .config to linux build tree
mkdirbuild_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bashIf you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>
Quoted 7 lines
All errors (new ones prefixed by >>):
lib/kobject.c: In function 'kobj_module_callback':Quoted 1 line
Quoted 1 line
lib/kobject.c:741:20: error: 'MODULE_STATE_GOING' undeclared (first use in this function)741 | if (val != MODULE_STATE_GOING) | ^~~~~~~~~~~~~~~~~~
lib/kobject.c:741:20: note: each undeclared identifier is reported only once for each function it appears in
Hello,
Thanks for the report!
This must be triggered when CONFIG_MODULES is off, and the following patch should kill the failure:
lib/kobject.c +2 -0
@@ -738,8 +738,10 @@ static int kobj_module_callback(struct notifier_block *nb, {LIST_HEAD (pending); +#ifdef CONFIG_MODULES if (val !=MODULE_STATE_GOING )return NOTIFY_DONE ; +#endif spin_lock_irq (&kobj_cleanup_lock);list_splice_init (&kobj_cleanup_list, &pending);
Thanks,
Ming
Re: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
In reply to Ming LeiQuoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.
Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.
Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Yes, there is the argument that it is a drivers bug when it does not work. But I wonder if we could create API that might be used by drivers and report the actuall bug. Something like:
First, update kobject_put() so that it returns 1 when the release method was called:
/**
* __kobject_put - decrement kobject refcount
* @kobject: pointer to kobject
*
* Decrement the refcount, and if 0, call release().
* Return 1 if the object was removed, otherwise return 0. Beware, if this
* function returns 0, you still can not count on the kref from remaining in
* memory. Only use the return value if you want to see if the kref is now
* gone, not present.
*/
int __kobject_put(struct kobject *kobj)
{
if (!kobj)
return 0;
if (!kobj->state_initialized) {
WARN(1, KERN_WARNING
"kobject: '%s' (%p): is not initialized, yet kobject_put() is being called.\n",
kobject_name(kobj), kobj);
}
return kref_put(&kobj->kref, kobject_release);
}/**
* kobject_remove_sync - remove the kobject in two stages and wait
* until it is removed.
* @kobject: pointer to kobject
*
* Return 0 on success, -EBUSY when someone else still owns a
* reference on the kobject.
*
* IMPORTANT: The caller is reponsible that nobody else has explicit
* reference on the kobject. The only expection are callbacks
* used by the related sysfs interface. The two stage removal
* makes sure that there is no pending operation when
* the final put is called.
*/
int kobject_remove_sync(struct kobject *kobj)
{
#ifdef CONFIG_DEBUG_KOBJECT_RELEASE DECLARE_COMPLETION(released); if (kobj) kobj->released = released;
#endif
/* Remove sysfs */ kobject_del(kobj); /* This should be the final put */ if (WARN(!__kobject_put(kobj), "Synchronous kobject release failed. Someone still had a reference.\n")) return -EBUSY;
#ifdef CONFIG_DEBUG_KOBJECT_RELEASE wait_for_completion(&released); #endif return 0; }
, where the pointer struct completion *released will be added into struct kobject. And kobject_cleanup() will call complete() after the object is released.
The completion must be defined in kobject_remove_sync() and passed via pointer. It is because struct kobject itself might be freed by release() callback.
Quoted 21 lines
When the ->ktype and ->ktype->release are allocated as module static variable, it can cause trouble because the delayed cleanup handler may be run after the module is unloaded.
Fixes the issue by flushing scheduled kobject cleanup work before freeing module.
lib/kobject.c +8
-0@@ -716,11 +729,49 @@ static void kobject_cleanup(struct kobject *kobj) }#ifdef CONFIG_DEBUG_KOBJECT_RELEASE +/* +* Module notifier call back, flushing scheduled kobject cleanup work +* before freeing module +*/ +static int kobj_module_callback (struct notifier_block *nb, +unsigned long val,void *data) +{ +LIST_HEAD (pending);
lib/kobject.c static void kobject_cleanup(struct kobject *kobj) · line 749
Quoted 10 lines
lib/kobject.c +10
-0+ +if (val !=MODULE_STATE_GOING ) +return NOTIFY_DONE ; + +spin_lock_irq (&kobj_cleanup_lock); +list_splice_init (&kobj_cleanup_list, &pending); +spin_unlock_irq (&kobj_cleanup_lock); + +while (!list_empty_careful (&pending)) +msleep (jiffies_to_msecs (HZ /10 ));
I was curious why this is needed. I guess that it is because flush_sched_work() will not wait for delayed work items that are still waiting for the timer. Am I right, please?
lib/kobject.c static void kobject_cleanup(struct kobject *kobj) · line 751
Quoted 2 lines
lib/kobject.c +2
-0+ +flush_scheduled_work ();
I guess that this is needed because the kobj is removed from the list before it is released. Am I right, please?
It would be worth to document it. IMHO, it is not obvious why it is that complicated.
More thoughts:
The advantage of the module going callback is that it is transparent. It should fix the problem for most existing users in most situations.
But it will solve the problem only when someone puts the final reference before the module going callback is called. It does not guarantee that it really works.
Note that CONFIG_DEBUG_KOBJECT_RELEASE and the workqueue is there only to make exactly this problem more visible. I mean that the final kobject_put() need not be final.
It would be great to have somehing for users that want to know that they do the right thing. For example, it is a must-to-have for the livepatch code. IMHO, kobject_remove_sync() or something similar would make the kobject API more safe to use.
lib/kobject.c static void kobject_cleanup(struct kobject *kobj) · line 754
Quoted 3 lines
lib/kobject.c +3
-0+return NOTIFY_DONE ; +} +
Best Regards,
Petr
Re: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 14 lines · Petr Mladek
Quoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.
Quoted 6 lines
Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Yes, there is the argument that it is a drivers bug when it does not work.
That is another 'issue'(even not sure if there is really), and it isn't covered in this patchset, which focuses on fixing CONFIG_DEBUG_KOBJECT_RELEASE, so please do not mix the two here.
The usual module use model is that module can't be used if someone is use it. After module_exit() is started, no one should & can 'use' the module any more, that is done by module's refcnt.
So far the driver core subsystem doesn't use module owner info, so no need to grab module refcnt in case that kobject is used. And that actually doesn't work here, given we can't hold the module refcnt during the kobject's lifetime, otherwise the module won't be unloaded at all. Sort of chicken and egg problem given kobject is often released during module_exit().
But driver core does provide kobject_del() interface to wait until all show()/store() are done.
So once the driver said now no one uses that device and the module can be unloaded, then kobject_del() is done inside module_exit(), who can hold kobject's extra reference? If there is, the caller should have grabbed the module refcnt to prevent module from being unloaded.
We usually think it is driver bug, see one fixed recently:
https://lore.kernel.org/linux-scsi/[email protected]/
Do you have real report?
Quoted 52 lines
But I wonder if we could create API that might be used by drivers and report the actuall bug. Something like:
First, update
kobject_put()so that it returns 1 when the release method was called:/**
*__kobject_put- decrement kobject refcount
* @kobject: pointer to kobject
*
* Decrement the refcount, and if 0, callrelease().
* Return 1 if the object was removed, otherwise return 0. Beware, if this
* function returns 0, you still can not count on the kref from remaining in
* memory. Only use the return value if you want to see if the kref is now
* gone, not present.
*/
int__kobject_put(struct kobject *kobj){ if (!kobj) return 0; if (!kobj->state_initialized) { WARN(1, KERN_WARNING "kobject: '%s' (%p): is not initialized, yet kobject_put() is being called.\n", kobject_name(kobj), kobj); } return kref_put(&kobj->kref, kobject_release); }/**
*kobject_remove_sync- remove the kobject in two stages and wait
* until it is removed.
* @kobject: pointer to kobject
*
* Return 0 on success,-EBUSYwhen someone else still owns a
* reference on the kobject.
*
* IMPORTANT: The caller is reponsible that nobody else has explicit
* reference on the kobject. The only expection are callbacks
* used by the related sysfs interface. The two stage removal
* makes sure that there is no pending operation when
* the final put is called.
*/
intkobject_remove_sync(struct kobject *kobj)
{#ifdef CONFIG_DEBUG_KOBJECT_RELEASE DECLARE_COMPLETION(released); if (kobj) kobj->released = released;
Quoted 8 lines
#endif
/* Remove sysfs */ kobject_del(kobj); /* This should be the final put */ if (WARN(!__kobject_put(kobj), "Synchronous kobject release failed. Someone still had a reference.\n")) return -EBUSY;
Not sure if this interface is useful:
1) who need this interface?
- It is basically not possible to audit all drivers for the conversion, and not necessary too.
2) this may break some common open()/release model:
- user open() one device, here module refcnt is hold, and device/kobject refcnt is hold too
- device needs to be deleted by kobject_del() via sysfs or ioctl or others, if kobject_remove_sync() is used, it will complain, but it is just false warning. There are lots of such examples.
3) this way may break some uses if spin_lock() is held before calling kobject_put().
4) not usable in deleting kobject itself, or break the deleting me interface simply.
5) actually only one implicit rule is here: kobject needs to be released before module exit is done if the kobject is created by this module
6) much less flexible than the usual two stage removal
So IMO, it is wrong direction for fixing the 'issue'.
More importantly I'd see one real such report first before figuring out solution, then we can see if it is driver issue or generic kobject API problem, doesn't it make sense?
Quoted 43 lines
#ifdef CONFIG_DEBUG_KOBJECT_RELEASE wait_for_completion(&released); #endif return 0; }, where the pointer struct completion *released will be added into struct kobject. And
kobject_cleanup()will callcomplete()after the object is released.The completion must be defined in
kobject_remove_sync()and passed via pointer. It is because struct kobject itself might be freed byrelease()callback.Quoted 27 lines
When the ->ktype and ->ktype->release are allocated as module static variable, it can cause trouble because the delayed cleanup handler may be run after the module is unloaded.
Fixes the issue by flushing scheduled kobject cleanup work before freeing module.
lib/kobject.c +14
-0@@ -716,11 +729,49 @@ static void kobject_cleanup(struct kobject *kobj) }#ifdef CONFIG_DEBUG_KOBJECT_RELEASE +/* +* Module notifier call back, flushing scheduled kobject cleanup work +* before freeing module +*/ +static int kobj_module_callback (struct notifier_block *nb, +unsigned long val,void *data) +{ +LIST_HEAD (pending); + +if (val !=MODULE_STATE_GOING ) +return NOTIFY_DONE ; + +spin_lock_irq (&kobj_cleanup_lock); +list_splice_init (&kobj_cleanup_list, &pending);
Quoted 8 lines
lib/kobject.c static void kobject_cleanup(struct kobject *kobj) · line 749
Quoted 4 lines
lib/kobject.c +4
-0+spin_unlock_irq (&kobj_cleanup_lock); + +while (!list_empty_careful (&pending)) +msleep (jiffies_to_msecs (HZ /10 ));I was curious why this is needed. I guess that it is because
flush_sched_work()will not wait for delayed work items that are still waiting for the timer. Am I right, please?
Right.
Actually flush_workqueue() can't cover delayed work item too, also asynchronous function doesn't support delayed function.
Quoted 6 lines
lib/kobject.c static void kobject_cleanup(struct kobject *kobj) · line 751
Quoted 3 lines
lib/kobject.c +2
-0+ +flush_scheduled_work ();I guess that this is needed because the kobj is removed from the list before it is released. Am I right, please?
Right.
Quoted 3 lines
It would be worth to document it. IMHO, it is not obvious why it is that complicated.
Fine. As I mentioned, I tried to do it via single kernel API(flush_work queue or asynchronous function), but there isn't anyone who is capable of the requirement.
Quoted 10 lines
More thoughts:
The advantage of the module going callback is that it is transparent. It should fix the problem for most existing users in most situations.
But it will solve the problem only when someone puts the final reference before the module going callback is called. It does not guarantee that it really works.
I think that is one implicit rule. The simple question is that after module is unloaded, who will/can use that kobject? Isn't it a driver bug?
Quoted 4 lines
Note that
CONFIG_DEBUG_KOBJECT_RELEASEand the workqueue is there only to make exactly this problem more visible. I mean that the finalkobject_put()need not be final.
No, I don't understand 'the final kobject_put() need not be final', isn't the kobject_remove_sync() done for the final release?
Quoted 5 lines
It would be great to have somehing for users that want to know that they do the right thing. For example, it is a must-to-have for the livepatch code. IMHO,
kobject_remove_sync()or something similar would make the kobject API more safe to use.
kobject_remove_sync() isn't good, see my above comment. Even it can't fix livepatch after the wq hack is removed.
Thanks,
Ming
Re: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 19 lines · Ming Lei
Quoted 18 lines · Petr Mladek
Quoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Quoted 6 lines
Quoted 2 lines
Yes, there is the argument that it is a drivers bug when it does not work.
That is another 'issue'(even not sure if there is really), and it isn't covered in this patchset, which focuses on fixing
CONFIG_DEBUG_KOBJECT_RELEASE, so please do not mix the two here.
Yes, it is another issue but the relation is very important.
My understanding is that this patch prevents problems caused by the delayed work. The kobject is added into kobj_cleanup_list only when the delayed work is scheduled. The patch has no effect if the delayed work is not used.
From my POV, this patch kind of removes the effect of the delayed work. My point is:
Does it still make sense to use the delayed work in the first place? Will the delayed work still help to catch some problems?
My point is that if this makes CONFIG_DEBUG_KOBJECT_RELEASE useless than we should remove CONFIG_DEBUG_KOBJECT_RELEASE instead. But then we need something else to prevent bugs that this functionality helped to debug.
Quoted 3 lines
The usual module use model is that module can't be used if someone is use it. After
module_exit()is started, no one should & can 'use' the module any more, that is done by module's refcnt.
This statement is suspicious. IMHO, no one should 'use' the module after module_exit() _finishes_.
It should be perfectly fine to use the module after module_exit() _starts_ as long as module_exit() callback could wait until the existing users stop using the module.
Quoted 10 lines
So far the driver core subsystem doesn't use module owner info, so no need to grab module refcnt in case that kobject is used. And that actually doesn't work here, given we can't hold the module refcnt during the kobject's lifetime, otherwise the module won't be unloaded at all. Sort of chicken and egg problem given kobject is often released during
module_exit().But driver core does provide
kobject_del()interface to wait until all show()/store() are done.
Quoted 8 lines
So once the driver said now no one uses that device and the module can be unloaded, then
kobject_del()is done insidemodule_exit(), who can hold kobject's extra reference? If there is, the caller should have grabbed the module refcnt to prevent module from being unloaded.We usually think it is driver bug, see one fixed recently:
Honestly, I do not understand how the extra module_get()/module_put() could prevent the race caused by delayed kobject clean up.
scsi_device_dev_release() uses try_module_get(). But it always calls scsi_device_dev_release_usercontext(). Why is it safe when try_module_get() failed?
I guess that the patch reduced the size of the race window but a race might still be there.
Anyway, it is pity that the commit message does not include the backtrace of the page fault. Or that it does not better describe the race that is fixed there.
Quoted 10 lines
Quoted 4 lines
But I wonder if we could create API that might be used by drivers and report the actuall bug. Something like:
int
kobject_remove_sync(struct kobject *kobj)Not sure if this interface is useful:
1) who need this interface?
- It is basically not possible to audit all drivers for the conversion, and not necessary too.
It might be useful for people that want to create interface and drivers that are safe to unload.
Quoted 8 lines
2) this may break some common open()/release model:
- user
open()one device, here module refcnt is hold, and device/kobject refcnt is hold too- device needs to be deleted by
kobject_del()via sysfs or ioctl or others, ifkobject_remove_sync()is used, it will complain, but it is just false warning. There are lots of such examples.
It might be solved the same way as sysfs_break_active_protection(). I mean that the API might be aware of that it is removing itself.
Quoted 2 lines
3) this way may break some uses if
spin_lock()is held before callingkobject_put().
This is not specific to the new API. The same problem is also with kobject_del().
Quoted 2 lines
4) not usable in deleting kobject itself, or break the deleting me interface simply.
It will be useful when the deleting is offloaded to a workqueue. I still consider is less hacky than using sysfs_break_active_protection().
Quoted 2 lines
5) actually only one implicit rule is here: kobject needs to be released before module exit is done if the kobject is created by this module
It the kobject is created by a module, it should be also destroyed by the module. And this is where some remove_kobject() API might be useful.
Quoted 1 line
6) much less flexible than the usual two stage removal
We still could create a two stage API. The point is that it might be useful to have an API that will wait until the kobject is really released.
Best Regards,
Petr
Re: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 34 lines · Petr Mladek
Quoted 19 lines · Ming Lei
Quoted 18 lines · Petr Mladek
Quoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Quoted 6 lines
Quoted 2 lines
Yes, there is the argument that it is a drivers bug when it does not work.
That is another 'issue'(even not sure if there is really), and it isn't covered in this patchset, which focuses on fixing
CONFIG_DEBUG_KOBJECT_RELEASE, so please do not mix the two here.Yes, it is another issue but the relation is very important.
My understanding is that this patch prevents problems caused by the delayed work. The kobject is added into
kobj_cleanup_listonly when the delayed work is scheduled. The patch has no effect if the delayed work is not used.
Quoted 5 lines
From my POV, this patch kind of removes the effect of the delayed work. My point is:
Does it still make sense to use the delayed work in the first place? Will the delayed work still help to catch some problems?
That depends on the user of CONFIG_DEBUG_KOBJECT_RELEASE, if users thought it is useless, I think it is fine to remove it.
Greg, any idea about if CONFIG_DEBUG_KOBJECT_RELEASE is useful now?
Quoted 2 lines
My point is that if this makes
CONFIG_DEBUG_KOBJECT_RELEASEuseless
No, that isn't true. CONFIG_DEBUG_KOBJECT_RELEASE still works in its original way and the delay is still there, what this patch is doing is to make it safe by completing the delayed cleanup before freeing module, because ->ktype & related callbacks are often allocated in module static memory.
Quoted 11 lines
than we should remove
CONFIG_DEBUG_KOBJECT_RELEASEinstead. But then we need something else to prevent bugs that this functionality helped to debug.Quoted 3 lines
The usual module use model is that module can't be used if someone is use it. After
module_exit()is started, no one should & can 'use' the module any more, that is done by module's refcnt.This statement is suspicious. IMHO, no one should 'use' the module after
module_exit()_finishes_.
I said after module_exit() is started, not module_exit() is finished.
Quoted 4 lines
It should be perfectly fine to use the module after
module_exit()_starts_ as long asmodule_exit()callback could wait until the existing users stop using the module.
No, once module_exit() is started, try_module_get() will return false, so module isn't supposed to be used any more. See delete_module(), ->exit() is only called in case of module refcnt being zero.
Quoted 17 lines
Quoted 17 lines
So far the driver core subsystem doesn't use module owner info, so no need to grab module refcnt in case that kobject is used. And that actually doesn't work here, given we can't hold the module refcnt during the kobject's lifetime, otherwise the module won't be unloaded at all. Sort of chicken and egg problem given kobject is often released during
module_exit().But driver core does provide
kobject_del()interface to wait until all show()/store() are done.So once the driver said now no one uses that device and the module can be unloaded, then
kobject_del()is done insidemodule_exit(), who can hold kobject's extra reference? If there is, the caller should have grabbed the module refcnt to prevent module from being unloaded.
Quoted 6 lines
Quoted 3 lines
We usually think it is driver bug, see one fixed recently:
Honestly, I do not understand how the extra module_get()/module_put() could prevent the race caused by delayed kobject clean up.
If module_get() is successful, module_exit() can't be called until the module refcnt is released.
Quoted 18 lines
scsi_device_dev_release()usestry_module_get(). But it always callsscsi_device_dev_release_usercontext(). Why is it safe whentry_module_get()failed?I guess that the patch reduced the size of the race window but a race might still be there.
Anyway, it is pity that the commit message does not include the backtrace of the page fault. Or that it does not better describe the race that is fixed there.
Quoted 5 lines
Quoted 4 lines
But I wonder if we could create API that might be used by drivers and report the actuall bug. Something like:
int
kobject_remove_sync(struct kobject *kobj)
Quoted 8 lines
Quoted 5 lines
Not sure if this interface is useful:
1) who need this interface?
- It is basically not possible to audit all drivers for the conversion, and not necessary too.It might be useful for people that want to create interface and drivers that are safe to unload.
It is one generic issue because most of ->ktype and related callbacks are stored in module static memory, so all modules should be unloaded safely. If the interface is created, in theory the last kobject_put() called in _all__ module_exit() should be converted to this new interface. That is why I said it is basically not possible, cause it isn't easy to figure one which is the last one in each driver/module.
Again, any real report which needs such new interface? If there isn't, I don't think it makes sense to take effort for making one, especially the new API is very hard to use/convert.
Quoted 11 lines
Quoted 10 lines
2) this may break some common open()/release model:
- user
open()one device, here module refcnt is hold, and device/kobject refcnt is hold too- device needs to be deleted by
kobject_del()via sysfs or ioctl or others, ifkobject_remove_sync()is used, it will complain, but it is just false warning. There are lots of such examples.
Quoted 8 lines
It might be solved the same way as
sysfs_break_active_protection(). I mean that the API might be aware of that it is removing itself.Quoted 2 lines
3) this way may break some uses if
spin_lock()is held before callingkobject_put().This is not specific to the new API. The same problem is also with
kobject_del().
No, spin_lock can't be held for kobject_del() which will sleep always.
Quoted 6 lines
Quoted 4 lines
4) not usable in deleting kobject itself, or break the deleting me interface simply.
It will be useful when the deleting is offloaded to a workqueue.
How is it useful?
Quoted 1 line
I still consider is less hacky than using
sysfs_break_active_protection().
OK, if you think wq is better, care to post a patch to replace sysfs_break_active_protection() with justification so that every user can benefit from it?
Quoted 8 lines
Quoted 4 lines
5) actually only one implicit rule is here: kobject needs to be released before module exit is done if the kobject is created by this module
It the kobject is created by a module, it should be also destroyed by the module. And this is where some
remove_kobject()API might be useful.
Yeah, but why new API is required, you have to provide one real report for supporting the idea of new API.
Quoted 7 lines
Quoted 3 lines
6) much less flexible than the usual two stage removal
We still could create a two stage API. The point is that it might be useful to have an API that will wait until the kobject is really released.
You have to know which one is the final release first, not mention not every kobject_put() can wait.
Thanks,
Ming
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 38 lines · Ming Lei
Quoted 37 lines · Petr Mladek
Quoted 19 lines · Ming Lei
Quoted 18 lines · Petr Mladek
Quoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Quoted 6 lines
Quoted 2 lines
Yes, there is the argument that it is a drivers bug when it does not work.
That is another 'issue'(even not sure if there is really), and it isn't covered in this patchset, which focuses on fixing
CONFIG_DEBUG_KOBJECT_RELEASE, so please do not mix the two here.Yes, it is another issue but the relation is very important.
My understanding is that this patch prevents problems caused by the delayed work. The kobject is added into
kobj_cleanup_listonly when the delayed work is scheduled. The patch has no effect if the delayed work is not used.From my POV, this patch kind of removes the effect of the delayed work. My point is:
Quoted 7 lines
Quoted 2 lines
Does it still make sense to use the delayed work in the first place? Will the delayed work still help to catch some problems?
That depends on the user of
CONFIG_DEBUG_KOBJECT_RELEASE, if users thought it is useless, I think it is fine to remove it.Greg, any idea about if
CONFIG_DEBUG_KOBJECT_RELEASEis useful now?
Yes it is, it finds driver bugs where they do things wrong.
I've been ignoring this thread until after 5.16-rc1 is out, sorry.
greg k-h
Re: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 42 lines · Greg Kroah-Hartman
Quoted 41 lines · Ming Lei
Quoted 39 lines · Petr Mladek
Quoted 19 lines · Ming Lei
Quoted 18 lines · Petr Mladek
Quoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Quoted 6 lines
Quoted 2 lines
Yes, there is the argument that it is a drivers bug when it does not work.
That is another 'issue'(even not sure if there is really), and it isn't covered in this patchset, which focuses on fixing
CONFIG_DEBUG_KOBJECT_RELEASE, so please do not mix the two here.Yes, it is another issue but the relation is very important.
My understanding is that this patch prevents problems caused by the delayed work. The kobject is added into
kobj_cleanup_listonly when the delayed work is scheduled. The patch has no effect if the delayed work is not used.From my POV, this patch kind of removes the effect of the delayed work. My point is:
Does it still make sense to use the delayed work in the first place? Will the delayed work still help to catch some problems?
Quoted 6 lines
Quoted 4 lines
That depends on the user of
CONFIG_DEBUG_KOBJECT_RELEASE, if users thought it is useless, I think it is fine to remove it.Greg, any idea about if
CONFIG_DEBUG_KOBJECT_RELEASEis useful now?Yes it is, it finds driver bugs where they do things wrong.
Please, do you have any idea what particular wrong things might happen?
IMHO, one bug might be that the driver module might be removed when there are still users, some reference still exists. This patch causes that CONFIG_DEBUG_KOBJECT_RELEASE will not longer help to catch this kind of problems.
Is there any other common bug type that might be discovered by the delayed release?
I just want to be sure that this patch does not make CONFIG_DEBUG_KOBJECT_RELEASE useless.
Best Regards,
Petr
Greg Kroah-Hartman
maintainerRe: [PATCH 2/2] kobject: wait until kobject is cleaned up before freeing module
Quoted 43 lines · Petr Mladek
Quoted 42 lines · Greg Kroah-Hartman
Quoted 41 lines · Ming Lei
Quoted 39 lines · Petr Mladek
Quoted 19 lines · Ming Lei
Quoted 18 lines · Petr Mladek
Quoted 7 lines · Ming Lei
kobject_put()may become asynchronously because ofCONFIG_DEBUG_KOBJECT_RELEASE, so oncekobject_put()returns, the caller may expect the kobject is released after the last refcnt is dropped, howeverCONFIG_DEBUG_KOBJECT_RELEASEjust schedules one delayed work function for cleaning up the kobject. Inside the cleanup handler,kobj->ktypeandkobj->ktype->releaseare required.Quoted 5 lines
It is supposed that no activity is on kobject itself any more since
module_exit()is started, so it is reasonable for the kobject user or driver to expect that kobject can be really released in the last run ofkobject_put()inmodule_exit()code path. Otherwise, it can be thought as one driver's bug since the module is going away.Honestly, this looks a bit fragile. What if there is still another reference from some reason. IMHO, it is easy to do it wrong. The kobject stuff is super-tricky.
Quoted 6 lines
Quoted 2 lines
Yes, there is the argument that it is a drivers bug when it does not work.
That is another 'issue'(even not sure if there is really), and it isn't covered in this patchset, which focuses on fixing
CONFIG_DEBUG_KOBJECT_RELEASE, so please do not mix the two here.Yes, it is another issue but the relation is very important.
My understanding is that this patch prevents problems caused by the delayed work. The kobject is added into
kobj_cleanup_listonly when the delayed work is scheduled. The patch has no effect if the delayed work is not used.From my POV, this patch kind of removes the effect of the delayed work. My point is:
Does it still make sense to use the delayed work in the first place? Will the delayed work still help to catch some problems?
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
That depends on the user of
CONFIG_DEBUG_KOBJECT_RELEASE, if users thought it is useless, I think it is fine to remove it.Greg, any idea about if
CONFIG_DEBUG_KOBJECT_RELEASEis useful now?Yes it is, it finds driver bugs where they do things wrong.
Please, do you have any idea what particular wrong things might happen?
The most obvious issue is when release functions access things that they shouldn't be accessing because either the code is gone, or the data is gone.
I think some problems in the tty layer are still present if you enable this option, but I can't remember the details, sorry. Search the archives for when this was added to the tree, or for bug reports with the option enabled for more details.
Quoted 10 lines
IMHO, one bug might be that the driver module might be removed when there are still users, some reference still exists. This patch causes that
CONFIG_DEBUG_KOBJECT_RELEASEwill not longer help to catch this kind of problems.Is there any other common bug type that might be discovered by the delayed release?
I just want to be sure that this patch does not make
CONFIG_DEBUG_KOBJECT_RELEASEuseless.
This option is there for debugging kernel code. If your patch series makes it obsolete, that's fine, as long as we still have a way to still debug these types of things easily.
I'll review this after 5.16-rc1 is out.
thanks,
greg k-h