All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: syzbot+21cfe1f803e0e158acf1@syzkaller.appspotmail.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] block: Replace bio_check_ro()'s WARN_ON()
Date: Fri, 24 Aug 2018 14:15:35 -0700	[thread overview]
Message-ID: <20180824211535.GA22251@beast> (raw)

As described in commit 96c6a32ccb55a ("include/asm-generic/bug.h: clarify
valid uses of WARN()"), this replaces a userspace-reachable WARN_ON()
with pr_warn_once(). The reachability is even noted in the existing
comment. This appears to be an "expected by unlikely" condition, so
getting rid of the WARN_ON() means kernel fuzzers will stop reporting
the problem. Additionally un-breaks the error string so it can more
easily be found with grep.

Reported-by: syzbot+21cfe1f803e0e158acf1@syzkaller.appspotmail.com
Cc: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 block/blk-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index dee56c282efb..470c3cea8cb0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2166,11 +2166,9 @@ static inline bool bio_check_ro(struct bio *bio, struct hd_struct *part)
 	if (part->policy && (op_is_write(op) && !op_is_flush(op))) {
 		char b[BDEVNAME_SIZE];
 
-		WARN_ONCE(1,
-		       "generic_make_request: Trying to write "
-			"to read-only block-device %s (partno %d)\n",
+		/* Older lvm-tools actually triggers this. */
+		pr_warn_once("Trying to write to read-only block-device %s (partno %d)\n",
 			bio_devname(bio, b), part->partno);
-		/* Older lvm-tools actually trigger this */
 		return false;
 	}
 
-- 
2.17.1


-- 
Kees Cook
Pixel Security

             reply	other threads:[~2018-08-24 21:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-24 21:15 Kees Cook [this message]
2019-11-22 18:53 ` [PATCH] block: Replace bio_check_ro()'s WARN_ON() Kees Cook
2019-11-22 18:55   ` Jens Axboe
2019-11-22 18:57     ` Kees Cook
2019-11-22 19:07   ` Christoph Hellwig
2019-11-22 19:09     ` Jens Axboe
2019-11-22 19:14       ` Christoph Hellwig
2019-11-22 19:34         ` Kees Cook
2019-11-25 17:40           ` Christoph Hellwig

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=20180824211535.GA22251@beast \
    --to=keescook@chromium.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+21cfe1f803e0e158acf1@syzkaller.appspotmail.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.