* [PATCH v3] scripts/decodecode: fix faulting instruction no print when opps.file is DOS format
@ 2021-09-30 2:04 unknown
2021-09-30 12:19 ` Borislav Petkov
0 siblings, 1 reply; 2+ messages in thread
From: unknown @ 2021-09-30 2:04 UTC (permalink / raw)
To: bp, akpm; +Cc: maz, will, rabin, linux-kernel, weidonghui
From: weidonghui <weidonghui@allwinnertech.com>
If opps.file is in DOS format, faulting instruction cannot be printed:
/ # ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
/ # ./scripts/decodecode < oops.file
[ 0.734345] Code: d0002881 912f9c21 94067e68 d2800001 (b900003f)
aarch64-linux-gnu-strip: '/tmp/tmp.5Y9eybnnSi.o': No such file
aarch64-linux-gnu-objdump: '/tmp/tmp.5Y9eybnnSi.o': No such file
All code
========
0: d0002881 adrp x1, 0x512000
4: 912f9c21 add x1, x1, #0xbe7
8: 94067e68 bl 0x19f9a8
c: d2800001 mov x1, #0x0 // #0
10: b900003f str wzr, [x1]
Code starting with the faulting instruction
===========================================
Background: The compilation environment is Ubuntu,
and the test environment is Windows.
Most logs are generated in the Windows environment.
In this way, CR (carriage return) will inevitably appear,
which will affect the use of decodecode in the Ubuntu environment.
The repaired effect is as follows:
/ # ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
/ # ./scripts/decodecode < oops.file
[ 0.734345] Code: d0002881 912f9c21 94067e68 d2800001 (b900003f)
All code
========
0: d0002881 adrp x1, 0x512000
4: 912f9c21 add x1, x1, #0xbe7
8: 94067e68 bl 0x19f9a8
c: d2800001 mov x1, #0x0 // #0
10:* b900003f str wzr, [x1] <-- trapping instruction
Code starting with the faulting instruction
===========================================
0: b900003f str wzr, [x1]
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Marc Zyngier <maz@misterjones.org>
Cc: Will Deacon <will@kernel.org>
Cc: Rabin Vincent <rabin@rab.in>
Cc: lkml <linux-kernel@vger.kernel.org>
Signed-off-by: weidonghui <weidonghui@allwinnertech.com>
---
scripts/decodecode | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/decodecode b/scripts/decodecode
index 31d884e35f2f..77a3b518aacc 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -126,7 +126,7 @@ if [ $marker -ne 0 ]; then
fi
echo Code starting with the faulting instruction > $T.aa
echo =========================================== >> $T.aa
-code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'`
+code=`echo $code | sed -e 's/\x0d//;s/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'`
echo -n " .$type 0x" > $T.s
echo $code >> $T.s
disas $T 0
--
2.22.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] scripts/decodecode: fix faulting instruction no print when opps.file is DOS format
2021-09-30 2:04 [PATCH v3] scripts/decodecode: fix faulting instruction no print when opps.file is DOS format unknown
@ 2021-09-30 12:19 ` Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2021-09-30 12:19 UTC (permalink / raw)
To: unknown; +Cc: akpm, maz, will, rabin, linux-kernel
On Thu, Sep 30, 2021 at 10:04:39AM +0800, unknown wrote:
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
You don't just add Signed-off-by of other people when sending a patch -
please don't *ever* do that.
If you don't know what you're doing, *don't* do it but *read* the damn
docs first:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html
> Cc: Marc Zyngier <maz@misterjones.org>
> Cc: Will Deacon <will@kernel.org>
> Cc: Rabin Vincent <rabin@rab.in>
> Cc: lkml <linux-kernel@vger.kernel.org>
> Signed-off-by: weidonghui <weidonghui@allwinnertech.com>
> ---
> scripts/decodecode | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/decodecode b/scripts/decodecode
> index 31d884e35f2f..77a3b518aacc 100755
> --- a/scripts/decodecode
> +++ b/scripts/decodecode
> @@ -126,7 +126,7 @@ if [ $marker -ne 0 ]; then
> fi
> echo Code starting with the faulting instruction > $T.aa
> echo =========================================== >> $T.aa
> -code=`echo $code | sed -e 's/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'`
> +code=`echo $code | sed -e 's/\x0d//;s/ [<(]/ /;s/[>)] / /;s/ /,0x/g; s/[>)]$//'`
So that link I pointed you to says:
"That character is matched with \r by sed. Use:
sed -e "s/\r//g" input-file"
I have no clue how you did not see it?!
But I guess \x0d works too.
To quote from the sed info manual:
"5.8 Escape Sequences - specifying special characters
====================================================
...
'\r'
Produces or matches a carriage return (ASCII 13).
...
'\xXX'
Produces or matches a character whose hexadecimal ASCII value is
XX."
In any case, I'd prefer \r because it is more readable.
Thx.
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-09-30 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30 2:04 [PATCH v3] scripts/decodecode: fix faulting instruction no print when opps.file is DOS format unknown
2021-09-30 12:19 ` Borislav Petkov
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).