All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] improper locking due to the unreleased lock
@ 2021-10-12  6:54 Ryan Cai
  2021-10-12  8:24 ` Juergen Gross
  0 siblings, 1 reply; 2+ messages in thread
From: Ryan Cai @ 2021-10-12  6:54 UTC (permalink / raw)
  To: xen-devel, ian.jackson

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

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

 


[-- Attachment #2: Type: text/html, Size: 2760 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] improper locking due to the unreleased lock
  2021-10-12  6:54 [BUG] improper locking due to the unreleased lock Ryan Cai
@ 2021-10-12  8:24 ` Juergen Gross
  0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2021-10-12  8:24 UTC (permalink / raw)
  To: Ryan Cai, xen-devel, ian.jackson


[-- Attachment #1.1.1: Type: text/plain, Size: 1020 bytes --]

On 12.10.21 08:54, Ryan Cai wrote:
> 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

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-12  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  6:54 [BUG] improper locking due to the unreleased lock Ryan Cai
2021-10-12  8:24 ` Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.