From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.bugs Subject: bug#31946: 27.0.50; The NSM should warn about more TLS problems Date: Mon, 26 Aug 2019 18:45:14 +0100 Message-ID: <86zhjvrfbp.fsf@gmail.com> References: <87h8647de5.fsf@gnus.org> <86tva4dq8h.fsf@gmail.com> <83k1azgbbi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="78924"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) To: 31946@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 26 19:46:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i2J4G-000KPo-RP for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Aug 2019 19:46:12 +0200 Original-Received: from localhost ([::1]:56256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2J4F-00010S-Kv for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Aug 2019 13:46:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51708) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2J47-00010A-U6 for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:46:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2J46-0000bv-JU for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:46:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i2J46-0000bj-C2 for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i2J46-0006w4-8C for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:46:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Andy Moreton Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 26 Aug 2019 17:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31946 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security fixed X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156684153026605 (code B ref -1); Mon, 26 Aug 2019 17:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Aug 2019 17:45:30 +0000 Original-Received: from localhost ([127.0.0.1]:47182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2J3Z-0006v3-Gq for submit@debbugs.gnu.org; Mon, 26 Aug 2019 13:45:30 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49922) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i2J3X-0006uv-AM for submit@debbugs.gnu.org; Mon, 26 Aug 2019 13:45:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51573) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2J3V-0000fg-SZ for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:45:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2J3U-0000Km-Lk for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:45:25 -0400 Original-Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:58444 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i2J3U-0000K0-F8 for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 13:45:24 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1i2J3S-000JYC-F8 for bug-gnu-emacs@gnu.org; Mon, 26 Aug 2019 19:45:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:6oPWc6YhbcumKbBkZdsdx9kMuDs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165913 Archived-At: On Mon 26 Aug 2019, Eli Zaretskii wrote: >> From: Andy Moreton >> Date: Mon, 26 Aug 2019 14:13:18 +0100 >> >> On Mon 26 Aug 2019, Lars Ingebrigtsen wrote: >> >> > The netsec branch has now been merged into the trunk and I'm closing >> > this bug report. >> >> After this merge, the network tests fail on 64 bit windows (MSYS2), and >> using any network functionality results in crashes. >> >> >From emacs --no-desktop under gdb, running list-packages pops upo the >> NSM "Certificate information" window and asks "Continue comnecting?". >> Any of the asnwer for this question result in a crash. >> >> warning: HEAP[emacs.exe]: >> warning: Invalid address specified to RtlFreeHeap( 0000000002720000, 0000000006037150 ) >> >> Thread 1 received signal SIGTRAP, Trace/breakpoint trap. >> 0x00007ff9199863b7 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\SYSTEM32\ntdll.dll >> (gdb) #0 0x00007ff9199863b7 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\SYSTEM32\ntdll.dll >> No symbol table info available. >> #1 0x00007ff919941467 in ntdll!memset () from C:\WINDOWS\SYSTEM32\ntdll.dll >> No symbol table info available. >> #2 0x00007ff919985290 in ntdll!RtlpNtMakeTemporaryKey () from C:\WINDOWS\SYSTEM32\ntdll.dll >> No symbol table info available. >> #3 0x00007ff9199356b8 in ntdll!memset () from C:\WINDOWS\SYSTEM32\ntdll.dll >> No symbol table info available. >> #4 0x00007ff9198c07a0 in ntdll!RtlGetCurrentServiceSessionId () from C:\WINDOWS\SYSTEM32\ntdll.dll >> No symbol table info available. >> #5 0x00007ff9198bfba1 in ntdll!RtlFreeHeap () from C:\WINDOWS\SYSTEM32\ntdll.dll >> No symbol table info available. >> #6 0x000000040029e7aa in free_after_dump (ptr=0x6037150) at C:/emacs/git/emacs/master/src/w32heap.c:504 >> No locals. >> #7 0x000000040018b7f4 in xfree (block=0x6037150) at C:/emacs/git/emacs/master/src/alloc.c:748 >> No locals. >> #8 0x0000000400227bb0 in Fgnutls_format_certificate (cert=XIL(0xd97ad24)) at C:/emacs/git/emacs/master/src/gnutls.c:1616 > > That's because any memory allocated by GnuTLS cannot be freed by Emacs > via 'free' or 'xfree', it needs to be freed by calling 'gnutls_free' > (the GnuTLS manual clearly says that, btw). That crashes, because on > Windows we use our own implementation of 'free', which uses a > different heap. Agreed, but master built from commit 1071a4f still crashes in the same way: Thread 1 received signal SIGSEGV, Segmentation fault. 0x00000000051d6248 in ?? () from C:\msys64\mingw64\bin\libgnutls-30.dll (gdb) bt #0 0x00000000051d6248 in ?? () from C:\msys64\mingw64\bin\libgnutls-30.dll #1 0x0000000400227be4 in Fgnutls_format_certificate (cert=XIL(0xd8e36e4)) at C:/emacs/git/emacs/master/src/gnutls.c:1619 #2 0x00000004001c2091 in funcall_subr (subr=0x4006667c0 , numargs=0x1, args=0xbfba20) at C:/emacs/git/emacs/master/src/eval.c:2876 [snipped] Lisp Backtrace: "gnutls-format-certificate" (0xbfba20) "nsm-query-user" (0xbfc0a0) "nsm-query" (0xbfc5b0) "nsm-check-tls-connection" (0xbfcbc0) "nsm-verify-connection" (0xbfd0c8) "read-event" (0xbfdd78) "sit-for" (0xbfe298) "execute-extended-command" (0xbfea00) "funcall-interactively" (0xbfe9f8) "call-interactively" (0xbfeec0) "command-execute" (0xbff3f8) (gdb) f 1 #1 0x0000000400227be4 in Fgnutls_format_certificate (cert=XIL(0xd8e36e4)) at C:/emacs/git/emacs/master/src/gnutls.c:1619 1619 gnutls_free (out.data); (gdb) info locals err = 0x0 crt = 0x61947a0 crt_data = { data = 0xd8e8588 "-----BEGIN CERTIFICATE-----\nMIIFUTCCBDmgAwIBAgISBOm+yiBCrLLuPB59/zwFk1v7MA0GCSqGSIb3DQEBCwUA\nMEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD\nExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw"..., size = 0x76f } out = { data = 0x60fc3f0 "X.509 Certificate Information:\n\tVersion: 3\n\tSerial Number (hex): 04e9beca2042acb2ee3c1e7dff3c05935bfb\n\tIssuer: CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US\n\tValidity:\n\t\tNot Before: Wed Aug 07 20"..., size = 0x101f } out_buf = 0x9ae8690 "X.509 Certificate Information:\n\tVersion: 3\n\tSerial Number (hex): 04e9beca2042acb2ee3c1e7dff3c05935bfb\n\tIssuer: CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US\n\tValidity:\n\t\tNot Before: Wed Aug 07 20"... result = XIL(0x5a90003) In Fgnutls_format_certificate, should out_buf be freed after calling build_string ? Removing both xfree(out.data) and xfree(out_buf) from the end of that function does give me a running emacs. AndyM