Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3979324rdb; Wed, 30 Aug 2023 11:35:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMhLlxytF/rQICnHNPDo739yYvjs8SRgVUQp3zrJgPol8vaBzOaPbpweyYLuURt4J4ldfQ X-Received: by 2002:a17:903:11c6:b0:1be:f53c:7d1d with SMTP id q6-20020a17090311c600b001bef53c7d1dmr3994046plh.23.1693420556189; Wed, 30 Aug 2023 11:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693420556; cv=none; d=google.com; s=arc-20160816; b=hKBO1uXJDlKk2mCLvYF8QZLEs08coSPJBGIYRy9/fzdsoH2gxToYGdLwyc/BYsGnTH J6kHg/7dlU6XPSgwMa9Z0S+2es8B6TgdJ0N5vWgCRU96o19buGbk/6DiiTu+xjzbpGC9 BG2cdeSWdcBs5QGP22Etor9dKw0BZwnZbuO2D6MzDSVCsf4e5KUMr59Xr4CWXXaaJ8eX WURd936YFkYuLwEsl/qJOy/yUssBCD39jFOv2iPpqwdrNYq1sOERiBSCikkhdTx5G7sB fJfnojzILTFB3CpiBGQ/hxioF5klNlQVXF5Xcueo5Oa/qpNAALg9svHeCobiNoVD88ZY JE/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RubBQKJk0catIhkgbnT+vDevLqqcLALStgFqU1Xx3VA=; fh=ai2XG8wBHrv7MyAfu5773UqWVf5GO1to5275zLhG7Gs=; b=WNRRpimORfppFvsQRZKg4Gq3sGMXZNRikosOXO6NtUM8Wi/YEFGHv+UvOHcpPXAk9z kjkQBQTnbSxnB8WMs9mUZLGrgqMw/IOELCkmAiw8FH/1NCww06APAXR5sAGDnzvforL3 hBbfoX2uLNz65UngFKTQ0jnEMfxBJtW6f7PKIsqVMmNd8SWD8TxpCZm3//JK+K+NKCqh YP/IsHwUPTXsPmC4uin/TNHaC3MjmgYcMEEU6CMtGgjApYiVjB8pbte5elfdDv5UXLIU akWyDyey7tE5PGm97+ASqTV2zddsYSAP2i3dGQUn2qj5nfiycXA/TCcB04Jm4a5N7g8R 2ULQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LFC0EcgY; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a170902e5c700b001bdd35033ebsi3495134plf.361.2023.08.30.11.35.41; Wed, 30 Aug 2023 11:35:56 -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=@kernel.org header.s=k20201202 header.b=LFC0EcgY; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbjH2VoG (ORCPT + 99 others); Tue, 29 Aug 2023 17:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239213AbjH2Vny (ORCPT ); Tue, 29 Aug 2023 17:43:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F21DCC4 for ; Tue, 29 Aug 2023 14:43:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E30664360 for ; Tue, 29 Aug 2023 21:43:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FED0C433CC for ; Tue, 29 Aug 2023 21:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693345430; bh=RubBQKJk0catIhkgbnT+vDevLqqcLALStgFqU1Xx3VA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=LFC0EcgYzA7PyN4rTC7RQVp26lsn79cx2tpY7EzvFzmD/51RB2XloyqxpgxlzGUHH j39hG2a54rvkEmbf0SJi8mPtui/tbAUZmoPXu9x9OZEyWKDLT+s2DJpBmIJOG94OMm PNRsCBFmi3beD9z5tNLWBv/cjFNjMGu6IzECxZ7IWc+70J5xuaR9w7j5+PbctcpX4M 2o9xqLP4qnaEbWlJDafozWDmK13muTk82aCygpBjD/JsLGUFilVwgaJ3lrqPo0/s2E n168RtPHWGvjtKQaZPE141raeMLzBFG5O6oTaPnZq5dSgBfRTQKoij7Wx3B3PbZVTq RJB9ZtFh1IHww== Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-4ffa248263cso7681937e87.2 for ; Tue, 29 Aug 2023 14:43:50 -0700 (PDT) X-Gm-Message-State: AOJu0YxQ/bFLAatI+WsOk99kjU0QmzSb0aj4EmTKHm5PjbhizqCT1x6A QMPcObolI69txjRFx/qCoB+kow3uiagEsDA7lGw= X-Received: by 2002:a19:8c1c:0:b0:500:a2d0:51b6 with SMTP id o28-20020a198c1c000000b00500a2d051b6mr117243lfd.37.1693345428565; Tue, 29 Aug 2023 14:43:48 -0700 (PDT) MIME-Version: 1.0 References: <202308281119.10472FC7@keescook> <202308282035.5AFD431B@keescook> In-Reply-To: From: Ard Biesheuvel Date: Tue, 29 Aug 2023 23:43:37 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] pstore updates for v6.6-rc1 To: Linus Torvalds Cc: Kees Cook , Kees Cook , linux-kernel@vger.kernel.org, Enlin Mu , Eric Biggers , "Guilherme G. Piccoli" , "Matthew Wilcox (Oracle)" , Yunlong Xing , Yuxiao Zhang Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Tue, 29 Aug 2023 at 20:04, Linus Torvalds wrote: > > On Tue, 29 Aug 2023 at 10:29, Ard Biesheuvel wrote: > > > > This is an oversight on my part. The diff below plugs this into the pstore code > > Hmm. My reaction is that you should also add the comment about the > "Work around a bug in zlib" issue, because this code makes no sense > otherwise. > Naturally. But pasting the comment into the email body seemed unnecessary. > Of course, potentially even better would be to actually move this fix > into our copy of zlib. Does the bug / misfeature still exist in > upstream zlib? > I have no idea. You are the one sitting on the only [potential] reproducer I am aware of, and there is nothing in the git (or prior) history that sheds any light on this. Could you copy one of those EFI variables to a file and share it so I can try and reproduce this? > Also, grepping around a bit, I note that btrfs, for example, just does > that Z_SYNC_FLUSH, and then checks for Z_OK. None of this Z_STREAM_END > stuff. > > Similarly, going off to the debian code search, I find other code that > just accepts either Z_OK or Z_STREAM_END. > > So what's so magical about how pstore uses zlib? This is just very odd. > AIUI, zlib can be used in raw mode and with a header/footer. Passing the wbits parameter as a negative number (!) will switch into raw mode. The btrfs and jffs2 occurrences both default to positive wbits, and switch to negative in a very specific case that involves zlib internals that I don't understand. crypto/deflate.c implements both modes, and pstore always used the raw one in all cases. The workaround in crypto/deflate.c is documented as being specific to the raw mode, which is why it makes sense to at least verify whether the same workaround that pstore-deflate was using when doing raw zlib through the crypto API is still needed now that it calls zlib directly.