From: Dave Martin <Dave.Martin@arm.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Dmitry V. Levin" <ldv@altlinux.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
sparclinux <sparclinux@vger.kernel.org>,
ppc-dev <linuxppc-dev@lists.ozlabs.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: sparc/ppc/arm compat siginfo ABI regressions: sending SIGFPE via kill() returns wrong values in si_pid and si_uid
Date: Fri, 13 Apr 2018 19:35:38 +0100 [thread overview]
Message-ID: <20180413183527.GC16308@e103592.cambridge.arm.com> (raw)
In-Reply-To: <20180413175407.GO16141@n2100.armlinux.org.uk>
On Fri, Apr 13, 2018 at 06:54:08PM +0100, Russell King - ARM Linux wrote:
> On Fri, Apr 13, 2018 at 06:08:28PM +0100, Dave Martin wrote:
> > On Fri, Apr 13, 2018 at 09:33:17AM -0700, Linus Torvalds wrote:
> > > On Fri, Apr 13, 2018 at 2:42 AM, Russell King - ARM Linux
> > > <linux@armlinux.org.uk> wrote:
> > > >
> > > > Yes, it does solve the problem at hand with strace - the exact patch I
> > > > tested against 4.16 is below.
> > >
> > > Ok, good.
> > >
> > > > However, FPE_FLTUNK is not defined in older kernels, so while we can
> > > > fix it this way for the current merge window, that doesn't help 4.16.
> > >
> > > I wonder if we should even bother with FPE_FLTUNK.
> > >
> > > I suspect we might as well use FPE_FLTINV, I suspect, and not have
> > > this complexity at all. That case is not worth worrying about, since
> > > it's a "this shouldn't happen anyway" and the *real* reason will be in
> > > the kernel logs due to vfs_panic().
> > >
> > > So it's not like this is something that the user should ever care
> > > about the si_code about.
> >
> > Ack, my intended meaning for FPE_FLTUNK is that the fp exception is
> > either spurious or we can't tell easily (or possibly at all) which
> > FPE_XXX should be returned. It's up to userspace to figure it out
> > if it really cares. Previously we were accidentally returning SI_USER
> > in si_code for arm64.
> >
> > This case on arm looks like a more serious error for which FPE_FLTINV
> > may be more appropriate anyway.
>
> No. The cases where we get to this point are:
>
> 1. A trap concerning a coprocessor register transfer instruction (iow, move
> between a VFP register and ARM register.)
> 2. A trap concerning a coprocessor register load or save instruction.
>
> (In both of these, "concerning" means that the VFP hardware provides
> such an instruction as the reason for the fault, *not* that it is the
> faulting instruction.)
>
> 3. A combination of the exception bits (EX and DEX) on certain VFP
> implementations.
>
> All of these can be summarised as "the hardware went wrong in some way"
> rather than "the user program did something wrong."
Although my understanding of VFP bounces is a bit hazy, I think this is
broadly in line with my assumptions.
> FPE_FLTINV means "floating point invalid operation". Does it really
> cover the case where hardware has failed, or is it intended to cover
> the case where userspace did something wrong and asked for an invalid
> operation from the FP hardware?
So, there's an argument that FPE_FLTINV is not really correct. My
rationale was that there is nothing correct that we can return, and
FPE_FLTINV may be no worse than the alternatives.
If we can only hit this case as the result of a hardware failure
or kernel bug though, should this be delivered as SIGKILL instead?
That's the approach I eventually followed for various exceptions
on arm64 that were theoretically delivered to userspace with si_code==0,
but really should be impossible unless and kernel and/or hardware
is buggy.
If that's the case though, I don't see how a userspace testsuite is
hitting this code path. Maybe I've misunderstood the context of this
thread.
Cheers
---Dave
next prev parent reply other threads:[~2018-04-13 18:35 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-09 15:22 ppc compat v4.16 regression: sending SIGTRAP or " Dmitry V. Levin
2018-04-12 1:34 ` sparc/ppc/arm compat siginfo ABI regressions: sending " Dmitry V. Levin
2018-04-12 1:45 ` Linus Torvalds
2018-04-12 9:58 ` Russell King - ARM Linux
2018-04-12 11:03 ` Dmitry V. Levin
2018-04-12 12:19 ` Russell King - ARM Linux
2018-04-12 12:49 ` Dmitry V. Levin
2018-04-12 13:14 ` Russell King - ARM Linux
2018-04-12 16:50 ` Linus Torvalds
2018-04-12 17:20 ` Russell King - ARM Linux
2018-04-12 17:22 ` Linus Torvalds
2018-04-13 9:42 ` Russell King - ARM Linux
2018-04-13 16:33 ` Linus Torvalds
2018-04-13 17:08 ` Dave Martin
2018-04-13 17:54 ` Russell King - ARM Linux
2018-04-13 18:23 ` Linus Torvalds
2018-04-13 18:45 ` Dave Martin
2018-04-13 19:53 ` Linus Torvalds
2018-04-15 13:12 ` Russell King - ARM Linux
2018-04-15 15:22 ` Eric W. Biederman
2018-04-15 15:56 ` [RFC PATCH 0/3] Dealing with the aliases of SI_USER Eric W. Biederman
2018-04-15 15:57 ` [RFC PATCH 1/3] signal: Ensure every siginfo we send has all bits initialized Eric W. Biederman
2018-04-17 13:23 ` Dave Martin
2018-04-17 19:37 ` Eric W. Biederman
2018-04-18 12:47 ` Dave Martin
2018-04-18 14:22 ` Eric W. Biederman
2018-04-19 8:26 ` Dave Martin
2018-04-15 15:58 ` [RFC PATCH 2/3] signal: Reduce copy_siginfo_to_user to just copy_to_user Eric W. Biederman
2018-04-15 15:59 ` [RFC PATCH 3/3] signal: Stop special casing TRAP_FIXME and FPE_FIXME in siginfo_layout Eric W. Biederman
2018-04-15 18:16 ` [RFC PATCH 0/3] Dealing with the aliases of SI_USER Linus Torvalds
2018-04-16 2:03 ` Eric W. Biederman
2018-04-18 17:58 ` Eric W. Biederman
2018-04-19 9:28 ` Dave Martin
2018-04-19 14:40 ` Eric W. Biederman
2018-04-13 18:35 ` Dave Martin [this message]
2018-04-13 18:50 ` sparc/ppc/arm compat siginfo ABI regressions: sending SIGFPE via kill() returns wrong values in si_pid and si_uid Russell King - ARM Linux
2018-04-13 18:56 ` Dave Martin
2018-04-12 17:35 ` Dmitry V. Levin
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=20180413183527.GC16308@e103592.cambridge.arm.com \
--to=dave.martin@arm.com \
--cc=ebiederm@xmission.com \
--cc=ldv@altlinux.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=sparclinux@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®