https://bugs.kde.org/show_bug.cgi?id=440743

            Bug ID: 440743
           Summary: Socketpair wrapper does not handle emulated resource
                    limit properly
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Unspecified
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: alo...@gmx-topmail.de
  Target Milestone: ---

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

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to