[all-commits] [llvm/llvm-project] 09a8b7: [TySan] Fix struct access with different bases (#1...

gbMattN via All-commits all-commits at lists.llvm.org
Mon Jan 13 07:28:59 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 09a8b7cbc29d8704c343197d4b33b6972366c682
      https://github.com/llvm/llvm-project/commit/09a8b7cbc29d8704c343197d4b33b6972366c682
  Author: gbMattN <146744444+gbMattN at users.noreply.github.com>
  Date:   2025-01-13 (Mon, 13 Jan 2025)

  Changed paths:
    M compiler-rt/lib/tysan/tysan.cpp
    A compiler-rt/test/tysan/struct-offset-different-base.cpp

  Log Message:
  -----------
  [TySan] Fix struct access with different bases (#120412)

Original pull request
[here](https://github.com/llvm/llvm-project/pull/108385)
Fixes issue https://github.com/llvm/llvm-project/issues/105960

If a member in a struct is also a struct, accessing a member partway
through this inner struct currently causes a false positive. This is
because when checking aliasing, the access offset is seen as greater
than the starting offset of the inner struct, so the loop continues one
iteration, and believes we are accessing the member after the inner
struct.

The next member's offset is greater than the offset we are looking for,
so when we subtract the next member's offset from what we are looking
for, the offset underflows.

To fix this, we check if the member we think we are accessing has a
greater offset than the offset we are looking for. If so, we take a step
back. We cannot do this in the loop, since the loop does not check the
final member. This means the penultimate member would still cause false
positives.



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