https://bugs.llvm.org/show_bug.cgi?id=43871
Bug ID: 43871
Summary: false positive: VforkChecker::isCallWhitelisted()
prohibits IO-related functions, which is wrong.
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Created attachment 22757
--> https://bugs.llvm.org/attachment.cgi?id=22757&action=edit
reproduction code
zsh % cat tmp.c
#include <sys/types.h>
#include <unistd.h>
void
test(void)
{
pid_t p = vfork();
if (p == 0) {
close(STDIN_FILENO);
execl("/bin/sh", "/bin/sh", 0);
}
}
zsh % scan-build-10 clang-10 -c tmp.c
scan-build: Using '/usr/lib/llvm-10/bin/clang' for static analysis
tmp.c:7:15: warning: Call to function 'vfork' is insecure as it can lead to
denial of service situations in the parent process. Replace calls to vfork with
calls to the safer 'posix_spawn' function
pid_t p = vfork();
^~~~~
tmp.c:9:9: warning: This function call is prohibited after a successful vfork
close(STDIN_FILENO);
^~~~~~~~~~~~~~~~~~~
2 warnings generated.
scan-build: 2 bugs found.
scan-build: Run 'scan-view /tmp/scan-build-2019-11-01-104537-23752-1' to
examine bug reports.
zsh %
This warning #2 is wrong. AFAIK there has never been any operating system
which prohibits closing file descriptor after a successful vfork. A file
descriptor is an in-kernel resource thus not shared among vfork parent/child.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs