Re: Userfaultfd doesn't seem to break out of poll on fd close

From: Jason Gunthorpe
Date: Thu Apr 16 2020 - 10:49:56 EST


On Wed, Apr 15, 2020 at 06:15:26PM -0700, Brian Geffon wrote:

> And all of that I guess makes sense in the case of a non-blocking fd,
> but what about the case of a blocking file descriptor? Both
> userfaultfd and eventfd can seemingly be stuck in a read syscall with
> no way to break them out when the userfaultfd/eventfd has no further
> utility. Here is an example:
> https://gist.github.com/bgaff/607302d86d99ac539efca307ce2dd679

If an application wants to terminate blocking calls it has to rely on
signal delivery or pthread_cancel to end it.

This is very complicated so it is generally better to use poll and non
blocking.

Jason