From: Thorsten Otto <admin@tho-otto.de>
To: linux-m68k@vger.kernel.org
Subject: Re: Software FPU emulation in linux kernel
Date: Thu, 06 Mar 2025 16:24:10 +0100 [thread overview]
Message-ID: <2773279.uZKlY2gecq@earendil> (raw)
In-Reply-To: <3374772.VqM8IeB0Os@earendil>
There are problems in fp_fsqrt when using the fp_one constant.
fp_one is declared as
static const struct fp_ext fp_one = {
.exp = 0x3fff,
};
So, despite the comment, this is not normalized (the explicit bit is not set).
This will have the effect that it is changed to zero, when fp_dyadic_check is
called in the entry of fp_add. So this call does not only have no effect, it
will also modify the constant.
And even if that is changed, fp_add will also write to it:
https://github.com/torvalds/linux/blob/
848e076317446f9c663771ddec142d7c2eb4cb43/arch/m68k/math-emu/fp_arith.c#L90:
dest->lowmant = src->lowmant = 0;
And 2 lines later, the call to
fp_denormalize(src, diff);
will also modify the src argument.
Wouldn't that crash the kernel, if it tries to write to a write-protected
section?
prev parent reply other threads:[~2025-03-06 15:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 16:22 Software FPU emulation in linux kernel Thorsten Otto
2025-03-03 22:10 ` Brad Boyer
2025-03-04 5:24 ` Thorsten Otto
2025-03-04 5:48 ` Brad Boyer
2025-03-03 23:38 ` Michael Schmitz
2025-03-04 4:44 ` Finn Thain
2025-03-04 5:47 ` Thorsten Otto
2025-03-06 15:24 ` Thorsten Otto [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=2773279.uZKlY2gecq@earendil \
--to=admin@tho-otto.de \
--cc=linux-m68k@vger.kernel.org \
/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.
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).