All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Kees Cook <kees@kernel.org>,
	cocci@inria.fr, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [cocci] coccinelle is skipping include files?
Date: Mon, 24 Oct 2022 09:53:54 -0700	[thread overview]
Message-ID: <202210240952.CD9E9D376@keescook> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2210200723020.2988@hadrien>

On Thu, Oct 20, 2022 at 07:23:34AM +0200, Julia Lawall wrote:
> On Wed, 19 Oct 2022, Kees Cook wrote:
> 
> > On October 19, 2022 9:43:35 PM PDT, Julia Lawall <julia.lawall@inria.fr> wrote:
> > >> The example I'm looking at is fs/xfs/xfs_bmap_item.c, which starts with:
> > >> #include "xfs.h"
> > >> #include "xfs_fs.h"
> > >> #include "xfs_format.h"
> > >> #include "xfs_log_format.h"
> > >> ...
> > >You may want to start with the option --verbose-includes for such
> > >problems.
> >
> > Ah-ha, thanks!
> >
> > >The problem is that Coccinelle can't find the file.  Your .c file is in
> > >fs/xfs, and despite the lack of a complete path, the header file is in
> > >a subdirectory: fs/xfs/libxfs.  So you could add -I fs/xfs/libxfs to your
> > >command line.
> >
> > Ugh, yes, I see this now. It looks like we need to parse the Makefiles? :(
> >
> > >Another solution is the option --relax-include-path.  This should cause
> > >Coccinelle to look over the entire kernel to see if it can find exactly
> > >one file named xfs_log_format.h.  If only one exists, that has to be the
> > >one you want.
> >
> > Interesting solution, and would work here. I wonder if there needs to be a "fail I Coccinelle fails to find a header" option? Hmmm
> 
> What do you mean by fail?  Do you want spatch to stop completely, or the
> file to just be ignored?

I mean have a mode where cocci will error out if it can't find a header.
It already ignores missing headers, but if it can't resolve a header,
and I'm depending on struct declarations to be found, silently ignoring
missing headers is going to mean I miss matches.

-- 
Kees Cook

      reply	other threads:[~2022-10-24 19:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 23:36 [cocci] coccinelle is skipping include files? Kees Cook
2022-10-20  4:43 ` Julia Lawall
2022-10-20  5:18   ` Kees Cook
2022-10-20  5:23     ` Julia Lawall
2022-10-24 16:53       ` Kees Cook [this message]

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=202210240952.CD9E9D376@keescook \
    --to=keescook@chromium.org \
    --cc=cocci@inria.fr \
    --cc=djwong@kernel.org \
    --cc=julia.lawall@inria.fr \
    --cc=kees@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.