@@ -0,0 +1,187 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#define __counted_by(f) __attribute__((counted_by(f)))
+
+struct bar;
+
+struct not_found {
+ int count;
+ struct bar *fam[] __counted_by(bork); // expected-error {{use of undeclared
identifier 'bork'}}
+};
+
+s
https://github.com/kees approved this pull request.
Thanks for the updates! Let's get this in and continue with the rest of the
support. :)
https://github.com/llvm/llvm-project/pull/90786
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https:/
kees wrote:
> This is why I believe the gcc behavior is correct. When it knows the size
> given to `malloc` it uses that. When it doesn't know that it simply returns
> INT_MAX. When you ask gcc for the `__bdos` of the FAM it will use the `count`
> to calculate the size.
(nit: `SIZE_MAX`, not
https://github.com/kees closed https://github.com/llvm/llvm-project/pull/110928
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
kees wrote:
> Thankfully, this PR and my other PR (WIP) leave the door open. You can ignore
> all types and then mark a few as `no_wraps` or you can sanitize all types
> (the default) and mark a few as `wraps`.
Right, while I want to go full instrumentation, it's just not going to happen
in t
kees wrote:
> It looks like this is similar to `__builtin_constant_p` - what is the
> proposed behavior wrt. side effects in the evaluated expression? gcc and
> clang disagree about this a lot currently: https://godbolt.org/z/rbneznT9z
It is intended to have no side-effects. I followed the sam
https://github.com/kees created https://github.com/llvm/llvm-project/pull/132524
Provide a way to introspect expressions to see if they are assignable, which
becomes very useful in macros that want to perform additional work on arguments
that are lvalues. GCC is adding this builtin as well:
ht
kees wrote:
Thanks for all the feedback! I'll continue working on this next week (I'm OoO
this week).
https://github.com/llvm/llvm-project/pull/132524
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listi
kees wrote:
This is looking good, but needs to support `void *` struct members (they are
treated as byte-sized for pointer arithmetic and `memcpy`). GCC has added
support for this. Otherwise, yes, this is building for Linux with some
(non-`void *`) annotations added and is operating correctly.
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From 729d249d3848c2e417174ed935bfefde5c048dc7 Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH] [sancov] Introduce optional callback for stack-depth tracking
Normally -
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From 027ff82e738f6bdf82f958a4774eb05d321b23ef Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH] [sancov] Introduce optional callback for stack-depth tracking
Normally -
@@ -34,6 +34,7 @@ class SanitizerArgs {
std::vector CoverageIgnorelistFiles;
std::vector BinaryMetadataIgnorelistFiles;
int CoverageFeatures = 0;
+ int StackDepthCallbackMin = 0;
kees wrote:
Fixed.
https://github.com/llvm/llvm-project/pull/138323
_
kees wrote:
Okay, a couple small clean-ups, and I've also solved the lack of dynamic stack
size tracking.
https://github.com/llvm/llvm-project/pull/138323
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/l
@@ -1078,22 +1091,61 @@ 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
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From a481c0b96417c63786811e5bf118f3eb2e7dabb1 Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH 1/2] [sancov] Introduce optional callback for stack-depth
tracking
Norma
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From a481c0b96417c63786811e5bf118f3eb2e7dabb1 Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH] [sancov] Introduce optional callback for stack-depth tracking
Normally -
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From 549d71572f086a3ecab9d8cd4e546a55b078bf11 Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH 1/3] [sancov] Introduce optional callback for stack-depth
tracking
Norma
@@ -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">,
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From 03e2eead7c4034c81c79619c1507dd27145aaa43 Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH 1/2] [sancov] Introduce optional callback for stack-depth
tracking
Norma
@@ -1078,22 +1091,61 @@ 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
https://github.com/kees created https://github.com/llvm/llvm-project/pull/138323
Normally -fsanitize-coverage=stack-depth inserts inline arithmetic to update
thread_local __sancov_lowest_stack. To support stack depth tracking in the
Linux kernel, which does not implement traditional thread_loca
https://github.com/kees updated https://github.com/llvm/llvm-project/pull/138323
>From 4c9e223b8f0457b3f3f66bbb3fa2688b49204cc9 Mon Sep 17 00:00:00 2001
From: Kees Cook
Date: Fri, 2 May 2025 10:51:02 -0700
Subject: [PATCH] [sancov] Introduce optional callback for stack-depth tracking
Normally -
kees wrote:
> ⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️
>
> You can test this locally with the following command:
> View the diff from clang-format here.
Whoops, yes, I've fixed these now.
https://github.com/llvm/llvm-project/pull/138323
__
@@ -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
kees wrote:
> This is also missing flag and IR tests.
Oh, yes, I will add those. Thanks!
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-commi
https://github.com/kees closed https://github.com/llvm/llvm-project/pull/138385
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/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">,
https://github.com/kees created https://github.com/llvm/llvm-project/pull/138385
Check for struct members that are structs filled only with function pointers by
recursively examining it. Since the lamba IsFunctionPointerOrForwardDecl cannot
call itself directly, move it into a helper function,
@@ -8663,31 +8663,95 @@ static const RecordDecl
*GetEnclosingNamedOrTopAnonRecord(const FieldDecl *FD) {
return RD;
}
-static bool
-CheckCountExpr(Sema &S, FieldDecl *FD, Expr *E,
- llvm::SmallVectorImpl &Decls) {
+enum class CountedByInvalidPointeeTypeKind {
@@ -8663,31 +8663,95 @@ static const RecordDecl
*GetEnclosingNamedOrTopAnonRecord(const FieldDecl *FD) {
return RD;
}
-static bool
-CheckCountExpr(Sema &S, FieldDecl *FD, Expr *E,
- llvm::SmallVectorImpl &Decls) {
+enum class CountedByInvalidPointeeTypeKind {
@@ -158,6 +158,7 @@ struct SanitizerCoverageOptions {
bool PCTable = false;
bool NoPrune = false;
bool StackDepth = false;
+ int StackDepthCallbackMin = 0;
kees wrote:
Yeah, I wasn't sure if I should keep it with the other StackDepth var. I've
moved it
@@ -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
101 - 132 of 132 matches
Mail list logo