Page MenuHomeFreeBSD

fstatat(2): handle non-vnode file descriptors for AT_EMPTY_PATH
ClosedPublic

Authored by kib on Aug 13 2021, 5:56 PM.
Tags
None
Referenced Files
F102843446: D31530.id.diff
Sun, Nov 17, 9:44 PM
F102806551: D31530.id93660.diff
Sun, Nov 17, 10:37 AM
Unknown Object (File)
Mon, Nov 11, 12:13 PM
Unknown Object (File)
Sat, Nov 9, 11:41 PM
Unknown Object (File)
Sat, Nov 9, 11:39 PM
Unknown Object (File)
Mon, Nov 4, 3:35 AM
Unknown Object (File)
Mon, Nov 4, 3:35 AM
Unknown Object (File)
Mon, Nov 4, 3:35 AM
Subscribers
None

Details

Summary

Set NIRES_EMPTYPATH earlies, to have use of EMPTYPATH recorded even if we are going to return error. When namei_setup() refused to accept dirfd, which is not vnode type, and indicated by ENOTDIR error return, fall back to kern_fstat(dirfd).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Aug 13 2021, 5:56 PM
kib created this revision.

When does this scenario arise?

This revision is now accepted and ready to land.Aug 13 2021, 8:36 PM

When does this scenario arise?

For instance, fstatat(pipefd, "", &stat, AT_EMPTY_PATH) would do it. I have no idea why an app would want to call fstat(pipefd) this way, but this is what Dmitry' test case does, adopted from some Linux trace.