Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1553815rdb; Mon, 2 Oct 2023 13:17:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE+or9ix4CM45/Q/4WBsnOvxeVCXHnQxinqk5nYqvSrNijCaObVLBybhJ0gp5maMn3HTo0U X-Received: by 2002:a05:6a20:442a:b0:12f:c0c1:d70 with SMTP id ce42-20020a056a20442a00b0012fc0c10d70mr12674811pzb.40.1696277865440; Mon, 02 Oct 2023 13:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696277865; cv=none; d=google.com; s=arc-20160816; b=0qfoKWJ9C/yylvgj47qBgRsBCrnWq2a4xpjqQ8vERRAfo9Kg4rVme7vVt39AteJTMy KoGDYh5TNM2OQ1GM/S4lp8Oax8hy5OG4GXRcOi+DHCW+E/BJm+zkRMwnporfTkRSvYoD dikUkmZjKWfeYx4ZFOYbeeDDW3QxMSBnyum1gcLZ9jYBmqxPn3TPRDh0UVfZ0T7b5Ryc bXr/j53Yujrk/sUlmsKwo1QuPaKPotulqB76bM0VHLsshW74pO3iBltGN9Mvw6clE3sy qsmkHFOjBtTlIQw0A0BmZBB7uDbGYikoaHt+RzDHsPpUo8n7ZbXZDXm1alVN47DNrRfT UlWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zPrUH5J+k/nTCuPqHTvyGlvTCCkInD9EOwhmWD637e8=; fh=ZRt84rnDBb6CTgy9eVU2hdEMIzv+dU96Q6LV0frsEYI=; b=z6/ZbYzmAal033B8gu8vr2tsKwqtrecbDjhpJS84DxAqbvcYLNqwaMx5eWBbkU9VHp miQ8zh2oOb+E3MH9ZrMyKYTdpbR+Pae9vHkgbMNc/U5kKyWOki73SkAZzhJp8P/WogKe EipMKBF5dE6Hl0VEu+F08G7x23JagyC5shsica9mAeORVeXu/g8+0BZJHfXUrRPIIQY6 KEAzsXa5NS/Do4H5HxepI9LSxmxjk4duhENgVDfo6I2fwh+0u05/DFTvbxns6HWWA60u y4I3vnV0pEd6lbM7u6/WhSx/Nv1kjEZi50luzeEpJB7+UTswXAKwuyWwCUJMlsFb8qeX 7SkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f16iptU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id p11-20020a170902c70b00b001b6788a54f4si13840936plp.191.2023.10.02.13.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 13:17:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=f16iptU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DE77A80278E0; Mon, 2 Oct 2023 09:53:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238523AbjJBQxa (ORCPT + 99 others); Mon, 2 Oct 2023 12:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjJBQx2 (ORCPT ); Mon, 2 Oct 2023 12:53:28 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2483A7 for ; Mon, 2 Oct 2023 09:53:25 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c61acd1285so38095ad.2 for ; Mon, 02 Oct 2023 09:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1696265605; x=1696870405; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=zPrUH5J+k/nTCuPqHTvyGlvTCCkInD9EOwhmWD637e8=; b=f16iptU4NGHN2Gshz+newGrq9CO5Bcs/ufv6XeLLZ85fOMW1YLhZQmOVWTQIY8rt+8 ON2yqMF+f1r0+7a+TlMkpnSLafnmqIBYGJ6Fi7JT2SlM9MOgZdAqte8NUOzgnc7Q5swn FDoEZ/qC4MC8IeDPukdjDGGFpV+b/aIrxufN8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696265605; x=1696870405; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zPrUH5J+k/nTCuPqHTvyGlvTCCkInD9EOwhmWD637e8=; b=KgSKyISTTFST3Q1qn7rl27CXVvlLelKtFlchNcFaTkiu60GdzmD2hhYAhmN6kpjsK3 Tmwv/+dMQrkPzJIjft2ODQowSnnKzonNtWL8foMDXWZnZ6yQWqJs3lGr1zDpmfzrASDW UWnmwCiTq15H3vnVBN/bzWJ22xF5jMwFV1tIM64b7fnXfY98jCycp2uGiIyvfwgx2nmU TuULD3EhypIvp6GyxhI7QZeF/MEzFtxdnMfBLae/xqFwm+zXPij848bSTLClJo2No5+g V0wIJz7B0jPbkpfYJYL69ef207CC08gq7yDWEOMQrd9QEZpyt1BFkuLTzErJbQwC0VFy tGJw== X-Gm-Message-State: AOJu0Yz69F/Y6oqSc4eQnR1kPAh0k6YIyPBoP1K5opOOTmJQbjt9yT+V Qw6mxSBQELTL6w2J9Np7fjQSCA== X-Received: by 2002:a17:902:ec8d:b0:1c6:1fc3:6857 with SMTP id x13-20020a170902ec8d00b001c61fc36857mr13017401plg.27.1696265605046; Mon, 02 Oct 2023 09:53:25 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id h6-20020a170902f54600b001c74876f032sm6638850plf.162.2023.10.02.09.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 09:53:24 -0700 (PDT) Date: Mon, 2 Oct 2023 09:53:21 -0700 From: Kees Cook To: Alex Deucher Cc: Christian =?iso-8859-1?Q?K=F6nig?= , David Airlie , "Pan, Xinhui" , Karol Herbst , Tom Rix , Joonas Lahtinen , dri-devel@lists.freedesktop.org, Chris Wilson , Prike Liang , Huang Rui , Gerd Hoffmann , Andrzej Hajda , Marijn Suijten , Matthew Brost , Evan Quan , Emma Anholt , amd-gfx@lists.freedesktop.org, Kuogee Hsieh , Lijo Lazar , VMware Graphics Reviewers , Ben Skeggs , Andi Shyti , nouveau@lists.freedesktop.org, David Airlie , Dmitry Baryshkov , Chia-I Wu , llvm@lists.linux.dev, Yifan Zhang , linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Kevin Wang , Abhinav Kumar , Jani Nikula , Tvrtko Ursulin , Nathan Chancellor , Le Ma , Gurchetan Singh , Maxime Ripard , Rodrigo Vivi , virtualization@lists.linux-foundation.org, Sean Paul , Neil Armstrong , Xiaojian Du , Lang Yu , Bjorn Andersson , Tejas Upadhyay , Nick Desaulniers , linux-kernel@vger.kernel.org, Hawking Zhang , Rob Clark , Melissa Wen , John Harrison , Daniel Vetter , Alex Deucher , Nirmoy Das , freedreno@lists.freedesktop.org, Christian =?iso-8859-1?Q?K=F6nig?= , Zack Rusin , linux-hardening@vger.kernel.org Subject: Re: [PATCH 0/9] drm: Annotate structs with __counted_by Message-ID: <202310020952.E7DE0948C0@keescook> References: <20230922173110.work.084-kees@kernel.org> <169601600138.3014939.8511343741428844249.b4-ty@chromium.org> <83cd056c-52ae-01dd-7576-42d41da64c26@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:53:56 -0700 (PDT) On Mon, Oct 02, 2023 at 11:06:19AM -0400, Alex Deucher wrote: > On Mon, Oct 2, 2023 at 5:20 AM Christian König > wrote: > > > > Am 29.09.23 um 21:33 schrieb Kees Cook: > > > On Fri, 22 Sep 2023 10:32:05 -0700, Kees Cook wrote: > > >> This is a batch of patches touching drm for preparing 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 to structs that would > > >> benefit from the annotation. > > >> > > >> [...] > > > Since this got Acks, I figure I should carry it in my tree. Let me know > > > if this should go via drm instead. > > > > > > Applied to for-next/hardening, thanks! > > > > > > [1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by > > > https://git.kernel.org/kees/c/a6046ac659d6 > > > > STOP! In a follow up discussion Alex and I figured out that this won't work. I'm so confused; from the discussion I saw that Alex said both instances were false positives? > > > > The value in the structure is byte swapped based on some firmware > > endianness which not necessary matches the CPU endianness. > > SMU10 is APU only so the endianess of the SMU firmware and the CPU > will always match. Which I think is what is being said here? > > Please revert that one from going upstream if it's already on it's way. > > > > And because of those reasons I strongly think that patches like this > > should go through the DRM tree :) Sure, that's fine -- please let me know. It was others Acked/etc. Who should carry these patches? Thanks! -Kees > > > > Regards, > > Christian. > > > > > [2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by > > > https://git.kernel.org/kees/c/4df33089b46f > > > [3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by > > > https://git.kernel.org/kees/c/ffd3f823bdf6 > > > [4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by > > > https://git.kernel.org/kees/c/2de35a989b76 > > > [5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by > > > https://git.kernel.org/kees/c/188aeb08bfaa > > > [6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by > > > https://git.kernel.org/kees/c/59a54dc896c3 > > > [7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by > > > https://git.kernel.org/kees/c/5cd476de33af > > > [8/9] drm/vmwgfx: Annotate struct vmw_surface_dirty with __counted_by > > > https://git.kernel.org/kees/c/b426f2e5356a > > > [9/9] drm/v3d: Annotate struct v3d_perfmon with __counted_by > > > https://git.kernel.org/kees/c/dc662fa1b0e4 > > > > > > Take care, > > > > > -- Kees Cook