From: Markus Elfring <Markus.Elfring@web.de>
To: Kees Cook <keescook@chromium.org>, cocci@inria.fr
Cc: Julia Lawall <julia.lawall@inria.fr>,
"Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: Re: [cocci] Reconsidering selected SmPL code
Date: Mon, 10 Oct 2022 21:12:13 +0200 [thread overview]
Message-ID: <c4640a3e-746b-a434-710e-fbcb296ab9fe@web.de> (raw)
In-Reply-To: <202210091035.7D63B5FB@keescook>
>> I'm starting to realize I should document my set of "with cocci, how do
>> I ...?" answers somewhere.
> Okay, initial dump is here:
>
> https://github.com/kees/kernel-tools/tree/trunk/coccinelle
I suggest to reconsider published implementation details a bit more.
https://github.com/kees/kernel-tools/blob/0d128055b31a7737eaa23c040e57a0f34a41e6c1/coccinelle/README.md#user-content-use-regular-expressions-to-quickly-match-identifiers
@display_with_regex@
identifier func =~ "^(?:get_random_(?:int|u32)|prandom_u32)$";
@@
*func
()
@display_with_disjunction@
@@
(
*get_random_int
|
*get_random_u32
|
*prandom_u32
)
()
Would you like to compare software run time characteristics in more detail?
https://github.com/kees/kernel-tools/blob/0d128055b31a7737eaa23c040e57a0f34a41e6c1/coccinelle/README.md#user-content-limit-matches-when-variable-contents-arent-used-again
I propose to take additional SmPL script design options into account.
https://github.com/kees/kernel-tools/blob/0d128055b31a7737eaa23c040e57a0f34a41e6c1/coccinelle/README.md#user-content-match-variables-of-a-given-type
Will further collateral evolution happen according to mentioned metavariable declarations?
https://github.com/kees/kernel-tools/blob/246d5fe3c1abf0a25778acc5d3b8af02511241b0/coccinelle/examples/rand-pass2.cocci#L1
I wonder why the source code search pattern “prandom_bytes(...)@p” was not used for the SmPL rule “hit”.
I imagine that the addition of constraints for metavariables with
the type “binary operator” can help to avoid duplicate code in related SmPL rules.
Regards,
Markus
prev parent reply other threads:[~2022-10-10 19:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 23:11 [cocci] how to check a for "don't care" state of a variable? Kees Cook
2022-10-08 3:09 ` Kees Cook
2022-10-08 7:43 ` Julia Lawall
2022-10-08 8:55 ` Markus Elfring
2022-10-08 9:00 ` Julia Lawall
2022-10-08 9:15 ` Markus Elfring
2022-10-08 11:02 ` Markus Elfring
2022-10-09 15:10 ` Kees Cook
2022-10-09 15:12 ` Julia Lawall
2022-10-09 15:56 ` Markus Elfring
2022-10-09 17:37 ` Kees Cook
2022-10-09 18:02 ` Julia Lawall
2022-10-09 18:16 ` Kees Cook
2022-10-09 18:19 ` Julia Lawall
2022-10-10 2:16 ` Jason A. Donenfeld
2022-10-10 19:12 ` Markus Elfring [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=c4640a3e-746b-a434-710e-fbcb296ab9fe@web.de \
--to=markus.elfring@web.de \
--cc=Jason@zx2c4.com \
--cc=cocci@inria.fr \
--cc=julia.lawall@inria.fr \
--cc=keescook@chromium.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.