diff options
| author | Sunil Dora <sunilkumar.dora@windriver.com> | 2025-10-14 07:43:44 -0700 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-10-17 07:27:24 -0700 |
| commit | 42b3adafcc6708d3f9340db7119f5c35c338c9cb (patch) | |
| tree | 19baa83dcb9f9ab4ca50681cf628c190318e9669 | |
| parent | 2105de9c82c73310516d78271d7bcbfa98e1c24e (diff) | |
| download | poky-42b3adafcc6708d3f9340db7119f5c35c338c9cb.tar.gz | |
glibc: nptl Fix indentation
The following commits have been cherry-picked from Glibc master branch:
Bug : https://sourceware.org/bugzilla/show_bug.cgi?id=25847
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=ee6c14ed59d480720721aaacc5fb03213dc153da
[2] https://sourceware.org/pipermail/libc-stable/2025-July/002280.html
(From OE-Core rev: f54e082df2f07893f66183089518f98cb792f22e)
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-core/glibc/glibc/0026-PR25847-7.patch | 149 | ||||
| -rw-r--r-- | meta/recipes-core/glibc/glibc_2.35.bb | 1 |
2 files changed, 150 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0026-PR25847-7.patch b/meta/recipes-core/glibc/glibc/0026-PR25847-7.patch new file mode 100644 index 0000000000..74cb49670b --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0026-PR25847-7.patch | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | From 1077953950d1e8864c63222967141c67f51297f8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Malte Skarupke <malteskarupke@fastmail.fm> | ||
| 3 | Date: Tue, 14 Oct 2025 06:27:04 -0700 | ||
| 4 | Subject: [PATCH] nptl: Fix indentation | ||
| 5 | |||
| 6 | In my previous change I turned a nested loop into a simple loop. I'm doing | ||
| 7 | the resulting indentation changes in a separate commit to make the diff on | ||
| 8 | the previous commit easier to review. | ||
| 9 | |||
| 10 | The following commits have been cherry-picked from Glibc master branch: | ||
| 11 | Bug : https://sourceware.org/bugzilla/show_bug.cgi?id=25847 | ||
| 12 | commit: ee6c14ed59d480720721aaacc5fb03213dc153da | ||
| 13 | |||
| 14 | Upstream-Status: Submitted | ||
| 15 | [https://sourceware.org/pipermail/libc-stable/2025-July/002280.html] | ||
| 16 | |||
| 17 | Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com> | ||
| 18 | --- | ||
| 19 | nptl/pthread_cond_wait.c | 110 +++++++++++++++++++-------------------- | ||
| 20 | 1 file changed, 55 insertions(+), 55 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c | ||
| 23 | index c8c99bbf..adf26a80 100644 | ||
| 24 | --- a/nptl/pthread_cond_wait.c | ||
| 25 | +++ b/nptl/pthread_cond_wait.c | ||
| 26 | @@ -383,65 +383,65 @@ __pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex, | ||
| 27 | } | ||
| 28 | |||
| 29 | |||
| 30 | - while (1) | ||
| 31 | - { | ||
| 32 | - /* Now wait until a signal is available in our group or it is closed. | ||
| 33 | - Acquire MO so that if we observe (signals == lowseq) after group | ||
| 34 | - switching in __condvar_quiesce_and_switch_g1, we synchronize with that | ||
| 35 | - store and will see the prior update of __g1_start done while switching | ||
| 36 | - groups too. */ | ||
| 37 | - unsigned int signals = atomic_load_acquire (cond->__data.__g_signals + g); | ||
| 38 | - uint64_t g1_start = __condvar_load_g1_start_relaxed (cond); | ||
| 39 | - unsigned int lowseq = (g1_start & 1) == g ? signals : g1_start & ~1U; | ||
| 40 | - | ||
| 41 | - if (seq < (g1_start >> 1)) | ||
| 42 | - { | ||
| 43 | - /* If the group is closed already, | ||
| 44 | - then this waiter originally had enough extra signals to | ||
| 45 | - consume, up until the time its group was closed. */ | ||
| 46 | - break; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - /* If there is an available signal, don't block. | ||
| 50 | - If __g1_start has advanced at all, then we must be in G1 | ||
| 51 | - by now, perhaps in the process of switching back to an older | ||
| 52 | - G2, but in either case we're allowed to consume the available | ||
| 53 | - signal and should not block anymore. */ | ||
| 54 | - if ((int)(signals - lowseq) >= 2) | ||
| 55 | - { | ||
| 56 | - /* Try to grab a signal. See above for MO. (if we do another loop | ||
| 57 | - iteration we need to see the correct value of g1_start) */ | ||
| 58 | - if (atomic_compare_exchange_weak_acquire ( | ||
| 59 | - cond->__data.__g_signals + g, | ||
| 60 | + while (1) | ||
| 61 | + { | ||
| 62 | + /* Now wait until a signal is available in our group or it is closed. | ||
| 63 | + Acquire MO so that if we observe (signals == lowseq) after group | ||
| 64 | + switching in __condvar_quiesce_and_switch_g1, we synchronize with that | ||
| 65 | + store and will see the prior update of __g1_start done while switching | ||
| 66 | + groups too. */ | ||
| 67 | + unsigned int signals = atomic_load_acquire (cond->__data.__g_signals + g); | ||
| 68 | + uint64_t g1_start = __condvar_load_g1_start_relaxed (cond); | ||
| 69 | + unsigned int lowseq = (g1_start & 1) == g ? signals : g1_start & ~1U; | ||
| 70 | + | ||
| 71 | + if (seq < (g1_start >> 1)) | ||
| 72 | + { | ||
| 73 | + /* If the group is closed already, | ||
| 74 | + then this waiter originally had enough extra signals to | ||
| 75 | + consume, up until the time its group was closed. */ | ||
| 76 | + break; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /* If there is an available signal, don't block. | ||
| 80 | + If __g1_start has advanced at all, then we must be in G1 | ||
| 81 | + by now, perhaps in the process of switching back to an older | ||
| 82 | + G2, but in either case we're allowed to consume the available | ||
| 83 | + signal and should not block anymore. */ | ||
| 84 | + if ((int)(signals - lowseq) >= 2) | ||
| 85 | + { | ||
| 86 | + /* Try to grab a signal. See above for MO. (if we do another loop | ||
| 87 | + iteration we need to see the correct value of g1_start) */ | ||
| 88 | + if (atomic_compare_exchange_weak_acquire ( | ||
| 89 | + cond->__data.__g_signals + g, | ||
| 90 | &signals, signals - 2)) | ||
| 91 | - break; | ||
| 92 | - else | ||
| 93 | - continue; | ||
| 94 | - } | ||
| 95 | - | ||
| 96 | - // Now block. | ||
| 97 | - struct _pthread_cleanup_buffer buffer; | ||
| 98 | - struct _condvar_cleanup_buffer cbuffer; | ||
| 99 | - cbuffer.wseq = wseq; | ||
| 100 | - cbuffer.cond = cond; | ||
| 101 | - cbuffer.mutex = mutex; | ||
| 102 | - cbuffer.private = private; | ||
| 103 | - __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer); | ||
| 104 | - | ||
| 105 | - err = __futex_abstimed_wait_cancelable64 ( | ||
| 106 | - cond->__data.__g_signals + g, signals, clockid, abstime, private); | ||
| 107 | - | ||
| 108 | - __pthread_cleanup_pop (&buffer, 0); | ||
| 109 | - | ||
| 110 | - if (__glibc_unlikely (err == ETIMEDOUT || err == EOVERFLOW)) | ||
| 111 | - { | ||
| 112 | - /* If we timed out, we effectively cancel waiting. */ | ||
| 113 | - __condvar_cancel_waiting (cond, seq, g, private); | ||
| 114 | - result = err; | ||
| 115 | break; | ||
| 116 | - } | ||
| 117 | + else | ||
| 118 | + continue; | ||
| 119 | } | ||
| 120 | |||
| 121 | + // Now block. | ||
| 122 | + struct _pthread_cleanup_buffer buffer; | ||
| 123 | + struct _condvar_cleanup_buffer cbuffer; | ||
| 124 | + cbuffer.wseq = wseq; | ||
| 125 | + cbuffer.cond = cond; | ||
| 126 | + cbuffer.mutex = mutex; | ||
| 127 | + cbuffer.private = private; | ||
| 128 | + __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer); | ||
| 129 | + | ||
| 130 | + err = __futex_abstimed_wait_cancelable64 ( | ||
| 131 | + cond->__data.__g_signals + g, signals, clockid, abstime, private); | ||
| 132 | + | ||
| 133 | + __pthread_cleanup_pop (&buffer, 0); | ||
| 134 | + | ||
| 135 | + if (__glibc_unlikely (err == ETIMEDOUT || err == EOVERFLOW)) | ||
| 136 | + { | ||
| 137 | + /* If we timed out, we effectively cancel waiting. */ | ||
| 138 | + __condvar_cancel_waiting (cond, seq, g, private); | ||
| 139 | + result = err; | ||
| 140 | + break; | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | /* Confirm that we have been woken. We do that before acquiring the mutex | ||
| 145 | to allow for execution of pthread_cond_destroy while having acquired the | ||
| 146 | mutex. */ | ||
| 147 | -- | ||
| 148 | 2.49.0 | ||
| 149 | |||
diff --git a/meta/recipes-core/glibc/glibc_2.35.bb b/meta/recipes-core/glibc/glibc_2.35.bb index 3034461e9e..7ef2c8cb4c 100644 --- a/meta/recipes-core/glibc/glibc_2.35.bb +++ b/meta/recipes-core/glibc/glibc_2.35.bb | |||
| @@ -68,6 +68,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
| 68 | file://0026-PR25847-4.patch \ | 68 | file://0026-PR25847-4.patch \ |
| 69 | file://0026-PR25847-5.patch \ | 69 | file://0026-PR25847-5.patch \ |
| 70 | file://0026-PR25847-6.patch \ | 70 | file://0026-PR25847-6.patch \ |
| 71 | file://0026-PR25847-7.patch \ | ||
| 71 | \ | 72 | \ |
| 72 | file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ | 73 | file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ |
| 73 | file://0002-get_nscd_addresses-Fix-subscript-typos-BZ-29605.patch \ | 74 | file://0002-get_nscd_addresses-Fix-subscript-typos-BZ-29605.patch \ |
