* [uml-devel] Strange segmentation fault
@ 2007-04-13 5:14 Haifeng He
2007-04-13 13:54 ` Jeff Dike
0 siblings, 1 reply; 4+ messages in thread
From: Haifeng He @ 2007-04-13 5:14 UTC (permalink / raw)
To: user-mode-linux-devel
[-- Attachment #1.1: Type: text/plain, Size: 954 bytes --]
Hi,
I met a program error when I tried to modify UML kernel. What I did was:
1. added a variable "a" in struct task_struct.
2. I wrote a function that will update the value of "a" in task struct
"current", i.e.,
something like:
foo () {
current->a = xx.
}
3. foo is called at many places.
Now, when I run the kernel, it goes to kernal panic in "start_userspace",
and it
shows error message
"panic - not syncing: start_userspace : expected SIGSTOP, got status = 2943"
I checked the value of status. It means a segv signal. My guess is
foo () was probably called in user address space and since it caused segv
because
it tried to access UML kernel address space. My question is, if it is
possible
such thing happened, i.e., some code in UML kernel may be executed in user
address
space? If not, what could be the cause for such error? The strange thing is,
if I just read value of "a" from "current", kernel runs fine.
Thanks
Haifeng
[-- Attachment #1.2: Type: text/html, Size: 1401 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #3: Type: text/plain, Size: 194 bytes --]
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Strange segmentation fault
2007-04-13 5:14 [uml-devel] Strange segmentation fault Haifeng He
@ 2007-04-13 13:54 ` Jeff Dike
2007-04-13 16:31 ` Haifeng He
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Dike @ 2007-04-13 13:54 UTC (permalink / raw)
To: Haifeng He; +Cc: user-mode-linux-devel
On Thu, Apr 12, 2007 at 10:14:32PM -0700, Haifeng He wrote:
> 3. foo is called at many places.
>
> If not, what could be the cause for such error? The strange thing is,
> if I just read value of "a" from "current", kernel runs fine.
Did you put a call in userspace_tramp?
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Strange segmentation fault
2007-04-13 13:54 ` Jeff Dike
@ 2007-04-13 16:31 ` Haifeng He
2007-04-13 17:59 ` Jeff Dike
0 siblings, 1 reply; 4+ messages in thread
From: Haifeng He @ 2007-04-13 16:31 UTC (permalink / raw)
To: Jeff Dike; +Cc: user-mode-linux-devel
[-- Attachment #1.1: Type: text/plain, Size: 538 bytes --]
On 4/13/07, Jeff Dike <jdike@addtoit.com> wrote:
>
> On Thu, Apr 12, 2007 at 10:14:32PM -0700, Haifeng He wrote:
> > 3. foo is called at many places.
> >
> > If not, what could be the cause for such error? The strange thing is,
> > if I just read value of "a" from "current", kernel runs fine.
>
> Did you put a call in userspace_tramp?
Yes. So that is the problem. Is there any other place which may cause
similar problems?
Thanks
Haifeng
Jeff
>
> --
> Work email - jdike at linux dot intel dot com
>
[-- Attachment #1.2: Type: text/html, Size: 1213 bytes --]
[-- Attachment #2: Type: text/plain, Size: 345 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #3: Type: text/plain, Size: 194 bytes --]
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [uml-devel] Strange segmentation fault
2007-04-13 16:31 ` Haifeng He
@ 2007-04-13 17:59 ` Jeff Dike
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Dike @ 2007-04-13 17:59 UTC (permalink / raw)
To: Haifeng He; +Cc: user-mode-linux-devel
On Fri, Apr 13, 2007 at 09:31:16AM -0700, Haifeng He wrote:
> Yes. So that is the problem. Is there any other place which may cause
> similar problems?
If you're going to be sprinking code randomly around UML, you need to
be cognizant of what stack the surrounding code runs on.
You hit code which is setting up a new process, and is running on a
non-kernel stack in the context of the new process.
init_thread_cb runs on the initial UML process stack.
The stubs run on a stack in the upper two pages of the process address
space.
These bits of code can't run kernel code, since they aren't on a
kernel stack, and current() et al won't be valid.
Pretty much everything else is on a kernel stack, and what you're
doing should be fine.
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-04-13 17:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-13 5:14 [uml-devel] Strange segmentation fault Haifeng He
2007-04-13 13:54 ` Jeff Dike
2007-04-13 16:31 ` Haifeng He
2007-04-13 17:59 ` Jeff Dike
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.