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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3576FC54755 for ; Thu, 15 May 2025 03:32:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79D306B00F5; Wed, 14 May 2025 23:32:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74D306B00F7; Wed, 14 May 2025 23:32:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C3F86B00FB; Wed, 14 May 2025 23:32:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 37E766B00F5 for ; Wed, 14 May 2025 23:32:46 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EFAE9E3021 for ; Thu, 15 May 2025 03:32:47 +0000 (UTC) X-FDA: 83443720374.18.F1CB76A Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf03.hostedemail.com (Postfix) with ESMTP id 1EB4920008 for ; Thu, 15 May 2025 03:32:45 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=RDrHMDko; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.174 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1747279966; a=rsa-sha256; cv=none; b=S9+nSnAw2SwsunwPjFMA4xk6NcejrNQ8/UtmGypl2sPhBkSUHK1oj+nFHPZOIvI4f7230c ICfic9S+zRBiPRH6eTOf8v905Atty8PLtTF8c9pCTUMjlXv0xNWqfcxB9oxSJyHPbzEb0c AZ/Zm/jlnj0OdVBifF2ZDF7yTDxsmwA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=RDrHMDko; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.174 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1747279966; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1g/suZwDMtwCwOejPygUimT1SDv6FRw8jhecB+9KAkU=; b=GsbmlJafaMZ3ej49mdeeNUEqWHYV2Qsww1zkaTZP+AKHnMN+xoz8QnSYbzlOjoXAAyJC/F HEeUMmv+X8ywYbikcFWXkyntRO78kwIIEBX8A+IpIuOTPnnpehzHRiXPFTFIt8c5dbLvB3 s/UiH2H/msuMRuddDZUKpqI3IYG6+QY= Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-879d2e419b9so328934a12.2 for ; Wed, 14 May 2025 20:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1747279965; x=1747884765; darn=kvack.org; 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=1g/suZwDMtwCwOejPygUimT1SDv6FRw8jhecB+9KAkU=; b=RDrHMDkoJZuOdJFabdxk49qBPMvQ7r9iHqcs5pisf+CdPKfIE6ud5H+qk/yPeFlnec ftbEoA74Am/jdoeOWSW3D0/1N4nUZhljKlNaD0dZe03qkoS2PWKawnYm6x0XwJ1pth8T Z9/N9bdObPxI4CcOfbX5aRojEs7B7NYnC+VQA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747279965; x=1747884765; 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=1g/suZwDMtwCwOejPygUimT1SDv6FRw8jhecB+9KAkU=; b=IfOdecftHvS0sJeYfVCUz84X15+0cunhNoJFKNBnEWcXsbmzMP/nd+1X9SvIf1XYJr 4+QicqqbfyCGPKK2JIdEiWuMICvX7sxYbg9hGOf9PT+rvtmYMDopuSpcTsO/QZvVDNmL ruNyXOjvDIv3ca4N+MGy9X8ZJU2r6Lggsg8NhO+Wviq5vlENcFSi32BnPhT3PfnxAPVM XxfL4cSzo/CuPfCCMlL4Sp+7MQT56qcNn4Nij8de+XSWMTplS4tvkp/o+2GG9U5GxVi6 uTxcuV4tDnlSp4o9GTMl+9WhPzwVL3BNuuSnQ4B86hNFyj8pFyJ+vvNDgY+oYG0eVtm8 eTig== X-Forwarded-Encrypted: i=1; AJvYcCVWwMCiQsrmA3xwE5Uj4z1xd64MZW5K9ADWiw/bLosxXt+/Eq2acQV84OGw3RXDAIBwGCKBAGvLqw==@kvack.org X-Gm-Message-State: AOJu0YzgBXR6tqyp/0Mwe0VOPnmwtOqmMC1EgElHkMJxg+2q7nEJfPAT DXls077o1Ivcx9GDCSP7hBQo9mzqWdGO3UY8n24KQaQMH9w5FCTF+8l14N2ccA== X-Gm-Gg: ASbGncvcD3Fk3CxmK1DHFUmSxN4ZbJ2Wt4MfhpMsYh0m3tRMXj47YiOe+BHGIqjW9+/ D4rB2ggIbkmx3rZOtiIjWRFV91LTsmfTHjigGXHpOLyzoIEG1l/Mt0UdzGQ6MjPhZyoUhUlS7Ag sU9iSGvl3TmwmGmWvoaAFFZPuvkDsybcIosYvki1Lx1NjCG99492awOpU4Y4xdUFVC9pX1i5LP/ 2cpQgvo2HmiVXuuE1pzjR6SiZDC+tnk6F1AHwtTZIgGQ+rLu0gOmivW29RW35LFfYeQX0uahkf9 MjFUpXfcIsoLDdRaE43t8AgIJPJVShOluPET2BMMWcgtTNdpPfPrEOI= X-Google-Smtp-Source: AGHT+IFMDL27J4Xfo5AX374nk2UIjh5s2nm/2nbFAWtcSmHlepcaluh1TqSJym39cx/9MwWz+2EWuQ== X-Received: by 2002:a05:6a20:6a0c:b0:1f5:7b6f:f8e8 with SMTP id adf61e73a8af0-215ff08594dmr9177059637.6.1747279964958; Wed, 14 May 2025 20:32:44 -0700 (PDT) Received: from google.com ([2401:fa00:8f:203:291c:c511:a135:fe23]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b234af2c287sm8231325a12.41.2025.05.14.20.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 May 2025 20:32:44 -0700 (PDT) Date: Thu, 15 May 2025 12:32:39 +0900 From: Sergey Senozhatsky To: Herbert Xu Cc: Sergey Senozhatsky , Zaslonko Mikhail , Andrew Morton , Minchan Kim , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Heiko Carstens , Ilya Leoshkevich Subject: Re: [PATCH 2/2] zram: support deflate-specific params Message-ID: References: <20250514024825.1745489-1-senozhatsky@chromium.org> <20250514024825.1745489-3-senozhatsky@chromium.org> <2bnnkkwhqor73ls7dvsxlt57tp2u3xf2o27opkveuqwgh3xf2j@5kzgq4eej3cw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Stat-Signature: p4dk95eqcxw1nr4yiyfea75qjs8bsch4 X-Rspam-User: X-Rspamd-Queue-Id: 1EB4920008 X-Rspamd-Server: rspam06 X-HE-Tag: 1747279965-314882 X-HE-Meta: U2FsdGVkX1/FoF2S6B/E95tvUqqq7J43l6xnPdMMz2owVL5ECvY+2C/LJWacqX+FHqe6DS5GccabHBolHrDZh6MWDT0P+PjyxmSyBqYSQj/1qVeivje+b9IeGBnLglIq18RdthVPv9pBvUj69Ulloypzx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0S3EzCvu4H1+M33lcPdA24v6fgqAibjtoN7ETPtjCT4SbxOZGGUaTUPjTr6hbJ5kXWTp8VPtFFxxll+aIpHUcrnvxZZcahOhxo2d2p+Da9WmC+l1r/CgO3kazo8m0p7w= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On (25/05/15 11:24), Herbert Xu wrote: > On Thu, May 15, 2025 at 12:19:25PM +0900, Sergey Senozhatsky wrote: > > > > OK, so do we want to limit user-space and permit only "raw deflate" > > winbits values. that is only negative ones (either explicitly or > > implicitly (by negating the value before zlib API calls))? > > I would suggest that we stick with the zlib values, but filter > out the ones that we don't support/use currently. If you've already > exported this to user-space then obviously you'll need to decide > on how to maintain compatibility but that should be specific to > zram. This is not exported yet. I lean toward not filtering/limiting anything and just permit what include/linux/zlib.h promises [1]. Would that be OK for Crypto API? [1] ---- The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. windowBits must be greater than or equal to the windowBits value provided to deflateInit2() while compressing, or it must be equal to 15 if deflateInit2() was not used. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. This is for use with other formats that use the deflate compressed data format such as zip. Those formats provide their own check values. If a custom format is developed using the raw deflate format for compressed data, it is recommended that a check value such as an adler32 or a crc32 be applied to the uncompressed data as is done in the zlib, gzip, and zip formats. For most applications, the zlib format should be used as is. Note that comments above on the use in deflateInit2() applies to the magnitude of windowBits. windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32.