Message ID | 2a6c6cbd-ccc6-ee89-99ca-c0267cf17ec0@sandisk.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show
Return-Path: <linux-btrfs-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B3BC60231 for <patchwork-linux-btrfs@patchwork.kernel.org>; Wed, 14 Sep 2016 09:01:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECACD29AA1 for <patchwork-linux-btrfs@patchwork.kernel.org>; Wed, 14 Sep 2016 09:01:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E183D29B2D; Wed, 14 Sep 2016 09:01:30 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable 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 1DDA629AA1 for <patchwork-linux-btrfs@patchwork.kernel.org>; Wed, 14 Sep 2016 09:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756073AbcINJBY (ORCPT <rfc822;patchwork-linux-btrfs@patchwork.kernel.org>); Wed, 14 Sep 2016 05:01:24 -0400 Received: from mail-by2nam03on0083.outbound.protection.outlook.com ([104.47.42.83]:20256 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751433AbcINJBW (ORCPT <rfc822;linux-btrfs@vger.kernel.org>); Wed, 14 Sep 2016 05:01:22 -0400 X-Greylist: delayed 887 seconds by postgrey-1.27 at vger.kernel.org; Wed, 14 Sep 2016 05:01:22 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sandiskcorp.onmicrosoft.com; s=selector1-sandisk-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=zk5DpLE6wnwB45ILBzNGkrPwRs3P06CC5tihOimDNBk=; b=tmQO9yKr12SkMwXqHIJ2Zt1ca2yIW+dUVP7mE446l6URJkC2BO6mKG8D3nG0XEin/d3RY7QMg2TNRLIDY2Vs8qxBL9XMb+nyCFvZaYHiSWPCurSIaQUu1OPKNF6Nph8mYh4+MJvHUqQqYzlEG4eYGqlRrWxN5gMeOmfs/fJMgoM= Received: from BLUPR0201CA0031.namprd02.prod.outlook.com (10.163.116.41) by BN6PR02MB2740.namprd02.prod.outlook.com (10.175.95.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.619.10; Wed, 14 Sep 2016 08:46:31 +0000 Received: from BY2FFO11OLC011.protection.gbl (2a01:111:f400:7c0c::180) by BLUPR0201CA0031.outlook.office365.com (2a01:111:e400:52e7::41) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.8 via Frontend Transport; Wed, 14 Sep 2016 08:46:31 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.21) smtp.mailfrom=sandisk.com; sharedspace.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; sharedspace.mail.onmicrosoft.com; dmarc=bestguesspass action=none header.from=sandisk.com; sharedspace.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.21 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.21; helo=milsmgep15.sandisk.com; Received: from milsmgep15.sandisk.com (63.163.107.21) by BY2FFO11OLC011.mail.protection.outlook.com (10.1.15.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.619.6 via Frontend Transport; Wed, 14 Sep 2016 08:46:31 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id E6.72.26959.13C09D75; Wed, 14 Sep 2016 01:37:06 -0700 (PDT) Received: from milsmgip12.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.301.0; Wed, 14 Sep 2016 01:46:27 -0700 X-AuditID: 0ac94369-ef8199800001694f-ba-57d90c31751e Received: from exp-402881.sandisk.com ( [10.177.8.100]) by (Symantec Messaging Gateway) with SMTP id D3.CF.03606.F5E09D75; Wed, 14 Sep 2016 01:46:27 -0700 (PDT) Subject: [PATCH 3/3] block: Improve bio_set_op_attrs() robustness To: Jens Axboe <axboe@fb.com> References: <35e3cdd6-8983-6c84-cb4c-9a7be15aea55@sandisk.com> CC: Mike Christie <mchristi@redhat.com>, Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>, Mike Snitzer <snitzer@redhat.com>, Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>, Damien Le Moal <Damien.LeMoal@hgst.com>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>, device-mapper development <dm-devel@redhat.com> From: Bart Van Assche <bart.vanassche@sandisk.com> Message-ID: <2a6c6cbd-ccc6-ee89-99ca-c0267cf17ec0@sandisk.com> Date: Wed, 14 Sep 2016 10:46:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <35e3cdd6-8983-6c84-cb4c-9a7be15aea55@sandisk.com> Content-Type: text/plain; charset="utf-8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rJJSc3JLEst0rdL4Mr423CPvWAKf0XbygVs DYxLeboYOTkkBEwkWu58YAOxhQQWM0p87C4DsYUFHCXuntvGBGKLCMhKfN/9GqrGTuL+sROM IDazwEJmicOHLUFsNgEjiW/vZ7KA2LxANZv+PAerYRFQlXj2sBesV1QgQuLWww6oGkGJkzOf gNmcAvYSrU86oWaqS/yZd4kZwpaX2P52DvMERr5ZSFpmISmbhaRsASPzKkax3Myc4tz0zAJD I73ixLyUzOJsveT83E2M4BDnjNrBeH2i+SFGJg5OqQbGPX3pbpN3/DDfv6j5+Sop7c+KwjOO NIRV3XFby/QmOoZvgWRVil9co5/J3kl8U14KVuVdyjCVe39DXP1OhCWXdc0fVsl5/0R8H+++ 68+yP9s6t2nv6plHVt6/v2nLj33Lvsy4t2mfql7a9puOLXea5vnHdQuHV3o8ulmqm7eh33um dcfsdf+OKbEUZyQaajEXFScCAPReRekhAgAA X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(97736004)(19580405001)(110136003)(7846002)(230700001)(106466001)(356003)(586003)(19580395003)(229853001)(4001350100001)(8936002)(4326007)(53416004)(92566002)(64126003)(31686004)(189998001)(87936001)(8676002)(65826007)(81166006)(81156014)(23676002)(47776003)(33646002)(2950100001)(77096005)(86362001)(54356999)(31696002)(11100500001)(69596002)(305945005)(50466002)(2906002)(50986999)(2270400002)(76176999)(68736007)(65806001)(5660300001)(7416002)(65956001)(83506001)(626004)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR02MB2740; H:milsmgep15.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC011; 1:dyCcBxHpYlgvx/4gKfaO8cX/peNkFRJ788pue9a0jHak90ysMgVkYm+RMaj41JRyVo49iA7NQjXswXEUNM9lrNjpbwwHM6DNUJR8smliTP2ezdAuKmCyBIgCjzYuTk8e3XR+Ia3mNVuzmlJO3z2U/7YQySrYisnQJvpK6Ei/y9CJhrOr6YkvBDB73F6xXCoQCbCZdPgSQKjH4oao6Jizf82uKyn8NqU1bFfXpntiAJbBy7nD6cGb631IcGK/R/YoonlIntJbZqEHWv6vhkEghRTTdz841j3sz4e9/pnYR+ZcgO8TXVivddt7dnXtuRAtBmsSxjsobptCQ2ldQLy0xg0szTagh7Y2ymHGTVcvobliKMK2odIa+fp5ryn+dj5X9034w949Q6Djc8teHwv1i7MedDjaV8T5Bro+4TZ1HXeEmDKvs79mw8ckPJA6coLBYCqVor0nWoiO4xzOxX44g6LP6FAR9ZQm1K1nAKUrj27GJUHtf8vy/EWtmXClrxq+Cg1mrAbpLP7M5XuT7OsWjA== X-MS-Office365-Filtering-Correlation-Id: 972daea8-a20b-43c1-a3c2-08d3dc7b9fe9 X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB2740; 2:im620usFCE/h69XFJbeVLhoMdwGkUfcqQM50WQcOy5Y4wBmNXGgGGnGTpqWJ5nfhFMDL0Aw2oc+IAVQ2djraqmsBCGHmdkxt4USiGFceUXbbzDcwpyULQjtizOWCeojtBqycQLPCkXO9ijOiflpjTDt51v0/G9fcfwE58VgVHkXr6/q6jKy79vU6VEiT2B5M; 3:DH36EipIwFBJsrDMvM7ckE+0RaKQolyUD3fFpCaAFkfTic/imlrih0ceMkRKNWQ14WqFmVZZQ9p+PKoBfueSK39FU5NYYu8lvj3Peyu0OsWviqADzGzbGVjZQcIL24vVtaIJ4CcJsR9CeN9eV2YqBqw1SN+QbNM0pawV4ppIUSeG9qadEd9aET8dNVzVg+fda+EoVId0yD+RzXFQU92GaDSM8u4DOcqPaSGEFJJ2TwDbAvUWtBU38v7vnqGT2srNOaVIJohjZdIhVv1m7ptR8Q==; 25:qtkI9A61XWEKABDlOvnKzTJ1mtZkzSg2rVNycd7Zu3l838Wn/Yft1uQyyf8lWMQvmI+I13w0J6Vs44w4mvEPo0bRf6dzpVZL3tSCRkGzAJnj7McD9l8ujcPW8BfMcipJeGpQ12Rgj4YLtWCRozSzwX1pTmlQuTc1xaaksU+4Wz4oodOgzXheCjyplzIce0rWgEAMJRFOZKe6LljCqr4fZ3+c8s1wMc90yhBHmGSn9c9WkVIWj5HbE2ZPX5zXd32VXzE14pMoHJSHDxfYIr2d451xuVNvLwfQh55gfpM1860BWb8CTzTrzcjUMhLlyrCvgfRyxGsjRBMjYB6IsiR43fR4QY+bpZIhqiROigt0WwIcJHVHgwiY33d+VmYr6QmRISNHOqJlRqeuu1GivyAtzR57IZGUm4RHwwdyw24A9F4= X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BN6PR02MB2740; X-LD-Processed: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB2740; 31:EQmlc2cSK951DrnBf6SgkGaUjp+gXc1PrkgEB9Ks1UcSFpYUw5LveSv2LrmVLzpsDjRZBR76xpUo64x4bUTbz4zlCqPOMNv9zCAvM9b+vXATZ5R4B4jKl/8HIoJTtoUf1D1OnDZsX83PPPmuEgP1rPx5rU7DmYm7RCI3MNHG3CDW9O5VlapqYxIDiFxjg8cjL+wWuji0GoFu/qerqA6UGQNaePBJ6seeIbpGGx5KTkc=; 20:FkfGHrJLg6ThgZRscna3nQY/dqidYRdR20UcZR7RtjglsfrIUg3BeZcXSmYxRIgJLiK0MU4DXnjoiYASohximP26/92/2IHkUVi4ZII5O8+wl8Akxba/Wf/HkddRE2vYUeG2k9ImsSL1t/L+AHNMltjm5ZWayh0YAHf/9qY5z9ZwycBE4gxs0x1PHPoJWfC6KELkJFjSn/DSkpO1uYsbW/cdgKsaAjvdhC7nTuzGJEi64l92iiEIOSKWSq9EvuoX8L6i4gS10aSzR/52Tc+CpMW2E8bEZKOwwPzkj9EF7paBFm53zco69b0U4+UoCclyZqUtPJOlRkI7Pck28psiEVgHJWJes1DWp5Jg+CpFj2aeykPY6uO7vz9M1C/HOtXPzQt7++IJkglN/l2/wEpZdwEbKEyEL6sC20rmxXbonUB6cMBv32Se0p7jtRqBzTX7hb2a8uK8LSpJjSooZJeBsJnY5XvNYd3IQMVRMtMTfjMzOn7y1ozmYuSGSNrwb19I X-Microsoft-Antispam-PRVS: <BN6PR02MB27407891A5C8199ABCAA067581F10@BN6PR02MB2740.namprd02.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(79135771888625)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(13016025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BN6PR02MB2740; BCL:0; PCL:0; RULEID:; SRVR:BN6PR02MB2740; X-Microsoft-Exchange-Diagnostics: 1; BN6PR02MB2740; 4:hb3cfLuBezTj9VkfukuQP0w9n8m7uQV2SrZOi95vT8bkZKywgQvmGfGqh2vI/Ghz18m/0FyzzNVTRuiyV6rzWrnA56rq46ecRNLwyDs7ELmWqaSbWwk9LtNNZY+r5mhDKCU2GWfLHQ/8C1VRRRbI7/0VdVa8P+J457v91w6PL+CaOurwL4uMfkkzZ366BkEld0ZSduM4+LeGLD7KxkuRokmH1GQ08YmRM6H44LEts01d0f/75BX4JC7YV42Cnr09DRdoAqPj622I+WxjRRkN6PCy9+kJn6imNkqNm8QJ1n8gAKVA0LJcnnil9g7Jfc+9afDfJuel4q+tHz/bdobIvcZe0/aYedVQgQJ7JZd4NuNzqkzgNxLrfqADu7cxo0FSWZmmFQCKgbaLHXGHxxH4d3a0OBQ+gJwbdeNMFG1puLmCyqj7G03vl9//jXqK+EZDkEXPn9juwHy5ldpiHcntYgpRK5+7BE1YdvymU4hktVR1W5P0KHoJQep1xm7XhgkPp9iB4J08SNr9qGOjae3xNg== X-Forefront-PRVS: 006546F32A X-Microsoft-Exchange-Diagnostics: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LFWPO+8Scx/UuClyr3uJbng8gJtpyCAwKz78fm+4nchT0VBbsh2OJ4EbrbvhMGX3sowZ9VSPCTeUlp574Mt0BYiozczRdD9ed X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2016 08:46:31.0257 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.21]; Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2740 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: <linux-btrfs.vger.kernel.org> X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
On Wed, Sep 14, 2016 at 10:46:22AM +0200, Bart Van Assche wrote: > Since REQ_OP_BITS == 3 and __REQ_NR_BITS == 30 it is not that hard > to pass an op_flags argument to bio_set_op_attrs() that is larger > than the number of bits reserved for the op_flags argument. Complain > if this happens. Additionally, ensure that negative arguments trigger > a complaint (1 << ... is signed while 1U << ... is unsigned; adding > 0U to an integer expression causes it to be promoted to an unsigned > type). And this does the proper check. Reviewed-by: Christoph Hellwig <hch@lst.de> -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 311fa2f..53ee1a2 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -93,11 +93,18 @@ struct bio { #define bio_flags(bio) ((bio)->bi_opf & ((1 << BIO_OP_SHIFT) - 1)) #define bio_op(bio) ((bio)->bi_opf >> BIO_OP_SHIFT) -#define bio_set_op_attrs(bio, op, op_flags) do { \ - WARN_ON(op >= (1 << REQ_OP_BITS)); \ - (bio)->bi_opf = bio_flags(bio); \ - (bio)->bi_opf |= ((unsigned int) (op) << BIO_OP_SHIFT); \ - (bio)->bi_opf |= op_flags; \ +#define bio_set_op_attrs(bio, op, op_flags) do { \ + if (__builtin_constant_p(op)) \ + BUILD_BUG_ON((op) + 0U >= (1U << REQ_OP_BITS)); \ + else \ + WARN_ON_ONCE((op) + 0U >= (1U << REQ_OP_BITS)); \ + if (__builtin_constant_p(op_flags)) \ + BUILD_BUG_ON((op_flags) + 0U >= (1U << BIO_OP_SHIFT)); \ + else \ + WARN_ON_ONCE((op_flags) + 0U >= (1U << BIO_OP_SHIFT)); \ + (bio)->bi_opf = bio_flags(bio); \ + (bio)->bi_opf |= (((op) + 0U) << BIO_OP_SHIFT); \ + (bio)->bi_opf |= (op_flags); \ } while (0) #define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs)
Since REQ_OP_BITS == 3 and __REQ_NR_BITS == 30 it is not that hard to pass an op_flags argument to bio_set_op_attrs() that is larger than the number of bits reserved for the op_flags argument. Complain if this happens. Additionally, ensure that negative arguments trigger a complaint (1 << ... is signed while 1U << ... is unsigned; adding 0U to an integer expression causes it to be promoted to an unsigned type). Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Cc: Mike Christie <mchristi@redhat.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Damien Le Moal <damien.lemoal@hgst.com> --- include/linux/blk_types.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)