From patchwork Fri Aug 24 21:15:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10575905 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC76C920 for ; Fri, 24 Aug 2018 21:15:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A147F2CD17 for ; Fri, 24 Aug 2018 21:15:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BE8B2CD1B; Fri, 24 Aug 2018 21:15:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F8702CCEF for ; Fri, 24 Aug 2018 21:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726992AbeHYAv5 (ORCPT ); Fri, 24 Aug 2018 20:51:57 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33869 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726896AbeHYAv5 (ORCPT ); Fri, 24 Aug 2018 20:51:57 -0400 Received: by mail-pg1-f194.google.com with SMTP id u10-v6so3106321pgr.1 for ; Fri, 24 Aug 2018 14:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=mh2KZDxgLOR5rF7CDKH71tMjDPkgT4/FlTyA6n+EiYc=; b=jZ51C+XCTTDYofziMtss28BT0xMMUgYBWA1wXOCBGVu6KJqYJTCd72oKnYSJ7oe2Kb 8ODFqrD5ssVX18tIIoRAdCoeFt1n9qImmpRZiDg7UJWgzAxxd7RAzMUjvDS7ELyNn66n l0+RQQQlmH+BzyCF83rjUteVG0Xt4eQyfNFM0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=mh2KZDxgLOR5rF7CDKH71tMjDPkgT4/FlTyA6n+EiYc=; b=o/m5AdJJ7dszKus8oZjLbryihsnpsRWeJRJQ66ofz4F6F+FSIvNT/+xqn0M09nTqBn 7JDhIni8n1dSafsp4rkQ1afsbPdGzlwVox3tL4dri+Ffx1/BH9qfzuQKDCbJracg7hxB 8Doqimlm/2mJOCR/OxMvDwXZVaLKu+J19M8rH8Vpc0Xk/wwNWXC+SIDmijjTJ8E7gzV4 iFVXljVJ5Bk5rGU3DPXSu5XufCw09HcmfuD37jvDoHn5MFjNsa4+sXzfyzot/YW6B6k2 WP07PfbITRon2EMugCCJAEQJhF7O6cN/1MvbLzCxmuSPpkGwX9e0Wey6asVR2SkYWLyF SApw== X-Gm-Message-State: APzg51Ajy7bhy+CAHJ6W04njMpSq80QgsXPLolY6mi8rxKNZLc48oejH SY1RI2TaInql+Mw9uR/LfbbIlQ== X-Google-Smtp-Source: ANB0VdZyE6iLpBpoNPTtiLzaSvpse3hciHF6lq/l5Y9KIaTf9OX+xg46CTIsHVY4xDH+mrHF5vg1TQ== X-Received: by 2002:a65:5004:: with SMTP id f4-v6mr3155005pgo.54.1535145338285; Fri, 24 Aug 2018 14:15:38 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id v8-v6sm11092901pff.120.2018.08.24.14.15.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Aug 2018 14:15:37 -0700 (PDT) Date: Fri, 24 Aug 2018 14:15:35 -0700 From: Kees Cook To: Jens Axboe 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() Message-ID: <20180824211535.GA22251@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: linux-block@vger.kernel.org Signed-off-by: Kees Cook --- 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; }