1. #1

    Join Date
    Apr 2013
    Posts
    30

    Misaligned IP

    Why does WinDbg assume misaligned instruction pointer as a hardware failure instead of stack buffer overflow or other similar software bug?


    • Ad Bot

      advertising
      Beep.

        
       

  2. #2
    x BlueRobot's Avatar
    Join Date
    May 2013
    Location
    Minkowski Space
    Posts
    1,651

    Re: Misaligned IP

    Do you mean why does it state it as a hardware failure rather than a software bug?

    This is for data structures, but may be very similar - Data structure alignment - Wikipedia, the free encyclopedia

    Additional Links:

    What is "Pointer Alignment" - C / C++
    unions, alignment, int pointers, wow!
    c++ - What exactly is an 'aligned pointer'? - Stack Overflow
    Machines Can Think

    Oxygen, Nature's paradox.

  3. #3
    x BlueRobot's Avatar
    Join Date
    May 2013
    Location
    Minkowski Space
    Posts
    1,651

    Re: Misaligned IP

    I'm still reading about misaligned pointers, but I think it may be considered a hardware fault (well shown as a hardware fault), because most CPUs can only access parts of memory addresses which have been aligned.

    It seems that a alignment fault can also be named a bus error (if I'm correct), which makes even more sense to why it may be considered a hardware fault, as a result of this here:

    A segmentation fault (often shortened to segfault), bus error, or access violation is generally an attempt to access memory that the CPU cannot physically address. It occurs when the hardware notifies an operating system about a memory access violation.
    The hardware notifies the operating system of the error.

    Source: en.wikipedia.org/wiki/Bus_error
    Machines Can Think

    Oxygen, Nature's paradox.

  4. #4

    Join Date
    Apr 2013
    Posts
    30

    Re: Misaligned IP

    Misaligned IP: execution in the middle of an instruction, which forms another instruction, which is often invalid: an illegal instruction or illegal memory reference ("segfault"). Sort of like "more cycles" being read as "recycles".

    Example: BSOD errors every couple of minutes | AVForums.com - UK Online

    The instruction being executed is 1800 (sbb byte ptr [rax],al), which is in fact a part of a longer instruction.

    The first thing coming to mind is
    stack buffer overflow, a common error in C and C++ programming, but WinDbg assumes hardware.


  5. #5
    x BlueRobot's Avatar
    Join Date
    May 2013
    Location
    Minkowski Space
    Posts
    1,651

    Re: Misaligned IP

    On x86 CPUs, unaligned memory access is corrected and only serves a performance problem, no exception is raised about this. I've also noticed, that the Misaligned IP is only thrown on x64 systems.
    Machines Can Think

    Oxygen, Nature's paradox.

Log in

Log in