Quiz: How many inode types are there on Linux?
You might think the answer to this is 7, i.e. regular files, directories, symlinks, block device nodes, char device nodes, fifos, and sockets. But you are actually are wrong: there's an 8th one. There's the concept of an anonymous inode on Linux which has the file type of zero. You can easily acquire fds to inodes of this type via eventfd(). If you call fstat() on such fds, then (.st_mode & S_IFMT) == 0 will hold. 🤯
And I am pretty sure there's a lot of software you might be able to break given that they do not expect this case on the most basic of fs concepts.
Also note that these anonymous inodes are not actually as anonymous as one might think: because open fds appear in /proc/self/fd/ as magic symlinks you can easily get am fs path when you call stat() on will return you a zero inode type.
Double 🤯🤯