Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Edgar Khachatryan <khachatryan.edgar@student.rau.am>
To: cocci@inria.fr
Subject: [cocci] Detecting Use-After-Free and Analyzing CMake Projects
Date: Mon, 10 Mar 2025 18:39:10 +0400	[thread overview]
Message-ID: <CAN1=rvJBSpCq35PY-tTFomZ17wNBRN=bNV4vwKTV-TgYe38FdQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]

Dear Coccinelle Team,

My name is Edgar Khachatryan, and I am a student currently working on a
project that involves static analysis of C programs. I am particularly
interested in using Coccinelle to detect use-after-free bugs.

I have found and tried to use the kfree.cocci semantic patch provided for
the Linux kernel. However, when I run the command:
spatch --sp-file kfree.cocci file.c

Although I am certain that file.c contains a very simple use-after-free
example, Coccinelle reports the following message:
No rules apply. Perhaps your semantic patch doesn't contain any +/-/* code,
or you have a failed dependency. If the problem is not clear, try
--debug-parse-cocci or check whether any virtual rules (e.g., report)
should be defined.

I also tried running it with --debug-parse-cocci, but I am still unsure how
to proceed. Could you please advise me on how to properly apply Coccinelle
to detect use-after-free issues in simple test files? Am I missing specific
steps or dependencies when using kernel semantic patches on general C code?

Additionally, I would like to know if there are any recommended ways to run
Coccinelle on CMake-based projects. Is there an established method to
integrate Coccinelle with CMake builds, or any workarounds you would
suggest for analyzing such projects?

I would greatly appreciate any guidance, documentation, or best practices
you can share on these topics. Thank you very much for your time and
assistance!

Best regards,
Edgar Khachatryan,
Russian-Armenian University

[-- Attachment #2: Type: text/html, Size: 1604 bytes --]

             reply	other threads:[~2025-03-18  9:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 14:39 Edgar Khachatryan [this message]
2025-03-18  9:43 ` [cocci] Detecting Use-After-Free and Analyzing CMake Projects Ella Ma
2025-03-18 13:45 ` [cocci] Detecting Use-After-Free … Markus Elfring
2025-03-18 14:21 ` [cocci] Analyzing CMake Projects Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN1=rvJBSpCq35PY-tTFomZ17wNBRN=bNV4vwKTV-TgYe38FdQ@mail.gmail.com' \
    --to=khachatryan.edgar@student.rau.am \
    --cc=cocci@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).