From: Julia Lawall <julia.lawall@inria.fr> To: Denis Efremov <efremov@linux.com> Cc: Julia Lawall <julia.lawall@inria.fr>, cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH] coccinelle: api: add kzfree script Date: Thu, 4 Jun 2020 17:51:19 +0200 (CEST) [thread overview] Message-ID: <alpine.DEB.2.21.2006041749520.2577@hadrien> (raw) In-Reply-To: <a188acce-348b-b106-9180-708c3050ef8d@linux.com> On Thu, 4 Jun 2020, Denis Efremov wrote: > > > On 6/4/20 5:15 PM, Julia Lawall wrote: > > Did you try ... here but find that some subexpressions of E could be > > modified in between? > > Yes, I tried to use "... when != E = E1 when != &E" and results were bad. > Now, I've tried forall and when strict. Here are examples: > > // forall added > // Works well, suitable for v2. One additional catch in w1 driver. > @r depends on !patch && !(file in "lib/test_kasan.c") && !(file in "mm/slab_common.c") forall@ > expression *E; // pointer. Results are equal as if we use E. > position p; > @@ > > * memset(E, 0, ...); > ... when != E // Is it enough to match &E, E = E1? Yes. > * kfree(E)@p; > > //no forall, when strict > //results are bad, too many false positives > @r depends on !patch && !(file in "lib/test_kasan.c") && !(file in "mm/slab_common.c")@ > expression *E; > position p; > @@ > > * memset(E, 0, ...); > ... when != E // E is not enough here > when strict OK, it's reassonable. > * kfree(E)@p; > > I guess that the difference is that "forall" requires that whole pattern should occur on > every path, "when strict" states that kfree should be called on every path after memset. > This results in missed uses of E in loops and under conditions. How can I state in this > case that E should not occur at all (in all paths) in between memset, kfree even as a > subexpression? > > // Doesn't work well > ... when != E > when != if (...) { ... E ... } > when != for(...;...;...) { ... E ... } Could you send an example of some C code on which the result is not suitable? julia
WARNING: multiple messages have this Message-ID (diff)
From: Julia Lawall <julia.lawall@inria.fr> To: Denis Efremov <efremov@linux.com> Cc: cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [Cocci] [PATCH] coccinelle: api: add kzfree script Date: Thu, 4 Jun 2020 17:51:19 +0200 (CEST) [thread overview] Message-ID: <alpine.DEB.2.21.2006041749520.2577@hadrien> (raw) In-Reply-To: <a188acce-348b-b106-9180-708c3050ef8d@linux.com> On Thu, 4 Jun 2020, Denis Efremov wrote: > > > On 6/4/20 5:15 PM, Julia Lawall wrote: > > Did you try ... here but find that some subexpressions of E could be > > modified in between? > > Yes, I tried to use "... when != E = E1 when != &E" and results were bad. > Now, I've tried forall and when strict. Here are examples: > > // forall added > // Works well, suitable for v2. One additional catch in w1 driver. > @r depends on !patch && !(file in "lib/test_kasan.c") && !(file in "mm/slab_common.c") forall@ > expression *E; // pointer. Results are equal as if we use E. > position p; > @@ > > * memset(E, 0, ...); > ... when != E // Is it enough to match &E, E = E1? Yes. > * kfree(E)@p; > > //no forall, when strict > //results are bad, too many false positives > @r depends on !patch && !(file in "lib/test_kasan.c") && !(file in "mm/slab_common.c")@ > expression *E; > position p; > @@ > > * memset(E, 0, ...); > ... when != E // E is not enough here > when strict OK, it's reassonable. > * kfree(E)@p; > > I guess that the difference is that "forall" requires that whole pattern should occur on > every path, "when strict" states that kfree should be called on every path after memset. > This results in missed uses of E in loops and under conditions. How can I state in this > case that E should not occur at all (in all paths) in between memset, kfree even as a > subexpression? > > // Doesn't work well > ... when != E > when != if (...) { ... E ... } > when != for(...;...;...) { ... E ... } Could you send an example of some C code on which the result is not suitable? julia _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2020-06-04 15:51 UTC|newest] Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-04 14:08 [PATCH] coccinelle: api: add kzfree script Denis Efremov 2020-06-04 14:08 ` [Cocci] " Denis Efremov 2020-06-04 14:15 ` Julia Lawall 2020-06-04 14:15 ` [Cocci] " Julia Lawall 2020-06-04 15:39 ` Denis Efremov 2020-06-04 15:39 ` [Cocci] " Denis Efremov 2020-06-04 15:51 ` Julia Lawall [this message] 2020-06-04 15:51 ` Julia Lawall 2020-06-04 17:22 ` Denis Efremov 2020-06-04 17:22 ` [Cocci] " Denis Efremov 2020-06-04 17:28 ` Julia Lawall 2020-06-04 17:28 ` [Cocci] " Julia Lawall 2020-06-04 16:27 ` Joe Perches 2020-06-04 16:27 ` [Cocci] " Joe Perches 2020-06-04 17:30 ` Denis Efremov 2020-06-04 17:30 ` [Cocci] " Denis Efremov 2020-06-04 17:36 ` Joe Perches 2020-06-04 17:36 ` [Cocci] " Joe Perches 2020-06-14 19:42 ` Denis Efremov 2020-06-14 19:42 ` [Cocci] " Denis Efremov 2020-06-14 20:01 ` Joe Perches 2020-06-14 20:01 ` [Cocci] " Joe Perches 2020-06-15 12:03 ` Dan Carpenter 2020-06-15 12:03 ` [Cocci] " Dan Carpenter 2020-06-15 13:51 ` Denis Efremov 2020-06-15 13:51 ` [Cocci] " Denis Efremov 2020-06-04 20:48 ` [PATCH v2] " Denis Efremov 2020-06-04 20:48 ` [Cocci] " Denis Efremov 2020-06-04 20:57 ` Julia Lawall 2020-06-04 20:57 ` Julia Lawall 2020-06-04 21:03 ` Denis Efremov 2020-06-04 21:03 ` Denis Efremov 2020-06-04 21:25 ` Denis Efremov 2020-06-04 21:25 ` Denis Efremov 2020-06-06 8:16 ` Julia Lawall 2020-06-06 8:16 ` Julia Lawall 2020-06-14 21:54 ` [PATCH v3] " Denis Efremov 2020-06-14 21:54 ` [Cocci] " Denis Efremov 2020-06-17 20:42 ` Julia Lawall 2020-06-17 20:42 ` Julia Lawall 2020-06-17 21:42 ` Denis Efremov 2020-06-17 21:42 ` Denis Efremov 2020-07-07 21:35 ` Julia Lawall 2020-07-07 21:35 ` Julia Lawall 2020-07-17 11:57 ` [PATCH v4] " Denis Efremov 2020-07-17 11:57 ` [Cocci] " Denis Efremov 2020-07-17 20:39 ` Julia Lawall 2020-07-17 20:39 ` [Cocci] " Julia Lawall 2020-08-10 23:45 ` Eric Biggers 2020-08-10 23:45 ` [Cocci] " Eric Biggers 2020-08-11 7:12 ` Denis Efremov 2020-08-11 7:12 ` [Cocci] " Denis Efremov 2020-08-11 7:49 ` [PATCH] coccinelle: api: update kzfree script to kfree_sensitive Denis Efremov 2020-08-11 7:49 ` [Cocci] " Denis Efremov 2020-08-26 8:12 ` Denis Efremov 2020-08-26 8:12 ` [Cocci] " Denis Efremov 2020-09-12 15:08 ` Julia Lawall 2020-09-12 15:08 ` [Cocci] " Julia Lawall 2020-06-04 15:20 [PATCH] coccinelle: api: add kzfree script Markus Elfring 2020-06-04 15:20 ` Markus Elfring 2020-06-04 15:56 ` Julia Lawall 2020-06-04 15:56 ` 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.21.2006041749520.2577@hadrien \ --to=julia.lawall@inria.fr \ --cc=cocci@systeme.lip6.fr \ --cc=efremov@linux.com \ --cc=linux-kernel@vger.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: linkBe 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.