Bug 468148 - getsockopt() returning incorrectly in PPC
Summary: getsockopt() returning incorrectly in PPC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel
Version: 5.3
Hardware: powerpc
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Jiri Pirko
QA Contact: Martin Jenner
URL:
Whiteboard:
: 462449 (view as bug list)
Depends On: 462741
Blocks: 469649
TreeView+ depends on / blocked
 
Reported: 2008-10-23 09:04 UTC by Jiri Pirko
Modified: 2018-10-19 18:55 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-01-20 19:38:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2009:0225 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 5.3 kernel security and bug fix update 2009-01-20 16:06:24 UTC

Description Jiri Pirko 2008-10-23 09:04:38 UTC
+++ This bug was initially created as a clone of Bug #462741 +++

Escalated to Bugzilla from IssueTracker

--- Additional comment from tao 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.com, anantyog.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.com, anantyog.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.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.com> - 2008-08-29 01:34 EDT

ip_getsockopt.patch

Patch for applying against RHEL 4.7 kernel
=Comment: #9=================================================
Yogananth Subramanian1 <anantyog.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.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 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 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 on 2008-09-18 13:04:22 EDT ---

------- Comment From anoop.vijayan.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 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 on 2008-09-18 13:08:32 EDT ---

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

--- Additional comment from balkov 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 on 2008-09-23 08:41:41 EDT ---

------- Comment From pramonag.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 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 08:48:09 UTC
*** Bug 462449 has been marked as a duplicate of this bug. ***

Comment 3 Linda Wang 2008-10-25 19:04:05 UTC
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 16:19:00 UTC
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 16:07:59 UTC
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 10:24:23 UTC
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 19:38:54 UTC
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.