[Bug 1864864] Re: [SRU] pthread_rwlock_trywrlock results in hang

Andreas Hasenack 1864864 at bugs.launchpad.net
Fri Sep 11 12:56:33 UTC 2020


Bionic verification

First, reproducing the bug with the current glibc:
ubuntu at bionic-glibc-1864864:~$ apt-cache policy libc6
libc6:
  Installed: 2.27-3ubuntu1.2
  Candidate: 2.27-3ubuntu1.2
  Version table:
 *** 2.27-3ubuntu1.2 500
        500 http://br.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://br.archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status

It hung immediately:
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
(stuck)

Second run worked, third run got stuck again:
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
(stuck)


With updated glibc:
ubuntu at bionic-glibc-1864864:~$ apt-cache policy libc6
libc6:
  Installed: 2.27-3ubuntu1.3
  Candidate: 2.27-3ubuntu1.3
  Version table:
 *** 2.27-3ubuntu1.3 500
        500 http://br.archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status

Sample program doesn't hang anymore, after multiple tries, and no need to rebuild it:
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000
ubuntu at bionic-glibc-1864864:~$ ./bug23844wr
trylock_wr
500000


bionic verification succeeded


** Tags removed: verification-needed-bionic
** Tags added: verification-done-bionic

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

Title:
  [SRU] pthread_rwlock_trywrlock results in hang

Status in glibc package in Ubuntu:
  Fix Released
Status in glibc source package in Bionic:
  Fix Committed
Status in glibc package in Debian:
  Fix Released

Bug description:
  [Impact]

   * pthread_rwlock_trywrlock and pthread_rwlock_tryrdlock before glibc
  2.30 could hang:
  https://sourceware.org/bugzilla/show_bug.cgi?id=23844#c14

   * We are especially able to reproduce the problem with BIND 9.16.x
  when --with-pthread-rwlock configure option enabled

   * But the impact is not limited to BIND 9.16, but any multithreaded
  application using phtread rwlocks

  [Test Case]

  * Fetch the source program and build it:
  $ sudo apt install build-essential -y
  $ wget https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1864864/+attachment/5333068/+files/bug23844.wr.c
  $ gcc bug23844.wr.c -lpthread -o bug23844wr

  * Run the resulting binary a few times. On affected systems, it should
  hang in less then 10 attempts.

  $ ./bug23844rw
  trylock_wr
  500000

  (...)

  $ ./bug23844.wr
  trylock_wr
  <hangs>

  [Regression Potential]

   * The upstream fix has been in glibc 2.30 and later
   * Debian has the fix in 2.28-8 as part of "git-updates.diff" from February 2019

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



More information about the foundations-bugs mailing list