| Summary: | Socketpair wrapper does not handle emulated resource limit properly | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Alois Wohlschlager <alois1> |
| Component: | general | Assignee: | Julian Seward <jseward> |
| Status: | REPORTED --- | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Unspecified | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
SUMMARY The syscall wrapper for socketpair returns success if the emulated resource limit for open files is exhausted. It should fail with error EMFILE. STEPS TO REPRODUCE 1. Compile the following test program: #include <stdio.h> #include <sys/resource.h> #include <sys/socket.h> #include <unistd.h> int main() { struct rlimit lim; getrlimit(RLIMIT_NOFILE, &lim); lim.rlim_cur = 3; setrlimit(RLIMIT_NOFILE, &lim); int sv[2]; printf("%d\n", socketpair(AF_UNIX, SOCK_STREAM, 0, sv)); } 2. Run the compiled program with valgrind (the tool does not matter) OBSERVED RESULT Test program prints 0 EXPECTED RESULT Test program prints -1 SOFTWARE/OS VERSIONS Valgrind: 3.17.0