mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Russell King <linux@armlinux.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: RFC: repeated insmod/rmmod and DEBUG_KOBJECT_RELEASE - do we care?
Date: Mon, 13 Jun 2022 21:38:22 +0200	[thread overview]
Message-ID: <YqeSLvnLo2CX+oTp@kroah.com> (raw)
In-Reply-To: <20220613110239.GA69975@windriver.com>

On Mon, Jun 13, 2022 at 07:02:39AM -0400, Paul Gortmaker wrote:
> If a person has CONFIG_DEBUG_KOBJECT_RELEASE enabled, and runs a rather
> questionable test suite doing a repeated modprobe followed by modprobe -r
> it will eventually trigger a duplicate sysfs name warning:
> 
> [ 1427.032646] kobject: 'usbserial_generic' (00000000c91a1c2c): kobject_release, parent 00000000890627c7 (delayed 4000)
> [...]
> [ 1430.110659] kobject: 'usbserial_generic' (00000000a633d9a5): kobject_add_internal: parent: 'drivers', set: 'drivers'
> [ 1430.110667] sysfs: cannot create duplicate filename '/bus/usb/drivers/usbserial_generic'
> [ 1430.110671] CPU: 2 PID: 1102 Comm: modprobe Not tainted 5.15.38 #7
> [ 1430.110678] Call Trace:
> [ 1430.110685]  dump_stack_lvl+0x33/0x42
> [ 1430.110693]  sysfs_warn_dup+0x51/0x60         <----------
> [ 1430.110699]  sysfs_create_dir_ns+0xb8/0xd0
> 
> For context to lkml readers, CONFIG_DEBUG_KOBJECT_RELEASE inserts a
> random delay of between 2 and 5 seconds before freeing a kobject.
> 
> In the above case, the free was delayed 4s by the DEBUG option, but we tried
> to reconstruct the same sysfs entry in just 3s elapsed and hence it triggered
> the namespace collision warning. 
> 
> I'm not convinced this warrants fixing, given the contrived nature of the
> root only test, but I did at least want to get it on record, so maybe it
> saves someone else some research time, given a similar report.

It's come up many many times in the past years, sorry you hit it again
without realizing it.

> We could I guess, within the CONFIG_DEBUG_KOBJECT_RELEASE ifdef'd code use
> kobject_rename() to add a "-zombie" suffix or something like that, but then
> it might mask name space collisions people *do* want to see?

That wouldn't work as you would have rename collisions as well.

And that warning is just that, a warning that you did something foolish
so the kernel is trying to say "don't do that".  And doing a
modprobe/rmmod constantly is a huge "don't do that" hint.

> As per above it was seen with usb-serial, but I suspect any driver with a
> sysfs kobject could reproduce the issue.  I also didn't reproduce on the
> latest kernel but I can't imagine anything has changed in this area.

Yes, the module handling code has changed a bit, so it might have solved
some of these things.  But the root cause is still there, you are doing
something odd/broken and the kernel warned you about it :)

thanks,

greg k-h

      reply	other threads:[~2022-06-13 20:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 11:02 Paul Gortmaker
2022-06-13 19:38 ` Greg Kroah-Hartman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YqeSLvnLo2CX+oTp@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=paul.gortmaker@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome