1 From https://ftp.gnu.org/gnu/bash/bash-4.4-patches/bash44-004
3 Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
11 Bug-Reported-by: Christian Weisgerber <naddy@mips.inka.de>
12 Bug-Reference-ID: <20161101160302.GB54856@lorvorc.mips.inka.de>
13 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2016-11/msg00004.html
17 There is a race condition that can result in bash referencing freed memory
18 when freeing data associated with the last process substitution.
20 Patch (apply with `patch -p0'):
22 *** a/bash-4.4/jobs.c 2016-08-23 16:38:44.000000000 -0400
23 --- b/jobs.c 2016-11-02 18:24:45.000000000 -0400
30 + discard_last_procsub_child ()
35 + BLOCK_CHILD (set, oset);
36 + disposer = last_procsub_child;
37 + last_procsub_child = (PROCESS *)NULL;
38 + UNBLOCK_CHILD (oset);
41 + discard_pipeline (disposer);
44 struct pipeline_saver *
45 alloc_pipeline_saver ()
46 *** a/bash-4.4/jobs.h 2016-04-27 10:35:51.000000000 -0400
47 --- b/jobs.h 2016-11-02 18:25:08.000000000 -0400
51 extern void stop_making_children __P((void));
52 extern void cleanup_the_pipeline __P((void));
53 + extern void discard_last_procsub_child __P((void));
54 extern void save_pipeline __P((int));
55 extern PROCESS *restore_pipeline __P((int));
56 *** a/bash-4.4/subst.c 2016-08-30 16:46:38.000000000 -0400
57 --- b/subst.c 2016-11-02 18:23:24.000000000 -0400
60 #if defined (JOB_CONTROL)
61 if (last_procsub_child)
63 ! discard_pipeline (last_procsub_child);
64 ! last_procsub_child = (PROCESS *)NULL;
66 last_procsub_child = restore_pipeline (0);
69 #if defined (JOB_CONTROL)
70 if (last_procsub_child)
71 ! discard_last_procsub_child ();
72 last_procsub_child = restore_pipeline (0);
74 *** a/bash-4.4/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
75 --- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
78 looks for to find the patch level (for the sccs version string). */
80 ! #define PATCHLEVEL 3
82 #endif /* _PATCHLEVEL_H_ */
84 looks for to find the patch level (for the sccs version string). */
86 ! #define PATCHLEVEL 4
88 #endif /* _PATCHLEVEL_H_ */