Re: timerfd: use-after-free in timerfd_remove_cancel

From: Dmitry Vyukov
Date: Tue Jan 31 2017 - 07:10:22 EST


On Tue, Jan 31, 2017 at 12:45 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> On Tue, 31 Jan 2017, Thomas Gleixner wrote:
>
>> On Mon, 30 Jan 2017, Dmitry Vyukov wrote:
>> >
>> > Seems that ctx->might_cancel is racy.
>>
>> Yes, it is. Fix below.
>
> And the fix is racy as well. Darn, we really need to lock the context to
> avoid that mess.

Yes. I think we need to lock most of timerfd_settime. Otherwise we can
end up with a timer that needs to be in the cancel list, but it is
actually not; or vice versa.