From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] fix mips syscall asm regressions and kernel bug
Date: Fri, 13 Mar 2020 20:12:45 -0400 [thread overview]
Message-ID: <20200314001245.GO11469@brightrain.aerifal.cx> (raw)
In-Reply-To: <20200311230925.GA27158@brightrain.aerifal.cx>
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 <dalias@aerifal.cx>
> 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
prev parent reply other threads:[~2020-03-14 0:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-11 23:09 Rich Felker
2020-03-14 0:12 ` Rich Felker [this message]
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=20200314001245.GO11469@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).