libzmq
  1. libzmq
  2. LIBZMQ-273

O_CLOEXEC flag used in ip.cpp:192 is supported only on Linux kernels 2.6.27+

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.10
    • Fix Version/s: None
    • Component/s: build system
    • Labels:
      None

      Description

      When building ZeroMQ versions 2.1.10+ build system have to check whether the underlying kernel version is actually 2.6.27 or newer (or maybe check it on runtime), even if the O_CLOEXEC flag is defined. Some virtualization environment, like OpenVZ, allow to run newer Linux systems (like Lucid) on older host systems (like Hardy), which will end up in new libc dev headers with O_CLOEXEC defined running on older kernel which doesn't support it, which in order will block all TCP communications due to an inability to bind a socket at all.

      1. 0001-Added-test-for-SOCK_CLOEXEC.patch
        3 kB
        Mikko Koppanen
      2. sockexec-check.patch
        1 kB
        Julian Taylor

        Activity

        Hide
        Julian Taylor added a comment -

        runtime SOCK_CLOEXEC check, based on 2.1.10

        Show
        Julian Taylor added a comment - runtime SOCK_CLOEXEC check, based on 2.1.10
        Hide
        Julian Taylor added a comment -

        yes you can close it fixed if you don't want to use a runtime check.
        I have attached the patch I'm going to apply to ubuntu (based on 2.1.10)

        Show
        Julian Taylor added a comment - yes you can close it fixed if you don't want to use a runtime check. I have attached the patch I'm going to apply to ubuntu (based on 2.1.10)
        Hide
        Martin Lucina added a comment -

        Thanks for the patch, are you sure you want this commented out?

        @@ -201,7 +207,8 @@ int zmq::open_socket (int domain_, int t
        // between socket creation and this point).
        #if !defined SOCK_CLOEXEC && defined FD_CLOEXEC
        int rc = fcntl (s, F_SETFD, FD_CLOEXEC);

        • errno_assert (rc != -1);
          + /* ignore to be able to run build testsuites on hardy builders
          + errno_assert (rc != -1); */
          #endif
        Show
        Martin Lucina added a comment - Thanks for the patch, are you sure you want this commented out? @@ -201,7 +207,8 @@ int zmq::open_socket (int domain_, int t // between socket creation and this point). #if !defined SOCK_CLOEXEC && defined FD_CLOEXEC int rc = fcntl (s, F_SETFD, FD_CLOEXEC); errno_assert (rc != -1); + /* ignore to be able to run build testsuites on hardy builders + errno_assert (rc != -1); */ #endif
        Hide
        Julian Taylor added a comment -

        there is nothing one can further do when there is no CLOEXEC. A socket without CLOEXEC is better than none at all.
        The #ifdef will never be true on ubuntu systems with zeromq anyway.

        Show
        Julian Taylor added a comment - there is nothing one can further do when there is no CLOEXEC. A socket without CLOEXEC is better than none at all. The #ifdef will never be true on ubuntu systems with zeromq anyway.
        Hide
        Martin Lucina added a comment -

        Closing as fixed since Ubuntu guys will use their own downstream patch

        Show
        Martin Lucina added a comment - Closing as fixed since Ubuntu guys will use their own downstream patch

          People

          • Assignee:
            Martin Sustrik
            Reporter:
            Andrey Sibiryov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: