Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid signed overflow in DBG_FlushInstructionCache #105918

Merged

Commits on Aug 4, 2024

  1. Avoid signed overflow in DBG_FlushInstructionCache

    On ARM32 Linux we can have an infinite loop because of integer overflow.
    For example, if DBG_FlushInstructionCache is called with
    the following parameters & locals:
      dwSize = 28
      pageSize = 4096
      begin = lpBaseAddress = 0x7ffff000
      end = begin + dwSize = 0x7ffff01c
    
    ALIGN_UP(0x7ffff000, 4096) returns 0x80000000 which is actually a
    negative number because INT_PTR is just int32_t (on ARM32). And here we
    are getting an infinite loop because "begin" will never be greater or
    equal than "end".
    
    So, this issue is related to all addresses between INT32_MAX - PAGE_SIZE and
    INT32_MAX because ALIGN_UP returns the address of the next page which
    will be greater or equal to INT32_MAX
    
    Signed-off-by: Andrei Lalaev <andrei.lalaev@anton-paar.com>
    andrei-lalaev-AP authored and AndreyLalaev committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    9037fc2 View commit details
    Browse the repository at this point in the history