From: Rich Felker <dalias@libc.org>
To: "Andreas Dröscher" <musl@bugfree.ch>
Cc: musl@lists.openwall.com
Subject: Re: [musl] mips32 little endian -ENOSYS is not -(-ENOSYS)
Date: Tue, 10 Mar 2020 22:18:08 -0400 [thread overview]
Message-ID: <20200311021808.GG11469@brightrain.aerifal.cx> (raw)
In-Reply-To: <5a45c0f9-21de-6649-d4d9-3d0804c3ca0e@droescher.ch>
On Wed, Mar 11, 2020 at 03:08:22AM +0100, Andreas Dröscher wrote:
> >>Sorry for not including that excerpt in the first place:
> >>
> >>illegal_syscall:
> >> li v0, -ENOSYS # error
> >> sw v0, PT_R2(sp)
> >> li t0, 1 # set error flag
> >> sw t0, PT_R7(sp)
> >> j o32_syscall_exit
> >> END(handle_sys)
> >>
> >>Source: https://github.com/torvalds/linux/blob/62d0cfcb27cf755cebdc93ca95dabc83608007cd/arch/mips/kernel/scall32-o32.S#L186
> >
> >OK, this was fixed by commit bda8229bdd087167f463ad5e74299987924f8137
> >in 2008. But it looks like there's still another path, called
> >"einval" from before commit fb498e2570eedc6c9c3d165e370624dfc3aed97b,
> >that returns -ENOSYS. All of this is awful, and I think your fix is
> >probably the right thing to do.
>
> Thank you very much for your review.
>
> Just as a side note. I’ve just figured out that there is a second
> issue with old kernels.
>
> The current implementation of __syscall5, __syscall6 and __syscall7
> (those use caller saved registers) violate the calling conventions
> of MIPS32 Linux Kernels prior 2.6.35. Those were assuming that the
> instruction immediately preceding the SYSCALL instruction was an
> instruction for loading the syscall number.
>
> I’ll will try to rearrange the stack pushes to accommodate this
> requirement and report back if I manage to come up with something
> presentable.
Uhg, so commit 604f8d3d8b08ee4f548de193050ef93a7753c2e0 was probably
wrong and there was a reason for the nonsensical code it removed:
making old broken kernels happy. I'm not sure if you can just revert
it or need to make new changes.
Do you know if this "rule" applies to n32/n64 too or just o32?
Rich
next prev parent reply other threads:[~2020-03-11 2:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 21:10 Andreas Dröscher
2020-03-11 0:55 ` Rich Felker
2020-03-11 1:19 ` Andreas Dröscher
2020-03-11 1:40 ` Rich Felker
2020-03-11 2:08 ` Andreas Dröscher
2020-03-11 2:18 ` Rich Felker [this message]
2020-03-11 21:08 ` Andreas Dröscher
2020-03-11 21:35 ` Rich Felker
2020-03-11 23:08 ` Rich Felker
2020-03-20 16:34 ` Rich Felker
2020-03-20 22:18 ` Andreas Dröscher
2020-03-20 22:33 ` Rich Felker
2020-03-29 21:46 ` Andreas Dröscher
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=20200311021808.GG11469@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@bugfree.ch \
--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).