linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: traps: fix opcode endianness when read from user memory
@ 2013-12-23 16:42 Taras Kondratiuk
  2014-01-10  0:09 ` [LNG] " Victor Kamensky
  0 siblings, 1 reply; 3+ messages in thread
From: Taras Kondratiuk @ 2013-12-23 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

Currently code has an inverted logic: opcode from user memory
is swapped to a proper endianness only in case of read error.
While normally opcode should be swapped only if it was read
correctly from user memory.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 arch/arm/kernel/traps.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 7940241..36a844e 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -425,9 +425,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
 			instr2 = __mem_to_opcode_thumb16(instr2);
 			instr = __opcode_thumb32_compose(instr, instr2);
 		}
-	} else if (get_user(instr, (u32 __user *)pc)) {
+	} else {
+		if (get_user(instr, (u32 __user *)pc))
+			goto die_sig;
 		instr = __mem_to_opcode_arm(instr);
-		goto die_sig;
 	}
 
 	if (call_undef_hook(regs, instr) == 0)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LNG] [PATCH] ARM: traps: fix opcode endianness when read from user memory
  2013-12-23 16:42 [PATCH] ARM: traps: fix opcode endianness when read from user memory Taras Kondratiuk
@ 2014-01-10  0:09 ` Victor Kamensky
  2014-01-10  0:38   ` Taras Kondratiuk
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Kamensky @ 2014-01-10  0:09 UTC (permalink / raw)
  To: linux-arm-kernel

Taras, it looks good. Did you submit it into Russell's patch system? It
would be good to have this fix in main line tree.

Anyone, is there any concerns about this patch? It is quite simple
change.

Thanks,
Victor

On 23 December 2013 08:42, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
> Currently code has an inverted logic: opcode from user memory
> is swapped to a proper endianness only in case of read error.
> While normally opcode should be swapped only if it was read
> correctly from user memory.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>  arch/arm/kernel/traps.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
> index 7940241..36a844e 100644
> --- a/arch/arm/kernel/traps.c
> +++ b/arch/arm/kernel/traps.c
> @@ -425,9 +425,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
>                         instr2 = __mem_to_opcode_thumb16(instr2);
>                         instr = __opcode_thumb32_compose(instr, instr2);
>                 }
> -       } else if (get_user(instr, (u32 __user *)pc)) {
> +       } else {
> +               if (get_user(instr, (u32 __user *)pc))
> +                       goto die_sig;
>                 instr = __mem_to_opcode_arm(instr);
> -               goto die_sig;
>         }
>
>         if (call_undef_hook(regs, instr) == 0)
> --
> 1.7.9.5
>
> --
> You received this message because you are subscribed to the Google Groups "Linaro Networking" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linaro-networking+unsubscribe at linaro.org.
> To post to this group, send email to linaro-networking at linaro.org.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LNG] [PATCH] ARM: traps: fix opcode endianness when read from user memory
  2014-01-10  0:09 ` [LNG] " Victor Kamensky
@ 2014-01-10  0:38   ` Taras Kondratiuk
  0 siblings, 0 replies; 3+ messages in thread
From: Taras Kondratiuk @ 2014-01-10  0:38 UTC (permalink / raw)
  To: linux-arm-kernel

I've just put it into tracker with your Reviewed-by.

On 10 January 2014 02:09, Victor Kamensky <victor.kamensky@linaro.org> wrote:
> Taras, it looks good. Did you submit it into Russell's patch system? It
> would be good to have this fix in main line tree.
>
> Anyone, is there any concerns about this patch? It is quite simple
> change.
>
> Thanks,
> Victor
>
> On 23 December 2013 08:42, Taras Kondratiuk <taras.kondratiuk@linaro.org> wrote:
>> Currently code has an inverted logic: opcode from user memory
>> is swapped to a proper endianness only in case of read error.
>> While normally opcode should be swapped only if it was read
>> correctly from user memory.
>>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
>> ---
>>  arch/arm/kernel/traps.c |    5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
>> index 7940241..36a844e 100644
>> --- a/arch/arm/kernel/traps.c
>> +++ b/arch/arm/kernel/traps.c
>> @@ -425,9 +425,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
>>                         instr2 = __mem_to_opcode_thumb16(instr2);
>>                         instr = __opcode_thumb32_compose(instr, instr2);
>>                 }
>> -       } else if (get_user(instr, (u32 __user *)pc)) {
>> +       } else {
>> +               if (get_user(instr, (u32 __user *)pc))
>> +                       goto die_sig;
>>                 instr = __mem_to_opcode_arm(instr);
>> -               goto die_sig;
>>         }
>>
>>         if (call_undef_hook(regs, instr) == 0)
>> --
>> 1.7.9.5
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Linaro Networking" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to linaro-networking+unsubscribe at linaro.org.
>> To post to this group, send email to linaro-networking at linaro.org.
>
> --
> You received this message because you are subscribed to the Google Groups "Linaro Networking" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linaro-networking+unsubscribe at linaro.org.
> To post to this group, send email to linaro-networking at linaro.org.



-- 
Regards,
Taras Kondratiuk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-10  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23 16:42 [PATCH] ARM: traps: fix opcode endianness when read from user memory Taras Kondratiuk
2014-01-10  0:09 ` [LNG] " Victor Kamensky
2014-01-10  0:38   ` Taras Kondratiuk

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).