unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46709: 28.0.50; Emacs crash in gnutls_handshake
@ 2021-02-22 18:35 Robert Pluim
  2021-02-24 16:55 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Pluim @ 2021-02-22 18:35 UTC (permalink / raw)
  To: 46709


1. Disconnect your network cable
2. Set a static IP on your ethernet interface
3. Comment out the '(skip-unless internet-is-working)' line in
test/lisp/net/network-stream-tests.el
4. Run:
    cd test
    make network-stream-tests SELECTOR=connect-to-tls-ipv4-nowait

Output:

    make[1]: Entering directory '/home/rpluim/repos/emacs-real-master/test'
      GEN      lisp/net/network-stream-tests.log
    No DNS server configuration found
    Running 1 tests (2021-02-22 19:05:20+0100, selector `connect-to-tls-ipv4-nowait')
    gnutls-serv: HTTP Server listening on IPv4 0.0.0.0 port 44331...done

    make[1]: *** [Makefile:192: lisp/net/network-stream-tests.log] Error 141
    make[1]: Leaving directory '/home/rpluim/repos/emacs-real-master/test'
    make: *** [Makefile:258: lisp/net/network-stream-tests] Error 2

This is emacs crashing in gnutls_try_handshake at gnutls.c:629 the
second time we call gnutls_handshake. The first time we called it we
got -53 GNUTLS_E_PUSH_ERROR, which is not surprising, because the test
has deleted the listening gnutls-serv process.

My reading of
<https://gnutls.org/manual/gnutls.html#gnutls_005fhandshake> is that
after receiving a fatal error, we should not call gnutls_handshake
again. Iʼve tested the following patch successfully. We currently
check only for GNUTLS_E_INTERRUPTED, but the list of non-fatal error
codes is more than that, so perhaps more is needed.

diff --git a/src/gnutls.c b/src/gnutls.c
index aa245ee5c3..4d5a909db0 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -625,6 +625,8 @@ gnutls_try_handshake (struct Lisp_Process *proc)
 
   while ((ret = gnutls_handshake (state)) < 0)
     {
+      if (gnutls_error_is_fatal (ret))
+	return emacs_gnutls_handle_error (state, ret);
       do
 	ret = gnutls_handshake (state);
       while (ret == GNUTLS_E_INTERRUPTED);



In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2021-02-21 built on rltb
Repository revision: d15a42ac453c47c4da8ba1a66170dee106541d63
Repository branch: master





^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-25 18:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 18:35 bug#46709: 28.0.50; Emacs crash in gnutls_handshake Robert Pluim
2021-02-24 16:55 ` Lars Ingebrigtsen
2021-02-24 17:08   ` Robert Pluim
2021-02-24 18:23     ` Robert Pluim
2021-02-25 15:15       ` Lars Ingebrigtsen
2021-02-25 16:04         ` Robert Pluim
2021-02-25 18:20           ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).