You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2010/09/04 20:17:47 UTC
DO NOT REPLY [Bug 48535] Potential data race on allocator->max_index
in allocator_alloc()
https://issues.apache.org/bugzilla/show_bug.cgi?id=48535
--- Comment #5 from sr-dev@gmx.net 2010-09-04 14:17:44 EDT ---
(In reply to comment #1)
> Isn't this an intentional race condition, following the usual pattern
>
> make a very cheap but imperfect state check
> if it looks good so far:
> get mutex
> check state carefully this time, handle appropriately
> release mutex
Thats true, but the current code does not do this (check again carefully).
Currently it does the following:
if index <= allocator->max_index
get mutex
do something1
release mutex
else
do something2
But it does not check the state carefully again... So I think it should do
this:
if index <= allocator->max_index
get mutex
// max_index could be changed in the mean while
if index <= allocator->max_index
do something1
release mutex
else
release mutex
do something2
else
do something2
However, I do not know the allocator code at all. But without the second if it
is possible to execute do something1 even if index is greater than max_index!
Regards,
Stefan (reporter of the issue on the mailing list ;-)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org