Red hat fix :

ksh.spec:
--
- job locking mechanism did not survive compiler optimization (#1123467)
--

ksh-20120801-locking.patch
--
diff -up ksh-20120801/src/cmd/ksh93/include/jobs.h.locking 
ksh-20120801/src/cmd/ksh93/include/jobs.h
--- ksh-20120801/src/cmd/ksh93/include/jobs.h.locking   2014-06-27 
15:51:07.144923719 +0200
+++ ksh-20120801/src/cmd/ksh93/include/jobs.h   2014-06-27 15:52:56.463272276 
+0200
@@ -149,15 +149,18 @@ extern struct jobs job;
 #define vmbusy()       0
 #endif
 
-#define job_lock()     (job.in_critical++)
+#define asoincint(p)  __sync_fetch_and_add(p,1)
+#define asodecint(p)  __sync_fetch_and_sub(p,1)
+
+#define job_lock()     asoincint(&job.in_critical)
 #define job_unlock()   \
        do { \
                int     sig; \
-               if (!--job.in_critical && (sig = job.savesig)) \
+               if (asodecint(&job.in_critical)==1 && (sig = job.savesig)) \
                { \
-                       if (!job.in_critical++ && !vmbusy()) \
+                       if (!asoincint(&job.in_critical) && !vmbusy()) \
                                job_reap(sig); \
-                       job.in_critical--; \
+                       asodecint(&job.in_critical); \
                } \
        } while(0)
--

** Tags added: sts-sru-needed

** Also affects: ksh (Ubuntu Yakkety)
   Importance: Undecided
       Status: New

** Also affects: ksh (Ubuntu Artful)
   Importance: Low
       Status: New

** Also affects: ksh (Ubuntu Trusty)
   Importance: Undecided
       Status: New

** Also affects: ksh (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Also affects: ksh (Ubuntu Zesty)
   Importance: Undecided
       Status: New

** Changed in: ksh (Ubuntu Artful)
   Importance: Low => Medium

** Changed in: ksh (Ubuntu Zesty)
   Importance: Undecided => Medium

** Changed in: ksh (Ubuntu Yakkety)
   Importance: Undecided => Medium

** Changed in: ksh (Ubuntu Xenial)
   Importance: Undecided => Medium

** Changed in: ksh (Ubuntu Trusty)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1697501

Title:
  ksh segfault on  job_chksave ()

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ksh/+bug/1697501/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to