Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] musl: backport patch to fix #37382
@ 2023-07-03 12:55 loreb
  2023-07-19 22:06 ` [PR PATCH] [Merged]: " classabbyamp
  0 siblings, 1 reply; 2+ messages in thread
From: loreb @ 2023-07-03 12:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]

There is a new pull request by loreb against master on the void-packages repository

https://github.com/loreb/void-packages missing-musl-patch-breaks-musl
https://github.com/void-linux/void-packages/pull/44815

musl: backport patch to fix #37382
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)
<--
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->

Patch from https://git.musl-libc.org/cgit/musl/commit/?id=a5aff1972c9e3981566414b09a28e331ccd2be5d

Fixes https://github.com/void-linux/void-packages/issues/37382 and afaik shouldn't break anything (I tried rebooting, upgrading, browsing...)

A patch file from https://github.com/void-linux/void-packages/pull/44815.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-missing-musl-patch-breaks-musl-44815.patch --]
[-- Type: text/x-diff, Size: 3305 bytes --]

From f318f360213243b04530c4a1fd7e1504931226bf Mon Sep 17 00:00:00 2001
From: Lorenzo Beretta <vc.net.loreb@gmail.com>
Date: Mon, 3 Jul 2023 14:49:33 +0200
Subject: [PATCH] musl: backport patch to fix #37382

---
 ...rlimit-misbehavior-and-hang-in-vfork.patch | 49 +++++++++++++++++++
 srcpkgs/musl/template                         |  2 +-
 2 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/musl/patches/avoid-set-id-setrlimit-misbehavior-and-hang-in-vfork.patch

diff --git a/srcpkgs/musl/patches/avoid-set-id-setrlimit-misbehavior-and-hang-in-vfork.patch b/srcpkgs/musl/patches/avoid-set-id-setrlimit-misbehavior-and-hang-in-vfork.patch
new file mode 100644
index 000000000000..21f236b3a6cd
--- /dev/null
+++ b/srcpkgs/musl/patches/avoid-set-id-setrlimit-misbehavior-and-hang-in-vfork.patch
@@ -0,0 +1,49 @@
+From a5aff1972c9e3981566414b09a28e331ccd2be5d Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 17 Sep 2020 15:09:46 -0400
+Subject: [PATCH 237/513] avoid set*id/setrlimit misbehavior and hang in
+ vforked/cloned child
+
+taking the deprecated/dropped vfork spec strictly, doing pretty much
+anything but execve in the child is wrong and undefined. however,
+these are commonly needed operations to setup the child state before
+exec, and historical implementations tolerated them.
+
+for single-threaded parents, these operations already worked as
+expected in the vforked child. however, due to the need for __synccall
+to synchronize id/resource limit changes among all threads, calling
+these functions in the vforked child of a multithreaded parent caused
+a misdirected broadcast signaling of all threads in the parent. these
+signals could kill the parent entirely if the synccall signal handler
+had never been installed in the parent, or could be ignored if it had,
+or could signal/kill one or more utterly wrong processes if the parent
+already terminated (due to vfork semantics, only possible via fatal
+signal) and the parent tids were recycled. in any case, the expected
+number of semaphore posts would never happen, so the child would
+permanently hang (with all signals blocked) waiting for them.
+
+to mitigate this, and also make the normal usage case work as
+intended, treat the condition where the caller's actual tid does not
+match the tid in its thread structure as single-threaded, and bypass
+the entire synccall broadcast operation.
+---
+ src/thread/synccall.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/thread/synccall.c b/src/thread/synccall.c
+index 648a6ad4..d58c851f 100644
+--- a/src/thread/synccall.c
++++ b/src/thread/synccall.c
+@@ -63,7 +63,8 @@ void __synccall(void (*func)(void *), void *ctx)
+ 	sem_init(&target_sem, 0, 0);
+ 	sem_init(&caller_sem, 0, 0);
+ 
+-	if (!libc.threads_minus_1) goto single_threaded;
++	if (!libc.threads_minus_1 || __syscall(SYS_gettid) != self->tid)
++		goto single_threaded;
+ 
+ 	callback = func;
+ 	context = ctx;
+-- 
+2.41.0
+
diff --git a/srcpkgs/musl/template b/srcpkgs/musl/template
index 9de13710d7d3..e0e05c2df099 100644
--- a/srcpkgs/musl/template
+++ b/srcpkgs/musl/template
@@ -2,7 +2,7 @@
 pkgname=musl
 reverts="1.2.0_1"
 version=1.1.24
-revision=16
+revision=17
 archs="*-musl"
 bootstrap=yes
 build_style=gnu-configure

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

* Re: [PR PATCH] [Merged]: musl: backport patch to fix #37382
  2023-07-03 12:55 [PR PATCH] musl: backport patch to fix #37382 loreb
@ 2023-07-19 22:06 ` classabbyamp
  0 siblings, 0 replies; 2+ messages in thread
From: classabbyamp @ 2023-07-19 22:06 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

There's a merged pull request on the void-packages repository

musl: backport patch to fix #37382
https://github.com/void-linux/void-packages/pull/44815

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)
<!--
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->

Patch from https://git.musl-libc.org/cgit/musl/commit/?id=a5aff1972c9e3981566414b09a28e331ccd2be5d

Fixes https://github.com/void-linux/void-packages/issues/37382 and afaik shouldn't break anything (I tried rebooting, upgrading, browsing...)

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

end of thread, other threads:[~2023-07-19 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 12:55 [PR PATCH] musl: backport patch to fix #37382 loreb
2023-07-19 22:06 ` [PR PATCH] [Merged]: " classabbyamp

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).