Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp3591654rdh; Thu, 28 Sep 2023 17:12:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjzda0+LPpv7NK4J5s4MXXllxQADBGiKnbUAlYfQo2YRAmNOxNok/D9GTwfDIDztZqCJWT X-Received: by 2002:a05:6a20:a110:b0:135:38b5:7e58 with SMTP id q16-20020a056a20a11000b0013538b57e58mr3005595pzk.37.1695946339985; Thu, 28 Sep 2023 17:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695946339; cv=none; d=google.com; s=arc-20160816; b=qX3y9Bc8GodB/cb1lV6li7W1Oc8V2CtMKvUXg6DPVFKQozU4vwe6CULvPInOlS//p9 WdSz3fTtD4k7GYt4D8rmPmr/foLNyBH0T8I4x4K+Mu7cJeskcGScAb9jz1VUwfg4Hsy9 ZxteN5W90ALV9cU+TvrtBHbEd47F3hQY1iHSxAsGoV7MuuyF/DtPbVO/mJMIG4nFCNNR GsEXyBk7kEvlNbqSOTGolUw7Bu4HF2IVqMKbQ/Wx5WDDnM5TcL94LdMIFnifOc+6tQVk iWFvRdZwu6sp4zTKvQh+nR+9r3mFpeaHGSeMVMDRabDgTltlnaRdiI5hqNxNuM8iDQIw 7mAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zMGjwo4JgaFeiq+zEmjwtYYKC8M3XQ2E3zEbRSN8O1A=; fh=EuqADQ/riqltfqxTnvMhtLY6+XlZ83AQkXXhx38tWyU=; b=aHRdnApAtlhLvbYyEPN+mGiq4Tf5aQYzyuJwZIs4DjxVcMxbqpv0vNo+my6JS3//Fy 3wbJg+D4saBXIrOXVqnha3W9RerqH4tBuc9WmkwKtF0aP/VnPlY87Uh3Gnsyy86kyKDq ngHaRhROCQoTKzNHrAuSDDGXixTokqKQSDPoQfJlOAhX/5bS5BZlEbd/6X7pKtnfTrYP DhROdxMnVpqn5dpklfY+Oz0VGxqFQIEqA6g6BUB/SF/AQslsuGI8LrMP+plSkUs0gxtR xSFAOWsaqGu46ADhIiGhEhNrGol1YCz1P8N8s8WXjd25SVvyBwFxxIRCCMSIO73UBBDP rTFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=KNYbvVMY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hpe.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id mh6-20020a17090b4ac600b002736ff3cc79si372789pjb.23.2023.09.28.17.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 17:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=KNYbvVMY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=hpe.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B18C3801DB64; Thu, 28 Sep 2023 10:33:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbjI1Rdb (ORCPT + 99 others); Thu, 28 Sep 2023 13:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjI1Rd2 (ORCPT ); Thu, 28 Sep 2023 13:33:28 -0400 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA56DD; Thu, 28 Sep 2023 10:33:25 -0700 (PDT) Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38SHWKLo005511; Thu, 28 Sep 2023 17:32:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=pps0720; bh=zMGjwo4JgaFeiq+zEmjwtYYKC8M3XQ2E3zEbRSN8O1A=; b=KNYbvVMYBYjGSnlNifo2nFf8YNsS4JPNxgEkskOiMg3EvAH0ikxJ/UDp/wwBJUePVIqQ Vd1KpY0uVjveavekAyO1zNJw6YiLXBrW4Vl/0bYmBMhEMR0P5HiwbhEyDaJE0Z6knz5k HpK9GPVUslRVlNqZUD9h6HLSGmVj66wBFeimSX2o7dSrLJizghOFMSsg+q/Bm79Vvkqj ZZ+UVLNoWGtThHSL/wuiySxCcEMKlM3Hmf6KV35VkM4YmRyjHw03CT0FpzItHX4DUi0H bB2oL9NrUmLybUcz5xeNZR4Cnqu0w1JNKdHuiNqA3EZ7pIlteJ1AQfatcaimq0ukDsm7 iQ== Received: from p1lg14881.it.hpe.com ([16.230.97.202]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3tdbgg1hag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Sep 2023 17:32:23 +0000 Received: from p1lg14885.dc01.its.hpecorp.net (unknown [10.119.18.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14881.it.hpe.com (Postfix) with ESMTPS id 99832805E57; Thu, 28 Sep 2023 17:32:21 +0000 (UTC) Received: from swahl-home.5wahls.com (unknown [16.231.227.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTPS id 0667A813810; Thu, 28 Sep 2023 17:32:18 +0000 (UTC) Date: Thu, 28 Sep 2023 12:32:17 -0500 From: Steve Wahl To: Kees Cook Cc: Steve Wahl , Dimitri Sivanich , Russ Anderson , Darren Hart , Andy Shevchenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , platform-driver-x86@vger.kernel.org, Justin Ernst , Kyle Meyer , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH] x86/platform/uv: Annotate struct uv_rtc_timer_head with __counted_by Message-ID: References: <20230922175151.work.118-kees@kernel.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230922175151.work.118-kees@kernel.org> X-Proofpoint-ORIG-GUID: I9OyhDCJxtf1u8SrtUrYsGnhjBLOHgpZ X-Proofpoint-GUID: I9OyhDCJxtf1u8SrtUrYsGnhjBLOHgpZ X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-28_16,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309280152 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 28 Sep 2023 10:33:44 -0700 (PDT) On Fri, Sep 22, 2023 at 10:51:51AM -0700, 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 uv_rtc_timer_head. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci > > Cc: Steve Wahl > Cc: Mike Travis > Cc: Dimitri Sivanich > Cc: Russ Anderson > Cc: Darren Hart > Cc: Andy Shevchenko > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: x86@kernel.org > Cc: "H. Peter Anvin" > Cc: platform-driver-x86@vger.kernel.org > Signed-off-by: Kees Cook > > --- > arch/x86/platform/uv/uv_time.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c > index 54663f3e00cb..ff5afc8a5a41 100644 > --- a/arch/x86/platform/uv/uv_time.c > +++ b/arch/x86/platform/uv/uv_time.c > @@ -53,7 +53,7 @@ struct uv_rtc_timer_head { > struct { > int lcpu; /* systemwide logical cpu number */ > u64 expires; /* next timer expiration for this cpu */ > - } cpu[]; > + } cpu[] __counted_by(ncpus); > }; > > /* > -- > 2.34.1 Looks good, thanks. Reviewed-by: Steve Wahl -- Steve Wahl, Hewlett Packard Enterprise