Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1258220
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() |
| Date | 2015-10-28 15:50 +0100 |
| Message-ID | <qoAd5-3T1-59@gated-at.bofh.it> (permalink) |
| References | <qntGG-3z4-21@gated-at.bofh.it> <qntGG-3z4-25@gated-at.bofh.it> <qo0jg-6CI-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 10/26, Christoph Hellwig wrote: > > On Sun, Oct 25, 2015 at 03:27:13PM +0100, Oleg Nesterov wrote: > > It is not safe to use the task_struct returned by kthread_run(threadfn) > > if threadfn() can exit before the "owner" does kthread_stop(), nothing > > protects this task_struct. > > > > So __nbd_ioctl() looks buggy; a killed nbd_thread_send() can exit, free > > its task_struct, and then kthread_stop() can use the freed/reused memory. > > > > Add the new trivial helper, kthread_get_run(). Hopefully it will have more > > users, this patch changes __nbd_ioctl() as an example. > > This looks horrible. Do you mean the helper itself? In fact iirc people asked for this helper before. It looks natural and simple. kthread_run() can only be used if this kthread can't exit on its own. > I think the real problem is that nbd is totally > abusing signals for kthreads and that needs to go away. I agree this code needs cleanups. And of course we can fix it without new helper, but see above. Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Oleg Nesterov <oleg@redhat.com> - 2015-10-25 14:40 +0100
[PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Oleg Nesterov <oleg@redhat.com> - 2015-10-25 14:40 +0100
Re: [PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Markus Pargmann <mpa@pengutronix.de> - 2015-10-26 08:40 +0100
Re: [PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Oleg Nesterov <oleg@redhat.com> - 2015-10-28 15:40 +0100
Re: [PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Christoph Hellwig <hch@infradead.org> - 2015-10-27 01:30 +0100
Re: [PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Markus Pargmann <mpa@pengutronix.de> - 2015-10-27 08:10 +0100
Re: [PATCH 1/1] kthread: introduce kthread_get_run() to fix __nbd_ioctl() Oleg Nesterov <oleg@redhat.com> - 2015-10-28 15:50 +0100
csiph-web