From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by sourceware.org (Postfix) with ESMTPS id 91C913857BB3 for ; Wed, 4 Jan 2023 12:00:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91C913857BB3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-14ffd3c5b15so28125983fac.3 for ; Wed, 04 Jan 2023 04:00:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=1lbmWTZCbfWrHWZtckWkKmsF+ODXLrioD8NQTx/DfWg=; b=RQJSreszq5bNkjNMYZ0D+jo399ksGDcZnoM5Z5bMhv4ZS7A89fxRUYM1JR88SicSZQ WiQAK0uNNdFb6iAmxhAVvkcLJdjbdSiVrb9iBEeh3+CpeMRXQqe7CdGk8gLyPev9DZKb B7LJYqA71TJA07UQLXGMVbvTIsLIRC/hEfRJ5B1z9H8OLmGaGCZoQrQ/9qU/U84FTrXI ANHG1hv6mO+Ah7Ytq07iP/U8GdJN3QHY7Qh3VdVN/zyNd+etE/kf+uoi0fvT8kE7tqB0 4UurpXII7yeyVHZxwsoLut0PdThUwEYpxpd4WqexbIea34m8sZ2iZml2V8FH20Y0ANgx PO7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1lbmWTZCbfWrHWZtckWkKmsF+ODXLrioD8NQTx/DfWg=; b=Zo7unCzbunF9TzmBJfzOgfWmSJe6rIBTSQmG4HsZctXUcY2tV1VS43Kqz0HXHE1Kgp K1eV1KFZW2Mqq3+8rNKtZSsmH3fKWX9JHxKU1TqWW14M220JGVPvNH6m7RJWEIhbM/SS vFi7ne/dCSYZ5saBQNrJTrje/yiyBf5x5FsNVlOjwzUjcGV515ltxWgqt5mQSnIXIj40 i0DO9KZ2IckTPGBM8tnysTkfUl5o5Ma6oHMOgCk3GX/YCBkRBz80T2UQLeOfXL8jxrT1 8MRL83zvfuSf8u42r2j6bS2R0856uDJ6kWDgV1IcsFyDKYIne42Q7subkgOaFiA+80In ENgw== X-Gm-Message-State: AFqh2kon9vHHYeSYEOZ2iwHZ6W67PxcX8/1QEyyv5DcMk6YPM0NEx1xf +IsA79LNAFJLk4uzkRcRHnCe+58AxwaSzVpgEDo= X-Google-Smtp-Source: AMrXdXsHo7qYadgo8hz3AVK5BZv2aO5gCRCU+5hYH4DphO504Ma1GNtKkzIZzHBqlwHcPdoQ4t2wfQ== X-Received: by 2002:a05:6870:9592:b0:148:2c02:5322 with SMTP id k18-20020a056870959200b001482c025322mr24690617oao.26.1672833619681; Wed, 04 Jan 2023 04:00:19 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c0:1729:386d:7dc6:8632:c39c? ([2804:1b3:a7c0:1729:386d:7dc6:8632:c39c]) by smtp.gmail.com with ESMTPSA id s24-20020a056870ea9800b0014c7958c55bsm15608288oap.42.2023.01.04.04.00.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 04:00:18 -0800 (PST) Message-ID: <9d2cac45-b81b-fa5f-e0e7-87396645bcfe@linaro.org> Date: Wed, 4 Jan 2023 09:00:16 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: Update on the glibc segfault issue on Alpha Content-Language: en-US To: John Paul Adrian Glaubitz , "debian-alpha@lists.debian.org" Cc: gentoo-alpha@lists.gentoo.org, GNU C Library , Florian Weimer References: <999879fc-9cb3-1efa-165b-36a5418f2e41@physik.fu-berlin.de> <86f86d4e-b9d5-1caf-a5ac-018bb95b38bc@linaro.org> <61cb548d-f5ee-bd6c-6d5f-b80e10f4be9e@physik.fu-berlin.de> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <61cb548d-f5ee-bd6c-6d5f-b80e10f4be9e@physik.fu-berlin.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 04/01/23 06:25, John Paul Adrian Glaubitz wrote: > Hi Adhemerval! > > On 1/3/23 13:09, Adhemerval Zanella Netto wrote: >> Thanks, this commits helps narrow down the issue.  The 73fc4e28b9464f0e refactor did not >> add the GL(dl_phdr) and GL(dl_phnum) for static case, relying on the __ehdr_start symbol >> to get the correct values. >> >> The issue is for some archs, alpha for instance, the hidden weak reference is not making >> the static linker to define the __ehdr_start address correctly: it is being set to 0 and >> thus GL(dl_phdr) and GL(dl_phnum) are set to invalid values. >> >> And I am not sure if the hidden weak __ehdr_start does work on all architectures, so I >> think it would be safer to just restore the previous behavior to setup GL(dl_phdr) and >> GL(dl_phnum) for static and we can simplify __ehdr_start fallback case to not use >> a weak ref (as for PIE). I am checking if the following patch trigger any regression, >> at least for alpha it fixes the static failures: >> >> diff --git a/csu/libc-start.c b/csu/libc-start.c >> index 543560f36c..63a3eceaea 100644 >> --- a/csu/libc-start.c >> +++ b/csu/libc-start.c >> @@ -271,18 +271,10 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), >>            So we can set up _dl_phdr and _dl_phnum even without any >>            information from auxv.  */ >> >> -      extern const ElfW(Ehdr) __ehdr_start >> -# if BUILD_PIE_DEFAULT >> -       __attribute__ ((visibility ("hidden"))); >> -# else >> -       __attribute__ ((weak, visibility ("hidden"))); >> -      if (&__ehdr_start != NULL) >> -# endif >> -        { >> -          assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); >> -          GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; >> -          GL(dl_phnum) = __ehdr_start.e_phnum; >> -        } >> +      extern const ElfW(Ehdr) __ehdr_start attribute_hidden; >> +      assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); >> +      GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff; >> +      GL(dl_phnum) = __ehdr_start.e_phnum; >>       } >> >>     __tunables_init (__environ); >> diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h >> index bf9374371e..5913c9d6e5 100644 >> --- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h >> +++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h >> @@ -56,6 +56,10 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values) >>     if (GLRO(dl_sysinfo_dso) != NULL) >>       GLRO(dl_sysinfo) = auxv_values[AT_SYSINFO]; >>   #endif >> +#ifndef SHARED >> +  GL(dl_phdr) = (void*) auxv_values[AT_PHDR]; >> +  GL(dl_phnum) = auxv_values[AT_PHENT]; >> +#endif >> >>     DL_PLATFORM_AUXV >>   } > > I can confirm that this patch fixes the problem for me. I have uploaded a manually built glibc > package with the patch applied to Debian »unreleased« so that the buildds can resume building > packages again. > > Would it be possible to backport this patch to 2.36 once it has been merged with the current > development tree? The reason is that I don't think that Debian is going to switch to anything > beyond 2.36 anytime soon due to the upcoming feature freeze in January. I have sent a more detailed patch [1] and I will probably backport to all affected releases once it is accepted.