qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Bug 1895305] [NEW] pthread_cancel fails with "RT33" with musl libc
@ 2020-09-11 14:29 Luca Weiss
  2020-09-11 14:54 ` [Bug 1895305] " Laurent Vivier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luca Weiss @ 2020-09-11 14:29 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

>From my testing it seems that QEMU built against musl libc crashes on
pthread_cancel cancel calls - if the binary is also built with musl
libc.

Minimal sample:

#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
void* threadfunc(void* ignored) {
	while (1) {
		pause();
	}
	return NULL;
}
int main() {
	pthread_t thread;
	pthread_create(&thread, NULL, &threadfunc, NULL);
	sleep(1);
	pthread_cancel(thread);
	printf("OK, alive\n");
}

In an Alpine Linux aarch64 chroot (on an x86_64 host) the binary will
just output RT33 and has exit code 161.

Using qemu-aarch64 on an x86_64 host results in the output (fish shell)
  fish: “qemu-aarch64-static ./musl-stat…” terminated by signal Unknown (Unknown)
or (bash)
  Real-time signal 2

and exit code 164.

It doesn't matter whether the binary is linked dynamically or static.
You can see my test results in the following table:

|                      | QEMU glibc | QEMU musl |
|----------------------|------------|-----------|
| binary glibc dynamic | ✓          | ✓         |
| binary glibc static  | ✓          | ✓         |
| binary musl dynamic  | ✓          | ✗         |
| binary musl static   | ✓          | ✗         |

Both QEMU builds are v5.1.0 (glibc v2.32 / musl v1.2.1)

I've uploaded all my compile and test commands (plus a script to
conveniently run them all) to https://github.com/z3ntu/qemu-
pthread_cancel . It also includes the built binaries if needed. The test
script output can be found at https://github.com/z3ntu/qemu-
pthread_cancel/blob/master/results.txt

Further links:
- https://gitlab.com/postmarketOS/pmaports/-/issues/190#note_141902075
- https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1970

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895305

Title:
  pthread_cancel fails with "RT33" with musl libc

Status in QEMU:
  New

Bug description:
  From my testing it seems that QEMU built against musl libc crashes on
  pthread_cancel cancel calls - if the binary is also built with musl
  libc.

  Minimal sample:

  #include <pthread.h>
  #include <stdio.h>
  #include <unistd.h>
  void* threadfunc(void* ignored) {
  	while (1) {
  		pause();
  	}
  	return NULL;
  }
  int main() {
  	pthread_t thread;
  	pthread_create(&thread, NULL, &threadfunc, NULL);
  	sleep(1);
  	pthread_cancel(thread);
  	printf("OK, alive\n");
  }

  In an Alpine Linux aarch64 chroot (on an x86_64 host) the binary will
  just output RT33 and has exit code 161.

  Using qemu-aarch64 on an x86_64 host results in the output (fish shell)
    fish: “qemu-aarch64-static ./musl-stat…” terminated by signal Unknown (Unknown)
  or (bash)
    Real-time signal 2

  and exit code 164.

  It doesn't matter whether the binary is linked dynamically or static.
  You can see my test results in the following table:

  |                      | QEMU glibc | QEMU musl |
  |----------------------|------------|-----------|
  | binary glibc dynamic | ✓          | ✓         |
  | binary glibc static  | ✓          | ✓         |
  | binary musl dynamic  | ✓          | ✗         |
  | binary musl static   | ✓          | ✗         |

  Both QEMU builds are v5.1.0 (glibc v2.32 / musl v1.2.1)

  I've uploaded all my compile and test commands (plus a script to
  conveniently run them all) to https://github.com/z3ntu/qemu-
  pthread_cancel . It also includes the built binaries if needed. The
  test script output can be found at https://github.com/z3ntu/qemu-
  pthread_cancel/blob/master/results.txt

  Further links:
  - https://gitlab.com/postmarketOS/pmaports/-/issues/190#note_141902075
  - https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1970

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895305/+subscriptions


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 1895305] Re: pthread_cancel fails with "RT33" with musl libc
  2020-09-11 14:29 [Bug 1895305] [NEW] pthread_cancel fails with "RT33" with musl libc Luca Weiss
@ 2020-09-11 14:54 ` Laurent Vivier
  2021-04-26  8:54 ` Ariadne Conill
  2021-04-27  4:20 ` Thomas Huth
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2020-09-11 14:54 UTC (permalink / raw)
  To: qemu-devel

** Tags added: linux-user

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895305

Title:
  pthread_cancel fails with "RT33" with musl libc

Status in QEMU:
  New

Bug description:
  From my testing it seems that QEMU built against musl libc crashes on
  pthread_cancel cancel calls - if the binary is also built with musl
  libc.

  Minimal sample:

  #include <pthread.h>
  #include <stdio.h>
  #include <unistd.h>
  void* threadfunc(void* ignored) {
  	while (1) {
  		pause();
  	}
  	return NULL;
  }
  int main() {
  	pthread_t thread;
  	pthread_create(&thread, NULL, &threadfunc, NULL);
  	sleep(1);
  	pthread_cancel(thread);
  	printf("OK, alive\n");
  }

  In an Alpine Linux aarch64 chroot (on an x86_64 host) the binary will
  just output RT33 and has exit code 161.

  Using qemu-aarch64 on an x86_64 host results in the output (fish shell)
    fish: “qemu-aarch64-static ./musl-stat…” terminated by signal Unknown (Unknown)
  or (bash)
    Real-time signal 2

  and exit code 164.

  It doesn't matter whether the binary is linked dynamically or static.
  You can see my test results in the following table:

  |                      | QEMU glibc | QEMU musl |
  |----------------------|------------|-----------|
  | binary glibc dynamic | ✓          | ✓         |
  | binary glibc static  | ✓          | ✓         |
  | binary musl dynamic  | ✓          | ✗         |
  | binary musl static   | ✓          | ✗         |

  Both QEMU builds are v5.1.0 (glibc v2.32 / musl v1.2.1)

  I've uploaded all my compile and test commands (plus a script to
  conveniently run them all) to https://github.com/z3ntu/qemu-
  pthread_cancel . It also includes the built binaries if needed. The
  test script output can be found at https://github.com/z3ntu/qemu-
  pthread_cancel/blob/master/results.txt

  Further links:
  - https://gitlab.com/postmarketOS/pmaports/-/issues/190#note_141902075
  - https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1970

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895305/+subscriptions


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 1895305] Re: pthread_cancel fails with "RT33" with musl libc
  2020-09-11 14:29 [Bug 1895305] [NEW] pthread_cancel fails with "RT33" with musl libc Luca Weiss
  2020-09-11 14:54 ` [Bug 1895305] " Laurent Vivier
@ 2021-04-26  8:54 ` Ariadne Conill
  2021-04-27  4:20 ` Thomas Huth
  2 siblings, 0 replies; 4+ messages in thread
From: Ariadne Conill @ 2021-04-26  8:54 UTC (permalink / raw)
  To: qemu-devel

This was a downstream regression in Alpine caused by an attempt to make
older Go binaries work under emulation.  We have reverted the patch
there.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895305

Title:
  pthread_cancel fails with "RT33" with musl libc

Status in QEMU:
  New

Bug description:
  From my testing it seems that QEMU built against musl libc crashes on
  pthread_cancel cancel calls - if the binary is also built with musl
  libc.

  Minimal sample:

  #include <pthread.h>
  #include <stdio.h>
  #include <unistd.h>
  void* threadfunc(void* ignored) {
  	while (1) {
  		pause();
  	}
  	return NULL;
  }
  int main() {
  	pthread_t thread;
  	pthread_create(&thread, NULL, &threadfunc, NULL);
  	sleep(1);
  	pthread_cancel(thread);
  	printf("OK, alive\n");
  }

  In an Alpine Linux aarch64 chroot (on an x86_64 host) the binary will
  just output RT33 and has exit code 161.

  Using qemu-aarch64 on an x86_64 host results in the output (fish shell)
    fish: “qemu-aarch64-static ./musl-stat…” terminated by signal Unknown (Unknown)
  or (bash)
    Real-time signal 2

  and exit code 164.

  It doesn't matter whether the binary is linked dynamically or static.
  You can see my test results in the following table:

  |                      | QEMU glibc | QEMU musl |
  |----------------------|------------|-----------|
  | binary glibc dynamic | ✓          | ✓         |
  | binary glibc static  | ✓          | ✓         |
  | binary musl dynamic  | ✓          | ✗         |
  | binary musl static   | ✓          | ✗         |

  Both QEMU builds are v5.1.0 (glibc v2.32 / musl v1.2.1)

  I've uploaded all my compile and test commands (plus a script to
  conveniently run them all) to https://github.com/z3ntu/qemu-
  pthread_cancel . It also includes the built binaries if needed. The
  test script output can be found at https://github.com/z3ntu/qemu-
  pthread_cancel/blob/master/results.txt

  Further links:
  - https://gitlab.com/postmarketOS/pmaports/-/issues/190#note_141902075
  - https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1970

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895305/+subscriptions


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 1895305] Re: pthread_cancel fails with "RT33" with musl libc
  2020-09-11 14:29 [Bug 1895305] [NEW] pthread_cancel fails with "RT33" with musl libc Luca Weiss
  2020-09-11 14:54 ` [Bug 1895305] " Laurent Vivier
  2021-04-26  8:54 ` Ariadne Conill
@ 2021-04-27  4:20 ` Thomas Huth
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2021-04-27  4:20 UTC (permalink / raw)
  To: qemu-devel

Ok, thanks, since this was a regressin in Alpine, I'm marking the bug as
closed here.

** Changed in: qemu
       Status: New => Invalid

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1895305

Title:
  pthread_cancel fails with "RT33" with musl libc

Status in QEMU:
  Invalid

Bug description:
  From my testing it seems that QEMU built against musl libc crashes on
  pthread_cancel cancel calls - if the binary is also built with musl
  libc.

  Minimal sample:

  #include <pthread.h>
  #include <stdio.h>
  #include <unistd.h>
  void* threadfunc(void* ignored) {
  	while (1) {
  		pause();
  	}
  	return NULL;
  }
  int main() {
  	pthread_t thread;
  	pthread_create(&thread, NULL, &threadfunc, NULL);
  	sleep(1);
  	pthread_cancel(thread);
  	printf("OK, alive\n");
  }

  In an Alpine Linux aarch64 chroot (on an x86_64 host) the binary will
  just output RT33 and has exit code 161.

  Using qemu-aarch64 on an x86_64 host results in the output (fish shell)
    fish: “qemu-aarch64-static ./musl-stat…” terminated by signal Unknown (Unknown)
  or (bash)
    Real-time signal 2

  and exit code 164.

  It doesn't matter whether the binary is linked dynamically or static.
  You can see my test results in the following table:

  |                      | QEMU glibc | QEMU musl |
  |----------------------|------------|-----------|
  | binary glibc dynamic | ✓          | ✓         |
  | binary glibc static  | ✓          | ✓         |
  | binary musl dynamic  | ✓          | ✗         |
  | binary musl static   | ✓          | ✗         |

  Both QEMU builds are v5.1.0 (glibc v2.32 / musl v1.2.1)

  I've uploaded all my compile and test commands (plus a script to
  conveniently run them all) to https://github.com/z3ntu/qemu-
  pthread_cancel . It also includes the built binaries if needed. The
  test script output can be found at https://github.com/z3ntu/qemu-
  pthread_cancel/blob/master/results.txt

  Further links:
  - https://gitlab.com/postmarketOS/pmaports/-/issues/190#note_141902075
  - https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1970

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1895305/+subscriptions


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-27  4:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 14:29 [Bug 1895305] [NEW] pthread_cancel fails with "RT33" with musl libc Luca Weiss
2020-09-11 14:54 ` [Bug 1895305] " Laurent Vivier
2021-04-26  8:54 ` Ariadne Conill
2021-04-27  4:20 ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).