[all-commits] [llvm/llvm-project] e913a3: [-Wunsafe-buffer-usage] Emit a warning if pointer ...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Thu Oct 17 17:02:24 PDT 2024


  Branch: refs/heads/users/vitalybuka/spr/main.sanitizer-add-memcpyaccessible
  Home:   https://github.com/llvm/llvm-project
  Commit: e913a33fcfbd667e4e3a35919b6bd9c5876a90a3
      https://github.com/llvm/llvm-project/commit/e913a33fcfbd667e4e3a35919b6bd9c5876a90a3
  Author: Malavika Samak <malavika.samak at gmail.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-warning-data-invocation.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Emit a warning if pointer returned by vector::data and array::data is cast to larger type (#111910)

Emit a warning when the raw pointer retrieved from std::vector and
std::array instances are cast to a larger type. Such a cast followed by
a field dereference to the resulting pointer could cause an OOB access.
This is similar to the existing span::data warning.

(rdar://136704278)

Co-authored-by: MalavikaSamak <malavika2 at apple.com>


  Commit: b060661da8b3b53db55644e5e358bb2dca8b56d7
      https://github.com/llvm/llvm-project/commit/b060661da8b3b53db55644e5e358bb2dca8b56d7
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/test/Transforms/LoopVectorize/trip-count-expansion-may-introduce-ub.ll

  Log Message:
  -----------
  [SCEVExpander] Expand UDiv avoiding UB when in seq_min/max. (#92177)

Update SCEVExpander to introduce an SafeUDivMode, which is set
when expanding operands of SCEVSequentialMinMaxExpr. In this mode,
the expander will make sure that the divisor of the expanded UDiv is
neither 0 nor poison.

Fixes https://github.com/llvm/llvm-project/issues/89958.


PR https://github.com/llvm/llvm-project/pull/92177


  Commit: 8c62bf54df76e37d0978f4901c6be6554e978b53
      https://github.com/llvm/llvm-project/commit/8c62bf54df76e37d0978f4901c6be6554e978b53
  Author: Bill Wendling <morbo at google.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/test/CodeGen/attr-counted-by.c

  Log Message:
  -----------
  [Clang] Disable use of the counted_by attribute for whole struct pointers (#112636)

The whole struct is specificed in the __bdos. The calculation of the
whole size of the structure can be done in two ways:

    1) sizeof(struct S) + count * sizeof(typeof(fam))
    2) offsetof(struct S, fam) + count * sizeof(typeof(fam))

The first will add any remaining whitespace that might exist after
allocation while the second method is more precise, but not quite
expected from programmers. See [1] for a discussion of the topic.

GCC isn't (currently) able to calculate __bdos on a pointer to the whole
structure. Therefore, because of the above issue, we'll choose to match
what GCC does for consistency's sake.

[1] https://lore.kernel.org/lkml/ZvV6X5FPBBW7CO1f@archlinux/

Co-authored-by: Eli Friedman <efriedma at quicinc.com>


  Commit: 5033ea73bb01061feb09b3216c74619e1fbefdeb
      https://github.com/llvm/llvm-project/commit/5033ea73bb01061feb09b3216c74619e1fbefdeb
  Author: Jacob Lalonde <jalalonde at fb.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
    M lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
    M lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
    M lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
    A lldb/test/API/functionalities/postmortem/minidump-new/linux-x86_64-exceptiondescription.yaml
    M llvm/include/llvm/BinaryFormat/Minidump.h

  Log Message:
  -----------
  [LLDB][Minidump] Add breakpoint stop reasons to the minidump. (#108448)

Recently my coworker @jeffreytan81 pointed out that Minidumps don't show
breakpoints when collected. This was prior blocked because Minidumps
could only contain 1 exception, now that we support N signals/sections
we can save all the threads stopped on breakpoints.


  Commit: 71b81e93d28c8db3f9cfa1d715c925a98ae4b153
      https://github.com/llvm/llvm-project/commit/71b81e93d28c8db3f9cfa1d715c925a98ae4b153
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp

  Log Message:
  -----------
  [alpha.webkit.UncountedLocalVarsChecker] Recursive functions are erroneously treated as non-trivial (#110973)

This PR fixes the bug that alpha.webkit.UncountedLocalVarsChecker
erroneously treats a trivial recursive function as non-trivial. This was
caused by TrivialFunctionAnalysis::isTrivialImpl which takes a statement
as an argument populating the cache with "false" while traversing the
statement to determine its triviality within a recursive function in
TrivialFunctionAnalysisVisitor's WithCachedResult. Because
IsFunctionTrivial honors an entry in the cache, this resulted in the
whole function to be treated as non-trivial.

Thankfully, TrivialFunctionAnalysisVisitor::IsFunctionTrivial already
handles recursive functions correctly so this PR applies the same logic
to TrivialFunctionAnalysisVisitor::WithCachedResult by sharing code
between the two functions. This avoids the cache to be pre-populated
with "false" while traversing statements in a recurisve function.


  Commit: 46df20ab63ee8c14c5d4eef07e2a7cccd466c064
      https://github.com/llvm/llvm-project/commit/46df20ab63ee8c14c5d4eef07e2a7cccd466c064
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_common.h
    M compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_posix_test.cpp

  Log Message:
  -----------
  [sanitizer] Add TryMemCpy (#112668)

For posix implementation is similar to
`IsAccessibleMemoryRange`, using `pipe`.

We need this because we can't rely on non-atomic
`IsAccessibleMemoryRange` + `memcpy`, as the
protection or mapping may change and we may
crash.


  Commit: 9310397392e43d970039f5be7d5ec36f9a73507e
      https://github.com/llvm/llvm-project/commit/9310397392e43d970039f5be7d5ec36f9a73507e
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp
    M clang/test/CodeGen/attr-counted-by.c
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-warning-data-invocation.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_common.h
    M lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp
    M lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
    M lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
    M lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
    A lldb/test/API/functionalities/postmortem/minidump-new/linux-x86_64-exceptiondescription.yaml
    M llvm/include/llvm/BinaryFormat/Minidump.h
    M llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
    M llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
    M llvm/test/Transforms/LoopVectorize/trip-count-expansion-may-introduce-ub.ll

  Log Message:
  -----------
  [𝘀𝗽𝗿] changes introduced through rebase

Created using spr 1.3.4

[skip ci]


Compare: https://github.com/llvm/llvm-project/compare/cb37ecbda34f...9310397392e4

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