Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4936449rwi; Mon, 17 Oct 2022 12:59:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4uwyJFIL6hcTIKJJYTekyPbqZ47phNA8dEtCxgYkGA3F/CdeaRGlGnPlxYlnBeGrQi+M2D X-Received: by 2002:a05:6a00:3202:b0:565:c863:78a1 with SMTP id bm2-20020a056a00320200b00565c86378a1mr14341883pfb.7.1666036750414; Mon, 17 Oct 2022 12:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666036750; cv=none; d=google.com; s=arc-20160816; b=OFWuTsn9cRmA3IepPbRAkqgGEfg08vv031fwcu0oKL/j/6JyfcXUZIpeKg0Kw9Je84 cnHxie09JJYIW/Ac6mn0yUk3tsJvWMNro38YCdN3BbCp9FkOtmKIz3StVuLlHtSR7EeS hQ+/wwnDRjh/aSxjmjdEshBNHKYgzcOCfo3U6N/rDSVOMZOEiHGjNQ67wRdvUhffDEAy 9lwQLbIjURERF+o/J/j6VaJa1jxy2oncyVFC/d2qpA8UZuqR8aRVIEbzo1SMr0PHXnuZ /jgst4YvPE1GVPUfvKwvOSjJMkr+l9pVFShWdrh8Nff4GPYBV0wfBLd+V9etAT0ksOvp FcRQ== 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=ue0kyx6qz2rMzedIasmuG59X+gNZQpN5B5kyFPGaXUg=; b=A9tzTtrgaRCIn7Y1V8W3mSIq/UYHs5pMoqvsu8QhvZBFwBikBZ55wpO3aOWCUHGH+4 VHOCgHybXh9tyifUT5CJgaE8UvQf5dtc571IGrTB2lRZYNAlC9gucj7ykU+CgMH5O0w0 Gykny4W96PaRk8vkTKjzSJk+XZnp5GWDaKafOpH4icTW5EOITyYZUm7v3/x/ahwgKbgx jzUKSrDRcYZVZEa6eldcRQCHu2Tfo5a7R/4Ngh9pn41UchlEkNZ7ndE+S465+QL3mAtH k/yM1JZr3wzZ8fupBNGO7mvLi83Y14ELtktAOHyqWJTNG0JLeRN1Q8EGWyIltJotWbuO DowA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oOeaOD87; 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 e7-20020a056a00162700b0053836f22d73si10581394pfc.214.2022.10.17.12.58.58; Mon, 17 Oct 2022 12:59:10 -0700 (PDT) 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=oOeaOD87; 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 S231286AbiJQTah (ORCPT + 99 others); Mon, 17 Oct 2022 15:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbiJQTaN (ORCPT ); Mon, 17 Oct 2022 15:30:13 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482A642AF9 for ; Mon, 17 Oct 2022 12:29:14 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id i6so11662931pli.12 for ; Mon, 17 Oct 2022 12:29:13 -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=ue0kyx6qz2rMzedIasmuG59X+gNZQpN5B5kyFPGaXUg=; b=oOeaOD87UL2DSnr8xg5//MuTm6Ca4Z/mdwBBsvzWSUvaaMwLs8me7s7u5ZJAh9v/8o lIWnxMrIw7DNbIMCfqGDiu/CAgA/awQQBjBnyLi6OFQ+uhI1Azdkhwc/yvAgXAIwJcIR mf/ua8KOS2zyteADmTTlwd5FuFrycq4SyIers= 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=ue0kyx6qz2rMzedIasmuG59X+gNZQpN5B5kyFPGaXUg=; b=5j2FR3wzfnhJkhTMRvdxYRzlniCnRNzHQFUMieS9dZnEMWh0H8jobAYcFkvEjt/QZE ZcNnQVaBecFUKmjkZinUXg0Iq/XQ9ldB+CA+tVkGmcgcn4viURakxNcgn2D5pge5q1xN lro6YA8jSXDGQhIIZ2JNrBIvrTsBKCafSW8AlHmMcRjT2DnOyJQ3u3avvblKgUVBqE0+ OzAlLkhmfaUB12ObvdnA3QpCzwhenTajnu/aBj9CBTMtwRIay9rQv9Jx75s/OqJAGqLI x9z1ER7WeLREtVKftyk3MHgyBhG1VTCZ/JVBsQvc7TCMmE/NJl270DXsT1fb0dHue0fy GRvw== X-Gm-Message-State: ACrzQf3tgasK9dRHEYtOH6tPViqzUoeao4uvqzhbC1qhsqnSTu1Kys/x irpuUpymIeUNgSdWvo8tzQhz1Q== X-Received: by 2002:a17:90a:b00b:b0:203:a6de:5b0f with SMTP id x11-20020a17090ab00b00b00203a6de5b0fmr15162750pjq.134.1666034945278; Mon, 17 Oct 2022 12:29:05 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id m10-20020a1709026bca00b00181a0e61ce4sm6976066plt.6.2022.10.17.12.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 12:29:04 -0700 (PDT) Date: Mon, 17 Oct 2022 12:29:03 -0700 From: Kees Cook To: Ard Biesheuvel Cc: "Guilherme G. Piccoli" , Anton Vorontsov , Colin Cross , Tony Luck , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] pstore: migrate to crypto acomp interface (take 2) Message-ID: <202210171227.35ED875219@keescook> References: <20221006234138.1835739-1-keescook@chromium.org> <191ec24d-35d4-e4e5-85f7-d7301984e647@igalia.com> <202210171100.5BAC4A5CC8@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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 Mon, Oct 17, 2022 at 08:14:14PM +0200, Ard Biesheuvel wrote: > So once we use the same size for input and output, I was curious > whether we could encrypt in place, and get rid of the big_oops_buf. > And the answer is 'yes', precisely because we have this horrid per-CPU > allocation which serves as a bounce buffer. And this is not specific > to acomp, the old comp algorithms get wrapped in scomps which receive > the same treatment. Ah, in the sense that "in place" is actually happening in the per-cpu allocation, and only if it succeeds does the input buffer get overwritten? > So at that point, I wondered what the point is of all this complexity. > Do we really need 6 different algorithms to compress a couple of K of > ASCII text on a code path that is ice cold by definition? Wouldn't it > be better to drop the crypto API altogether here, and just use GZIP > via the library interface? Well, my goal was to make the algo "pstore doesn't care". If someone picks deflate, do they still get all the per-cpu allocations? -- Kees Cook