From: Julia Lawall <julia.lawall@inria.fr>
To: Kees Cook <keescook@chromium.org>
Cc: cocci@inria.fr, linux-hardening@vger.kernle.org,
"Gustavo A. R. Silva" <gustavoars@kernel.org>
Subject: Re: [cocci] spatch --jobs N missing matches?
Date: Tue, 27 Sep 2022 23:09:35 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2209272304030.2842@hadrien> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2209272235060.2842@hadrien>
The running time is cut in half for the command line:
spatch ~/linux-next/fs/dlm flex2.cocci -I ~/linux-next/include
Where flex2.cocci is:
------------
#spatch --recursive-includes --include-headers
// match memcpy() which has a composite flexible array struct as the destination
@memcpy_compflex_dest@
identifier outer, compflex;
struct outer *PTR;
expression SRC, SIZE;
@@
memcpy(
&PTR->compflex
, SRC, SIZE)
// "level2" matches a composite flexible array struct (struct ending with "level1")
@level2@
identifier inner;
identifier memcpy_compflex_dest.outer, memcpy_compflex_dest.compflex;
@@
struct outer {
...
struct inner compflex;
};
// "level1" matches a struct ending in a flexible array.
@level1@
identifier level2.inner, flex;
type T;
@@
struct inner {
...
T flex[];
};
// match memcpy() which has a composite flexible array struct as the destination
@depends on level1@
identifier memcpy_compflex_dest.outer, memcpy_compflex_dest.compflex;
struct outer *memcpy_compflex_dest.PTR;
expression SRC, SIZE;
@@
memcpy(
* &PTR->compflex
, SRC, SIZE)
------------
Actually, there are not that many memcpys in the considered code. Then
there are not that many that refer to the last element of a structure. If
level2 produces nothing, then level 1 should not be applied.
In the original rule order, all of the pairs of a flexible structure and
any structure are considered, regardless of whether any memcpys are
present.
julia
next prev parent reply other threads:[~2022-09-27 21:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-26 18:52 [cocci] spatch --jobs N missing matches? Kees Cook
2022-09-26 21:14 ` Julia Lawall
2022-09-26 22:09 ` Kees Cook
2022-09-27 20:37 ` Julia Lawall
2022-09-27 21:09 ` Julia Lawall [this message]
2022-09-28 0:06 ` Kees Cook
2022-09-28 5:23 ` Julia Lawall
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=alpine.DEB.2.22.394.2209272304030.2842@hadrien \
--to=julia.lawall@inria.fr \
--cc=cocci@inria.fr \
--cc=gustavoars@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernle.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 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 NNTP newsgroup(s).