[all-commits] [llvm/llvm-project] c09368: [StackProtector] Catch direct out-of-bounds when c...

john-brawn-arm via All-commits all-commits at lists.llvm.org
Tue Mar 17 05:10:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c09368313c236291298e1f8f0a9d319b34d61be6
      https://github.com/llvm/llvm-project/commit/c09368313c236291298e1f8f0a9d319b34d61be6
  Author: John Brawn <john.brawn at arm.com>
  Date:   2020-03-17 (Tue, 17 Mar 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/StackProtector.h
    M llvm/lib/CodeGen/StackProtector.cpp
    A llvm/test/CodeGen/X86/stack-guard-oob.ll

  Log Message:
  -----------
  [StackProtector] Catch direct out-of-bounds when checking address-takenness

With -fstack-protector-strong we check if a non-array variable has its address
taken in a way that could cause a potential out-of-bounds access. However what
we don't catch is when the address is directly used to create an out-of-bounds
memory access.

Fix this by examining the offsets of GEPs that are ultimately derived from
allocas and checking if the resulting address is out-of-bounds, and by checking
that any memory operations using such addresses are not over-large.

Fixes PR43478.

Differential revision: https://reviews.llvm.org/D75695




More information about the All-commits mailing list