Debian Codegraph @

llvm-project/clang-tools-extra/docs/clang-tidy/checks/android/cloexec-pipe2.rst

raw
1 .. title:: clang-tidy - android-cloexec-pipe2
2
3 android-cloexec-pipe2
4 =====================
5
6 This check ensures that pipe2() is called with the O_CLOEXEC flag. The check also
7 adds the O_CLOEXEC flag that marks the file descriptor to be closed in child processes.
8 Without this flag a sensitive file descriptor can be leaked to a child process,
9 potentially into a lower-privileged SELinux domain.
10
11 Examples:
12
13 .. code-block:: c++
14
15 pipe2(pipefd, O_NONBLOCK);
16
17 Suggested replacement:
18
19 .. code-block:: c++
20
21 pipe2(pipefd, O_NONBLOCK | O_CLOEXEC);