Project

General

Profile

Actions

Bug #9124

closed

TestSocket errors in test-all on Arch 64-bit

Added by jonforums (Jon Forums) about 11 years ago. Updated almost 11 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
ruby -v:
ruby 2.1.0dev (2013-11-19 trunk 43711) [x86_64-linux]
[ruby-core:58411]

Description

My system misconfiguration or MRI bug?

arch64:build % uname -a
Linux arch64 3.12.0-1-ARCH #1 SMP PREEMPT Wed Nov 6 09:06:27 CET 2013 x86_64 GNU/Linux

arch64:build % uru ls
 => 210dev      : ruby 2.1.0dev (2013-11-19 trunk 43711) [x86_64-linux]

arch64:build % ../configure --prefix=$HOME/.rubies/ruby-2.1.0 --enable-shared --disable-install-doc && make all && make test-all
...
[12188/14685] TestSocket#test_timestamp = 0.00 s
  5) Error:
TestSocket#test_timestamp:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:457:in `recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:457:in `block (2 levels) in test_timestamp'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:181:in `bind'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:454:in `block in test_timestamp'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:181:in `bind'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:453:in `test_timestamp'

[12189/14685] TestSocket#test_timestampns = 0.00 s
  6) Error:
TestSocket#test_timestampns:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:484:in `recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:484:in `block (2 levels) in test_timestampns'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:181:in `bind'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:476:in `block in test_timestampns'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:181:in `bind'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:475:in `test_timestampns'

[12190/14685] TestSocket#test_udp_server = 10.02 s
  7) Error:
TestSocket#test_udp_server:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:654:in `recvmsg_nonblock'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:654:in `block in udp_server_recv'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:652:in `each'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:652:in `udp_server_recv'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:684:in `block in udp_server_loop_on'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:682:in `loop'
    /home/jon/rubydev/ruby-git/build/.ext/common/socket.rb:682:in `udp_server_loop_on'
    /home/jon/rubydev/ruby-git/test/socket/test_socket.rb:388:in `block (2 levels) in test_udp_server'

[12247/14685] TestSocketNonblock#test_recvmsg_nonblock_error = 0.00 s
  8) Error:
TestSocketNonblock#test_recvmsg_nonblock_error:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_nonblock.rb:250:in `recvmsg_nonblock'
    /home/jon/rubydev/ruby-git/test/socket/test_nonblock.rb:250:in `block in test_recvmsg_nonblock_error'
    /home/jon/rubydev/ruby-git/test/socket/test_nonblock.rb:155:in `udp_pair'
    /home/jon/rubydev/ruby-git/test/socket/test_nonblock.rb:248:in `test_recvmsg_nonblock_error'

[12279/14685] TestSocket_UNIXSocket#test_fd_passing_n = 0.00 s
  9) Error:
TestSocket_UNIXSocket#test_fd_passing_n:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:54:in `recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:54:in `block (2 levels) in test_fd_passing_n'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:46:in `pair'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:46:in `block in test_fd_passing_n'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:44:in `each'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:44:in `test_fd_passing_n'

[12280/14685] TestSocket_UNIXSocket#test_fd_passing_n2 = 0.00 s
 10) Error:
TestSocket_UNIXSocket#test_fd_passing_n2:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:91:in `recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:91:in `block (2 levels) in test_fd_passing_n2'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:83:in `pair'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:83:in `block in test_fd_passing_n2'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:81:in `each'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:81:in `test_fd_passing_n2'

[12292/14685] TestSocket_UNIXSocket#test_recvmsg = 0.00 s
 11) Error:
TestSocket_UNIXSocket#test_recvmsg:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:214:in `recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:214:in `block (2 levels) in test_recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:212:in `pair'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:212:in `block in test_recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:211:in `pipe'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:211:in `test_recvmsg'

[12295/14685] TestSocket_UNIXSocket#test_sendcred_ucred = 0.00 s
 12) Error:
TestSocket_UNIXSocket#test_sendcred_ucred:
Errno::EINVAL: Invalid argument - recvmsg(2)
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:479:in `recvmsg'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:479:in `block in test_sendcred_ucred'
    /home/jon/rubydev/ruby-git/lib/tmpdir.rb:88:in `mktmpdir'
    /home/jon/rubydev/ruby-git/test/socket/test_unix.rb:472:in `test_sendcred_ucred'

Finished tests in 410.247772s, 35.7954 tests/s, 6317.1702 assertions/s.
14685 tests, 2591605 assertions, 0 failures, 8 errors, 32 skips

Updated by jonforums (Jon Forums) almost 11 years ago

No failure on 64bit ubuntu server 13.10 with glibc 2.17 and gcc 4.8.1. Failure only on arch 64bit with glibc 2.18 and gcc 4.8.2

Updated by normalperson (Eric Wong) almost 11 years ago

This looks to be a problem of Linux 3.12 and later

commit 1661bf364ae9c506bc8795fef70d1532931be1e8
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Oct 3 00:27:20 2013 +0300

    net: heap overflow in __audit_sockaddr()

I'm inclined to believe Ruby is incorrect for using a gigantic
placeholder value.

Ruby started using a gigantic buffer since r39529 (so no stable releases).

 * ext/socket/rubysocket.h (union_sockaddr): make it longer for SunOS
   and Darwin.

The following is a dirty workaround, but I don't think it's sufficient
since SunOS and Darwin could be affected by the same heap overflow in
which was in Linux.

--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -194,7 +194,9 @@ typedef union {
struct sockaddr_dl dl; /* AF_LINK /
#endif
struct sockaddr_storage storage;
+#ifndef linux
char place_holder[2048]; /
sockaddr_storage is not enough for Unix domain sockets on SunOS and Darwin. */
+#endif
} union_sockaddr;

#ifdef APPLE

Updated by normalperson (Eric Wong) almost 11 years ago

Linux patch to fix this:
http://mid.gmane.org/20131127124021.GA2025@elgon.mountain
I think Ruby can remain unchanged.

Updated by jonforums (Jon Forums) almost 11 years ago

normalperson (Eric Wong) wrote:

Linux patch to fix this:
http://mid.gmane.org/20131127124021.GA2025@elgon.mountain
I think Ruby can remain unchanged.

Ah, I see. I'll check again when Arch pushes an update to 3.12.1-3-ARCH. Thank you for the info.

Updated by jonforums (Jon Forums) almost 11 years ago

After updating Ubuntu Server 13.10 with linux-image-3.11.0-14-generic I see the same error with Arch.

The behavior Eric mentioned is on linux-stable so it may have been pulled in with their latest update

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/commit/net?id=1661bf364ae9c506bc8795fef70d1532931be1e8

Linux 3.13-rc2 has the patch, so Arch will likely get it soon after 3.13, but But will Ubuntu Server 13.10 ever get the patch or move to 3.13?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net?id=db31c55a6fb245fdbb752a2ca4aefec89afabb06

Anyone running an up-to-date desktop Ubuntu 13.10 also seeing this, or is it currently Server 13.10 only?

Updated by normalperson (Eric Wong) almost 11 years ago

"jonforums (Jon Forums)" wrote:

Linux 3.13-rc2 has the patch, so Arch will likely get it soon after 3.13, but But will Ubuntu Server 13.10 ever get the patch or move to 3.13?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/net?id=db31c55a6fb245fdbb752a2ca4aefec89afabb06

This will flow into the stable maintenance kernels (3.12, 3.10, etc)
within a few weeks. DaveM (net maintainer) usually lets things settle
in Linus' tree a bit before submitting them for -stable inclusion.

I'll provide updates as stable kernels are released with this fix.

Updated by normalperson (Eric Wong) almost 11 years ago

Eric Wong wrote:

This will flow into the stable maintenance kernels (3.12, 3.10, etc)
within a few weeks.

GregKH has these queued up for the next 3.12, 3.10, and 3.4 stable releases.
So Linux 3.12.4, 3.10.23, and 3.4.73 should all have them

I expect the maintainers for 3.2 and 3.5 (LTS Ubuntu) to pick them up in
the next releases, too.

Updated by normalperson (Eric Wong) almost 11 years ago

Eric Wong wrote:

Eric Wong wrote:

This will flow into the stable maintenance kernels (3.12, 3.10, etc)
within a few weeks.

GregKH has these queued up for the next 3.12, 3.10, and 3.4 stable releases.
So Linux 3.12.4, 3.10.23, and 3.4.73 should all have them

Btw, all of these are released. I think the issue may be closed, now.

I expect the maintainers for 3.2 and 3.5 (LTS Ubuntu) to pick them up in
the next releases, too.

3.5 just picked it up, too. Expect a slightly longer cycle for 3.2;
but it'll get there.

Updated by jonforums (Jon Forums) almost 11 years ago

normalperson (Eric Wong) wrote:

Eric Wong wrote:

Eric Wong wrote:

This will flow into the stable maintenance kernels (3.12, 3.10, etc)
within a few weeks.

GregKH has these queued up for the next 3.12, 3.10, and 3.4 stable releases.
So Linux 3.12.4, 3.10.23, and 3.4.73 should all have them

Btw, all of these are released. I think the issue may be closed, now.

Agreed re: closing. Arch 64bit based upon 3.12.4 builds trunk with 0 test-all errors.

Updated by hsbt (Hiroshi SHIBATA) almost 11 years ago

  • Target version changed from 2.1.0 to 2.2.0

Updated by vo.x (Vit Ondruch) almost 11 years ago

This test passes for me on Fedora Rawhide with Kernel 3.12.8-300.fc20.x86_64

Updated by akr (Akira Tanaka) almost 11 years ago

I think we can accept a workaround if there is well commented patch.

Updated by kosaki (Motohiro KOSAKI) almost 11 years ago

  • Status changed from Open to Third Party's Issue

We don't need to care upstream kernel specific bugs. Nobody except developer uses it.
I've closed this.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0