[Bug 2007796] Re: glibc __read_chk not a cancellation point

Brian Murray 2007796 at bugs.launchpad.net
Tue Jun 6 19:54:36 UTC 2023


Hello jandryuk, or anyone else affected,

Accepted glibc into jammy-proposed. The package will build now and be
available at https://launchpad.net/ubuntu/+source/glibc/2.35-0ubuntu3.2
in a few hours, and then in the -proposed repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.  Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, what testing has been
performed on the package and change the tag from verification-needed-
jammy to verification-done-jammy. If it does not fix the bug for you,
please add a comment stating that, and change the tag to verification-
failed-jammy. In either case, without details of your testing we will
not be able to proceed.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance for helping!

N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.

** Changed in: glibc (Ubuntu Jammy)
       Status: In Progress => Fix Committed

** Tags added: verification-needed verification-needed-jammy

-- 
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/2007796

Title:
  glibc __read_chk not a cancellation point

Status in glibc package in Ubuntu:
  Fix Released
Status in glibc source package in Jammy:
  Fix Committed
Status in glibc source package in Kinetic:
  Fix Released

Bug description:
  [Impact]
  I'm working with Xen and libxenstore.  libxenstore, when using a "watch", spawns a pthread (read_thread).  When libxenstore shuts down, it pthread_cancel()s and pthread_join()s the "watch" thread.

  That thread never exits and the process shutdown hangs.

  read_threads is sitting in __read_chk().  In glibc 2.35, __read_chk is
  not a cancellation point, so the thread never reacts to the
  cancellation.

  Upstream glibc fixed it in 2.36 in
  https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=dc30acf20bd635d71cd4c84100e842fdf0429e48

  Here's the 2.35 disassembly - the lack of __pthread_enable_asynccancel() indicates the missing cancellation support:
  (gdb) disassemble
  Dump of assembler code for function __read_chk:
     0x00007ffff7ea04d0 <+0>:	endbr64
     0x00007ffff7ea04d4 <+4>:	cmp    %rcx,%rdx
     0x00007ffff7ea04d7 <+7>:	ja     0x7ffff7ea0504 <__read_chk+52>
     0x00007ffff7ea04d9 <+9>:	xor    %eax,%eax
     0x00007ffff7ea04db <+11>:	syscall
  => 0x00007ffff7ea04dd <+13>:	cmp    $0xfffffffffffff000,%rax
     0x00007ffff7ea04e3 <+19>:	ja     0x7ffff7ea04f0 <__read_chk+32>
     0x00007ffff7ea04e5 <+21>:	ret
     0x00007ffff7ea04e6 <+22>:	cs nopw 0x0(%rax,%rax,1)
     0x00007ffff7ea04f0 <+32>:	mov    0xe3919(%rip),%rdx        # 0x7ffff7f83e10
     0x00007ffff7ea04f7 <+39>:	neg    %eax
     0x00007ffff7ea04f9 <+41>:	mov    %eax,%fs:(%rdx)
     0x00007ffff7ea04fc <+44>:	mov    $0xffffffffffffffff,%rax
     0x00007ffff7ea0503 <+51>:	ret
     0x00007ffff7ea0504 <+52>:	push   %rax
     0x00007ffff7ea0505 <+53>:	call   0x7ffff7ea00b0 <__GI___chk_fail>
  End of assembler dump.

  [Test procedure]

  The patch includes a test for this that is run at build time.

  [Regression potential]

  Besides the usual risks with any glibc update, this could potentially
  surface some race conditions at thread shutdown in user applications
  that were thus far hidden by the lack of cancellation point.

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




More information about the foundations-bugs mailing list