• weidonghui's avatar
    scripts/decodecode: fix faulting instruction no print when opps.file is DOS format · 75e2f715
    weidonghui authored
    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]
    
    Link: https://lkml.kernel.org/r/20211008064712.926-1-weidonghui@allwinnertech.comSigned-off-by: default avatarweidonghui <weidonghui@allwinnertech.com>
    Acked-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: Marc Zyngier <maz@misterjones.org>
    Cc: Will Deacon <will@kernel.org>
    Cc: Rabin Vincent <rabin@rab.in>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    75e2f715
decodecode 2.89 KB