Hello community,

here is the log from the commit of package glibc for openSUSE:Factory checked 
in at 2019-02-24 16:55:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/glibc (Old)
 and      /work/SRC/openSUSE:Factory/.glibc.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "glibc"

Sun Feb 24 16:55:34 2019 rev:226 rq:678055 version:2.29

Changes:
--------
--- /work/SRC/openSUSE:Factory/glibc/glibc.changes      2019-02-08 
12:04:11.621676704 +0100
+++ /work/SRC/openSUSE:Factory/.glibc.new.28833/glibc.changes   2019-02-24 
16:55:44.184899034 +0100
@@ -1,0 +2,21 @@
+Thu Feb 21 08:37:00 UTC 2019 - Martin Liška <[email protected]>
+
+- Add add-new-Fortran-vector-math-header-file.patch.
+
+-------------------------------------------------------------------
+Mon Feb 18 09:28:08 UTC 2019 - [email protected]
+
+- pthread-rwlock-trylock-stalls.patch: nptl: Fix pthread_rwlock_try*lock
+  stalls (BZ #23844)
+- arm-systemtap-probe-constraint.patch: arm: Use "nr" constraint for
+  Systemtap probes (BZ #24164)
+- pthread-mutex-barrier.patch: Add compiler barriers around modifications
+  of the robust mutex list for pthread_mutex_trylock (BZ #24180)
+- fork-handler-lock.patch: nptl: Avoid fork handler lock for
+  async-signal-safe fork (BZ #24161)
+- pthread-join-probe.patch: nptl: Fix invalid Systemtap probe in
+  pthread_join (BZ #24211)
+- riscv-clone-unwind.patch: RISC-V: Fix elfutils testsuite unwind failures
+  (BZ #24040)
+
+-------------------------------------------------------------------

New:
----
  add-new-Fortran-vector-math-header-file.patch
  arm-systemtap-probe-constraint.patch
  fork-handler-lock.patch
  pthread-join-probe.patch
  pthread-mutex-barrier.patch
  pthread-rwlock-trylock-stalls.patch
  riscv-clone-unwind.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ glibc.spec ++++++
--- /var/tmp/diff_new_pack.biGp5Z/_old  2019-02-24 16:55:52.880894898 +0100
+++ /var/tmp/diff_new_pack.biGp5Z/_new  2019-02-24 16:55:52.884894896 +0100
@@ -270,6 +270,20 @@
 ###
 # Patches from upstream
 ###
+# PATCH-FIX-UPSTREAM nptl: Fix pthread_rwlock_try*lock stalls (BZ #23844)
+Patch1000:      pthread-rwlock-trylock-stalls.patch
+# PATCH-FIX-UPSTREAM arm: Use "nr" constraint for Systemtap probes (BZ #24164)
+Patch1001:      arm-systemtap-probe-constraint.patch
+# PATCH-FIX-UPSTREAM Add compiler barriers around modifications of the robust 
mutex list for pthread_mutex_trylock (BZ #24180)
+Patch1002:      pthread-mutex-barrier.patch
+# PATCH-FIX-UPSTREAM nptl: Avoid fork handler lock for async-signal-safe fork 
(BZ #24161)
+Patch1003:      fork-handler-lock.patch
+# PATCH-FIX-UPSTREAM nptl: Fix invalid Systemtap probe in pthread_join (BZ 
#24211)
+Patch1004:      pthread-join-probe.patch
+# PATCH-FIX-UPSTREAM RISC-V: Fix elfutils testsuite unwind failures (BZ #24040)
+Patch1005:      riscv-clone-unwind.patch
+# PATCH-FIX-UPSTREAM Add new Fortran vector math header file.
+Patch1006:      add-new-Fortran-vector-math-header-file.patch
 
 ### 
 # Patches awaiting upstream approval
@@ -479,6 +493,14 @@
 %patch304 -p1
 %patch306 -p1
 
+%patch1000 -p1
+%patch1001 -p1
+%patch1002 -p1
+%patch1003 -p1
+%patch1004 -p1
+%patch1005 -p1
+%patch1006 -p1
+
 %patch2000 -p1
 %patch2004 -p1
 %patch2005 -p1
@@ -850,9 +872,9 @@
        # this will not work if we generate them in parallel.
        # thus we need to run fdupes on  /usr/lib/locale/
        # Still, on my system this is a speed advantage:
-       # non-parallel build for install-locale-files: 9:34mins
+       # non-parallel build for install-locales: 9:34mins
        # parallel build with fdupes: 7:08mins
-       make %{?_smp_mflags} install_root=%{buildroot} 
localedata/install-locale-files
+       make %{?_smp_mflags} install_root=%{buildroot} 
localedata/install-locales
        # Avoid hardlinks across subpackages
        mv %{buildroot}/usr/lib/locale/{en_US,C}.utf8 .
        %fdupes %{buildroot}/usr/lib/locale

++++++ add-new-Fortran-vector-math-header-file.patch ++++++
>From dc0afac3252d0c53716ccaf0b424f7769a66d695 Mon Sep 17 00:00:00 2001
From: marxin <[email protected]>
Date: Wed, 20 Feb 2019 14:54:35 +0100
Subject: [PATCH] Add new Fortran vector math header file.

---
 ChangeLog                                  |  6 +++
 bits/math-vector-fortran.h                 | 19 ++++++++++
 math/Makefile                              |  1 +
 sysdeps/x86/fpu/bits/math-vector-fortran.h | 43 ++++++++++++++++++++++
 4 files changed, 69 insertions(+)
 create mode 100644 bits/math-vector-fortran.h
 create mode 100644 sysdeps/x86/fpu/bits/math-vector-fortran.h

diff --git a/bits/math-vector-fortran.h b/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..7c1e095094
--- /dev/null
+++ b/bits/math-vector-fortran.h
@@ -0,0 +1,19 @@
+! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 
-*-
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.
+
+! No SIMD math functions are available for this platform.
diff --git a/math/Makefile b/math/Makefile
index 76e8edac19..fc4191089d 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -26,6 +26,7 @@ headers               := math.h bits/mathcalls.h 
bits/mathinline.h \
                   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
                   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
                   bits/math-finite.h bits/math-vector.h \
+                  bits/math-vector-fortran.h \
                   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
                   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
                   bits/long-double.h bits/mathcalls-helper-functions.h \
diff --git a/sysdeps/x86/fpu/bits/math-vector-fortran.h 
b/sysdeps/x86/fpu/bits/math-vector-fortran.h
new file mode 100644
index 0000000000..36051cc73e
--- /dev/null
+++ b/sysdeps/x86/fpu/bits/math-vector-fortran.h
@@ -0,0 +1,43 @@
+! Platform-specific declarations of SIMD math functions for Fortran. -*- f90 
-*-
+!   Copyright (C) 2019 Free Software Foundation, Inc.
+!   This file is part of the GNU C Library.
+!
+!   The GNU C Library is free software; you can redistribute it and/or
+!   modify it under the terms of the GNU Lesser General Public
+!   License as published by the Free Software Foundation; either
+!   version 2.1 of the License, or (at your option) any later version.
+!
+!   The GNU C Library is distributed in the hope that it will be useful,
+!   but WITHOUT ANY WARRANTY; without even the implied warranty of
+!   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+!   Lesser General Public License for more details.
+!
+!   You should have received a copy of the GNU Lesser General Public
+!   License along with the GNU C Library; if not, see
+!   <http://www.gnu.org/licenses/>.
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x86_64')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x86_64')
+
+!GCC$ builtin (cos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (cosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sin) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sinf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincos) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (sincosf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (log) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (logf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (exp) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (expf) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (pow) attributes simd (notinbranch) if('x32')
+!GCC$ builtin (powf) attributes simd (notinbranch) if('x32')
-- 
2.20.1

++++++ arm-systemtap-probe-constraint.patch ++++++
2019-02-05  Florian Weimer  <[email protected]>

        [BZ #24164]
        arm: Use "nr" constraint for Systemtap probes, to avoid the
        compiler using memory operands for constants, due to the "o"
        alternative in the default "nor" constraint.
        * include/stap-probe.h [USE_STAP_PROBE]: Include
        <stap-probe-machine.h>
        * sysdeps/generic/stap-probe-machine.h: New file.
        * sysdeps/arm/stap-probe-machine.h: Likewise.

Index: glibc-2.29/include/stap-probe.h
===================================================================
--- glibc-2.29.orig/include/stap-probe.h
+++ glibc-2.29/include/stap-probe.h
@@ -21,6 +21,7 @@
 
 #ifdef USE_STAP_PROBE
 
+# include <stap-probe-machine.h>
 # include <sys/sdt.h>
 
 /* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
Index: glibc-2.29/sysdeps/arm/stap-probe-machine.h
===================================================================
--- /dev/null
+++ glibc-2.29/sysdeps/arm/stap-probe-machine.h
@@ -0,0 +1,22 @@
+/* Macros for customizing Systemtap <sys/sdt.h>.  Arm version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The default "nor" constraint produces unparseable memory references
+   for constants.  Omit the problematic "o" constraint.  See bug 24164
+   and GCC PR 89146.  */
+#define STAP_SDT_ARG_CONSTRAINT nr
Index: glibc-2.29/sysdeps/generic/stap-probe-machine.h
===================================================================
--- /dev/null
+++ glibc-2.29/sysdeps/generic/stap-probe-machine.h
@@ -0,0 +1,19 @@
+/* Macros for customizing Systemtap <sys/sdt.h>.  Generic version.
+   Copyright (C) 2019 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* By default, there are no customizations.  */
++++++ fork-handler-lock.patch ++++++
2019-02-08  Florian Weimer  <[email protected]>

        [BZ #24161]
        * sysdeps/nptl/fork.h (__run_fork_handlers): Add multiple_threads
        argument.
        * nptl/register-atfork.c (__run_fork_handlers): Only perform
        locking if the new do_locking argument is true.
        * sysdeps/nptl/fork.c (__libc_fork): Pass multiple_threads to
        __run_fork_handlers.

Index: glibc-2.29/nptl/register-atfork.c
===================================================================
--- glibc-2.29.orig/nptl/register-atfork.c
+++ glibc-2.29/nptl/register-atfork.c
@@ -107,13 +107,14 @@ __unregister_atfork (void *dso_handle)
 }
 
 void
-__run_fork_handlers (enum __run_fork_handler_type who)
+__run_fork_handlers (enum __run_fork_handler_type who, _Bool do_locking)
 {
   struct fork_handler *runp;
 
   if (who == atfork_run_prepare)
     {
-      lll_lock (atfork_lock, LLL_PRIVATE);
+      if (do_locking)
+       lll_lock (atfork_lock, LLL_PRIVATE);
       size_t sl = fork_handler_list_size (&fork_handlers);
       for (size_t i = sl; i > 0; i--)
        {
@@ -133,7 +134,8 @@ __run_fork_handlers (enum __run_fork_han
          else if (who == atfork_run_parent && runp->parent_handler)
            runp->parent_handler ();
        }
-      lll_unlock (atfork_lock, LLL_PRIVATE);
+      if (do_locking)
+       lll_unlock (atfork_lock, LLL_PRIVATE);
     }
 }
 
Index: glibc-2.29/sysdeps/nptl/fork.c
===================================================================
--- glibc-2.29.orig/sysdeps/nptl/fork.c
+++ glibc-2.29/sysdeps/nptl/fork.c
@@ -55,7 +55,7 @@ __libc_fork (void)
      but our current fork implementation is not.  */
   bool multiple_threads = THREAD_GETMEM (THREAD_SELF, header.multiple_threads);
 
-  __run_fork_handlers (atfork_run_prepare);
+  __run_fork_handlers (atfork_run_prepare, multiple_threads);
 
   /* If we are not running multiple threads, we do not have to
      preserve lock state.  If fork runs from a signal handler, only
@@ -134,7 +134,7 @@ __libc_fork (void)
       __rtld_lock_initialize (GL(dl_load_lock));
 
       /* Run the handlers registered for the child.  */
-      __run_fork_handlers (atfork_run_child);
+      __run_fork_handlers (atfork_run_child, multiple_threads);
     }
   else
     {
@@ -149,7 +149,7 @@ __libc_fork (void)
        }
 
       /* Run the handlers registered for the parent.  */
-      __run_fork_handlers (atfork_run_parent);
+      __run_fork_handlers (atfork_run_parent, multiple_threads);
     }
 
   return pid;
Index: glibc-2.29/sysdeps/nptl/fork.h
===================================================================
--- glibc-2.29.orig/sysdeps/nptl/fork.h
+++ glibc-2.29/sysdeps/nptl/fork.h
@@ -52,9 +52,11 @@ enum __run_fork_handler_type
    - atfork_run_child: run all the CHILD_HANDLER and unlocks the internal
                       lock.
    - atfork_run_parent: run all the PARENT_HANDLER and unlocks the internal
-                       lock.  */
-extern void __run_fork_handlers (enum __run_fork_handler_type who)
-  attribute_hidden;
+                       lock.
+
+   Perform locking only if DO_LOCKING.  */
+extern void __run_fork_handlers (enum __run_fork_handler_type who,
+                                _Bool do_locking) attribute_hidden;
 
 /* C library side function to register new fork handlers.  */
 extern int __register_atfork (void (*__prepare) (void),


++++++ pthread-join-probe.patch ++++++
2019-02-15  Florian Weimer  <[email protected]>

        [BZ #24211]
        * nptl/pthread_join_common.c (__pthread_timedjoin_ex): Do not read
        pd->result after the thread descriptor has been freed.

Index: glibc-2.29/nptl/pthread_join_common.c
===================================================================
--- glibc-2.29.orig/nptl/pthread_join_common.c
+++ glibc-2.29/nptl/pthread_join_common.c
@@ -86,6 +86,7 @@ __pthread_timedjoin_ex (pthread_t thread
       pthread_cleanup_pop (0);
     }
 
+  void *pd_result = pd->result;
   if (__glibc_likely (result == 0))
     {
       /* We mark the thread as terminated and as joined.  */
@@ -93,7 +94,7 @@ __pthread_timedjoin_ex (pthread_t thread
 
       /* Store the return value if the caller is interested.  */
       if (thread_return != NULL)
-       *thread_return = pd->result;
+       *thread_return = pd_result;
 
       /* Free the TCB.  */
       __free_tcb (pd);
@@ -101,7 +102,7 @@ __pthread_timedjoin_ex (pthread_t thread
   else
     pd->joinid = NULL;
 
-  LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
+  LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd_result);
 
   return result;
 }
++++++ pthread-mutex-barrier.patch ++++++
2019-02-07  Stefan Liebler  <[email protected]>

        [BZ #24180]
        * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
        Add compiler barriers and comments.

Index: glibc-2.29/nptl/pthread_mutex_trylock.c
===================================================================
--- glibc-2.29.orig/nptl/pthread_mutex_trylock.c
+++ glibc-2.29/nptl/pthread_mutex_trylock.c
@@ -94,6 +94,9 @@ __pthread_mutex_trylock (pthread_mutex_t
     case PTHREAD_MUTEX_ROBUST_ADAPTIVE_NP:
       THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
                     &mutex->__data.__list.__next);
+      /* We need to set op_pending before starting the operation.  Also
+        see comments at ENQUEUE_MUTEX.  */
+      __asm ("" ::: "memory");
 
       oldval = mutex->__data.__lock;
       do
@@ -119,7 +122,12 @@ __pthread_mutex_trylock (pthread_mutex_t
              /* But it is inconsistent unless marked otherwise.  */
              mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
 
+             /* We must not enqueue the mutex before we have acquired it.
+                Also see comments at ENQUEUE_MUTEX.  */
+             __asm ("" ::: "memory");
              ENQUEUE_MUTEX (mutex);
+             /* We need to clear op_pending after we enqueue the mutex.  */
+             __asm ("" ::: "memory");
              THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
              /* Note that we deliberately exist here.  If we fall
@@ -135,6 +143,8 @@ __pthread_mutex_trylock (pthread_mutex_t
              int kind = PTHREAD_MUTEX_TYPE (mutex);
              if (kind == PTHREAD_MUTEX_ROBUST_ERRORCHECK_NP)
                {
+                 /* We do not need to ensure ordering wrt another memory
+                    access.  Also see comments at ENQUEUE_MUTEX. */
                  THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
                                 NULL);
                  return EDEADLK;
@@ -142,6 +152,8 @@ __pthread_mutex_trylock (pthread_mutex_t
 
              if (kind == PTHREAD_MUTEX_ROBUST_RECURSIVE_NP)
                {
+                 /* We do not need to ensure ordering wrt another memory
+                    access.  */
                  THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
                                 NULL);
 
@@ -160,6 +172,9 @@ __pthread_mutex_trylock (pthread_mutex_t
                                                        id, 0);
          if (oldval != 0 && (oldval & FUTEX_OWNER_DIED) == 0)
            {
+             /* We haven't acquired the lock as it is already acquired by
+                another owner.  We do not need to ensure ordering wrt another
+                memory access.  */
              THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
              return EBUSY;
@@ -173,13 +188,20 @@ __pthread_mutex_trylock (pthread_mutex_t
              if (oldval == id)
                lll_unlock (mutex->__data.__lock,
                            PTHREAD_ROBUST_MUTEX_PSHARED (mutex));
+             /* FIXME This violates the mutex destruction requirements.  See
+                __pthread_mutex_unlock_full.  */
              THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
              return ENOTRECOVERABLE;
            }
        }
       while ((oldval & FUTEX_OWNER_DIED) != 0);
 
+      /* We must not enqueue the mutex before we have acquired it.
+        Also see comments at ENQUEUE_MUTEX.  */
+      __asm ("" ::: "memory");
       ENQUEUE_MUTEX (mutex);
+      /* We need to clear op_pending after we enqueue the mutex.  */
+      __asm ("" ::: "memory");
       THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
       mutex->__data.__owner = id;
@@ -211,10 +233,15 @@ __pthread_mutex_trylock (pthread_mutex_t
        }
 
        if (robust)
-         /* Note: robust PI futexes are signaled by setting bit 0.  */
-         THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
-                        (void *) (((uintptr_t) &mutex->__data.__list.__next)
-                                  | 1));
+         {
+           /* Note: robust PI futexes are signaled by setting bit 0.  */
+           THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending,
+                          (void *) (((uintptr_t) &mutex->__data.__list.__next)
+                                    | 1));
+           /* We need to set op_pending before starting the operation.  Also
+              see comments at ENQUEUE_MUTEX.  */
+           __asm ("" ::: "memory");
+         }
 
        oldval = mutex->__data.__lock;
 
@@ -223,12 +250,16 @@ __pthread_mutex_trylock (pthread_mutex_t
          {
            if (kind == PTHREAD_MUTEX_ERRORCHECK_NP)
              {
+               /* We do not need to ensure ordering wrt another memory
+                  access.  */
                THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
                return EDEADLK;
              }
 
            if (kind == PTHREAD_MUTEX_RECURSIVE_NP)
              {
+               /* We do not need to ensure ordering wrt another memory
+                  access.  */
                THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
                /* Just bump the counter.  */
@@ -250,6 +281,9 @@ __pthread_mutex_trylock (pthread_mutex_t
          {
            if ((oldval & FUTEX_OWNER_DIED) == 0)
              {
+               /* We haven't acquired the lock as it is already acquired by
+                  another owner.  We do not need to ensure ordering wrt another
+                  memory access.  */
                THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
                return EBUSY;
@@ -270,6 +304,9 @@ __pthread_mutex_trylock (pthread_mutex_t
            if (INTERNAL_SYSCALL_ERROR_P (e, __err)
                && INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
              {
+               /* The kernel has not yet finished the mutex owner death.
+                  We do not need to ensure ordering wrt another memory
+                  access.  */
                THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
                return EBUSY;
@@ -287,7 +324,12 @@ __pthread_mutex_trylock (pthread_mutex_t
            /* But it is inconsistent unless marked otherwise.  */
            mutex->__data.__owner = PTHREAD_MUTEX_INCONSISTENT;
 
+           /* We must not enqueue the mutex before we have acquired it.
+              Also see comments at ENQUEUE_MUTEX.  */
+           __asm ("" ::: "memory");
            ENQUEUE_MUTEX (mutex);
+           /* We need to clear op_pending after we enqueue the mutex.  */
+           __asm ("" ::: "memory");
            THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 
            /* Note that we deliberately exit here.  If we fall
@@ -310,13 +352,20 @@ __pthread_mutex_trylock (pthread_mutex_t
                                                  PTHREAD_ROBUST_MUTEX_PSHARED 
(mutex)),
                              0, 0);
 
+           /* To the kernel, this will be visible after the kernel has
+              acquired the mutex in the syscall.  */
            THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
            return ENOTRECOVERABLE;
          }
 
        if (robust)
          {
+           /* We must not enqueue the mutex before we have acquired it.
+              Also see comments at ENQUEUE_MUTEX.  */
+           __asm ("" ::: "memory");
            ENQUEUE_MUTEX_PI (mutex);
+           /* We need to clear op_pending after we enqueue the mutex.  */
+           __asm ("" ::: "memory");
            THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
          }
 
++++++ pthread-rwlock-trylock-stalls.patch ++++++
++++ 616 lines (skipped)

++++++ riscv-clone-unwind.patch ++++++
2019-01-13  Jim Wilson  <[email protected]>

        [BZ #24040]
        * elf/Makefile (CFLAGS-tst-unwind-main.c): Add -DUSE_PTHREADS=0.
        * elf/tst-unwind-main.c: If USE_PTHEADS, include pthread.h and error.h
        (func): New.
        (main): If USE_PTHREADS, call pthread_create to run func.  Otherwise
        call func directly.
        * nptl/Makefile (tests): Add tst-unwind-thread.
        (CFLAGS-tst-unwind-thread.c): Define.
        * nptl/tst-unwind-thread.c: New file.
        * sysdeps/unix/sysv/linux/riscv/clone.S (__thread_start): Mark ra
        as undefined.

Index: glibc-2.29/elf/Makefile
===================================================================
--- glibc-2.29.orig/elf/Makefile
+++ glibc-2.29/elf/Makefile
@@ -1497,4 +1497,4 @@ $(objpfx)tst-big-note: $(objpfx)tst-big-
 
 $(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
 
-CFLAGS-tst-unwind-main.c += -funwind-tables
+CFLAGS-tst-unwind-main.c += -funwind-tables -DUSE_PTHREADS=0
Index: glibc-2.29/elf/tst-unwind-main.c
===================================================================
--- glibc-2.29.orig/elf/tst-unwind-main.c
+++ glibc-2.29/elf/tst-unwind-main.c
@@ -20,19 +20,41 @@
 #include <unistd.h>
 #include <support/test-driver.h>
 
+#if USE_PTHREADS
+# include <pthread.h>
+# include <error.h>
+#endif
+
 static _Unwind_Reason_Code
 callback (struct _Unwind_Context *ctx, void *arg)
 {
   return _URC_NO_REASON;
 }
 
-int
-main (void)
+static void *
+func (void *a)
 {
   /* Arrange for this test to be killed if _Unwind_Backtrace runs into an
      endless loop.  We cannot use the test driver because the complete
      call chain needs to be compiled with -funwind-tables so that
-     _Unwind_Backtrace is able to reach _start.  */
+     _Unwind_Backtrace is able to reach the start routine.  */
   alarm (DEFAULT_TIMEOUT);
   _Unwind_Backtrace (callback, 0);
+  return a;
+}
+
+int
+main (void)
+{
+#if USE_PTHREADS
+  pthread_t thr;
+  int rc = pthread_create (&thr, NULL, &func, NULL);
+  if (rc)
+    error (1, rc, "pthread_create");
+  rc = pthread_join (thr, NULL);
+  if (rc)
+    error (1, rc, "pthread_join");
+#else
+  func (NULL);
+#endif
 }
Index: glibc-2.29/nptl/Makefile
===================================================================
--- glibc-2.29.orig/nptl/Makefile
+++ glibc-2.29/nptl/Makefile
@@ -320,7 +320,8 @@ tests = tst-attr1 tst-attr2 tst-attr3 ts
        tst-cnd-timedwait tst-thrd-detach tst-mtx-basic tst-thrd-sleep \
        tst-mtx-recursive tst-tss-basic tst-call-once tst-mtx-timedlock \
        tst-rwlock-pwn \
-       tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall
+       tst-rwlock-tryrdlock-stall tst-rwlock-trywrlock-stall \
+       tst-unwind-thread
 
 tests-internal := tst-rwlock19 tst-rwlock20 \
                  tst-sem11 tst-sem12 tst-sem13 \
@@ -710,6 +711,8 @@ $(objpfx)tst-audit-threads: $(objpfx)tst
 $(objpfx)tst-audit-threads.out: $(objpfx)tst-audit-threads-mod1.so
 tst-audit-threads-ENV = LD_AUDIT=$(objpfx)tst-audit-threads-mod1.so
 
+CFLAGS-tst-unwind-thread.c += -funwind-tables
+
 # The tests here better do not run in parallel
 ifneq ($(filter %tests,$(MAKECMDGOALS)),)
 .NOTPARALLEL:
Index: glibc-2.29/nptl/tst-unwind-thread.c
===================================================================
--- /dev/null
+++ glibc-2.29/nptl/tst-unwind-thread.c
@@ -0,0 +1,2 @@
+#define USE_PTHREADS 1
+#include "../elf/tst-unwind-main.c"
Index: glibc-2.29/sysdeps/unix/sysv/linux/riscv/clone.S
===================================================================
--- glibc-2.29.orig/sysdeps/unix/sysv/linux/riscv/clone.S
+++ glibc-2.29/sysdeps/unix/sysv/linux/riscv/clone.S
@@ -69,6 +69,11 @@ L (error):
 
 ENTRY (__thread_start)
 L (thread_start):
+       /* Terminate call stack by noting ra is undefined.  Use a dummy
+          .cfi_label to force starting the FDE.  */
+       .cfi_label .Ldummy
+       cfi_undefined (ra)
+
        /* Restore the arg for user's function.  */
        REG_L           a1,0(sp)        /* Function pointer.  */
        REG_L           a0,SZREG(sp)    /* Argument pointer.  */

Reply via email to