Bug 488367

Summary: [NET] Fix functions put_cmsg()/put_cmsg_compat() which may cause usr application memory overflow
Product: Red Hat Enterprise Linux 5 Reporter: Dave Maley <dmaley>
Component: kernelAssignee: Jiri Pirko <jpirko>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.3CC: cward, davem, dzickus, emcnabb, mjenner, nhorman, qcai, rkhan, tao, tgraf
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 08:49:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer
none
proposed patch none

Description Dave Maley 2009-03-03 21:58:58 UTC
Description of problem:
When use getsockopt() with 'IPV6_2292PKTOPTIONS', the packet-info length returned by kernel should be no larger than the length of receive buffer.


Version-Release number of selected component (if applicable):
kernel-2.6.18-128.EL


How reproducible:
every time


Steps to Reproduce:
1. # gcc -o pktinfo-12 pktinfo-12.c
2. # ./pktinfo-12

  
Actual results:
Kernel returns packet-info length larger than the receive buffer length

Reproduce program log.
# ./pktinfo-12
== create tcp socket for tcp server ==
== create tcp socket for tcp client ==
== enable tcp client to receive packet information  ==
== bind tcp server socket to address ==
== listen on tcp server socket ==
== connect to tcp server ==
== accept a connection on tcp socket ==
== send message from tcp server to tcp client ==
== recv message from tcp server on tcp client ==
== get IPV6_2292PKTOPTIONS of tcp client ==
ERROR: return packet infomations(40) is larger than memory we have(24)
<=====NG=====>


Expected results:
Kernel return packet-info length should be no larger than the length of receive buffer


Additional info:
The reproduction program: pktinfo-12.c
The patch file is attached:
file: net-fix-return-length-when-getsockopt-with-not-enough-memory.patch
This patch has already been applied for the Community's kernel.

Comment 1 Dave Maley 2009-03-03 22:00:39 UTC
Created attachment 333938 [details]
reproducer

# gcc -o pktinfo-12 pktinfo-12.c
# ./pktinfo-12

Comment 2 Dave Maley 2009-03-03 22:03:36 UTC
Created attachment 333939 [details]
proposed patch

upstream info:
commit 1ac70e7ad24a88710cf9b6d7ababaefa2b575df0
Author: Wei Yongjun <yjwei.com>
Date:   Thu Dec 20 14:36:44 2007 -0800

Comment 4 RHEL Program Management 2009-03-11 16:18:48 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 5 Don Zickus 2009-03-16 15:22:36 UTC
in kernel-2.6.18-135.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.

Comment 8 Chris Ward 2009-07-03 18:26:13 UTC
~~ Attention - RHEL 5.4 Beta Released! ~~

RHEL 5.4 Beta has been released! There should be a fix present in the Beta release that addresses this particular request. Please test and report back results here, at your earliest convenience. RHEL 5.4 General Availability release is just around the corner!

If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.

Please do not flip the bug status to VERIFIED. Only post your verification results, and if available, update Verified field with the appropriate value.

Questions can be posted to this bug or your customer or partner representative.

Comment 9 Chris Ward 2009-07-10 19:11:48 UTC
~~ Attention Partners - RHEL 5.4 Snapshot 1 Released! ~~

RHEL 5.4 Snapshot 1 has been released on partners.redhat.com. If you have already reported your test results, you can safely ignore this request. Otherwise, please notice that there should be a fix available now that addresses this particular request. Please test and report back your results here, at your earliest convenience. The RHEL 5.4 exception freeze is quickly approaching.

If you encounter any issues while testing Beta, please describe the issues you have encountered and set the bug into NEED_INFO. If you encounter new issues, please clone this bug to open a new issue and request it be reviewed for inclusion in RHEL 5.4 or a later update, if it is not of urgent severity.

Do not flip the bug status to VERIFIED. Instead, please set your Partner ID in the Verified field above if you have successfully verified the resolution of this issue. 

Further questions can be directed to your Red Hat Partner Manager or other appropriate customer representative.

Comment 12 errata-xmlrpc 2009-09-02 08:49:47 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-1243.html