From: "Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, philipoakley@iee.email,
eschwartz@archlinux.org, Victoria Dye <vdye@github.com>,
Victoria Dye <vdye@github.com>
Subject: [PATCH] async_die_is_recursing: fix use of pthread_getspecific for Fedora
Date: Thu, 04 Nov 2021 01:47:45 +0000 [thread overview]
Message-ID: <pull.1072.git.1635990465854.gitgitgadget@gmail.com> (raw)
From: Victoria Dye <vdye@github.com>
Correct an issue encountered in the `dockerized(pedantic, fedora)` CI build,
first appearing after the release of v36 as the latest stable version of the
Fedora docker image. This image includes a version of `glibc` with the
attribute `__attr_access_none` added to `pthread_getspecific` [1], the
implementation of which only exists for GCC 11.X - the version included in
Fedora. The attribute requires that the pointer provided in the second
argument of `pthread_getspecific` must, if not NULL, be a pointer to a valid
object. In the usage in `async_die_is_recursing`, `(void *)1` is not valid,
resulting in the error.
The fix imitates a workaround added in SELinux [2] by using the pointer to
`ret` as the second argument to `pthread_getspecific`. This guaranteed
non-NULL, valid pointer adheres to the current intended usage of
`pthread_getspecific` while not triggering the build error.
[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=a1561c3bbe8
[2] https://lore.kernel.org/all/20211021140519.6593-1-cgzones@googlemail.com/
Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Victoria Dye <vdye@github.com>
---
async_die_is_recursing: fix use of pthread_getspecific for Fedora
Following up on Johannes' report earlier [1], this patch fixes a
compiler error in the Fedora CI build (the same issue was identified in
a local developer build about a week ago [2]). This fix changes the
second argument in the call to pthread_getspecific from '(void *)1' to a
valid pointer, thus preventing the error in the use of
__attr_access_none.
[1]
https://lore.kernel.org/git/nycvar.QRO.7.76.6.2111040007170.56@tvgsbejvaqbjf.bet/
[2]
https://lore.kernel.org/git/43fe6d5c-bdb2-585c-c601-1da7a1b3ff8b@archlinux.org/
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1072%2Fvdye%2Ffix-fedora-build-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1072/vdye/fix-fedora-build-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1072
run-command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/run-command.c b/run-command.c
index 7ef5cc712a9..a82cf69e7d3 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1099,7 +1099,7 @@ static NORETURN void die_async(const char *err, va_list params)
static int async_die_is_recursing(void)
{
void *ret = pthread_getspecific(async_die_counter);
- pthread_setspecific(async_die_counter, (void *)1);
+ pthread_setspecific(async_die_counter, &ret); /* set to any non-NULL valid pointer */
return ret != NULL;
}
base-commit: 876b1423317071f43c99666f3fc3db3642dfbe14
--
gitgitgadget
next reply other threads:[~2021-11-04 1:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 1:47 Victoria Dye via GitGitGadget [this message]
2021-11-04 2:23 ` [PATCH] async_die_is_recursing: fix use of pthread_getspecific for Fedora Carlo Arenas
2021-11-04 2:37 ` Jeff King
2021-11-04 3:20 ` Carlo Arenas
2021-11-04 5:56 ` Jeff King
2021-11-04 4:01 ` [PATCH v2] async_die_is_recursing: work around GCC v11.x issue on Fedora Victoria Dye via GitGitGadget
2021-11-04 5:58 ` Jeff King
2021-11-04 6:35 ` Junio C Hamano
2021-11-04 9:42 ` Ævar Arnfjörð Bjarmason
2021-11-04 13:08 ` Derrick Stolee
2021-11-04 17:46 ` Junio C Hamano
2021-11-05 21:45 ` Junio C Hamano
2021-11-04 8:43 ` Johannes Schindelin
2021-11-04 9:46 ` Carlo Arenas
2021-11-04 16:33 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1072.git.1635990465854.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=eschwartz@archlinux.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=philipoakley@iee.email \
--cc=vdye@github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).