HomeFreeBSD

kern: never restart syscalls calling closefp(), e.g. close(2)

Description

kern: never restart syscalls calling closefp(), e.g. close(2)

All paths leading into closefp() will either replace or remove the fd from
the filedesc table, and closefp() will call fo_close methods that can and do
currently sleep without regard for the possibility of an ERESTART. This can
be dangerous in multithreaded applications as another thread could have
opened another file in its place that is subsequently operated on upon
restart.

The following are seemingly the only ones that will pass back ERESTART
in-tree:

  • sockets (SO_LINGER)
  • fusefs
  • nfsclient

Reviewed by: jilles, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27310

Details

Provenance
kevansAuthored on
Reviewer
jilles
Differential Revision
D27310: kern: never restart syscalls calling closefp(), e.g. close(2)
Parents
rS368005: Remove the cloned file descriptors for /dev/crypto.
Branches
Unknown
Tags
Unknown