RFR: 8253717: Relocate stack overflow code out of thread.hpp/cpp [v3]

Coleen Phillimore coleenp at openjdk.java.net
Wed Oct 7 19:05:09 UTC 2020


On Wed, 7 Oct 2020 18:15:59 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> I just found this comment.  I think the ascii art was added by @GoeLin.  I just moved it. Your picture is upside down
>> but it sorta makes sense that the 'base' addresses point to the first address in the range, which is what I think they
>> do.
>
> I'm quite sure they don't.
> 
> stack_base() points to one-beyond-the-highest address in stack and therefore outside the stack. If the stack is 8
> pages, stack_base points to the start of the 9th page. Therefore stack_base may actually point into a different memory
> region, eg the stack of a neighboring thread, should they happen to be allocated without gap.  stack_red_zone_base()
> points to one-beyond-the-highest address in the red zone resp. the lowest address in the yellow zone. So it points
> outside the red zone.   And so forth, for all other "base" values. All are one-beyond pointers.
> 
> But nothing that needs to be addressed with your patch, of course.

in Thread::record_stack_base_and_size ->  set_stack_base(os::current_stack_base());
which has different implementations in os_cpu files.  You're saying that these set stack_base to one word beyond?
Which makes all the calculations off by one. We should file a bug or rfe to clean this up.  I haven't worked out how it
would manifest itself as a bug.  I'll file it but you might need to fill in some details. Right, I'm not going to
address it with this patch, which is supposed to be a cleanup.  Thanks.

-------------

PR: https://git.openjdk.java.net/jdk/pull/522


More information about the hotspot-dev mailing list