CHEATSHEET.md: minor changes
[dragora.git] / patches / bash / bash44-004
blob1d8af26a91237211455ecca29a6a3ea5e5a1f341
1                              BASH PATCH REPORT
2                              =================
4 Bash-Release:   4.4
5 Patch-ID:       bash44-004
7 Bug-Reported-by:        Christian Weisgerber <naddy@mips.inka.de>
8 Bug-Reference-ID:       <20161101160302.GB54856@lorvorc.mips.inka.de>
9 Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2016-11/msg00004.html
11 Bug-Description:
13 There is a race condition that can result in bash referencing freed memory
14 when freeing data associated with the last process substitution.
16 Patch (apply with `patch -p0'):
18 *** ../bash-4.4/jobs.c  2016-08-23 16:38:44.000000000 -0400
19 --- jobs.c      2016-11-02 18:24:45.000000000 -0400
20 ***************
21 *** 454,457 ****
22 --- 454,472 ----
23   }
24   
25 + void
26 + discard_last_procsub_child ()
27 + {
28 +   PROCESS *disposer;
29 +   sigset_t set, oset;
30
31 +   BLOCK_CHILD (set, oset);
32 +   disposer = last_procsub_child;
33 +   last_procsub_child = (PROCESS *)NULL;
34 +   UNBLOCK_CHILD (oset);
35
36 +   if (disposer)
37 +     discard_pipeline (disposer);
38 + }
39
40   struct pipeline_saver *
41   alloc_pipeline_saver ()
42 *** ../bash-4.4/jobs.h  2016-04-27 10:35:51.000000000 -0400
43 --- jobs.h      2016-11-02 18:25:08.000000000 -0400
44 ***************
45 *** 191,194 ****
46 --- 191,195 ----
47   extern void stop_making_children __P((void));
48   extern void cleanup_the_pipeline __P((void));
49 + extern void discard_last_procsub_child __P((void));
50   extern void save_pipeline __P((int));
51   extern PROCESS *restore_pipeline __P((int));
52 *** ../bash-4.4/subst.c 2016-08-30 16:46:38.000000000 -0400
53 --- subst.c     2016-11-02 18:23:24.000000000 -0400
54 ***************
55 *** 5809,5816 ****
56   #if defined (JOB_CONTROL)
57         if (last_procsub_child)
58 !       {
59 !         discard_pipeline (last_procsub_child);
60 !         last_procsub_child = (PROCESS *)NULL;
61 !       }
62         last_procsub_child = restore_pipeline (0);
63   #endif
64 --- 5834,5838 ----
65   #if defined (JOB_CONTROL)
66         if (last_procsub_child)
67 !       discard_last_procsub_child ();
68         last_procsub_child = restore_pipeline (0);
69   #endif
70 *** ../bash-4.4/patchlevel.h    2016-06-22 14:51:03.000000000 -0400
71 --- patchlevel.h        2016-10-01 11:01:28.000000000 -0400
72 ***************
73 *** 26,30 ****
74      looks for to find the patch level (for the sccs version string). */
75   
76 ! #define PATCHLEVEL 3
77   
78   #endif /* _PATCHLEVEL_H_ */
79 --- 26,30 ----
80      looks for to find the patch level (for the sccs version string). */
81   
82 ! #define PATCHLEVEL 4
83   
84   #endif /* _PATCHLEVEL_H_ */