From: Ming Lei <tom.leiming@gmail.com>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-block <linux-block@vger.kernel.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: Re: [PATCH 1/8] Guard bvec iteration logic
Date: Fri, 31 Mar 2017 16:21:40 +0800 [thread overview]
Message-ID: <CACVXFVPNpZgo4-Hjbg0_BN2Xby-P4R_zcWTR_MDN_v+8TGM3sw@mail.gmail.com> (raw)
In-Reply-To: <1490881776-28735-2-git-send-email-dmonakhov@openvz.org>
On Thu, Mar 30, 2017 at 9:49 PM, Dmitry Monakhov <dmonakhov@openvz.org> wrote:
> If some one try to attempt advance bvec beyond it's size we simply
> dump WARN_ONCE and continue to iterate beyond bvec array boundaries.
> This simply means that we endup dereferencing/corrupting random memory
> region.
>
> Code was added long time ago here 4550dd6c, luckily no one hit it
> in real life :)
>
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
> include/linux/bvec.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/linux/bvec.h b/include/linux/bvec.h
> index 89b65b8..86b914f 100644
> --- a/include/linux/bvec.h
> +++ b/include/linux/bvec.h
> @@ -70,8 +70,7 @@ static inline void bvec_iter_advance(const struct bio_vec *bv,
> struct bvec_iter *iter,
> unsigned bytes)
> {
> - WARN_ONCE(bytes > iter->bi_size,
> - "Attempted to advance past end of bvec iter\n");
> + BUG_ON(bytes > iter->bi_size);
This may not a good idea, especially Linus did not like BUG_ON(), please see the
following link:
https://lkml.org/lkml/2016/10/4/1
Thanks,
Ming Lei
next prev parent reply other threads:[~2017-03-31 8:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-30 13:49 [PATCH 0/8] block: T10/DIF Fixes and cleanups Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 1/8] Guard bvec iteration logic Dmitry Monakhov
2017-03-31 8:21 ` Ming Lei [this message]
2017-03-30 13:49 ` [PATCH 2/8] bio-integrity: Do not allocate integrity context for bio w/o data Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 3/8] bio-integrity: save original iterator for verify stage Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 4/8] bio-integrity: bio_trim should truncate integrity vector accordingly Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 5/8] bio-integrity: fix interface for bio_integrity_trim Dmitry Monakhov
2017-03-30 13:49 ` [PATCH 6/8] bio-integrity: add bio_integrity_setup helper Dmitry Monakhov
2017-03-31 22:15 ` kbuild test robot
2017-03-30 13:49 ` [PATCH 7/8] T10: Move opencoded contants to common header Dmitry Monakhov
2017-03-31 22:09 ` kbuild test robot
2017-03-30 13:49 ` [PATCH 8/8] tcm_fileio: Prevent information leak for short reads Dmitry Monakhov
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=CACVXFVPNpZgo4-Hjbg0_BN2Xby-P4R_zcWTR_MDN_v+8TGM3sw@mail.gmail.com \
--to=tom.leiming@gmail.com \
--cc=dmonakhov@openvz.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).