From: Li Jinlin <lijinlin3@huawei.com>
To: <song@kernel.org>, <philipp.reisner@linbit.com>,
<lars.ellenberg@linbit.com>, <axboe@kernel.dk>, <hare@suse.de>,
<jack@suse.cz>, <ming.lei@redhat.com>, <tj@kernel.org>,
<mcgrof@kernel.org>, <mcroce@microsoft.com>
Cc: <linux-raid@vger.kernel.org>, <linux-block@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <drbd-dev@lists.linbit.com>,
<linfeilong@huawei.com>
Subject: [PATCH 0/3] Fix undefined behaviour during device synchronization
Date: Fri, 10 Dec 2021 13:17:04 +0800 [thread overview]
Message-ID: <20211210051707.2202646-1-lijinlin3@huawei.com> (raw)
md/drbd drivers use 'signed int' variable to track sync vs non-sync IO,
and judge whether sync IO needs to be throttled by signed comparison.
If the value of the variable is greater than INT_MAX or close to
INT_MAX, some undefined behavior may occur.
Fix by using 64bit signed integer type.
The v2 "md: Fix undefined behaviour in is_mddev_idle" patch
differences to v1:
- add ubsan info in message
- use 64bit signed integer type instead of long type;
- move sync_io variable form struct gendisk to struct md_rdev, and
modify md_sync_acct() and md_sync_acct_bio() to fit for this change.
Li Jinlin (3):
md: Fix undefined behaviour in is_mddev_idle
drdb: Fix undefined behaviour in drbd_rs_c_min_rate_throttle
drdb: Remove useless variable in struct drbd_device
drivers/block/drbd/drbd_bitmap.c | 2 +-
drivers/block/drbd/drbd_int.h | 5 ++---
drivers/block/drbd/drbd_main.c | 3 +--
drivers/block/drbd/drbd_receiver.c | 12 ++++++------
drivers/block/drbd/drbd_state.c | 1 -
drivers/block/drbd/drbd_worker.c | 5 ++---
drivers/md/md.c | 6 +++---
drivers/md/md.h | 13 +++++++++----
drivers/md/raid1.c | 4 ++--
drivers/md/raid10.c | 24 ++++++++++++------------
drivers/md/raid5.c | 4 ++--
include/linux/genhd.h | 1 -
12 files changed, 40 insertions(+), 40 deletions(-)
--
2.27.0
next reply other threads:[~2021-12-10 4:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 5:17 Li Jinlin [this message]
2021-12-10 5:17 ` [PATCH v2 1/3] md: Fix undefined behaviour in is_mddev_idle Li Jinlin
2021-12-10 6:45 ` Hannes Reinecke
2021-12-10 7:17 ` Damien Le Moal
2021-12-10 8:46 ` Li Jinlin
2021-12-10 5:17 ` [PATCH 2/3] drdb: Fix undefined behaviour in drbd_rs_c_min_rate_throttle Li Jinlin
2021-12-10 5:17 ` [PATCH 3/3] drdb: Remove useless variable in struct drbd_device Li Jinlin
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=20211210051707.2202646-1-lijinlin3@huawei.com \
--to=lijinlin3@huawei.com \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linbit.com \
--cc=hare@suse.de \
--cc=jack@suse.cz \
--cc=lars.ellenberg@linbit.com \
--cc=linfeilong@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mcroce@microsoft.com \
--cc=ming.lei@redhat.com \
--cc=philipp.reisner@linbit.com \
--cc=song@kernel.org \
--cc=tj@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®