From: Stefan Hajnoczi <stefanha@redhat.com>
To: Alexander Bulekov <alxndr@bu.edu>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Mauro Matteo Cascella" <mcascell@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Bandan Das" <bsd@redhat.com>,
"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
"Darren Kenny" <darren.kenny@oracle.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Jon Maloy" <jmaloy@redhat.com>, "Siqi Chen" <coc.cyqh@gmail.com>
Subject: Re: [PATCH v5 3/4] checkpatch: add qemu_bh_new/aio_bh_new checks
Date: Thu, 26 Jan 2023 09:57:14 -0500 [thread overview]
Message-ID: <Y9KUynOHFXcmjXA7@fedora> (raw)
In-Reply-To: <20230126052558.572634-4-alxndr@bu.edu>
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
On Thu, Jan 26, 2023 at 12:25:57AM -0500, Alexander Bulekov wrote:
> Advise authors to use the _guarded versions of the APIs, instead.
>
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> ---
> scripts/checkpatch.pl | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 6ecabfb2b5..61bb4b0a19 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2865,6 +2865,14 @@ sub process {
> if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
> ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
> }
> +# recommend qemu_bh_new_guarded instead of qemu_bh_new
> + if ($line =~ /\bqemu_bh_new\s*\(/) {
> + ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
> + }
> +# recommend aio_bh_new_guarded instead of aio_bh_new
> + if ($line =~ /\baio_bh_new\s*\(/) {
> + ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
> + }
These checks should be limited to source code in hw/. Other directories
can use BHs without MemReentrancyGuard.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-01-26 14:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 5:25 [PATCH v5 0/4] memory: prevent dma-reentracy issues Alexander Bulekov
2023-01-26 5:25 ` [PATCH v5 1/4] " Alexander Bulekov
2023-01-26 20:54 ` Peter Xu
2023-01-26 5:25 ` [PATCH v5 2/4] async: Add an optional reentrancy guard to the BH API Alexander Bulekov
2023-01-26 5:25 ` [PATCH v5 3/4] checkpatch: add qemu_bh_new/aio_bh_new checks Alexander Bulekov
2023-01-26 14:57 ` Stefan Hajnoczi [this message]
2023-01-26 5:25 ` [PATCH v5 4/4] hw: replace most qemu_bh_new calls with qemu_bh_new_guarded Alexander Bulekov
2023-01-26 16:18 ` [PATCH v5 0/4] memory: prevent dma-reentracy issues Darren Kenny
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=Y9KUynOHFXcmjXA7@fedora \
--to=stefanha@redhat.com \
--cc=alxndr@bu.edu \
--cc=berrange@redhat.com \
--cc=bin.meng@windriver.com \
--cc=bsd@redhat.com \
--cc=coc.cyqh@gmail.com \
--cc=darren.kenny@oracle.com \
--cc=david@redhat.com \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=jasowang@redhat.com \
--cc=jmaloy@redhat.com \
--cc=kraxel@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mcascell@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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.