sys: un-staticise finit_open() tmpfs: VOP_OPEN() should be allowed on unlinked files There is no reason for such restriction, and other file systems do not impose it. pddupfd(2): add a designator for the current process pddupfd(2): allow to open the executable One of the common uses for sysctl kern.proc.<pid>.pathname is to immediately open(2) the returned path to parse the image, e.g. to read the symbols. This operation was made more reliable since introduction of p_textdvp, but still rename or unlink of the binary cause unnecessary failures for that. Introduce pddupfd(pfd, PD_DUPFD_EXECUTABLE) special case that returns read-only file descriptor to the process executable image. pdfork.2: document PD_DUPFD_ME and PD_DUPFD_EXECUTABLE tests/sys/kern/procdesc: test pddupfd(PD_DUPFD_ME) Check that the descriptor of the calling process is duplicated with O_CLOEXEC set and the file shared, and that a closed descriptor gives EBADF. tests/sys/kern/procdesc: test pddupfd(PD_DUPFD_EXECUTABLE) Check that the returned file descriptor references the process binary, both for the calling process and for a child whose binary was unlinked after exec, and that it is close-on-exec, readable and lacks the write capability right. procfdcat(1): utility to read content of a file opened by process It reads the content of a regular file opened by another process, or of its executable, using pddupfd(2) and pread(2).
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped