Skip to contentSkip to conversation

Changing thread_info->task, does it harm?

DISCUSSION Samer Sarhan 3 participants 3 messages Aug 14, 2005

lore
Share & tools
lore
#0 lore raw

Hi,
I had a design problem of a Linux module (Linux 2.6.11) that lead me to do this:

int work_fn(void* data);
task_t my_task;
task_t* kthread = kthread_create(work_fn, NULL, "Task 1"); // assume kthread create was successfully... my_task = *kthread;
// change what current maceo points to... kthread->thread_info->task = &my_task;
...
...
wake_up_process(&my_task);
...
..

well... is it dangerous to change what current macro points to through changing thread_info->task?

Please help!
Thanks for help in advance!

Signature · 4 lines
===========
Samer Sarhan.
"To understand recursion, you need to understand recursion."
http://samersarhan.blogspot.com
#1 lore raw
Quoted 11 lines · Samer Sarhan

Hi,
I had a design problem of a Linux module (Linux 2.6.11) that lead me to do this:

int work_fn(void* data);
task_t my_task;
task_t* kthread = kthread_create(work_fn, NULL, "Task 1"); // assume kthread create was successfully... my_task = *kthread;
// change what current maceo points to... kthread->thread_info->task = &my_task;
...

why ?

Quoted 2 lines

well... is it dangerous to change what current macro points to through changing thread_info->task?

it most likely is.

1) Why do you think you need to do this ??
2) What are you trying to solve?
3) What is the URL to the sourcecode of your module ?

#2 lore raw
In reply to Samer Sarhan
Quoted 16 lines · Samer Sarhan

Hi,
I had a design problem of a Linux module (Linux 2.6.11) that lead me to do this:

int work_fn(void* data);
task_t my_task;
task_t* kthread = kthread_create(work_fn, NULL, "Task 1"); // assume kthread create was successfully... my_task = *kthread;
// change what current maceo points to... kthread->thread_info->task = &my_task;
...
...
wake_up_process(&my_task);
...
..

Quoted 2 lines

well... is it dangerous to change what current macro points to through changing thread_info->task?

Yes. It's totally broken.