bash44-004 2.3 KB

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