Subject: lib/34722: pthread can use unlimited amount of stack
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 10/05/2006 14:10:01
>Number: 34722
>Category: lib
>Synopsis: pthread can use unlimited amount of stack
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 05 14:10:01 +0000 2006
>Originator: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
>Release: NetBSD 4.99.3
>Organization:
>Environment:
System: NetBSD 4.99.3
Architecture: i386
Machine: i386
>Description:
(i thought i filed this PR sometime ago, but i couldn't find a number.
sorry if it was duplicated.)
1. your thread is interrupted by an upcall.
2. pthread__upcall() handles the upcall and switch back to your thread
by pthread__upcall_switch.
3. pthread__upcall_switch switches its stack (STACK_SWITCH),
and eventually calls _md_setcontext_u.
4. if you are unfortunate enough, _md_setcontext_u is interrupted by
an upcall. now, it's similar to #1, but with some more stack consumed.
5. if you are really unfortunate, you'll repeat the above sequence
again and again, and eventually run out stack.
>How-To-Repeat:
code inspection.
>Fix:
>Unformatted: