All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: cocci@inria.fr, Erick Karanja <karanja99erick@gmail.com>
Subject: Re: [cocci] Searching for lock calls without unlocking (with SmPL)?
Date: Sat, 2 Aug 2025 15:45:31 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2508021541010.3428@hadrien> (raw)
In-Reply-To: <04403bf5-82f6-4c23-a217-0063f802e8ed@web.de>

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



On Sat, 2 Aug 2025, Markus Elfring wrote:

> >>>>>> May I expect that only a single call should be marked for such a test case?
> >>>>>
> >>>>> No, I already explained why two calls are marked.
> >>>>
> >>>> I see further challenges with this explanation approach.
> >>>>
> >>>>
> >>>>> The shortest path constraint is that for A ... B, the ... doesn't contain
> >>>>> A or B.
> >>>>
> >>>> This is generally fine.
> >>
> >> How does the “shortest path” fit to the statement “action_lock(&blockage2);”
> >> from the if branch in your software view?
> >
> > I explained it already.  If you have A ... B, Coccinelle doe not allow A
> > or B to occur in the code matched by ...
>
> How does the second lock call fit to these criteria?

In the two matches I mentioned earlier there was no intermediate lock
call.

> > A problem that you see to insist on causing is that by using * you have
> > no idea which matches involve which pieces of code.
>
> Partly, yes.
>
> The source code search patterns can occasionally be constructed with more
> unique context data.
> I hope still that undesirable data processing confusion can be reduced further.
>
>
> >                                                      If you would print
> > the line numbers of the involved calls then things would be clear.
>
> I hope still that a better consensus can be achieved also for safer applications
> of the SmPL asterisk functionality.

I have no idea what is considered to be unsafe. In any case, * is only
intended as a convenience.  It works well with emacs to jump to the
affected region of code.  Then you can study it and see what you really
want to do.

>
>
> >> Can the path distance be determined anyhow?
>
> I would appreciate a more helpful answer here.

No idea what this means nor why exact path distance is relevant.  The
point is that there may be some longer paths that start and end with A and
B, but that also contain instances of A and/or B.  By default Coccinelle
doesn't return them.

But * doesn't reflect the result of a single match.  It reflects the
result of all possible matches.  So they can overlap.

>
>
> …>>> independent.  There is no guarantee that one match will not cross another
> >>> one.  Furthermore, (just in case this is the concern) when you mentin two
> >>> different metavariables, there is no guarantee that they are not bound to
> >>> the same term.
> …>> Will it become more desirable to distinguish metavariable contents in an
> >> unique way?
> >
> > If you want something you have to express it in Coccinelle.
> >
> > foo(A)
> > ...
> > (
> > foo(A)
> > |
> > *foo(B)
> > )
> >
> > ensures that the marked foo(B) involves a different argument than the
> > matched foo(A).
>
> Would you like to provide a “guarantee” here?

Sure, it is guaranteed.

julia

  reply	other threads:[~2025-08-02 13:45 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23  7:45 [cocci] Searching for questionable call pairs (with SmPL)? Markus Elfring
2025-07-24 14:15 ` Markus Elfring
2025-07-24 14:47 ` Julia Lawall
2025-07-24 15:02   ` Markus Elfring
2025-07-24 15:09     ` Julia Lawall
2025-07-24 15:15       ` Markus Elfring
2025-07-24 15:25         ` Julia Lawall
2025-07-24 15:30           ` Markus Elfring
2025-07-24 16:18       ` Markus Elfring
2025-07-30 12:10       ` Markus Elfring
2025-08-01  7:33         ` Markus Elfring
2025-08-01  8:06           ` Julia Lawall
2025-08-01  8:33             ` Markus Elfring
2025-08-02 10:13             ` [cocci] Searching for lock calls without unlocking " Markus Elfring
2025-08-02 11:18               ` Markus Elfring
2025-08-02 11:28                 ` Julia Lawall
2025-08-02 11:51                   ` Markus Elfring
2025-08-02 11:54                     ` Julia Lawall
2025-08-02 12:02                       ` Markus Elfring
2025-08-02 12:10                         ` Julia Lawall
2025-08-02 12:56                           ` Markus Elfring
2025-08-02 13:05                             ` Julia Lawall
2025-08-02 13:33                               ` Markus Elfring
2025-08-02 13:45                                 ` Julia Lawall [this message]
2025-08-02 14:06                                   ` Markus Elfring
2025-08-02 15:43                               ` Markus Elfring
2025-08-02 15:46                                 ` Julia Lawall
2025-08-02 16:01                                   ` Markus Elfring
2025-08-02 16:04                                     ` Julia Lawall
2025-08-02 16:18                                       ` Markus Elfring
2025-08-02 16:24                                         ` Julia Lawall
2025-08-02 16:35                                           ` Markus Elfring
2025-08-02 17:38                                             ` Julia Lawall
2025-08-02 18:11                                               ` Markus Elfring
2025-08-02 19:12                                                 ` Julia Lawall
2025-08-02 19:26                                                   ` Markus Elfring
2025-08-02 19:35                                                     ` Julia Lawall
2025-08-02 19:42                                                       ` Markus Elfring
2025-08-02 19:44                                                         ` Julia Lawall
2025-08-02 19:48                                                           ` [cocci] Evolution of software documentation? Markus Elfring
2025-08-03  5:24                                                   ` [cocci] Searching for lock calls without unlocking (with SmPL)? Markus Elfring
2025-08-03  5:34                                                     ` Julia Lawall
2025-08-03  5:55                                                       ` Markus Elfring
2025-08-03  7:55                                                       ` Markus Elfring
2025-08-04 10:55             ` [cocci] Searching for questionable call pairs " Markus Elfring
2025-08-04 11:25               ` [cocci] Searching for lock calls without unlocking " Markus Elfring
2025-08-06  9:30               ` [cocci] Searching for repeated actions " Markus Elfring
2025-07-24 18:37 ` [cocci] Searching for questionable call pairs " Markus Elfring
2025-07-25  7:06 ` 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=alpine.DEB.2.22.394.2508021541010.3428@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=karanja99erick@gmail.com \
    /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.