From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RDNS_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 3103 invoked from network); 14 Mar 2020 00:13:00 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from unknown (HELO mother.openwall.net) (195.42.179.200) by inbox.vuxu.org with ESMTP; 14 Mar 2020 00:13:00 -0000 Received: (qmail 1932 invoked by uid 550); 14 Mar 2020 00:12:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 1914 invoked from network); 14 Mar 2020 00:12:57 -0000 Date: Fri, 13 Mar 2020 20:12:45 -0400 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20200314001245.GO11469@brightrain.aerifal.cx> References: <20200311230925.GA27158@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200311230925.GA27158@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] fix mips syscall asm regressions and kernel bug On Wed, Mar 11, 2020 at 07:09:25PM -0400, Rich Felker wrote: > >From dd656a205b5f1d0513f7c71c70c786af1e248304 Mon Sep 17 00:00:00 2001 > From: Rich Felker > Date: Wed, 11 Mar 2020 18:58:38 -0400 > Subject: [PATCH 3/4] restore mips syscall asm improvements from reverted > change > > in addition to the wrong change to loading of r2, commit > 604f8d3d8b08ee4f548de193050ef93a7753c2e0 removed some useless, > redundant, and possibly undefined constraints. bring back the good > parts. > --- > arch/mips/syscall_arch.h | 31 ++++++++++++++++--------------- > 1 file changed, 16 insertions(+), 15 deletions(-) > > diff --git a/arch/mips/syscall_arch.h b/arch/mips/syscall_arch.h > index a3812188..0a5d6d8f 100644 > --- a/arch/mips/syscall_arch.h > +++ b/arch/mips/syscall_arch.h > @@ -21,7 +21,8 @@ static inline long __syscall0(long n) > register long r2 __asm__("$2"); > __asm__ __volatile__ ( > "addu $2,$0,%2 ; syscall" > - : "=&r"(r2), "=r"(r7) : "ir"(n), "0"(r2), "1"(r7) > + : "=&r"(r2), "=r"(r7) > + : "ir"(n) > : SYSCALL_CLOBBERLIST, "$8", "$9", "$10"); > return r7 ? -r2 : r2; > } This part of the change (also present in the 64-bit versions) was horribly wrong because of an ancient GCC bug: specific-register bindings for outputs are not honored at all with earlyclobber. This is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87733 I think for now I can work around it by adding back the dummy input constraint the old asm was using. This looks wrong but at least it worked. Rich