Bug 468148 - getsockopt() returning incorrectly in PPC
getsockopt() returning incorrectly in PPC
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel (Show other bugs)
5.3
powerpc Linux
urgent Severity high
: rc
: ---
Assigned To: Jiri Pirko
Martin Jenner
: ZStream
: 462449 (view as bug list)
Depends On: 462741
Blocks: 469649
  Show dependency treegraph
 
Reported: 2008-10-23 05:04 EDT by Jiri Pirko
Modified: 2015-05-04 21:15 EDT (History)
14 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-20 14:38:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jiri Pirko 2008-10-23 05:04:38 EDT
+++ This bug was initially created as a clone of Bug #462741 +++

Escalated to Bugzilla from IssueTracker

--- Additional comment from tao@redhat.com on 2008-09-18 13:04:17 EDT ---

---Problem Description---
getsockopt() is returning 0 when (u_char *) is passed as an argument and TTL =
255. This is happening in PPC platforms.

Contact Information = pramonag@in.ibm.com, anantyog@in.ibm.com

---uname output---
Linux linppc01.in.ibm.com 2.6.9-42.EL #1 SMP Wed Jul 12 23:22:51 EDT 2006 ppc64
ppc64 ppc64 GNU/Linux

Machine Type = PPC 64

---Debugger---
A debugger is not configured

---Steps to Reproduce---
Testcase which reproduces the problem:

#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
int main(int argc, char *argv[]){
int fd = socket(AF_INET,SOCK_DGRAM,getprotobyname("udp")->p_proto);
int ttl = 255;
char cttl = (char)ttl;
int uchar_getlen;
u_char uchar_getttl;
int int_getttl;
int int_getlen;
if(setsockopt(fd,IPPROTO_IP,IP_MULTICAST_TTL,(char *)&cttl,sizeof(cttl))<0){
printf("setsockopt failed::errno=%d\n",errno);
}
else{
uchar_getttl = 0;
uchar_getlen = sizeof(uchar_getttl);
int_getttl = 0;
int_getlen = sizeof(int_getttl);
if(getsockopt(fd,IPPROTO_IP,IP_MULTICAST_TTL,(u_char
*)&uchar_getttl,&uchar_getlen)<0){
printf("getsockopt failed::errno=%d\n",errno);
}
if(getsockopt(fd,IPPROTO_IP,IP_MULTICAST_TTL,(int
*)&int_getttl,&int_getlen)<0){
printf("getsockopt failed::errno=%d\n",errno);
}

printf("setTTL=%d,getTTL with u_char=%d,getTTL with int
=%d\n",ttl,uchar_getttl,int_getttl);
}
}


---Kernel - Network Drivers Component Data---
Stack trace output:
no

Oops output:
no

Userspace tool common name: na

The userspace tool has the following bit modes: Both

System Dump Info:
The system is not configured to capture a system dump.

Userspace rpm: na

*Additional Instructions for pramonag@in.ibm.com, anantyog@in.ibm.com:
-Post a private note with access information to the machine that the bug is
occuring on.
-Attach sysctl -a output output to the bug.
-Attach ltrace and strace of userspace application.
=Comment: #1=================================================
Anoop V. Chakkalakkal <anoop.vijayan@in.ibm.com> - 2008-08-29 01:32 EDT
The issue is discussed at http://lists.openwall.net/netdev/2008/04/10/20 where
David Miller has provided a patch.
=Comment: #2=================================================
Anoop V. Chakkalakkal <anoop.vijayan@in.ibm.com> - 2008-08-29 01:34 EDT

ip_getsockopt.patch

Patch for applying against RHEL 4.7 kernel
=Comment: #9=================================================
Yogananth Subramanian1 <anantyog@in.ibm.com> - 2008-09-01 12:09 EDT
Hi
I ran the test with the patch in comment #2 , the test works fine now.
This bug can be closed.This patch can be sent to Redhat.
The bug was initially found on the RHEL 5.1 kernel. I had tested the patch on
RHEL 5.1 Kerenel.

Anoop do u want me to test it on RHEL 5.2 kernel too.

Thanks
Yogi
=Comment: #10=================================================
Anoop V. Chakkalakkal <anoop.vijayan@in.ibm.com> - 2008-09-02 00:52 EDT
(In reply to comment #9)
> Anoop do u want me to test it on RHEL 5.2 kernel too.
This bug needs to be tested against RHEL 4.7-PPC.
Also see #47564, which needs to be tested against RHEL 5.2-S390
This event sent from IssueTracker by balkov  [IBM-LTC]
 issue 220832

--- Additional comment from tao@redhat.com on 2008-09-18 13:04:19 EDT ---

File uploaded: ip_getsockopt.patch

This event sent from IssueTracker by balkov  [IBM-LTC]
 issue 220832
it_file 156579

--- Additional comment from tao@redhat.com on 2008-09-18 13:04:20 EDT ---

So... has this patch, in fact, been backported and applied to, and tested
with, the RHEL 4.7 kernel?

Internal Status set to 'Waiting on Customer'

This event sent from IssueTracker by balkov  [IBM-LTC]
 issue 220832

--- Additional comment from tao@redhat.com on 2008-09-18 13:04:22 EDT ---

------- Comment From anoop.vijayan@in.ibm.com 2008-09-16 05:44 EDT-------
(In reply to comment #19)
> ------- Comment #2342557 from balkov at 2008/09/15 16:04:05 EDT -------
> So... has this patch, in fact, been backported and applied to, and
tested
with, the RHEL 4.7 kernel?

Yes.


This event sent from IssueTracker by balkov  [IBM-LTC]
 issue 220832

--- Additional comment from balkov@redhat.com on 2008-09-18 13:06:26 EDT ---

I realize this is coming in very late, and I may end up nominating it for either 4.7.z or 4.8, depending on the content of IBM's business impact statement.

--- Additional comment from balkov@redhat.com on 2008-09-18 13:08:32 EDT ---

Created an attachment (id=317097)
One-liner to fix ip_getsockopt()

--- Additional comment from balkov@redhat.com on 2008-09-18 13:09:30 EDT ---

One-line patch for ip_getsockopt backported from 5.1. Fixes problem, tested, etc.

--- Additional comment from tao@redhat.com on 2008-09-23 08:41:41 EDT ---

------- Comment From pramonag@in.ibm.com 2008-09-23 08:38 EDT-------
Hi,

The bug is breaking a Java functionality ::
java.net.MulticastSocket.getTTL,java.net.MulticastSocket.setTTL,java.net.MulticastSocket.getTimeToLive
and java.net.MulticastSocket.SetTimeToLive methods are failing. As such
any Java
based Applications using these methods will also fail.It is also causing a
JCK
failure for IBM Java and IBM Java cannot be JCK certified.


This event sent from IssueTracker by Glen Johnson 
 issue 220832

--- Additional comment from jpirko@redhat.com on 2008-10-23 04:44:45 EDT ---

Upstream commit for this:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=951e07c930f5f66b676eaa4c32a1b0d8e2d7d06a
Comment 2 Hans-Joachim Picht 2008-10-25 04:48:09 EDT
*** Bug 462449 has been marked as a duplicate of this bug. ***
Comment 3 Linda Wang 2008-10-25 15:04:05 EDT
inherit flags request from bug 462449:

dmaley: rhel‑5.2.z?
pm-rhel: rhel‑5.3.0+
pm-rhel: blocker+
pm-rhel: pm_ack+
lwang: devel_ack+
mgahagan: qa_ack+
  	exception 		
  	hot_fix_requested 		
  	needinfo 		()
  	requires_release_note 		
  	fast
Comment 5 Don Zickus 2008-10-29 12:19:00 EDT
in kernel-2.6.18-121.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5
Comment 9 Jan Tluka 2008-12-01 11:07:59 EST
Reproduced and tested fix on s390x using kernels:
2.6.18-53.el5 fails:

[root@z206 ~]# uname -a
Linux z206.z900.redhat.com 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:30 EDT 2007 s390x s390x s390x GNU/Linux
[root@z206 ~]# ./test 
setTTL=255,getTTL with u_char=0,getTTL with int=255

2.6.18-121.el5 passes:

[root@z206 ~]# uname -a
Linux z206.z900.redhat.com 2.6.18-121.el5 #1 SMP Mon Oct 27 21:49:15 EDT 2008 s390x s390x s390x GNU/Linux

[root@z206 ~]# ./test 
setTTL=255,getTTL with u_char=255,getTTL with int=255
[root@z206 ~]#

I will test on powerpc later, too.
Comment 10 Jan Tluka 2008-12-02 05:24:23 EST
Reproduced and tested fix on ppc64 using kernels:
2.6.18-92.el5 fails:

[root@ibm-qs22-01 ~]# uname -r
2.6.18-92.el5
[root@ibm-qs22-01 ~]# ./test 
setTTL=255,getTTL with u_char=0,getTTL with int=255

2.6.18-121.el5 passes:

[root@ibm-qs22-01 ~]# uname -r
2.6.18-121.el5
[root@ibm-qs22-01 ~]# ./test
setTTL=255,getTTL with u_char=255,getTTL with int=255
Comment 16 errata-xmlrpc 2009-01-20 14:38:54 EST
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-0225.html

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