[PATCH 1/3] kthread: implement probe_kthread_data()

2013-04-03 Thread Tejun Heo
Implement probe_kthread_data() which returns kthread_data if accessible. The function is equivalent to kthread_data() except that the specified @task may not be a kthread or its vfork_done is already cleared rendering struct kthread inaccessible. In the former case, probe_kthread_data() may retur

Re: [PATCH 1/3] kthread: implement probe_kthread_data()

2013-04-03 Thread Jan Kara
On Fri 29-03-13 20:00:45, Tejun Heo wrote: > Implement probe_kthread_data() which returns kthread_data if > accessible. The function is equivalent to kthread_data() except that > the specified @task may not be a kthread or its vfork_done is already > cleared rendering struct kthread inaccessible.

Re: [PATCH 1/3] kthread: implement probe_kthread_data()

2013-03-30 Thread Oleg Nesterov
On 03/30, Tejun Heo wrote: > > On Sat, Mar 30, 2013 at 10:00 AM, Oleg Nesterov wrote: > > > But I guess I missed the fact that this helper should be safe even this > > @task can be the a vfork'ed user-space process, yes? > > > > Yeap, we really don't know what to expect. OK, > > Or we can add to

Re: [PATCH 1/3] kthread: implement probe_kthread_data()

2013-03-30 Thread Oleg Nesterov
Hi Tejun, On 03/30, Tejun Heo wrote: > > On Sat, Mar 30, 2013 at 7:36 AM, Oleg Nesterov wrote: > > > +void *probe_kthread_data(struct task_struct *task) > > > +{ > > > + struct kthread *kthread = to_kthread(task); > > > + void *data = NULL; > > > + > > > + probe_kernel_read(&data, &kt

Re: [PATCH 1/3] kthread: implement probe_kthread_data()

2013-03-30 Thread Tejun Heo
Hello, Oleg. On Sat, Mar 30, 2013 at 7:36 AM, Oleg Nesterov wrote: > > +void *probe_kthread_data(struct task_struct *task) > > +{ > > + struct kthread *kthread = to_kthread(task); > > + void *data = NULL; > > + > > + probe_kernel_read(&data, &kthread->data, sizeof(data)); > > + re

Re: [PATCH 1/3] kthread: implement probe_kthread_data()

2013-03-30 Thread Oleg Nesterov
On 03/29, Tejun Heo wrote: > > Implement probe_kthread_data() which returns kthread_data if > accessible. The function is equivalent to kthread_data() except that > the specified @task may not be a kthread ^ This doesn't necessarily mean its ->vfork_done !

[PATCH 1/3] kthread: implement probe_kthread_data()

2013-03-29 Thread Tejun Heo
Implement probe_kthread_data() which returns kthread_data if accessible. The function is equivalent to kthread_data() except that the specified @task may not be a kthread or its vfork_done is already cleared rendering struct kthread inaccessible. In the former case, probe_kthread_data() may retur