Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/bin/sh Pull up following revision(s) (requested by kre in...



details:   https://anonhg.NetBSD.org/src/rev/636eb021aa93
branches:  netbsd-8
changeset: 851947:636eb021aa93
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Aug 25 14:41:21 2018 +0000

description:
Pull up following revision(s) (requested by kre in ticket #987):

        bin/sh/trap.c: revision 1.44

PR bin/36532 (perhaps)

This is more or less the same patch as provided in the PR
(just 11 years later, so changed a bit) by woods@...

Since there is no known way to actually cause the reported crash,
we may never know if this change actually fixes anything.   But
even if it doesn't it certainly cannot hurt.

There is a potential race which could possibly explain the issue
(see commentary in the PR) which is not easy to avoid - if that is
the actual cause, this should provide a defence, if not really a fix.

diffstat:

 bin/sh/trap.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 22d3bd92479a -r 636eb021aa93 bin/sh/trap.c
--- a/bin/sh/trap.c     Sat Aug 25 14:35:21 2018 +0000
+++ b/bin/sh/trap.c     Sat Aug 25 14:41:21 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.40.2.1 2017/07/23 14:58:14 snj Exp $        */
+/*     $NetBSD: trap.c,v 1.40.2.2 2018/08/25 14:41:21 martin Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)trap.c     8.5 (Berkeley) 6/5/95";
 #else
-__RCSID("$NetBSD: trap.c,v 1.40.2.1 2017/07/23 14:58:14 snj Exp $");
+__RCSID("$NetBSD: trap.c,v 1.40.2.2 2018/08/25 14:41:21 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -523,9 +523,11 @@
                savestatus=exitstatus;
                CTRACE(DBG_TRAP|DBG_SIG, ("dotrap %d: \"%s\"\n", i,
                    trap[i] ? trap[i] : "-NULL-"));
-               tr = savestr(trap[i]);          /* trap code may free trap[i] */
-               evalstring(tr, 0);
-               ckfree(tr);
+               if ((tr = trap[i]) != NULL) {
+                       tr = savestr(tr);       /* trap code may free trap[i] */
+                       evalstring(tr, 0);
+                       ckfree(tr);
+               }
                exitstatus=savestatus;
        }
 }



Home | Main Index | Thread Index | Old Index