Merge lp://qastaging/~percona-core/percona-server/5.6-553-bug-1351148 into lp://qastaging/percona-server/5.6

Proposed by Vlad Lesin
Status: Work in progress
Proposed branch: lp://qastaging/~percona-core/percona-server/5.6-553-bug-1351148
Merge into: lp://qastaging/percona-server/5.6
Diff against target: 68 lines (+37/-3)
2 files modified
mysys/lf_alloc-pin.c (+10/-1)
mysys/my_thr_init.c (+27/-2)
To merge this branch: bzr merge lp://qastaging/~percona-core/percona-server/5.6-553-bug-1351148
Reviewer Review Type Date Requested Status
Percona core Pending
Review via email: mp+229179@code.qastaging.launchpad.net

Description of the change

1) Take into accout the current stack offset when stack size is calculated in my_thread_init();

2) Don't allocate the whole free stack space in _lf_pinbox_real_free(), take some window for qsort();

To post a comment you must log in.
554. By Vlad Lesin

Bug #1351128 fix.

The bug's summary:

1) The value in pins->stack_ends_here is actually incorrect. This value is
calculated when the thread is initialized in my_thread_init(). The problem is
that the value doesn't take into account existing stack usage and just adds the
thread stack size to calculate the beginning of the stack.

2) _lf_pinbox_real_free() is using alloca() in a very unsafe way. alloca()
should only be used by leaf functions, since you cannot predict the amount of
stack space that non-leaf functions will use. As pins->stack_ends_here is
calculated in wrong way and there is no window for the qsort() which is invoked
from _lf_pinbox_real_free() after alloca(), stack overflow can take place.

The solution:

1) Take into accout the current stack offset when stack size is calculated
in my_thread_init();

2) Don't allocate the whole free stack space in _lf_pinbox_real_free(),
take some window for qsort();

Unmerged revisions

554. By Vlad Lesin

Bug #1351128 fix.

The bug's summary:

1) The value in pins->stack_ends_here is actually incorrect. This value is
calculated when the thread is initialized in my_thread_init(). The problem is
that the value doesn't take into account existing stack usage and just adds the
thread stack size to calculate the beginning of the stack.

2) _lf_pinbox_real_free() is using alloca() in a very unsafe way. alloca()
should only be used by leaf functions, since you cannot predict the amount of
stack space that non-leaf functions will use. As pins->stack_ends_here is
calculated in wrong way and there is no window for the qsort() which is invoked
from _lf_pinbox_real_free() after alloca(), stack overflow can take place.

The solution:

1) Take into accout the current stack offset when stack size is calculated
in my_thread_init();

2) Don't allocate the whole free stack space in _lf_pinbox_real_free(),
take some window for qsort();

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches