Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2139513rwl; Fri, 6 Jan 2023 02:24:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXu44XyRruZh1aG5x3tHfgxVkbDKoK0iIryqiWZo6impuuaDgvK+dMVIgvHNImaahDCjGhOi X-Received: by 2002:a17:907:8c81:b0:7c0:d0ba:e81f with SMTP id td1-20020a1709078c8100b007c0d0bae81fmr47622068ejc.1.1673000689653; Fri, 06 Jan 2023 02:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673000689; cv=none; d=google.com; s=arc-20160816; b=jYcSnV9fkbzu3JZvj0dehcAd/7z/+2xUKM3tShJuvseyU3d4asHDMPTIUeaN5eX/e2 errfFUXDgavjAM0lMOVDAGT4pzGBHPfzzKoMMWuICHaCZ0/8tnKVEp5q0TLqA6CUx3T9 d5k/jCBFrnE94YmJ+09ahxBK0uywm3Gb9LI7RO1+OfO17skZO9EGsNoDPhC7AULaRR1a Yr17e0qnMDq1PYDrgwRd0PLZ504xWBTVdEuWy3K9ou+Wv2L9rv3smJ6pP32driCtDHQJ NEE/tuKo8bFv5geaLMhFJzD/HLrHtZfazUkFxifsePizehSXbyHPku4PFQJ1s3gCSNnb c0Lw== 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; bh=/4efxMBcBnkcN/fiArWXNXd8iGmHCbWghkSsBaaIwpI=; b=JfyXtc3czMRnJC3o1HKNJZIaQswCxL00wh9fA8V1jz+FgiHgHSaRAQd7KbCy6PkJ08 3o54n3bYkaurnENsiOTMCcfq3vfWF+n7xQYCpVl3PZG7bZjJJ/WzQ/BARs3Halmw5iCc 9ADK09jQAeOKHYiyZ6oDGf6KmJyrNkU4gkYU4kfleQLoJZ/lPqdHTgPhKCNTi3DiG+Nc vbXZGTg7zyTe1KAQiX97BY3M1QxDflKULWM+bSGhHOo53IibPoAPLn6GxqAi7J3ZNiOU 0eWU0jJ4RrOJoRnNalvbKAeE1qjjYPcXNOacxOLX9HVNPtMlMGWml/Jb/Az4TGWTDsAi Bpww== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a05640240c400b00484c1d97aa5si1541570edb.278.2023.01.06.02.24.36; Fri, 06 Jan 2023 02:24:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232269AbjAFKBL (ORCPT + 55 others); Fri, 6 Jan 2023 05:01:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjAFKBI (ORCPT ); Fri, 6 Jan 2023 05:01:08 -0500 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F091C4164C; Fri, 6 Jan 2023 02:01:06 -0800 (PST) Received: from [2a02:8108:963f:de38:eca4:7d19:f9a2:22c5]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1pDjX7-0000wO-Gx; Fri, 06 Jan 2023 11:01:05 +0100 Message-ID: <132043f4-d19a-911d-04c4-a24fdf89153f@leemhuis.info> Date: Fri, 6 Jan 2023 11:01:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] bcache: Silence memcpy() run-time false positive warnings Content-Language: en-US, de-DE To: Kees Cook , Coly Li Cc: Kent Overstreet , linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20230106060229.never.047-kees@kernel.org> From: Thorsten Leemhuis In-Reply-To: <20230106060229.never.047-kees@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;linux@leemhuis.info;1672999267;823a9b22; X-HE-SMSGID: 1pDjX7-0000wO-Gx X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 06.01.23 07:02, Kees Cook wrote: > struct bkey has internal padding in a union, but it isn't always named > the same (e.g. key ## _pad, key_p, etc). This makes it extremely hard > for the compiler to reason about the available size of copies done > against such keys. Use unsafe_memcpy() for now, to silence the many > run-time false positive warnings: > > memcpy: detected field-spanning write (size 264) of single field "&i->j" at drivers/md/bcache/journal.c:152 (size 240) > memcpy: detected field-spanning write (size 24) of single field "&b->key" at drivers/md/bcache/btree.c:939 (size 16) > emcpy: detected field-spanning write (size 24) of single field "&temp.key" at drivers/md/bcache/extents.c:428 (size 16) Thx for looking into this. > Reported-by: Thorsten Leemhuis > Link: https://lore.kernel.org/all/19200730-a3ba-6f4f-bb81-71339bdbbf73@leemhuis.info/ Credit where credit is due, this should be: Reported-by: Alexandre Pereira Link: https://bugzilla.kernel.org/show_bug.cgi?id=216785 > Cc: Coly Li > […] Ciao, Thorsten