Project

General

Profile

Actions

Bug #11438

closed

native_thread_init_stack() get machine.stack_start unequal to thread's stack start address, x86 win32

Bug #11438: native_thread_init_stack() get machine.stack_start unequal to thread's stack start address, x86 win32

Added by rickerliang (l ly) almost 11 years ago. Updated 3 days ago.

Status:
Closed
Assignee:
Target version:
-
[ruby-core:<unknown>]
Tags:

Description

In function native_thread_init_stack() use VirtualQuery to get thread's stack start address.But some situation(ruby embbed in other application and initial it on the fly),native_thread_init_stack() will be called at low stack address and VirtualQuery return memory info BaseAddress + RegionSize < thread stack base(teb.StackBase).
In this situation,subsequently call stack_check() at high stack address will cause stack_overflow exception,because esp > machine.stack_start:
(teb.StackLimit < machine.stack_start < esp < teb.StackBase)
but actually it is not stack overflow at this time.
Use teb.StackBase instead of VirtualQuery get thread stack base is a more reliable solution.

Updated by hsbt (Hiroshi SHIBATA) over 2 years ago Actions #1

  • Status changed from Open to Assigned

Updated by hsbt (Hiroshi SHIBATA) 16 days ago Actions #3

  • Status changed from Assigned to Closed

Applied in changeset git|e585c9449965a6837374e0c5436cf4be731802df.


win32: Use GetCurrentThreadStackLimits to set machine stack bounds
[Bug #11438]

VirtualQuery against a local variable address may return a region that
does not span the whole thread stack when the interpreter is
initialized deep in the stack, such as Ruby embedded in another
application. stack_check() then misfires with a bogus SystemStackError.

Updated by hsbt (Hiroshi SHIBATA) 16 days ago Actions #4

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) 3 days ago Actions #5 [ruby-core:126344]

  • Backport changed from 3.3: WONTFIX, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: WONTFIX, 3.4: DONE, 4.0: REQUIRED
Actions

Also available in: PDF Atom