Public bug reported:

The issue was detected when building openjdk-17[1].

The bug occurs due to the introduction of a new guard mechanism[2] 
ALLOCATE_GUARD_MADV_GUARD. 
This is a default value for the stack protection guard  (0) and it is unchanged 
when the thread is created with 0 size guard area[3]. The stack block is added 
to the list of the stacks in use[4].
The first thread runs its course and exits.

When the subsequent thread is created with non-zero guard area, the existing 
stack can be reused[5].
It has ALLOCATE_GUARD_MADV_GUARD stack protection flag set, but the kernel does 
not support it. adjust_stack_prot function will try to adjust the guard 
area[6], but the call will fail with EINVAL. 

This breaks OpenJDK and other multithreaded applications running glibc
2.42-0ubuntu1 on kernels < 6.13.


[1] 
https://launchpad.net/ubuntu/+source/openjdk-17/17.0.17~5ea-1/+build/31115316
[2] 
https://github.com/bminor/glibc/commit/a6fbe36b7f31292981422692236465ab56670ea9
[3] 
https://github.com/bminor/glibc/blob/0c6cb5285bc90b35dfdb476f47fe9bad721abf8b/nptl/allocatestack.c#L191
[4] 
https://github.com/bminor/glibc/blob/0c6cb5285bc90b35dfdb476f47fe9bad721abf8b/nptl/allocatestack.c#L558
[5] 
https://github.com/bminor/glibc/blob/0c6cb5285bc90b35dfdb476f47fe9bad721abf8b/nptl/allocatestack.c#L483
[6] 
https://github.com/bminor/glibc/blob/0c6cb5285bc90b35dfdb476f47fe9bad721abf8b/nptl/allocatestack.c#L256

** Affects: glibc (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  glibc 2.42-0ubuntu1 fails to start the thread on kernel < 6.13

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


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

Reply via email to