[all-commits] [llvm/llvm-project] 53c157: [StackProtector] Fix phi handling in HasAddressTak...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Wed Mar 5 03:45:34 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 53c157939e5ac9acc8e1f8853325a021bc925501
https://github.com/llvm/llvm-project/commit/53c157939e5ac9acc8e1f8853325a021bc925501
Author: Nikita Popov <npopov at redhat.com>
Date: 2025-03-05 (Wed, 05 Mar 2025)
Changed paths:
M llvm/lib/CodeGen/StackProtector.cpp
M llvm/test/CodeGen/X86/stack-protector-phi.ll
Log Message:
-----------
[StackProtector] Fix phi handling in HasAddressTaken() (#129248)
Despite the name, the HasAddressTaken() heuristic identifies not only
allocas that have their address taken, but also those that have accesses
that cannot be proven to be in-bounds.
However, the current handling for phi nodes is incorrect. Phi nodes are
only visited once, and will perform the analysis using whichever
(remaining) allocation size is passed the first time the phi node is
visited. If it is later visited with a smaller remaining size, which may
lead to out of bounds accesses, it will not be detected.
Fix this by keeping track of the smallest seen remaining allocation size
and redo the analysis if it is decreased. To avoid degenerate cases
(including via loops), limit the number of allowed decreases to a small
number.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list