Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12311223rwl; Tue, 3 Jan 2023 12:17:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXvzrXnFctDt3U4LOONmpBnsisVTMjCAIlPIGCHea+Dl4/KfGlv4DHGHCj1LMT1bHyxWRobC X-Received: by 2002:a05:6a20:e68f:b0:b3:32fa:1d9d with SMTP id mz15-20020a056a20e68f00b000b332fa1d9dmr38814845pzb.33.1672777052371; Tue, 03 Jan 2023 12:17:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672777052; cv=none; d=google.com; s=arc-20160816; b=nvMZ76mNp7z65wVKbito4HQc4Rj6tT6vvbUqvcTb0c1rWTSRH7xd3vp9P9xpL15Y+z fXA647NnVi9eHKsLRlCW/aCizi2P7nu5MoGqTHCrmm0Quk6KX8Olxvl/rel8bCgc4h2M qfsBdS4AJe/9JBMfnREozJ4XZnAiORzf2+HcCku/MZAMAXf5fZp6LP7qaWJG9yOCpeoF XHQKzjAxZiMxocR+OqieJ0fGPd3oKL4M4Fw9AacvO6eEr44uGDuS33HnWTHPtpYb8P3i 2SU2SWw5kClXOsFENW+RnIvEjd97LOSdtgMgNwW5qD7/ik0mkbm2+zGnC5nIvfcQkoIz Ffcw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GfjrvxCRgV3vcT3TiLbdLY/UTFxhC+HimhMaHMPiFqY=; b=cupSKC60LvTZf9yh6BssDIFgJe6+3jVeYU5FtEqux8NeeLU2MgGY2+I9yrut1u0EBr amyD4ErWs8kyWEE2nr75W7aZ4OP4FQ33VM9Yhy5iEf0WslbpOs2G9e5/G3BcyXd+MIS6 5izxzKapbFIuYWdED2l2MZypN7WrD2qNQI31hU/pyMVMGGFLpmXRGW1WykTVvqkTbKMB 3PM4KVVAyvhM46JlYRla1yrTN7FBo4EjxpczEjjNwPostnzHMb0AJUF7rN8ULLpYhYIX V1El66inPgpw6of3Ch/60eX2vPZrFzU7Y02PGQccYaTBI+v0gPyIQgDIh9vmBabC1rym UrVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lArsKCWj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c12-20020a634e0c000000b004785d1cf6c4si32198666pgb.380.2023.01.03.12.17.24; Tue, 03 Jan 2023 12:17:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lArsKCWj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239022AbjACTb3 (ORCPT + 59 others); Tue, 3 Jan 2023 14:31:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233920AbjACTbJ (ORCPT ); Tue, 3 Jan 2023 14:31:09 -0500 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7630813D06 for ; Tue, 3 Jan 2023 11:31:05 -0800 (PST) Received: by mail-pj1-x1031.google.com with SMTP id cp9-20020a17090afb8900b00226a934e0e5so535670pjb.1 for ; Tue, 03 Jan 2023 11:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GfjrvxCRgV3vcT3TiLbdLY/UTFxhC+HimhMaHMPiFqY=; b=lArsKCWjaQrB20DDdwcxHZshdTmlKenjx9q1kEE6MWgGogRQe1DWuhUAXVToG8qYiA 8U8uXUk4teUMCrqDh5YtbMTi0o6YZOYfyQyxJjOD4NylWdGhThCq8q5I2boGk/1RWJca 1bI+yV0oKGCQmpGLKKhqmgyiBJsK1/96ROlvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to: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=GfjrvxCRgV3vcT3TiLbdLY/UTFxhC+HimhMaHMPiFqY=; b=tr6fUHgN+wP8/yvLrL3+PQUjcceyIbFe9Y/bLvqWXuB0OdZfPpfBK0LKBCpl966KEU DoNBJhu3S9Ld9EfpT4WtmYhge3CxldlZ55GkkVSUqiUoNyhfgg61pW92gTEU5OKzepWT kSGKliymE0c+WIQA5O+wuFJuZR2qJsA26lTRIpxemKopM1yLpzhwDyyIh/n/pqPa0ax7 dWP05PNAY9pEOHEVtpYTn4sle2kXgNBWgqtst9a8k1dcJhjURQ3/JysAGFn+uc6bFd8m aso9w90/3u9fVmSXvsgVolgP861U8G1ID+asoybmpfxa4N46UauH2DKEFqUq2Gl5RK5y N8uQ== X-Gm-Message-State: AFqh2ko6z8KqvWk8HZxCf5iDqb1FzkAH6q/XHOUNZXmp9y9UnXEm+AWN tY0E7awKLbN3ckYf+zxyLTtIZQ== X-Received: by 2002:a17:902:ca95:b0:189:e711:173 with SMTP id v21-20020a170902ca9500b00189e7110173mr42031348pld.33.1672774264931; Tue, 03 Jan 2023 11:31:04 -0800 (PST) Received: from google.com ([2620:15c:9d:2:d4fc:5992:1009:1647]) by smtp.gmail.com with ESMTPSA id l2-20020a170903244200b001888cadf8f6sm22727951pls.49.2023.01.03.11.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 11:31:04 -0800 (PST) Date: Tue, 3 Jan 2023 11:31:02 -0800 From: Brian Norris To: Guenter Roeck Cc: Julius Werner , Paul Menzel , LKML , Greg KH , Guenter Roeck , Stephen Boyd , Jack Rosenthal , coreboot@coreboot.org, Kees Cook Subject: Re: memcpy: detected field-spanning write (size 168) of single field "&device->entry" at drivers/firmware/google/coreboot_table.c:103 (size 8) Message-ID: References: <03ae2704-8c30-f9f0-215b-7cdf4ad35a9a@molgen.mpg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 29, 2022 at 12:28:14PM -0800, Guenter Roeck wrote: > On Thu, Dec 29, 2022 at 6:43 AM Julius Werner wrote: > > > > I can confirm that this warning is a false positive, at least. We're > > intentionally copying bytes from beyond the end of the header > > structure in this case. > > > > I don't know what kind of kernel system detects this stuff at runtime > > and how to silence it. Probably need to add a void pointer cast or > > something? > > > > This is part of kernel hardening code. Kees Cook might know what to do about it. One could probably throw in casts, like this example did: 0d043351e5ba ext4: fix fortify warning in fs/ext4/fast_commit.c:1551 Or one could probably imitate this example, and insert an appropriate flexible array (possibly with yet another union?): b43088f30db1 s390/zcrypt: fix warning about field-spanning write Side mostly-unrelated note: coreboot_table_populate() doesn't do any bounds checking that the individual entry copies don't overflow the table buffer size. We're _probably_ not that interested in recovering from a malicious (or even buggy) Coreboot, but it does seem like an area of improvement. Brian > > Guenter > > > On Thu, Dec 29, 2022 at 11:46 AM Paul Menzel wrote: > > > > > > Dear Linux folks, > > > > > > > > > Running Linux v6.2-rc1+ on a motherboard using coreboot as firmware, the > > > warning below is shown. > > > > > > ``` > > > [ 1.630244] ------------[ cut here ]------------ > > > [ 1.630249] memcpy: detected field-spanning write (size 168) of > > > single field "&device->entry" at > > > drivers/firmware/google/coreboot_table.c:103 (size 8) > > > [ 1.630299] WARNING: CPU: 1 PID: 150 at > > > drivers/firmware/google/coreboot_table.c:103 > > > coreboot_table_probe+0x1ea/0x210 [coreboot_table] [...]