LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-06-2010, 09:10 AM   #1
namit2010
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Rep: Reputation: 0
User stack giving error (EFAULT), when task switch to next CPU


Hi All,

While task switch from CPU 0 to another CPU 1, user stack dump (using __get_user) giving Error while when again return back to CPU 0 it giving correct value.

I have noticed "task->mm->start_stack" never change in both cases.

Below given some result for reference:
================================================================
-------------- CPU 0 -------------------
task stack info : pid(518) stack area (0xbe8b8000 ~ 0xbe8cd000)
pid(518) stack vma (0xbe8b8000 ~ 0xbe8cd000)
User Stack: (0xbe8ccc3c to 0xbe8ccda0)
cc20: be8ccc4c
cc40: be8ccda4 00000001 00000000 4006f4c4 40197000 be8ccda4 00000001 00008474
cc60: 000000e8 00000000 00000000 40197000 00000000 00000000 000000e8 00000000
cc80: be8ccc50 4006f47c 00000000 00000000 00000000 00000000 00000000 00000000
cca0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

-------------- CPU 1 -------------------
pid(518) stack vma (0xbe8b8000 ~ 0xbe8cd000)
User Stack: (0xbe8ccc3c to 0xbe8ccda0)
cc20: 00000000
cc40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cc60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cc80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
================================================================
 
Old 12-08-2010, 02:31 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
How do you call __get_user? Is it in user space?
 
Old 12-08-2010, 11:21 PM   #3
namit2010
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
no I am calling in Kernel space

The issue has been resolved on activating the task memory on the CPU context. but i am little bit worried that its caused bad effect on the system.
 
Old 12-09-2010, 02:33 PM   #4
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
If the issue had been resolved, the __get_user is called in user context. Otherwise you should get trouble. I am caution of activating the task memory on the CPU context. Do you mean that the page isn't active or isn't loaded into memory at the moment when the task is switched to CPU1?
 
Old 12-10-2010, 12:08 AM   #5
namit2010
LQ Newbie
 
Registered: Apr 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Yeah you are right. actually for debugging i want to see the dump user stack of the task through the kernel thread. but problem was that when my kernel thread and user task are running in different CPU then stack dump(using __get_user) giving Error. the error get resolved when i have task activated memory before dumping the stack( using activate_mm call before __get_user).
Now my questions are--
what are the bad effect on the system due to activating task memory.
are other running tasks also affected due to this ??? if yes how to protect ??
 
Old 12-10-2010, 03:00 PM   #6
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,850

Rep: Reputation: 161Reputation: 161
You can try following case and see what happen.
Your kernel thread and user task are running at same time and in different CPU.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing stack of non-current task shankarvk Linux - Kernel 3 04-28-2010 05:45 AM
Giving a user CPU preference MarchHare22 Slackware 1 09-22-2009 09:55 AM
strcat giving a stack smashing detected error ashlesha Programming 2 03-11-2007 11:15 AM
giving separate stack space for each task manas_sem Programming 2 03-01-2007 04:34 PM
thread switch results in kernel stack switch superstition Linux - General 1 05-17-2005 11:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration