From: no-reply@sashiko.virtuozzo.com
To: alexander.ivanov@virtuozzo.com,
Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 2/5] drivers/md/push_backup: clear pb->alive under pb->lock
Date: Mon, 2 Nov 2026 23:47:24 +0000 [thread overview]
Message-ID: <010701a19ea917be-61bfad2a-0e72-4b1f-b884-e385cc70a2c1-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261102233849.613155-3-andrey.zhadchenko@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] dm-push-backup: pb->alive KCSAN race only partly fixed, plain accesses remain
--
commit 9d9907f2e7f049fda97985539a4920b9e2e49764
Author: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
drivers/md/push_backup: clear pb->alive under pb->lock
This patch makes pb_message() take pb->lock around the store that clears
pb->alive when handling push_backup_stop. The aim is to avoid a possible
KCSAN report and to match other users of pb->alive.
Link: https://virtuozzo.atlassian.net/browse/VSTOR-152912
> diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c
> index 9a6252f2b21e..1ae4ccc208ff 100644
> --- a/drivers/md/dm-push-backup.c
> +++ b/drivers/md/dm-push-backup.c
> @@ -581,7 +581,9 @@ static int pb_message(struct dm_target *ti, unsigned int argc, char **argv,
> if (!pb->map)
> return -EBADF;
>
> + spin_lock_irq(&pb->lock);
> pb->alive = false;
> + spin_unlock_irq(&pb->lock);
> wake_up_interruptible(&pb->waitq); /* pb->alive = false */
> }
[Severity: Low]
Does this fully avoid the KCSAN report described in the commit message
("it may potentially trigger KCSAN")?
This store in pb_message() runs before ctl_rwsem is taken, so it holds
pb->lock but not ctl_rwsem. A concurrent push_backup_start() holds
ctl_rwsem but not pb->lock, so the two do not exclude each other:
push_backup_start()
if (pb->alive)
return -EEXIST;
That read is a plain read with no pb->lock and no READ_ONCE(), so it can
still race with the store above.
The wait_event condition used by push_backup_read() is also evaluated
without pb->lock. It reads the flag through pb_has_event():
!READ_ONCE(pb->alive) || !READ_ONCE(pb->map_bits) || ...
Here the reader is marked, but none of the writers use WRITE_ONCE(). The
stores in pb_message() (this patch), push_backup_stop(), and the
pb->alive = true store in the push_backup_start() setup path are all
still plain stores.
KCSAN can report a plain store racing with a lockless read, so taking
pb->lock around only this one store may not remove the report.
Would it make sense to use WRITE_ONCE() on the stores to pb->alive and
READ_ONCE() on the read in push_backup_start() (or take pb->lock for that
read)? The commit message could also be adjusted if the intent is only to
make the locking consistent.
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261102233849.613155-1-andrey.zhadchenko@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-02 23:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 23:38 [Devel] [PATCH 0/5] dm/push_backup: event fd interface and fixes Andrey Zhadchenko
2026-11-02 23:38 ` [Devel] [PATCH hci-8.1 1/5] drivers/md/push_backup: correct initialization Andrey Zhadchenko
2026-11-02 23:46 ` no-reply
2026-11-02 23:38 ` [Devel] [PATCH hci-8.1 2/5] drivers/md/push_backup: clear pb->alive under pb->lock Andrey Zhadchenko
2026-11-02 23:47 ` no-reply [this message]
2026-11-02 23:38 ` [Devel] [PATCH hci-8.1 3/5] drivers/md/push_backup: do not re-arm deadline timer in push_backup_write() Andrey Zhadchenko
2026-11-02 23:48 ` no-reply
2026-11-02 23:38 ` [Devel] [PATCH hci-8.1 4/5] drivers/md/push_backup: fix mod_timer() usage Andrey Zhadchenko
2026-11-02 23:47 ` no-reply
2026-11-02 23:38 ` [Devel] [PATCH hci-8.1 5/5] dm/push_backup: add event file descriptor interface Andrey Zhadchenko
2026-11-02 23:51 ` no-reply
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=010701a19ea917be-61bfad2a-0e72-4b1f-b884-e385cc70a2c1-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=alexander.ivanov@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.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.