improper locking due to the unreleased lock
Dear maintainers for Xen Project,
I am writing you to report a bug due to the unreleased lock. The impact could be deadlock or memory consumption. In the function of read_watch_internal, the mutex lock h->watch_mutex (Line901) is not released correctly when read_message(h,nonblocking)== -1(Line 923). Looking forward to your feedback. Thank for checking.
Locations, https://github.com/xen-project/xen/blob/master/tools/libs/store/xs.c#L902-L924
Best,
Ryan Cai
Quoted 6 lines · Ryan Cai
Dear maintainers for Xen Project,
I am writing you to report a bug due to the unreleased
lock. The impact could be deadlock or memory consumption. In the function of /read_watch_internal/, the mutex lock /h->watch_mutex/ (*Line901*) is not released correctly when /read_message(h,nonblocking)== -1/(*Line 923*). Looking forward to your feedback. Thank for checking.Locations, https://github.com/xen-project/xen/blob/master/tools/libs/store/xs.c#L902-L924
Thanks for the report.
From looking at read_watch_internal() this seems to be right, but this is no issue in reality.
The missing mutex_unlock() is inside a !USE_PTHREAD section. This implies muex_lock() and mutex_unlock() being defined as ((void)0), so there is no risk of anything going wrong.
Even with no risk something going wrong here, the code should be corrected nevertheless in order to avoid others to stumble over that.
Juergen