This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/59856] Support sparse-style context checking, used to validate locking correctness
- From: "josh at joshtriplett dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Nov 2015 19:37:18 +0000
- Subject: [Bug c/59856] Support sparse-style context checking, used to validate locking correctness
- Auto-submitted: auto-generated
- References: <bug-59856-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59856
--- Comment #16 from Josh Triplett <josh at joshtriplett dot org> ---
(In reply to PaX Team from comment #14)
> (In reply to Josh Triplett from comment #13)
> > This approach won't necessarily provide the "different contexts for basic
> > block" warning that Sparse has, but I don't necessarily think we need that;
>
> can you give me an example of this?
Sparse warns if you can reach the same basic block with different context
values (for instance, with or without a lock held). That warning *may*
indicate a problem, but it can also just indicate code too intricate for Sparse
to understand.
> the thing is, my approach tracks the
> context with statement granularity so if you can tell the compiler where you
> expect specific states (such as the context attr on callees) checks can be
> inserted there easily, down to individual statements (say, the structure
> field accesses you mentioned).
Sounds good to me.
(In reply to Tom Tromey from comment #15)
> Anyway given that this is happening, I suggest closing this gcc bug.
Have we completely ruled out the possibility of a native GCC implementation?
This really doesn't seem specific to the Linux kernel in any way; it'd be nice
if this could work in most programs. We could add annotations to pthread
locking functions, and any program using locking would benefit.