Public bug reported:

We updated a number of (amd64) machines from linux-
image-6.5.0-21-generic (6.5.0-21.21~22.04.1) to linux-
image-6.5.0-25-generic (6.5.0-25.25~22.04.1), and this caused
ThreadSanitizer-instrumented programs to immediately exit with an error
similar to:

FATAL: ThreadSanitizer: unexpected memory mapping
0x5c4dc2bcd000-0x5c4dc2bed000

Reverting the kernel back to 6.5.0-21.21~22.04.1 and rebooting makes the
same executables work again.

There are a few older bugs including
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67308 and
https://github.com/google/sanitizers/issues/503 but these are from
~2015, and about gcc 7 and linux 4.1 so it does not seem to be the same
problem.

A very small program, lifted from
https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual can
be used to show the problem:

$ cat simple-race.c
#include <pthread.h>
#include <stdio.h>

int Global;

void *Thread1(void *x) {
  Global++;
  return NULL;
}

void *Thread2(void *x) {
  Global--;
  return NULL;
}

int main() {
  pthread_t t[2];
  pthread_create(&t[0], NULL, Thread1, NULL);
  pthread_create(&t[1], NULL, Thread2, NULL);
  pthread_join(t[0], NULL);
  pthread_join(t[1], NULL);
}

$ cc -fsanitize=thread -fPIE -pie -g simple-race.c -o simple-race

$ ./simple-race
FATAL: ThreadSanitizer: unexpected memory mapping 0x5d161227c000-0x5d161227d000

$ uname -a
Linux buildhost 6.5.0-25-generic #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 
20 16:09:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

When running that exact same binary, on the same machine, but with linux
6.5.0-21:

$ ./simple-race
==================
WARNING: ThreadSanitizer: data race (pid=19373)
  Read of size 4 at 0x560964a2d014 by thread T2:
    #0 Thread2 /home/lxc-unpriv/simple-race.c:12 (simple-race+0x12d1)

  Previous write of size 4 at 0x560964a2d014 by thread T1:
    #0 Thread1 /home/lxc-unpriv/simple-race.c:7 (simple-race+0x128c)

  Location is global 'Global' of size 4 at 0x560964a2d014 (simple-
race+0x000000004014)

  Thread T2 (tid=19376, running) created by main thread at:
    #0 pthread_create 
../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 
(libtsan.so.0+0x605b8)
    #1 main /home/lxc-unpriv/simple-race.c:19 (simple-race+0x1368)

  Thread T1 (tid=19375, finished) created by main thread at:
    #0 pthread_create 
../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 
(libtsan.so.0+0x605b8)
    #1 main /home/lxc-unpriv/simple-race.c:18 (simple-race+0x1347)

SUMMARY: ThreadSanitizer: data race /home/lxc-unpriv/simple-race.c:12 in Thread2
==================
ThreadSanitizer: reported 1 warnings

$ uname -a
Linux buildhost 6.5.0-21-generic #21~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 
 9 13:32:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

** Affects: linux-signed-hwe-6.5 (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/2056762

Title:
  ThreadSanitizer: unexpected memory mapping with 6.5.0-25.25~22.04.1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-signed-hwe-6.5/+bug/2056762/+subscriptions


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

Reply via email to