ChanServ changed the topic of #armlinux to: ARM kernel talk [Upstream kernel, find your vendor forums for questions about their kernels] | https://libera.irclog.whitequark.org/armlinux
apritzel has quit [Ping timeout: 255 seconds]
heat has quit [Ping timeout: 255 seconds]
sakman has quit [Ping timeout: 240 seconds]
sakman has joined #armlinux
jclsn has quit [Ping timeout: 272 seconds]
jclsn has joined #armlinux
mvaittin has joined #armlinux
mvaittin has quit [Ping timeout: 258 seconds]
sukrutb has joined #armlinux
cbeznea has joined #armlinux
mvaittin has joined #armlinux
monstr has joined #armlinux
monstr has quit [Ping timeout: 252 seconds]
tlwoerner has quit [Ping timeout: 255 seconds]
tlwoerner has joined #armlinux
apritzel has joined #armlinux
monstr has joined #armlinux
gclement has joined #armlinux
monstr has quit [Ping timeout: 255 seconds]
iivanov has quit [Remote host closed the connection]
apritzel has quit [Ping timeout: 240 seconds]
iivanov has joined #armlinux
monstr has joined #armlinux
sukrutb has quit [Ping timeout: 240 seconds]
matthias_bgg has joined #armlinux
matthias_bgg has quit [Ping timeout: 260 seconds]
sszy has joined #armlinux
ezulian has joined #armlinux
rvalue has quit [Read error: Connection reset by peer]
matthias_bgg has joined #armlinux
rvalue has joined #armlinux
headless has joined #armlinux
luispm has joined #armlinux
apritzel has joined #armlinux
Misotauros has quit [Ping timeout: 240 seconds]
Misotauros has joined #armlinux
mvaittin has quit [Ping timeout: 252 seconds]
apritzel has quit [Remote host closed the connection]
apritzel has joined #armlinux
mvaittin has joined #armlinux
ezulian has quit [Quit: ezulian]
ezulian has joined #armlinux
Peng_Fan has quit [Quit: Connection closed for inactivity]
headless has quit [Quit: Konversation terminated!]
gclement has quit [Quit: Leaving.]
monstr has quit [Ping timeout: 255 seconds]
rockosov has quit [Ping timeout: 255 seconds]
gclement has joined #armlinux
gclement1 has joined #armlinux
gclement1 has quit [Client Quit]
gclement has quit [Ping timeout: 255 seconds]
iivanov has quit [Remote host closed the connection]
iivanov has joined #armlinux
gclement has joined #armlinux
Misotauros has quit [Ping timeout: 264 seconds]
<ukleinek>
arnd: looking at chrdev_open doing fops_get(p->ops); If the module holding p->ops might get be away, evaluating p->ops->owner might oops, doesn't it?
<ukleinek>
related to that, cdev->owner = fops->owner in __register_chrdev is strange
<arnd>
ukleinek: I'm not too familiar with this logic, but I do remember that the entire cdev->owner tracking is done specifically to avoid this race. So I would assume that unloading the module would involve setting i_cdev=NULL under cdev_lock so that any ongoing open() fails, while a successful open increments owner->refcnt to prevent the unload
<ukleinek>
the intention is clear, I still doubt it works
gclement has quit [Quit: Leaving.]
<ukleinek>
hmm, it's hard to construct a failing case to probably it has no practical relevance.
mraynal has quit [Remote host closed the connection]
heat has joined #armlinux
<arnd>
ukleinek: I still don't see an active race in there, I think the comment above the try_module_get() declaration that mentions sysfs should also apply for chrdev: unregistering the character device in this case should block until the device is closed again, and the module does not actually go away until the module_exit() function returns after it has finished unregistering the chrdev
<ukleinek>
arnd: I think the module holding ops might go away before chrdev_open is called
mripard has quit [Quit: mripard]
apritzel has quit [Remote host closed the connection]
<arnd>
ukleinek: are you thinking of the case where i_cdev is NULL and it does a kobj_lookup to find the cdev, or the case where i_cdev points to an active cdev object?
<ukleinek>
arnd: I don't think about i_cdev at all. I just consider a character device being registered and then the module holding ops going away (and the cdev staying)
<arnd>
I don't understand. If the module gets unloaded and fails to unload the cdev, then you obviously get an instant oops, but that would be a bug in the module_exit function
<ukleinek>
(the module with ops going away is however hard if cdev->owner = THIS_MODULE where THIS_MOUDLE probably holds a reference to the module containing ops)
<ukleinek>
arnd: module A does: somecdev->ops = ops_from_b; cdev_add(somecdev, ...); where ops_from_b is defined in module B. Then rmmod B should work, as the cdev only holds a reference to B once the chardev is opened.
Grimler has quit [Quit: leaving]
<ukleinek>
B's exit_module functions wouldn't remove somecdev of course
<arnd>
ukleinek: If module A got the ops_from_b from an exported symbol, you wouldn't be able to remove B because of the symbol dependency
<arnd>
if the reference to the ops got passed some other way to module A without taking a reference count, that would be a bug in that module
sukrutb has joined #armlinux
<ukleinek>
arnd: in that case calling fops_get in chrdev_open() is useless, right?
<ukleinek>
(as just before, cdev_get(p) calls module_get() on p->owner which in this example is A)
<arnd>
ukleinek: I think the fops_get() is used to keep the module pinned until the final close(), while the cdev_get() is paired with cdev_put()
<ukleinek>
cdev_put() isn't called in the success path
<arnd>
it's called before the ops_get()
<ukleinek>
arnd: on new, which is NULL in the success path?
<ukleinek>
hmm, not sure
Grimler has joined #armlinux
Nact has joined #armlinux
Misotauros has joined #armlinux
heat_ has joined #armlinux
heat has quit [Read error: Connection reset by peer]