From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13768 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: David Edelsohn Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] powerpc64: use a type for mcontext_t regs field Date: Tue, 12 Feb 2019 13:17:34 -0500 Message-ID: References: <20190212153522.2371-1-AWilcox@Wilcox-Tech.com> <20190212161800.GJ23599@brightrain.aerifal.cx> <20190212172338.GL23599@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="94955"; mail-complaints-to="usenet@blaine.gmane.org" To: musl@lists.openwall.com Original-X-From: musl-return-13784-gllmg-musl=m.gmane.org@lists.openwall.com Tue Feb 12 19:18:02 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1gtcd7-000Oap-Pr for gllmg-musl@m.gmane.org; Tue, 12 Feb 2019 19:18:01 +0100 Original-Received: (qmail 15738 invoked by uid 550); 12 Feb 2019 18:17:59 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15715 invoked from network); 12 Feb 2019 18:17:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=hfIwtq/1z2YRGRxmyMKrS1KRiz++lcwCrZuwiVn7/po=; b=VZwyJIcT2G/h0g/cdm27tGgiuHsQyZlCmcTMIDFUJ2cygW5qx24+QEtEKNIWa/A8zJ vNRMMt18Jcm8XaTLPztjkvKuXEyOj9XvcnNm/belPyPCk0jsJDykLvTDV4rcZUxAbyQB KHRSwj5ZV121cr8KJV6RuJVAoPFPHE7zv03d0sVhIeFshc4lqRwpufyQ3Wf7ujr2hX03 0HTRj//d23ZgTyPWc09JtjorQpXQOgZDFMoa2gBW7/zWi+BlTQfqqlQDo4BvXnY9H4ZJ i4hX9qhHVX2MKn01Nu53/0SXkH6Y1glkI/QxXjHcc4TUDuDTH1sbHPCFAvqCYlI3Cfdk 7oOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=hfIwtq/1z2YRGRxmyMKrS1KRiz++lcwCrZuwiVn7/po=; b=t7VwK+0PbnAZrgqMeJnWsWq+0vrw2DFS6ApZbDBJ42+2HDuuJceDTVAGmfshCyHroF S60UO3gfSTYRqGnpd72F0gBmFmX5AGlt0uIaAFw7k5ZxcVuyGmouAzKXJPpNgrL26nbm PcLMk74tG5NONdrxGRgOoNnH0Wn0pFBWIqu6Rroszd2lDCPH40mAUSI10jPap/n5HoII igkKNz6mW/Ep5cxdteICySe01HmIZGWA6AMKr1DBfATZhtZ/ZsMOBSD/ZlanRbHOwu7Q BTYE5qAQuvfFiGlsIWyHetUt9YNj7MdWDbVpi/M0IGgGVkamEFLHmEo8H7XHeV5wttcL lMBg== X-Gm-Message-State: AHQUAuabebpYZAbsRHLc+q+kmcXn9IT8+jQF/z75PqMxyR15jvtZ2ehH 8B0G1lgDBz7PJQDR7jF4dxXE0OlahPukUF5rXLKQ0g== X-Google-Smtp-Source: AHgI3Ib2NeWnOAfglREy66ToV+1dTa2c3nqg39n6VIGrEu7QhgZfNMu/+gJBMpfZ0GwKVNayRsFt048U0lcM5UoqQZ8= X-Received: by 2002:a7b:c766:: with SMTP id x6mr125242wmk.15.1549995466531; Tue, 12 Feb 2019 10:17:46 -0800 (PST) In-Reply-To: <20190212172338.GL23599@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:13768 Archived-At: On Tue, Feb 12, 2019 at 12:23 PM Rich Felker wrote: > > On Tue, Feb 12, 2019 at 12:05:17PM -0500, David Edelsohn wrote: > > On Tue, Feb 12, 2019 at 11:18 AM Rich Felker wrote: > > > > > > On Tue, Feb 12, 2019 at 09:35:22AM -0600, A. Wilcox wrote: > > > > GCC Go dereferences `regs` for `nip`. Without this change, compila= tion > > > > fails with the following message: > > > > > > > > .../../../libgo/runtime/go-signal.c: In function =E2=80=98getSiginf= o=E2=80=99: > > > > .../../../libgo/runtime/go-signal.c:225:56: warning: dereferencing = =E2=80=98void *=E2=80=99 pointer > > > > ret.sigpc =3D ((ucontext_t*)(context))->uc_mcontext.regs->nip; > > > > ^~ > > > > .../../../libgo/runtime/go-signal.c:225:56: error: request for memb= er =E2=80=98nip=E2=80=99 in something not a structure or union > > > > --- > > > > arch/powerpc64/bits/signal.h | 4 +++- > > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/arch/powerpc64/bits/signal.h b/arch/powerpc64/bits/sig= nal.h > > > > index 34693a68..6736c69a 100644 > > > > --- a/arch/powerpc64/bits/signal.h > > > > +++ b/arch/powerpc64/bits/signal.h > > > > @@ -8,6 +8,8 @@ > > > > > > > > #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) > > > > > > > > +#include > > > > + > > > > > > This is almost surely not right. You can never use a bits/* header > > > except from the corresponding public header that includes it. They do > > > not have multiple-inclusion guards and are not designed to be usable > > > independently. And including sys/user.h is also almost surely wrong > > > since it's a problematic header you don't want getting included > > > (conflicts with linux/*.h stuff). > > > > > > > typedef unsigned long greg_t, gregset_t[48]; > > > > > > > > typedef struct { > > > > @@ -29,7 +31,7 @@ typedef struct sigcontext { > > > > int _pad0; > > > > unsigned long handler; > > > > unsigned long oldmask; > > > > - void *regs; > > > > + struct pt_regs *regs; > > > > gregset_t gp_regs; > > > > fpregset_t fp_regs; > > > > vrregset_t *v_regs; > > > > -- > > > > 2.19.2 > > > > > > Do you know if there's a reason Go is trying to use this regs member > > > rather than gp_regs? I think that's the real issue here. > > > > Apparently GCCGo runtime has dependencies on GLibc and has not been > > ported to Musl Libc. The GCCGo runtime is trying to obtain the PC for > > a signal. > > > > #ifdef __PPC__ > > #ifdef __linux__ > > ret.sigpc =3D ((ucontext_t*)(context))->uc_mcontext.regs->nip; > > #endif > > #ifdef _AIX > > ret.sigpc =3D ((ucontext_t*)(context))->uc_mcontext.jmp_context.= iar; > > #endif > > #endif > > > > The program counter is not part of gp_regs. > > Yes it is, as musl already depends on having access to the program > counter for thread cancellation. See arch/powerpc64/pthread_arch.h: > > // the kernel calls the ip "nip", it's the first saved value after the 32 > // GPRs. > #define MC_PC gp_regs[32] Apparently Ian Taylor now is aware of this and investigating a solution -- possibly another ifdef in the above for PPC Musl Libc. - David