Re: [PATCH v3] kernel/watch_queue: Make pipe NULL while clearing watch_queue

From: Siddh Raman Pant
Date: Thu Aug 04 2022 - 04:40:49 EST


On Wed, 03 Aug 2022 23:45:31 +0530 Eric Biggers wrote:
> Well, you should try listening instead. Because you are not listening.

Sorry for that, never meant to come across like that.

> Even if wqueue->pipe was set to NULL during free_pipe_info(), there would still
> have been a use-after-free, as the real bug was the lack of synchronization
> between post_one_notification() and free_pipe_info(). That is fixed now.

Okay, noted.

> To re-iterate, I encourage you to send a cleanup patch if you see an
> opportunity. It looks like the state wqueue->defunct==true could be replaced
> with wqueue->pipe==NULL, which would be simpler, so how about doing that? Just
> don't claim that it is "fixing" something, unless it is, as that makes things
> very confusing and difficult for everyone.

Okay, I will do that. That actually seems like a plausible thing to do, in
v2 convo, David Howells had also remarked similarly about `defunct` to a reply.

https://lore.kernel.org/linux-kernel/3565221.1658933355@xxxxxxxxxxxxxxxxxxxxxx/

> A reproducer can just be written as a normal program, in C or another language.
> The syzkaller reproducers are really hard to read as they are auto-generated, so
> don't read too much into them -- they're certainly not examples of good code.
>
> - Eric

Okay, noted.

Thanks for your patience, I probably annoyed you.

Thanks,
Siddh