[Home]

Summary:ASTERISK-17438: [patch] TCP TLS session open failure dumps core
Reporter:cmaj (cmaj)Labels:
Date Opened:2011-02-19 12:54:40.000-0600Date Closed:2011-03-16 14:51:56
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/TCP-TLS
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) patch-chan_sip-1.8.3-rc2-tcptls-thread-error-return.diff.txt
( 1) patch-main-tcptls-1.8.3-rc2-open-session-crash.diff.txt
( 2) patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt
( 3) patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt
Description:I don't have TLS enabled anywhere (seems to be off by default in all modules) but got a couple dumps lately in the TLS layer!

Attached patch should help fix.
Comments:By: cmaj (cmaj) 2011-02-20 15:47:55.000-0600

Patch updated. First version wasn't closing stuff properly. Missed the effects of the SSL IFDEF's.

By: cmaj (cmaj) 2011-02-23 11:46:08.000-0600

Had about a gorillion of these errors (below.) Couldn't even kill -9 the process for over a minute. I uploaded another patch in https://issues.asterisk.org/view.php?id=18874 to possibly nail this down.

[Feb 23 09:58:57] ERROR[15507] chan_sip.c: Unknown tcptls thread alert '1705677801'
[Feb 23 09:58:57] ERROR[15507] chan_sip.c: Unknown tcptls thread alert '1705677801'
[Feb 23 09:58:57] ERROR[15507] chan_sip.c: Unknown tcptls thread alert '1705677801'
[Feb 23 09:58:57] ERROR[15507] chan_sip.c: Unknown tcptls thread alert '1705677801'
[Feb 23 09:58:57] ERROR[15507] chan_sip.c: Unknown tcptls thread alert '1705677801'

By: cmaj (cmaj) 2011-02-23 12:24:53.000-0600

Uploaded an additional patch. Both 2 & 3 should be applied by anyone testing.

By: cmaj (cmaj) 2011-02-28 18:09:54.000-0600

Another corner case corrected in "take3" patch, when setvbuf() returns non-zero it should be handled properly.

Testers should now apply the last 3 patches, in order. (The first patch "patch-main-tcptls-1.8.3-rc2-open-session-crash.diff.txt" should be ignored.)

By: Terry Wilson (twilson) 2011-03-03 18:18:33.000-0600

Oddly enough, Russell had me looking at this issue today and we came up with very similar patches. I don't think your chan_sip patch is necessary, though, since cleanup immediately follows the switch() anyway. I'll go ahead and commit the non-chan_sip parts (with some error reporting debug messages added).

By: cmaj (cmaj) 2011-03-07 09:04:54.000-0600

I put the nasty "goto cleanup" in because those "unknown tcptls thread alerts" are generated within a containing "for(;;)" loop, and without a jump out of there it just keeps repeating. At least it does keep repeating until some sort of break elsewhere.

But I'm glad you're taking a look into this. The TCP-TLS code needs a lot of work.

By: Digium Subversion (svnbot) 2011-03-16 14:35:56

Repository: asterisk
Revision: 310995

U   branches/1.6.1/main/tcptls.c

------------------------------------------------------------------------
r310995 | twilson | 2011-03-16 14:35:55 -0500 (Wed, 16 Mar 2011) | 11 lines

Fix crash on fdopen failure

See security advisory AST-2011-004

(closes issue ASTERISK-17438)
Reported by: cmaj
Patches:
     patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt uploaded by cmaj (license 830)
     patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt uploaded by cmaj (license 830)
Tested by: cmaj, twilson

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=310995

By: Digium Subversion (svnbot) 2011-03-16 14:37:55

Repository: asterisk
Revision: 310996

U   branches/1.6.2/main/manager.c
U   branches/1.6.2/main/tcptls.c

------------------------------------------------------------------------
r310996 | twilson | 2011-03-16 14:37:55 -0500 (Wed, 16 Mar 2011) | 11 lines

Fix crash on fdopen failure

See security advisory AST-2011-004

(closes issue ASTERISK-17438)
Reported by: cmaj
Patches:
    patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt uploaded by cmaj (license 830)
    patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt uploaded by cmaj (license 830)
Tested by: cmaj, twilson

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=310996

By: Digium Subversion (svnbot) 2011-03-16 14:46:37

Repository: asterisk
Revision: 310998

U   branches/1.6.2/main/tcptls.c

------------------------------------------------------------------------
r310998 | twilson | 2011-03-16 14:46:37 -0500 (Wed, 16 Mar 2011) | 11 lines

Fix crash on fdopen failure

See security advisory AST-2011-004

(closes issue ASTERISK-17438)
Reported by: cmaj
Patches:
   patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt uploaded by cmaj (license 830)
   patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt uploaded by cmaj (license 830)
Tested by: cmaj, twilson

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=310998

By: Digium Subversion (svnbot) 2011-03-16 14:48:00

Repository: asterisk
Revision: 310999

_U  branches/1.8/
U   branches/1.8/main/tcptls.c

------------------------------------------------------------------------
r310999 | twilson | 2011-03-16 14:48:00 -0500 (Wed, 16 Mar 2011) | 18 lines

Merged revisions 310998 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r310998 | twilson | 2011-03-16 14:46:36 -0500 (Wed, 16 Mar 2011) | 11 lines
 
 Fix crash on fdopen failure
 
 See security advisory AST-2011-004
 
 (closes issue ASTERISK-17438)
 Reported by: cmaj
 Patches:
     patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt uploaded by cmaj (license 830)
     patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt uploaded by cmaj (license 830)
 Tested by: cmaj, twilson
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=310999

By: Digium Subversion (svnbot) 2011-03-16 14:51:56

Repository: asterisk
Revision: 311001

_U  trunk/
U   trunk/main/tcptls.c

------------------------------------------------------------------------
r311001 | twilson | 2011-03-16 14:51:55 -0500 (Wed, 16 Mar 2011) | 25 lines

Merged revisions 310999 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r310999 | twilson | 2011-03-16 14:47:59 -0500 (Wed, 16 Mar 2011) | 18 lines
 
 Merged revisions 310998 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r310998 | twilson | 2011-03-16 14:46:36 -0500 (Wed, 16 Mar 2011) | 11 lines
   
   Fix crash on fdopen failure
   
   See security advisory AST-2011-004
   
   (closes issue ASTERISK-17438)
   Reported by: cmaj
   Patches:
       patch-main-tcptls-1.8.3-rc2-open-session-crash-take2.diff.txt uploaded by cmaj (license 830)
       patch-main-tcptls-1.8.3-rc2-open-session-crash-take3.diff.txt uploaded by cmaj (license 830)
   Tested by: cmaj, twilson
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=311001