Bug 444560 - accept(2) return EINVAL on s390x
accept(2) return EINVAL on s390x
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.6.z
s390x Linux
medium Severity medium
: rc
: ---
Assigned To: Red Hat Kernel Manager
Martin Jenner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-28 23:48 EDT by CAI Qian
Modified: 2008-04-29 00:04 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-04-29 00:04:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
testr.c (1.81 KB, text/plain)
2008-04-28 23:48 EDT, CAI Qian
no flags Details
testw.c (940 bytes, text/plain)
2008-04-28 23:49 EDT, CAI Qian
no flags Details

  None (edit)
Description CAI Qian 2008-04-28 23:48:38 EDT
Description of problem:
While communicating through unix domain socket (AF_UNIX, SOCK_STREAM), accept(2)
returns EINVAL. This has only been observed on s390x, and it breaks POSIX. CCed
Ulrich Drepper, as this might be a glibc issue.

Version-Release number of selected component (if applicable):
RHEL4U6
kernel-2.6.9-67.0.7.EL
glibc-headers-2.3.4-2.39.s390x

How reproducible:
Always on s390x

Steps to Reproduce:
1. compile testr.c and run
2. compile testw.c and run

Additional info:
strace from both programs,

[root@z207 435122]# strace ./testr
execve("./r", ["./r"], [/* 21 vars */]) = 0
uname({sys="Linux", node="z207.z900.redhat.com", ...}) = 0
brk(0)                                  = 0x80003000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2000001a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=36766, ...}) = 0
mmap(NULL, 36766, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2000001b000
close(3)                                = 0
open("/lib64/tls/libc.so.6", O_RDONLY)  = 3
read(3, "\177ELF\2\2\1\0\0\0\0\0\0\0\0\0\0\3\0\26\0\0\0\1\0\0\0\0\0\1\361d"...,
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1748512, ...}) = 0
mmap(NULL, 1431936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x20000024000
mmap(0x20000179000, 20480, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x154000) = 0x20000179000
mmap(0x2000017e000, 14720, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2000017e000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x20000182000
mprotect(0x20000179000, 12288, PROT_READ) = 0
mprotect(0x20000018000, 4096, PROT_READ) = 0
munmap(0x2000001b000, 36766)            = 0
unlink("./.sockfile")                   = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
bind(3, {sa_family=AF_FILE, path="./.sockfile"}, 110) = 0
listen(3, 5)                            = 0
select(4, [3], NULL, NULL, NULL)        = 1 (in [3])
accept(3, 0x3fffffff718, [9223841047283499008]) = -1 EINVAL (Invalid argument)
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2000001b000
write(1, "accept error (22)\n", 18accept error (22)
)     = 18
exit_group(22)                          = ?

[root@z207 435122]# strace ./testw
execve("./w", ["./w"], [/* 21 vars */]) = 0
uname({sys="Linux", node="z207.z900.redhat.com", ...}) = 0
brk(0)                                  = 0x80002000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2000001a000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=36766, ...}) = 0
mmap(NULL, 36766, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2000001b000
close(3)                                = 0
open("/lib64/tls/libc.so.6", O_RDONLY)  = 3
read(3, "\177ELF\2\2\1\0\0\0\0\0\0\0\0\0\0\3\0\26\0\0\0\1\0\0\0\0\0\1\361d"...,
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1748512, ...}) = 0
mmap(NULL, 1431936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x20000024000
mmap(0x20000179000, 20480, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x154000) = 0x20000179000
mmap(0x2000017e000, 14720, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2000017e000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x20000182000
mprotect(0x20000179000, 12288, PROT_READ) = 0
mprotect(0x20000018000, 4096, PROT_READ) = 0
munmap(0x2000001b000, 36766)            = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_FILE, path="./.sockfile"}, 110) = 0
write(3, "ABCDEFGH", 8)                 = 8
close(3)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_FILE, path="./.sockfile"}, 110) = 0
write(3, "ABCDEFGH", 8)                 = 8
close(3)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_FILE, path="./.sockfile"}, 110) = 0
write(3, "ABCDEFGH", 8)                 = 8
close(3)                                = 0
socket(PF_FILE, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_FILE, path="./.sockfile"}, 110) = 0
write(3, "ABCDEFGH", 8)                 = -1 EPIPE (Broken pipe)
--- SIGPIPE (Broken pipe) @ 0 (0) ---
+++ killed by SIGPIPE +++
Comment 1 CAI Qian 2008-04-28 23:48:38 EDT
Created attachment 304061 [details]
testr.c
Comment 2 CAI Qian 2008-04-28 23:49:06 EDT
Created attachment 304062 [details]
testw.c
Comment 3 Ulrich Drepper 2008-04-29 00:04:46 EDT
The program is invalid.  The variable len is not initialized.  This can cause
the EINVAL error.

Note You need to log in before you can comment on or make changes to this bug.