linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: oliver <oohall@gmail.com>
To: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] Fix fall-through from case 30 (rld*) to case 31
Date: Wed, 27 Jan 2016 16:29:01 +1100	[thread overview]
Message-ID: <CAOSf1CEh6GjJZLKGXDviVbycPUuPzb6jL05Zq5d0pzBpeiumNA@mail.gmail.com> (raw)
In-Reply-To: <56A814B4.9020802@au1.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 3533 bytes --]

> The patch summary should probably be something along the lines of
"powerpc/sstep: fix switch fall-through when analysing malformed rld*
instructions" or similar. The rest of the message should have the more
specific details of the bug you're fixing.
>
> In general, we always mention the affected subsystems in the patch
summary line and write both the summary line and the message so that other
developers can get a quick understanding of what the patch does without
actually needing to read the code. Keep in mind that commit messages will
show up in the git logs of every kernel developer, not just powerpc people.

That's fair.

> I had a cursory glance at the code and it's not obvious to me that this
is the correct way to deal with an invalid instruction. What happens when
you break out of the switch? It looks like it just ends up returning 0, the
same as any other instruction that isn't executed directly in the
analyse_instr() stage.
>
>Is there anywhere else in the sstep code that deals well with malformed
instructions?

When you break out of the switch the opcode type is marked as unknown and
when further attempts to parse the instruction fail it returns zero to
indicate failure. Also, many of the instructions handled by the function
are only valid in 64bit mode. For 32bit processors these instructions would
be illegal and the code that handles them is #ifdef`ed out when compiling
for 32 bit platforms so simply breaking out of the switch and letting it
propagate should be the right move here.

Oliver


On Wed, Jan 27, 2016 at 11:52 AM, Andrew Donnellan <
andrew.donnellan@au1.ibm.com> wrote:

> On 25/01/16 17:55, Oliver O'Halloran wrote:
>
>> I think this bug can only be triggered if the instruction to
>> simulate is malformed. The switch in the else case only handles
>> the zero and one case, but it extracts bits 4:1 from the
>> instruction word so it may be other values. It's pretty minor, but
>> a bug is a bug.
>>
>> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>>
>
> The patch summary should probably be something along the lines of
> "powerpc/sstep: fix switch fall-through when analysing malformed rld*
> instructions" or similar. The rest of the message should have the more
> specific details of the bug you're fixing.
>
> In general, we always mention the affected subsystems in the patch summary
> line and write both the summary line and the message so that other
> developers can get a quick understanding of what the patch does without
> actually needing to read the code. Keep in mind that commit messages will
> show up in the git logs of every kernel developer, not just powerpc people.
>
> --- a/arch/powerpc/lib/sstep.c
>> +++ b/arch/powerpc/lib/sstep.c
>> @@ -925,6 +925,7 @@ int __kprobes analyse_instr(struct instruction_op
>> *op, struct pt_regs *regs,
>>                         }
>>                 }
>>   #endif
>> +       break; /* illegal instruction */
>>
>
> I had a cursory glance at the code and it's not obvious to me that this is
> the correct way to deal with an invalid instruction. What happens when you
> break out of the switch? It looks like it just ends up returning 0, the
> same as any other instruction that isn't executed directly in the
> analyse_instr() stage.
>
> Is there anywhere else in the sstep code that deals well with malformed
> instructions?
>
> --
> Andrew Donnellan              Software Engineer, OzLabs
> andrew.donnellan@au1.ibm.com  Australia Development Lab, Canberra
> +61 2 6201 8874 (work)        IBM Australia Limited
>
>

[-- Attachment #2: Type: text/html, Size: 5111 bytes --]

  reply	other threads:[~2016-01-27  5:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  6:55 [PATCH] Fix fall-through from case 30 (rld*) to case 31 Oliver O'Halloran
2016-01-27  0:52 ` Andrew Donnellan
2016-01-27  5:29   ` oliver [this message]
2016-01-27  7:00     ` Andrew Donnellan
2016-02-15 23:28 ` [PATCH] powerpc/lib/sstep.c - Fix emulation fall-through Oliver O'Halloran
2016-02-16  0:59   ` Andrew Donnellan
2016-02-16  6:31     ` [PATCH v2] powerpc/sstep.c " Oliver O'Halloran
2016-05-10 21:48       ` [v2] " Michael Ellerman

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=CAOSf1CEh6GjJZLKGXDviVbycPUuPzb6jL05Zq5d0pzBpeiumNA@mail.gmail.com \
    --to=oohall@gmail.com \
    --cc=andrew.donnellan@au1.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.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).