Bug 1170722

Summary: stunnel loses data due to mishandled POLLHUP
Product: Red Hat Enterprise Linux 7 Reporter: Ross Lagerwall <ross>
Component: stunnelAssignee: Tomas Mraz <tmraz>
Status: CLOSED ERRATA QA Contact: Stanislav Zidek <szidek>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: tmraz
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: stunnel-4.56-5.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 01:33:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1295396    
Attachments:
Description Flags
patch to fix the issue none

Description Ross Lagerwall 2014-12-04 16:53:18 UTC
Created attachment 964756 [details]
patch to fix the issue

Description of problem:
The version of stunnel in RHEL 7 loses data if a client sends a large amount of data to stunnel and then closes the socket. This is because poll() return both POLLIN and POLLHUP on the socket and stunnel ignores the POLLIN and just closes the socket.

Version-Release number of selected component (if applicable):
stunnel 4.56-4.el7


How reproducible:
Every time.


Steps to Reproduce:
1. Write a client to write a large amount of plaintext data to a stunnel socket.
2. Immediately close the socket.

Actual results:
All the data is received by the server to which stunnel is connected.

Expected results:
Only part of the data comes out the other end, the rest is missing.

Additional info:
This has been fixed upstream:
An incomplete fix is available in stunnel 5.05b1.
It was fixed properly in stunnel 5.08b2.

https://www.stunnel.org/pipermail/stunnel-users/2014-September/004742.html
http://www.stunnel.org/pipermail/stunnel-users/2014-November/004860.html

I have attached a patch backported from 5.05b1 with some extra changes which works for me.

Thanks

Comment 9 errata-xmlrpc 2016-11-04 01:33:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2243.html