[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 1/1] audio/jack: fix use after free segfault
From: |
Christian Schoenebeck |
Subject: |
Re: [PATCH v5 1/1] audio/jack: fix use after free segfault |
Date: |
Thu, 20 Aug 2020 12:06:39 +0200 |
On Donnerstag, 20. August 2020 07:37:28 CEST Gerd Hoffmann wrote:
> Hi,
>
> > > + qemu_bh_cancel(c->shutdown_bh);
> >
> > Looks like a potential race. Quote from the API doc of qemu_bh_cancel():
> > "While cancellation itself is also wait-free and thread-safe, it can of
> > course race with the loop that executes bottom halves unless you are
> > holding the iothread mutex. This makes it mostly useless if you are not
> > holding the mutex."
>
> Should not be a problem, all auto backend code should only be called
> while qemu holds the iothread mutex. With the exception of the shutdown
> handler which jack might call from signal context (which is why we need
> the BH in the first place).
Hmmm, as Geoffrey already added a lock today, I noticed that QEMU's main IO
thread mutex is not initialized as 'recursive' lock type. Does that make
sense? I.e. shouldn't there be a
qemu_rec_mutex_init(&qemu_global_mutex);
in softmmu/cpus.c for safety reasons to prevent nested locks from same thread
causing misbehaviour?
CCing Paolo to clarify.
Best regards,
Christian Schoenebeck
- [PATCH v5 0/1] audio/jack: fix use after free segfault, Geoffrey McRae, 2020/08/19
- [PATCH v5 1/1] audio/jack: fix use after free segfault, Geoffrey McRae, 2020/08/19
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Christian Schoenebeck, 2020/08/19
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Geoffrey McRae, 2020/08/19
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Gerd Hoffmann, 2020/08/20
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault,
Christian Schoenebeck <=
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Paolo Bonzini, 2020/08/20
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Christian Schoenebeck, 2020/08/20
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Paolo Bonzini, 2020/08/21
- PTHREAD_MUTEX_ERRORCHECK and fork(), Christian Schoenebeck, 2020/08/26
- recursive locks (in general), Christian Schoenebeck, 2020/08/21
- Re: recursive locks (in general), Paolo Bonzini, 2020/08/21
- Re: recursive locks (in general), Christian Schoenebeck, 2020/08/21
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Geoffrey McRae, 2020/08/21
- Re: [PATCH v5 1/1] audio/jack: fix use after free segfault, Paolo Bonzini, 2020/08/21