Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp147725rdb; Mon, 18 Sep 2023 10:33:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIksqdiMFawsFGAdRFyeItalbGl3agfOciZJ4MDOoNq4ZxhiYS6vy83Lwy61GV2rOtnSzd X-Received: by 2002:a17:90b:2396:b0:273:fa72:ba83 with SMTP id mr22-20020a17090b239600b00273fa72ba83mr7600338pjb.47.1695058417606; Mon, 18 Sep 2023 10:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695058417; cv=none; d=google.com; s=arc-20160816; b=KdHrfKMLJXuYXmnSOtihZSV+hTGbN6ncAvTB3e/D7EkusuAxqlElqClBRX+2U3GOjc of1h34mTd+ffuLIFHX6yJzUcNuQOBgv7QClG3A5cO0vtGJMf40U1qYkYgSdLVzLgfVMu 1V9UsX4O1nSjUxvXgLvZY83h3G6ZMju/TYDuzt4Qpe3Cdxf1+hw5m2LkEvbKIvTchi7A Fk5DB/6jYh5YUoLR5df84+bsZ5rXziia1UNZjobtWiJ7CuCckE7IxRXl7AUQ36nk4Haa 5tdvgGBNItJrxVjDQBESVnv3bo+1nSFWKBT2/w9Eyf5rjTbs3HIaU+uDI2G0UcI1fwVm IiEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=AJdGHYJg1hgtR/OBv+kksXjfIjKSJaQgEUNRz4rnSZ4=; fh=C8RCbcoh/pSEIyuJ+iZpicv2L1pFfzjBT2WXpjQrDBY=; b=IixpGQPWtfQVKlNcvweSbBHjY01C2Gv6TbFzp3DJb+aRy0vQVNlw1aQUBu+umoscpQ MyPl5t1P8y1B6IlXsTI/m1PFN5O3dWHAMAPkKikfp+F3BHtlYFttdfMbVnhl9v3Wn6M+ /C+i+Ea/TGj/CBYtH+l7gEcM/13RIkvDx4vuk29btAwBMvzqYN4PtrslqA8OuIQkRdaj M2BRU6djNNnNq943gLzq1VgN8uMFoY6cdWvYyKourSogahE66ET387uCBbalZdKu3s6d HJIAOR2llxSjz6k3S8HHljq8ffSj0uubK7fZxF9z5bzS8gouBjX74WjIT98xfaypyiX6 mH5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GmvybUmb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id p2-20020a17090a2d8200b0026d4adee541si10361355pjd.150.2023.09.18.10.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GmvybUmb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id DEED581D68F6; Sun, 17 Sep 2023 17:28:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234732AbjIRA0e (ORCPT + 99 others); Sun, 17 Sep 2023 20:26:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234032AbjIRA02 (ORCPT ); Sun, 17 Sep 2023 20:26:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311BC12C for ; Sun, 17 Sep 2023 17:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694996739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AJdGHYJg1hgtR/OBv+kksXjfIjKSJaQgEUNRz4rnSZ4=; b=GmvybUmbNk8i2sLKHAOQ32EYyqORBflUfHrtEJ7Jl3jrkIDbRxRMZs2rkTWI5TzA3gEV3I CiavIzGjOTojrxEHBjMnh69I0A+udoNebwV3ypt5Q5kWpsanoCBAS+NbVMRvdOFoYa5vjV BlICdikFAN3lMizc57hZTXREia3pNFc= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-JKhDf9dGMQGiHL_l4dXNbQ-1; Sun, 17 Sep 2023 20:25:38 -0400 X-MC-Unique: JKhDf9dGMQGiHL_l4dXNbQ-1 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-27484fabc22so2135040a91.3 for ; Sun, 17 Sep 2023 17:25:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694996737; x=1695601537; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AJdGHYJg1hgtR/OBv+kksXjfIjKSJaQgEUNRz4rnSZ4=; b=PdPf/+aL3l03IrQ++KX2m/wh5zGsK3J/gVSUrC1ITnO+GVz0Osg5tArA2GBHAUtLq+ sMJ8BY+7sAYUz+Itl4fmMvSZL+1LFw+rN6zo6eY5BV51epq7toX3IjkAGc24pLHgu1q8 6SmbdvM5kWCtnrjUm+c0zIXSzc88I3UCmEL1t+UuNF//w4K4nh7Rl4s8+FUXvKGYGKxg jPLaeI1vimwMUHkVi+7gylvQjAwbpJ0batt5WEMkOLJs0bQvR6LrxftRii/pxfTehcQ3 tYgKObG68OBtYoe2cYyjULATZYoTTq8JUe+MAANHOsTXQK3hZHT/jsHgM0MnXmvEzLLv VKjg== X-Gm-Message-State: AOJu0Yyqjdr1/XquiWaS0Je6t8L7j1xBVNKyKCIsMicZYq8NDvXPFuLp 0lN1/dm5Z1g4BIiYkJW+OwQ87Lr9J6VCYA34XNPSnab48nu5dO2Of4vHDRMSjQBTDIsFN10YvC9 td3v6H2dR5yTFM/RvcH4lUPO7 X-Received: by 2002:a17:90a:fd0f:b0:26d:2b42:cdae with SMTP id cv15-20020a17090afd0f00b0026d2b42cdaemr5172612pjb.3.1694996737001; Sun, 17 Sep 2023 17:25:37 -0700 (PDT) X-Received: by 2002:a17:90a:fd0f:b0:26d:2b42:cdae with SMTP id cv15-20020a17090afd0f00b0026d2b42cdaemr5172602pjb.3.1694996736663; Sun, 17 Sep 2023 17:25:36 -0700 (PDT) Received: from [10.72.113.158] ([43.228.180.230]) by smtp.gmail.com with ESMTPSA id q8-20020a17090a178800b0026f39c90111sm6713718pja.20.2023.09.17.17.25.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Sep 2023 17:25:35 -0700 (PDT) Message-ID: <246eda77-09c9-ae8a-996a-44d69fca84a4@redhat.com> Date: Mon, 18 Sep 2023 08:25:31 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] ceph: Annotate struct ceph_osd_request with __counted_by Content-Language: en-US To: Kees Cook , Ilya Dryomov Cc: Jeff Layton , ceph-devel@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org References: <20230915201517.never.373-kees@kernel.org> From: Xiubo Li In-Reply-To: <20230915201517.never.373-kees@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 17 Sep 2023 17:28:32 -0700 (PDT) On 9/16/23 04:15, Kees Cook wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct ceph_osd_request. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Ilya Dryomov > Cc: Xiubo Li > Cc: Jeff Layton > Cc: ceph-devel@vger.kernel.org > Signed-off-by: Kees Cook > --- > include/linux/ceph/osd_client.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h > index bf9823956758..b8610e9d2471 100644 > --- a/include/linux/ceph/osd_client.h > +++ b/include/linux/ceph/osd_client.h > @@ -278,7 +278,7 @@ struct ceph_osd_request { > int r_attempts; > u32 r_map_dne_bound; > > - struct ceph_osd_req_op r_ops[]; > + struct ceph_osd_req_op r_ops[] __counted_by(r_num_ops); > }; > > struct ceph_request_redirect { Reviewed-by: Xiubo Li Thanks! - Xiubo