Re: [PATCH v3] x86/sgx: Synchronize encl->srcu in sgx_encl_release().
From: Borislav Petkov
Date: Tue Jan 05 2021 - 09:58:54 EST
On Wed, Dec 16, 2020 at 03:49:20PM +0200, Jarkko Sakkinen wrote:
> Add synchronize_srcu_expedited() to sgx_encl_release() to catch a grace
> period initiated by sgx_mmu_notifier_release().
>
> A trivial example of a failing sequence with tasks A and B:
>
> 1. A: -> sgx_release()
> 2. B: -> sgx_mmu_notifier_release()
> 3. B: -> list_del_rcu()
> 3. A: -> sgx_encl_release()
> 4. A: -> cleanup_srcu_struct()
>
> The loop in sgx_release() observes an empty list because B has removed its
> entry in the middle, and calls cleanup_srcu_struct() before B has a chance
> to calls synchronize_srcu().
Leading to what? NULL ptr?
https://lkml.kernel.org/r/X9e2jOWz1hfXVpQ5@xxxxxxxxxx
already suggested that you should explain the bug better and add the
splat but I'm still missing that explanation.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette