Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1295191rdh; Mon, 25 Sep 2023 08:32:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy009HXCGVH95Eii3F5pz+LK71WVXufAN47MYRLUIX5Za6ssRqXIYBbwZ5YAdYKB3iyhCl X-Received: by 2002:a17:903:120b:b0:1c3:92de:1b23 with SMTP id l11-20020a170903120b00b001c392de1b23mr7458922plh.59.1695655925845; Mon, 25 Sep 2023 08:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695655925; cv=none; d=google.com; s=arc-20160816; b=RGnEii8XG5bfdPMnuX/bCp5iZeTw+8qqhGBKZpSgX2Enaxatq74K9eRYwe+DEmKcFj KCz4upDG5sm32oZA5Abe20M64FGr1su43lrE1m9d43p1Rq7IklEZjvrLfXKDA7BxIy17 6b8xwvREb86lFYusEC1P34KzvEXy5UYdaOfro9VhMEjs2i26nG4TX3sMbxVF2V7TeNFj epI7XpIcuUNTNpoW99lMBXM/K5vlmfRL6KdrX6iYYamkXe1LpTTYTqAnDf/Oe3p0Noa8 e7dH+vrxsheQpXfc6LznNE/tWMHdXc7t279KR5o8rN6N7jmijccYw9ocx3SuzTOiS3MI nFHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=kqSSfRt2FX1iJgBnNFLYuQcx0Izo1QKFxQpbwmgNxLk=; fh=9xi8jGpaX9pVAYpIscscyAONx58tSzm8S/6bD6m812I=; b=vruja6B2/aZdapzuY8s2Juk3Mb8K+a9TURjgID29IcPyKLvyW0dExlGLZYi5nM8Nf1 /HQLDtMIPXDab0D9VERYpzfnMpTzkMlws+F/5WGbdoHdAoxb/0i8OZjob7NJmgSnvxVG HKGjn8cXg68iAMszz7FYV8XH8cpdKvV3wYqXQThHQc5ZCfowlqwThKrp19pWc7cNbE6T ak7sH1HcWZlNU4iNet8nN737zUUCvbbvIm4DO8dkFm07MCplKqv8c3aRI0TEadXUsMxz wVETQFqSS7Cya1PTzTsJc+IiemBtE7U+x9BYDPdzJuyTMfg9oKboQttkd5P2sunzJtDj tZ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=ZeAg6Ywp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e17-20020a17090301d100b001c1e1fe16c7si11471032plh.236.2023.09.25.08.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:32:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=ZeAg6Ywp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A5A2D8087271; Mon, 25 Sep 2023 00:43:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232361AbjIYHnS (ORCPT + 99 others); Mon, 25 Sep 2023 03:43:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232324AbjIYHnP (ORCPT ); Mon, 25 Sep 2023 03:43:15 -0400 Received: from mail-ua1-x92f.google.com (mail-ua1-x92f.google.com [IPv6:2607:f8b0:4864:20::92f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37577E3 for ; Mon, 25 Sep 2023 00:43:08 -0700 (PDT) Received: by mail-ua1-x92f.google.com with SMTP id a1e0cc1a2514c-7a29ef55d5fso2128725241.3 for ; Mon, 25 Sep 2023 00:43:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1695627787; x=1696232587; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=kqSSfRt2FX1iJgBnNFLYuQcx0Izo1QKFxQpbwmgNxLk=; b=ZeAg6Ywp1qkdnd1zKcQx2etQeb/PPE0/F7vJtTt8Yssa39IxL4csN3q8PevavOy7ek Qnn/roTXPkhAwk91ZERG+q0l6ZUAxi2NbjEmMgqqSdmrHYfAxDlCHUjW2sJdBgJOfC+P wSixGsU4lGm6t25exYUI/2VRM7S6B0WRSYkcs7BmVtI7iAiM6xfJpWqCRmfgPByI0RC/ UT/Ik9tVaL5dN8V8j+hjCTcCpXB0VXYEHOagIl/BPhTvMMx88rlENiUrEgyinGX3YSR0 Cv4+vzez8fPjFxObCvkAiDPdUY5jT+fAY1k06ApsyyTjvcG9Ni/AeZGIs9ZYNVyXnxEU OQOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695627787; x=1696232587; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kqSSfRt2FX1iJgBnNFLYuQcx0Izo1QKFxQpbwmgNxLk=; b=UUSGBxR8/mrelCJJefrfNAlvOHtPIK51U+ZHowJOz9mAF77yWCxgHIghb3vRfC/9Pz ODkapfYtYjCkcWV3I/5k7g21Bl376grkY8y5plDwtBqs+V/K3W8lHhNdlOh+Ejv1HpvZ HW/wyFTrucQ43r6Nyyp4TqnUGkX3soviNN1GsKl3T0YbMp2ScvVVfYHuq5Q3go4wLnry wBOBwc1Dq33jL55Q0uBf4e+LvmbdlFEbs/ml72M9s7stIbGSNH6xZgBDv15JSQ3yoNuz bxI6pQY25AdaCtJu5HPT+Zj7ntO2ENflMvr39SeHM8wd4euCfMlKLoRziu0s6CznTaty L+Xg== X-Gm-Message-State: AOJu0Yz0lXtRGRlhoBrjcIQK2AW49vJbiDPmHjNSuiy75AaT5Usfkysl uAwdnZcKHwtX2F2+yrgw4awRjo3yzg1NjeRjsSCziw== X-Received: by 2002:a67:d014:0:b0:450:c5e4:4869 with SMTP id r20-20020a67d014000000b00450c5e44869mr2873248vsi.25.1695627787321; Mon, 25 Sep 2023 00:43:07 -0700 (PDT) MIME-Version: 1.0 References: <20230922175203.work.760-kees@kernel.org> In-Reply-To: <20230922175203.work.760-kees@kernel.org> From: Bartosz Golaszewski Date: Mon, 25 Sep 2023 09:42:56 +0200 Message-ID: Subject: Re: [PATCH] gpiolib: cdev: Annotate struct linereq with __counted_by To: Kees Cook Cc: Linus Walleij , Andy Shevchenko , linux-gpio@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:43:17 -0700 (PDT) On Fri, Sep 22, 2023 at 7:52=E2=80=AFPM Kees Cook w= rote: > > Prepare for the coming implementation by GCC and Clang of the __counted_b= y > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUND= S > (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family > functions). > > As found with Coccinelle[1], add __counted_by for struct linereq. > Additionally, since the element count member must be set before accessing > the annotated flexible array member, move its initialization earlier. > > [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/c= ounted_by.cocci > > Cc: Linus Walleij > Cc: Bartosz Golaszewski > Cc: Andy Shevchenko > Cc: linux-gpio@vger.kernel.org > Signed-off-by: Kees Cook > --- Applied, thanks! Bart