From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 768B2FA373E for ; Tue, 25 Oct 2022 18:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231357AbiJYSkj (ORCPT ); Tue, 25 Oct 2022 14:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231868AbiJYSkh (ORCPT ); Tue, 25 Oct 2022 14:40:37 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A583FAC3B2 for ; Tue, 25 Oct 2022 11:40:34 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id f9so7942954pgj.2 for ; Tue, 25 Oct 2022 11:40:34 -0700 (PDT) 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=ypp924cOxRmHJ8467PlsPJpac5ZwhKzqHwYjG4vMAIY=; b=mQqIscoUoR78Aw4+ZOXT7NSKhlzbBIdYBrdStGaIeyFAJ99E+k+uGZ2R3qWQvm05/F MW89Bc0HbsLmfE5k/NykN+XajLXcYkfsEsIhVCSH2OwZE5r1mktm5pLMIeVOoLsKu6Jw apvpHRozka7y4c+v67UC4Vve+dT6xng4qslT8= 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=ypp924cOxRmHJ8467PlsPJpac5ZwhKzqHwYjG4vMAIY=; b=2abfiQ3+i5UONEWG5AreHoM6MrWuxiZ3omc3y4xH+hqLnjx8xR8SJfVerkgDjDlij/ MK1uvp05ZUekq2Rkh0uKI+oyPjy+zqgR3ZjjOPZlQf3WT9Jsfd470nvt1P8kmf08XBJ0 yeyE0HjlJEoHWX0USQPIAjEf2Z6zfftnzH5wy9nF8+A18TN6SfAiqQnp0NkjgSmcuktZ R3d6dk0/kieqEuyuVJP+vF942WJgwUWK0OV7fRXwABfdGyP1WlhLmZHjaKO/UVrKjfv5 uA2mv2UtLJBBbu0TkyiKtM/RjWQa3ZVmP/ETeheJIf2dqfxelmibxfsxo01mR2dUvN/i p1XQ== X-Gm-Message-State: ACrzQf1Mfw1e7AjaEPYMKLy9O5fd8b+cMjBHGVrTLyIStYjJb7qBD7mj wPiwrq+GvdwRU+Rb6LSWyES9mg== X-Google-Smtp-Source: AMsMyM5nbOc8BgUpdi2qEvHsCOyN0L6nfnS73pIqvKPHRx34G0fgtXnb7aCW38It/DJwWuEFaqdzAg== X-Received: by 2002:aa7:92c8:0:b0:56b:d0b8:10f0 with SMTP id k8-20020aa792c8000000b0056bd0b810f0mr11874851pfa.46.1666723234002; Tue, 25 Oct 2022 11:40:34 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d185-20020a6236c2000000b0056286c552ecsm1666652pfa.184.2022.10.25.11.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 11:40:33 -0700 (PDT) Date: Tue, 25 Oct 2022 11:40:32 -0700 From: Kees Cook To: "Darrick J. Wong" Cc: h@magnolia, xfs , Zorro Lang , linux-hardening@vger.kernel.org Subject: Re: [RFC PATCH] xfs: fix FORTIFY_SOURCE complaints about log item memcpy Message-ID: <202210251139.3612057E@keescook> References: <202210240937.A1404E5@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Mon, Oct 24, 2022 at 02:38:14PM -0700, Darrick J. Wong wrote: > I realized that these helpers introducing unsafe memcpy weren't > needed. Later on after chatting with dchinner a bit I came to the > conclusion that we might as well convert most of the _copy_format > functions to memcpy the structure head and flex array separately since > that function is converting an ondisk log item into its in-memory > representation, and some day we'll make those struct fields endian safe. > They aren't now, and that's one of the (many) gaping holes that need > fixing. Ah, perfect! Yeah, this is one of the other standard solutions -- header and flex array handled separately. I'm still working on APIs to handle the common cases, though. XFS probably will want to keep it separate as you've done. > I sent my candidate fixes series to the list just now. Thanks! I'll go check them out. -- Kees Cook