[clang] 69935d8 - [Clang][Sanitizers] Expect test failure on {arm, thumb}v7

2020-05-28 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-05-28T11:33:32+02:00 New Revision: 69935d86aed1b691c5f33a2141f15cb3aaee1af6 URL: https://github.com/llvm/llvm-project/commit/69935d86aed1b691c5f33a2141f15cb3aaee1af6 DIFF: https://github.com/llvm/llvm-project/commit/69935d86aed1b691c5f33a2141f15cb3aaee1af6.diff L

[clang] 866ee23 - [KernelAddressSanitizer] Make globals constructors compatible with kernel

2020-06-05 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-05T20:20:46+02:00 New Revision: 866ee2353f7d0224644799d0d1faed53c7f3a06d URL: https://github.com/llvm/llvm-project/commit/866ee2353f7d0224644799d0d1faed53c7f3a06d DIFF: https://github.com/llvm/llvm-project/commit/866ee2353f7d0224644799d0d1faed53c7f3a06d.diff L

[clang] 2dd83a9 - [ASan][Test] Fix globals test for Mach-O

2020-06-05 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-05T23:08:11+02:00 New Revision: 2dd83a923046a5cd9585dbf9f90daeab6c37265c URL: https://github.com/llvm/llvm-project/commit/2dd83a923046a5cd9585dbf9f90daeab6c37265c DIFF: https://github.com/llvm/llvm-project/commit/2dd83a923046a5cd9585dbf9f90daeab6c37265c.diff L

[clang] 97a6709 - [ASan][Test] Fix globals test on 32-bit architectures

2020-06-06 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-06T11:23:16+02:00 New Revision: 97a670958c240d469c6baf2d3c601d4dea286069 URL: https://github.com/llvm/llvm-project/commit/97a670958c240d469c6baf2d3c601d4dea286069 DIFF: https://github.com/llvm/llvm-project/commit/97a670958c240d469c6baf2d3c601d4dea286069.diff L

[clang] c6ec352 - Revert "[KernelAddressSanitizer] Make globals constructors compatible with kernel"

2020-06-08 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-08T10:34:03+02:00 New Revision: c6ec352a6bde1995794c523adc2ebab802ccdf0a URL: https://github.com/llvm/llvm-project/commit/c6ec352a6bde1995794c523adc2ebab802ccdf0a DIFF: https://github.com/llvm/llvm-project/commit/c6ec352a6bde1995794c523adc2ebab802ccdf0a.diff L

[clang] d3f8931 - [KernelAddressSanitizer] Make globals constructors compatible with kernel [v2]

2020-06-10 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-10T15:08:42+02:00 New Revision: d3f89314ff20ce1612bd5e09f9f90ff5dd5205a7 URL: https://github.com/llvm/llvm-project/commit/d3f89314ff20ce1612bd5e09f9f90ff5dd5205a7 DIFF: https://github.com/llvm/llvm-project/commit/d3f89314ff20ce1612bd5e09f9f90ff5dd5205a7.diff L

[clang] 0f04f10 - [ASan][Test] Split out global alias test

2020-06-10 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-10T19:58:50+02:00 New Revision: 0f04f104537bf037d07933cc306d0a0c0772e78f URL: https://github.com/llvm/llvm-project/commit/0f04f104537bf037d07933cc306d0a0c0772e78f DIFF: https://github.com/llvm/llvm-project/commit/0f04f104537bf037d07933cc306d0a0c0772e78f.diff L

[clang] 52cae05 - [ASan][Test] Fix expected strings for globals test

2020-06-10 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-06-10T20:26:24+02:00 New Revision: 52cae05e087b3d4fd02849fc37c387c720055ffb URL: https://github.com/llvm/llvm-project/commit/52cae05e087b3d4fd02849fc37c387c720055ffb DIFF: https://github.com/llvm/llvm-project/commit/52cae05e087b3d4fd02849fc37c387c720055ffb.diff L

[clang] c4842bb - [Clang] Introduce -fexperimental-sanitize-metadata=

2022-09-07 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2022-09-07T21:25:40+02:00 New Revision: c4842bb2e98e2f1ee23bb3bc753752816927b7b3 URL: https://github.com/llvm/llvm-project/commit/c4842bb2e98e2f1ee23bb3bc753752816927b7b3 DIFF: https://github.com/llvm/llvm-project/commit/c4842bb2e98e2f1ee23bb3bc753752816927b7b3.diff L

[clang] c28b18a - [KernelAddressSanitizer] Fix globals exclusion for indirect aliases

2020-12-11 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2020-12-11T12:20:40+01:00 New Revision: c28b18af19621e6b5cca257ef7139ba93833df0c URL: https://github.com/llvm/llvm-project/commit/c28b18af19621e6b5cca257ef7139ba93833df0c DIFF: https://github.com/llvm/llvm-project/commit/c28b18af19621e6b5cca257ef7139ba93833df0c.diff L

[clang] ca6df73 - [NFC][CodeGenOptions] Refactor checking SanitizeCoverage options

2021-05-25 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2021-05-25T12:57:14+02:00 New Revision: ca6df734069ae590d1632e920ceba03bea317549 URL: https://github.com/llvm/llvm-project/commit/ca6df734069ae590d1632e920ceba03bea317549 DIFF: https://github.com/llvm/llvm-project/commit/ca6df734069ae590d1632e920ceba03bea317549.diff L

[clang] 85feebf - [NFC][SanitizeCoverage] Test always_inline functions work

2021-05-25 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2021-05-25T12:57:14+02:00 New Revision: 85feebf5a3401eab4c71288e2dc089faf547ab4c URL: https://github.com/llvm/llvm-project/commit/85feebf5a3401eab4c71288e2dc089faf547ab4c DIFF: https://github.com/llvm/llvm-project/commit/85feebf5a3401eab4c71288e2dc089faf547ab4c.diff L

[clang] 2803330 - [SanitizeCoverage] Add support for NoSanitizeCoverage function attribute

2021-05-25 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2021-05-25T12:57:14+02:00 New Revision: 280333021e9550d80f5c1152a34e33e81df1e178 URL: https://github.com/llvm/llvm-project/commit/280333021e9550d80f5c1152a34e33e81df1e178 DIFF: https://github.com/llvm/llvm-project/commit/280333021e9550d80f5c1152a34e33e81df1e178.diff L

[clang] 4fbc66c - [Clang] Enable __has_feature(coverage_sanitizer)

2021-05-27 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2021-05-27T18:24:21+02:00 New Revision: 4fbc66cd6d90d8d5169c43fcc1b1e26e8a98d3a9 URL: https://github.com/llvm/llvm-project/commit/4fbc66cd6d90d8d5169c43fcc1b1e26e8a98d3a9 DIFF: https://github.com/llvm/llvm-project/commit/4fbc66cd6d90d8d5169c43fcc1b1e26e8a98d3a9.diff L

[clang] b95646f - Revert "Use-after-return sanitizer binary metadata"

2022-11-30 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2022-11-30T23:35:50+01:00 New Revision: b95646fe7058471cc0ecda1efa25003009af0317 URL: https://github.com/llvm/llvm-project/commit/b95646fe7058471cc0ecda1efa25003009af0317 DIFF: https://github.com/llvm/llvm-project/commit/b95646fe7058471cc0ecda1efa25003009af0317.diff L

[clang] 61ed649 - [SanitizerBinaryMetadata] Do not add to GPU code

2023-03-09 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2023-03-09T10:15:28+01:00 New Revision: 61ed64954b979df0d5bfdfbe54a7c27e20be9001 URL: https://github.com/llvm/llvm-project/commit/61ed64954b979df0d5bfdfbe54a7c27e20be9001 DIFF: https://github.com/llvm/llvm-project/commit/61ed64954b979df0d5bfdfbe54a7c27e20be9001.diff L

[clang] 421215b - [SanitizerBinaryMetadata] Support ignore list

2023-02-10 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2023-02-10T10:25:48+01:00 New Revision: 421215b919d037a912cd4fffa73242852da41fc0 URL: https://github.com/llvm/llvm-project/commit/421215b919d037a912cd4fffa73242852da41fc0 DIFF: https://github.com/llvm/llvm-project/commit/421215b919d037a912cd4fffa73242852da41fc0.diff L

[clang] bb8bd8c - [SanitizerBinaryMetadata] Fix ignorelist test under Windows

2023-02-10 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2023-02-10T11:24:25+01:00 New Revision: bb8bd8c232e893441937d057a8b32760065c6e1d URL: https://github.com/llvm/llvm-project/commit/bb8bd8c232e893441937d057a8b32760065c6e1d DIFF: https://github.com/llvm/llvm-project/commit/bb8bd8c232e893441937d057a8b32760065c6e1d.diff L

[clang] dac423b - [SanitizerBinaryMetadata] Fix ignorelist test with -Assert

2023-02-10 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2023-02-11T00:33:13+01:00 New Revision: dac423bd571858a85f3b388904392f0e55421d7d URL: https://github.com/llvm/llvm-project/commit/dac423bd571858a85f3b388904392f0e55421d7d DIFF: https://github.com/llvm/llvm-project/commit/dac423bd571858a85f3b388904392f0e55421d7d.diff L

[clang] 5f605e2 - [SanitizerBinaryMetadata] Respect no_sanitize("thread") function attribute

2023-04-19 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2023-04-19T14:49:56+02:00 New Revision: 5f605e254a0f81a41fd69025c572d597f3059ebc URL: https://github.com/llvm/llvm-project/commit/5f605e254a0f81a41fd69025c572d597f3059ebc DIFF: https://github.com/llvm/llvm-project/commit/5f605e254a0f81a41fd69025c572d597f3059ebc.diff L

[clang] [llvm] [SanitizerBinaryMetadata] Fix multi-version sanitizer metadata (PR #97848)

2024-07-05 Thread Marco Elver via cfe-commits
https://github.com/melver created https://github.com/llvm/llvm-project/pull/97848 It should be valid to combine TUs that have different versions of sanitizer metadata. However, this had not been possible due to giving sanitizer metadata sections, constructors, and destructors (that call callba

[clang] [llvm] [SanitizerBinaryMetadata] Fix multi-version sanitizer metadata (PR #97848)

2024-07-08 Thread Marco Elver via cfe-commits
https://github.com/melver closed https://github.com/llvm/llvm-project/pull/97848 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] c65186c - [clang] Improve -Wdeclaration-after-statement

2022-01-20 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2022-01-20T19:56:34+01:00 New Revision: c65186c89f35b7b599c41183def666a2bde62ddd URL: https://github.com/llvm/llvm-project/commit/c65186c89f35b7b599c41183def666a2bde62ddd DIFF: https://github.com/llvm/llvm-project/commit/c65186c89f35b7b599c41183def666a2bde62ddd.diff L

[clang] 17ce89f - [SanitizerBounds] Add support for NoSanitizeBounds function

2022-03-01 Thread Marco Elver via cfe-commits
Author: Tong Zhang Date: 2022-03-01T18:47:02+01:00 New Revision: 17ce89fa8016758be2ec879c5560e506cad4c362 URL: https://github.com/llvm/llvm-project/commit/17ce89fa8016758be2ec879c5560e506cad4c362 DIFF: https://github.com/llvm/llvm-project/commit/17ce89fa8016758be2ec879c5560e506cad4c362.diff LO

[clang] 732ad8e - [clang][auto-init] Provide __builtin_alloca*_uninitialized variants

2022-01-12 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2022-01-12T15:13:10+01:00 New Revision: 732ad8ea62edc403727af57537b5d83dcfa937aa URL: https://github.com/llvm/llvm-project/commit/732ad8ea62edc403727af57537b5d83dcfa937aa DIFF: https://github.com/llvm/llvm-project/commit/732ad8ea62edc403727af57537b5d83dcfa937aa.diff L

[clang] [ubsan] Suppression by type for `-fsanitize=enum` (PR #114754)

2024-11-04 Thread Marco Elver via cfe-commits
https://github.com/melver approved this pull request. https://github.com/llvm/llvm-project/pull/114754 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement labelled type filtering for overflow/truncation sanitizers w/ SSCLs (PR #107332)

2024-10-30 Thread Marco Elver via cfe-commits
melver wrote: > > I wished that we could just attach attributes to type, e.g. `typedef int > > __attribute__((no_sanitize("signed-integer-overflow")) wrapping_int` or > > something. One thing here is that this should _not_ be a type modifier > > (like volatile and such), so it does not change

[clang] [Clang] Implement labelled type filtering for overflow/truncation sanitizers w/ SSCLs (PR #107332)

2024-10-30 Thread Marco Elver via cfe-commits
melver wrote: > We could make custom types that are filtered out in an ignorelist, allowing > for types to be more expressive -- without the need for annotations Having this sort of semantic information detached from the code may cause some maintenance headaches. For example, if the type is re

[clang] [Clang] Implement labelled type filtering for overflow/truncation sanitizers w/ SSCLs (PR #107332)

2024-10-30 Thread Marco Elver via cfe-commits
@@ -15,8 +15,9 @@ file at compile-time. Goal and usage == -Users of sanitizer tools, such as :doc:`AddressSanitizer`, :doc:`ThreadSanitizer` -or :doc:`MemorySanitizer` may want to disable or alter some checks for +Users of sanitizer tools, such as :doc:`AddressSan

[clang] [Clang] Implement labelled type filtering for overflow/truncation sanitizers w/ SSCLs (PR #107332)

2024-10-30 Thread Marco Elver via cfe-commits
https://github.com/melver approved this pull request. https://github.com/llvm/llvm-project/pull/107332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
https://github.com/melver requested changes to this pull request. https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu +typedef int __attribute__((wraps)) wrapping_int; melver wrote: Can we test more types? Can the attributes be applied to pointers? Both the pointer itself and the pointee?

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2025-02-03 Thread Marco Elver via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2025-02-03 Thread Marco Elver via cfe-commits
melver wrote: > RFC regarding canonical wrapping/non-wrapping types in Clang: > https://discourse.llvm.org/t/rfc-clang-canonical-wrapping-and-non-wrapping-types/84356 > > Ultimately, a type like what the RFC describes would supersede this PR in > terms of feature completeness and usefulness. I

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-02-04 Thread Marco Elver via cfe-commits
melver wrote: FWIW, the Linux kernel integration (draft, WIP) currently lives here: https://github.com/google/kernel-sanitizers/tree/cap-analysis It currently enables -Wthread-safety-addressof if available. Thus far, I have not found any false positives due to -Wthread-safety-addressof in the 2

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-02-04 Thread Marco Elver via cfe-commits
melver wrote: > Doesn't `counted_by` have the same requirements? If not, why does guarded_by? It does, AFAIK. > Sure, I can imagine where there might be pushback, but perhaps its worthwhile > to see how far you can get with either marking structs that don't need > `-fexperimental-late-parse-a

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-02-04 Thread Marco Elver via cfe-commits
melver wrote: > Looks like the kernel patches > [use](https://github.com/google/kernel-sanitizers/commit/81883e1fa377d866c288192b6eb8334bcf10f38f) > `-fexperimental-late-parse-attributes`? :( Yeah, no way around it if we want to have guarded_by in structs work properly. If the problem is cost

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-02-04 Thread Marco Elver via cfe-commits
melver wrote: > Can any of the members in the structs be reorganized to put the mutex member > declaration BEFORE the members they guard? Probably not always, but perhaps > that's possible for most structures? It's an option I considered, but I can already hear "what is this crap ... NACK". I

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-02-05 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/123063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support warning on taking address of guarded variables (PR #123063)

2025-02-05 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/123063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-21 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/123063 >From 6727047d25b8b72f8e23b03a84c0b23f6dad566a Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 15 Jan 2025 13:23:14 +0100 Subject: [PATCH 1/3] Thread Safety Analysis: Support warning on obtaining address o

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-21 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/123063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-20 Thread Marco Elver via cfe-commits
melver wrote: > We had a discussion on https://reviews.llvm.org/D52395 that might be relevant > here. To quote @delesley: > > > When you pass an object to a function, either by pointer or by reference, > > no actual load from memory has yet occurred. Thus, there is a real risk of > > false po

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-21 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/123063 >From 6727047d25b8b72f8e23b03a84c0b23f6dad566a Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 15 Jan 2025 13:23:14 +0100 Subject: [PATCH 1/3] Thread Safety Analysis: Support warning on obtaining address o

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-15 Thread Marco Elver via cfe-commits
melver wrote: For additional background: I'm trying to work out how to bring -Wthread-safety to the Linux kernel. Since -fexperimental-late-parse-attributes made the feature practical for complex C structs, I started to look at a strategy to enable the feature. The current strategy is to cre

[clang] [clang-tools-extra] thread-safety: Support the new capability-based names for all related attributes. (PR #99919)

2025-01-15 Thread Marco Elver via cfe-commits
melver wrote: Was this dropped? It'd be nice to see this change land. https://github.com/llvm/llvm-project/pull/99919 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-15 Thread Marco Elver via cfe-commits
https://github.com/melver created https://github.com/llvm/llvm-project/pull/123063 Add the optional ability, via `-Wthread-safety-addressof`, to warn when obtaining the address of guarded variables. This is required to avoid false negatives in large C codebases, where data structures are typi

[clang] Thread Safety Analysis: Support warning on obtaining address of guarded variables (PR #123063)

2025-01-15 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/123063 >From 6727047d25b8b72f8e23b03a84c0b23f6dad566a Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 15 Jan 2025 13:23:14 +0100 Subject: [PATCH] Thread Safety Analysis: Support warning on obtaining address of gu

[clang] Thread Safety Analysis: Support warning on passing/returning pointers to guarded variables (PR #127396)

2025-02-16 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/127396 >From a70f021becb2888d6c2a63b2d1e619393a996058 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Sun, 16 Feb 2025 14:53:41 +0100 Subject: [PATCH 1/2] Thread Safety Analysis: Handle address-of followed by derefere

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-26 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] 4bf93c0 - Thread Safety Analysis: Fix style

2025-04-29 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2025-04-30T08:49:15+02:00 New Revision: 4bf93c098c8b04a06f228b05732d691d0ce2babc URL: https://github.com/llvm/llvm-project/commit/4bf93c098c8b04a06f228b05732d691d0ce2babc DIFF: https://github.com/llvm/llvm-project/commit/4bf93c098c8b04a06f228b05732d691d0ce2babc.diff L

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-30 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/137133 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-30 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From a8319028f08192ca6140beed7f27a83a829c6d84 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-30 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/137133 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-30 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/137133 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
https://github.com/melver approved this pull request. https://github.com/llvm/llvm-project/pull/138323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
@@ -2361,6 +2361,13 @@ def fsanitize_coverage_ignorelist : Joined<["-"], "fsanitize-coverage-ignorelist HelpText<"Disable sanitizer coverage instrumentation for modules and functions " "that match the provided special case list, even the allowed ones">,

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/138323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
https://github.com/melver commented: Generally LGTM - but let's also wait for others to comment. Documentation of this feature is lacking (and afaik also wasn't added in https://reviews.llvm.org/D36839). Given this will be used in the kernel, some kind of official documentation might be good t

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-04 Thread Marco Elver via cfe-commits
https://github.com/melver requested changes to this pull request. This is also missing flag and IR tests. https://github.com/llvm/llvm-project/pull/138323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-04 Thread Marco Elver via cfe-commits
@@ -1078,22 +1092,44 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB, Store->setNoSanitizeMetadata(); } if (Options.StackDepth && IsEntryBB && !IsLeafFunc) { -// Check stack depth. If it's the deepest so far, record it. Modu

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-04 Thread Marco Elver via cfe-commits
@@ -34,6 +34,7 @@ class SanitizerArgs { std::vector CoverageIgnorelistFiles; std::vector BinaryMetadataIgnorelistFiles; int CoverageFeatures = 0; + int StackDepthCallbackMin = 0; melver wrote: `CoverageStackDepthCallbackMin` https://github.com/llvm/llv

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-04 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/138323 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the CF table at startup: // the collected control flow. } +Tracing Stack Depth +=== + +With ``-fsanitize-coverage=stack-depth`` the compiler will track how much +stack space has be

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the CF table at startup: // the collected control flow. } +Tracing Stack Depth +=== + +With ``-fsanitize-coverage=stack-depth`` the compiler will track how much +stack space has be

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the CF table at startup: // the collected control flow. } +Tracing Stack Depth +=== + +With ``-fsanitize-coverage=stack-depth`` the compiler will track how much +stack space has be

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
@@ -385,6 +385,49 @@ Users need to implement a single function to capture the CF table at startup: // the collected control flow. } +Tracing Stack Depth +=== + +With ``-fsanitize-coverage=stack-depth`` the compiler will track how much +stack space has be

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-06 Thread Marco Elver via cfe-commits
@@ -1078,22 +1091,65 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB, Store->setNoSanitizeMetadata(); } if (Options.StackDepth && IsEntryBB && !IsLeafFunc) { -// Check stack depth. If it's the deepest so far, record it. Modu

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-06 Thread Marco Elver via cfe-commits
@@ -1078,22 +1091,65 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB, Store->setNoSanitizeMetadata(); } if (Options.StackDepth && IsEntryBB && !IsLeafFunc) { -// Check stack depth. If it's the deepest so far, record it. Modu

[clang] [llvm] [sancov] Introduce optional callback for stack-depth tracking (PR #138323)

2025-05-05 Thread Marco Elver via cfe-commits
@@ -2361,6 +2361,13 @@ def fsanitize_coverage_ignorelist : Joined<["-"], "fsanitize-coverage-ignorelist HelpText<"Disable sanitizer coverage instrumentation for modules and functions " "that match the provided special case list, even the allowed ones">,

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-24 Thread Marco Elver via cfe-commits
https://github.com/melver created https://github.com/llvm/llvm-project/pull/137133 Introduce the `reentrant_capability` attribute, which may be specified alongside the `capability(..)` attribute to denote that the defined capability type is reentrant. Marking a capability as reentrant means that

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-24 Thread Marco Elver via cfe-commits
melver wrote: In https://lore.kernel.org/all/CANpmjNPquO=W1JAh1FNQb8pMQjgeZAKCPQUAd7qUg=5pjJ6x=q...@mail.gmail.com/ I wrote: > 1. Re-entrant acquires: rcu_read_lock(), preempt_disable(), etc. are > all re-entrant locks. My proposal is to introduce an attribute that > can be added to "ACQUIRE(.

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-24 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From c60ccbc31de8e81e6a4af915a83b8271f58f8e7e Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-24 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From c60ccbc31de8e81e6a4af915a83b8271f58f8e7e Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
@@ -434,6 +434,16 @@ class can be used as a capability. The string argument specifies the kind of capability in error messages, e.g. ``"mutex"``. See the ``Container`` example given above, or the ``Mutex`` class in :ref:`mutexheader`. +REENTRANT +- + +``REENTRANT``

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
melver wrote: > I think the biggest issue is that removing `const` from `FactEntry` does not > work. You'll have to undo all those changes and instead create a new > `FactEntry` for every lock/unlock. Good catch, reworked this. PTAL. https://github.com/llvm/llvm-project/pull/137133 __

[clang] a9788e3 - Thread Safety Analysis: Test: Minor style fix

2025-04-25 Thread Marco Elver via cfe-commits
Author: Marco Elver Date: 2025-04-25T09:56:54+02:00 New Revision: a9788e3a86cab64ae92dd7d041718b0722f43c3a URL: https://github.com/llvm/llvm-project/commit/a9788e3a86cab64ae92dd7d041718b0722f43c3a DIFF: https://github.com/llvm/llvm-project/commit/a9788e3a86cab64ae92dd7d041718b0722f43c3a.diff L

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
@@ -271,26 +271,32 @@ class CFGWalker { // translateAttrExpr needs it, but that should be moved too. class CapabilityExpr { private: - /// The capability expression and whether it's negated. - llvm::PointerIntPair CapExpr; + /// The capability expression and flags. + llvm::

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/137133 >From d3324c1023533bf784a3c3c3ef095d07c865e6f9 Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 23 Apr 2025 11:31:25 +0200 Subject: [PATCH 1/2] Thread Safety Analysis: Convert CapabilityExpr::CapExpr to hol

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
@@ -163,15 +184,15 @@ using FactID = unsigned short; /// the analysis of a single routine. class FactManager { private: - std::vector> Facts; + std::vector> Facts; melver wrote: Fixed. I guess we have to do clone-mutate-replace of the FactEntries - a little

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
@@ -3990,6 +3990,13 @@ def LocksExcluded : InheritableAttr { let Documentation = [Undocumented]; } +def ReentrantCapability : InheritableAttr { + let Spellings = [Clang<"reentrant_capability">]; + let Subjects = SubjectList<[Record, TypedefName]>; + let Documentation = [U

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-25 Thread Marco Elver via cfe-commits
@@ -1831,15 +1852,15 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D, assert(!Self); const auto *TagT = Exp->getType()->getAs(); if (D->hasAttrs() && TagT && Exp->isPRValue()) { - std::pair Placeholder = - Analyzer->SxBuilder.crea

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-29 Thread Marco Elver via cfe-commits
@@ -235,6 +266,20 @@ class FactSet { return false; } + std::optional replaceLock(FactManager &FM, iterator It, +std::unique_ptr Entry) { +if (It == end()) + return std::nullopt; +FactID F = FM.newFact(std::move(Entry)); +

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-29 Thread Marco Elver via cfe-commits
@@ -271,26 +271,32 @@ class CFGWalker { // translateAttrExpr needs it, but that should be moved too. class CapabilityExpr { private: - /// The capability expression and whether it's negated. - llvm::PointerIntPair CapExpr; + /// The capability expression and flags. + llvm::

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-29 Thread Marco Elver via cfe-commits
@@ -388,7 +395,7 @@ class SExprBuilder { til::LiteralPtr *createVariable(const VarDecl *VD); // Create placeholder for this: we don't know the VarDecl on construction yet. - std::pair + std::pair melver wrote: I think this code is just more complex tha

[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

2025-04-29 Thread Marco Elver via cfe-commits
@@ -81,26 +81,25 @@ static bool isCalleeArrow(const Expr *E) { return ME ? ME->isArrow() : false; } -static StringRef ClassifyDiagnostic(const CapabilityAttr *A) { - return A->getName(); -} - -static StringRef ClassifyDiagnostic(QualType VDT) { +static CapabilityExpr makeCa

[clang] Thread Safety Analysis: Improved pointer handling (PR #127396)

2025-02-19 Thread Marco Elver via cfe-commits
melver wrote: FWIW, I'm ready for sending a v2 series to the Linux kernel mailing list: https://git.kernel.org/pub/scm/linux/kernel/git/melver/linux.git/log/?h=cap-analysis/dev But I'd like to sort out this PR first before sending the v2 series. https://github.com/llvm/llvm-project/pull/127396

[clang] Thread Safety Analysis: Support warning on taking address of guarded variables (PR #123063)

2025-02-12 Thread Marco Elver via cfe-commits
melver wrote: Addressed comments so far. > > The equivalent of passing a `pt_guarded_by` variable by value doesn't seem > > to warn. > > This inconsistency is probably my largest concern. If you have > > ```c > int x GUARDED_BY(mu); > int *p PT_GUARDED_BY(mu); > ``` > > then `&x` should basi

[clang] Thread Safety Analysis: Support warning on taking address of guarded variables (PR #123063)

2025-02-12 Thread Marco Elver via cfe-commits
https://github.com/melver updated https://github.com/llvm/llvm-project/pull/123063 >From 6727047d25b8b72f8e23b03a84c0b23f6dad566a Mon Sep 17 00:00:00 2001 From: Marco Elver Date: Wed, 15 Jan 2025 13:23:14 +0100 Subject: [PATCH 1/5] Thread Safety Analysis: Support warning on obtaining address o

[clang] Thread Safety Analysis: Support warning on taking address of guarded variables (PR #123063)

2025-02-12 Thread Marco Elver via cfe-commits
@@ -515,8 +515,18 @@ Warning flags + ``-Wthread-safety-analysis``: The core analysis. + ``-Wthread-safety-precise``: Requires that mutex expressions match precisely. This warning can be disabled for code which has a lot of aliases. - + ``-Wthread-safety-reference``

[clang] Thread Safety Analysis: Handle address-of followed by dereference (PR #127397)

2025-02-17 Thread Marco Elver via cfe-commits
https://github.com/melver closed https://github.com/llvm/llvm-project/pull/127397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Handle address-of followed by dereference (PR #127397)

2025-02-17 Thread Marco Elver via cfe-commits
melver wrote: Superseded by https://github.com/llvm/llvm-project/pull/127396 https://github.com/llvm/llvm-project/pull/127397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support warning on taking address of guarded variables (PR #123063)

2025-02-17 Thread Marco Elver via cfe-commits
https://github.com/melver converted_to_draft https://github.com/llvm/llvm-project/pull/123063 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Thread Safety Analysis: Support warning on taking address of guarded variables (PR #123063)

2025-02-17 Thread Marco Elver via cfe-commits
melver wrote: [...] > Then we only need to make sure that `checkPtAccess` can look through `&`, as > mentioned above. (Casts should already be unwrapped.) This might not even > need a new flag, it's just closing a gap in the existing analysis. Thanks for the suggestions! I implemented both -

[clang] Thread Safety Analysis: Improved pointer handling (PR #127396)

2025-02-17 Thread Marco Elver via cfe-commits
https://github.com/melver edited https://github.com/llvm/llvm-project/pull/127396 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   >