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 8D3E3C021B2 for ; Sun, 23 Feb 2025 03:13:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA9086B007B; Sat, 22 Feb 2025 22:13:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E58996B0082; Sat, 22 Feb 2025 22:13:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D20016B0083; Sat, 22 Feb 2025 22:13:01 -0500 (EST) 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 B56EB6B007B for ; Sat, 22 Feb 2025 22:13:01 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 30A49C012F for ; Sun, 23 Feb 2025 03:13:01 +0000 (UTC) X-FDA: 83149737762.13.2DA9693 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf22.hostedemail.com (Postfix) with ESMTP id 468B8C0004 for ; Sun, 23 Feb 2025 03:12:59 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=cjT7jra6; spf=pass (imf22.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.41 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740280379; 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=Q4hSWwxP6ZiCusbLhbTnvl7H4ZNzc7v3lXbdR+X+u7U=; b=jIPPwHwbZEx3ZSQu7GvG65ghH26WMzulBAPeLDf2laV2sB81EOPJpo4J81WpBbWhEzcLyp qCHB+NrJr39PTHkD5t+1+2Vnj5r+E+lrr0IKGXKe6A9f1uZPqqSBuyG7Zf/JaUZ3faeAy3 3Kdo8SYJK1HgCztip0qvbUQXhBB7JrU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=cjT7jra6; spf=pass (imf22.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.41 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740280379; a=rsa-sha256; cv=none; b=4r3b+x0ZxAevVq8csnJsDdTb6BrU2khSWZs3Q3PxkN8TJjx8AtqxSHdMwV3/F6oJCYhvWv bcIHFXlpWWtmOwzAAPYs+r8Pnynyox2sXZr3xMkaAlDTptoJCJ+meB0WruWY/XLVZGHJwf XwzFehVWCWtHpMUtpoBYg8mkf9tbxj0= Received: by mail-pj1-f41.google.com with SMTP id 98e67ed59e1d1-2fc33aef343so6918438a91.1 for ; Sat, 22 Feb 2025 19:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1740280378; x=1740885178; 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=Q4hSWwxP6ZiCusbLhbTnvl7H4ZNzc7v3lXbdR+X+u7U=; b=cjT7jra62Mf8drULOz8tnY3hXSidozVgHRy0VtLLhJR1WF47zIAcRkPx/m3zVLK5oE MyyM9mQWhuuFKMgJeRDMWEnY+MfdYnpgUlIOU0a2JICweWFNTXGAjuHo+ofVpFWXeWxS qyVc6zK+KSKwrqItfbhxg2u5BvSvT9og9JJ64= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740280378; x=1740885178; 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=Q4hSWwxP6ZiCusbLhbTnvl7H4ZNzc7v3lXbdR+X+u7U=; b=epQMSRkrApP80sD1gqIG5Mox6axtPz0mkK1/NdYD597wPZD5yUqc6jwRTtkA+lI3wc 0sBYVC2kDdHgj040r5VcjSO6ejvkm3tyS7v6/bZi7R/QEAVX5p6vnvZkzClK62PM/obf xqqqF7wlEbYEE47oWR3o0kxl7VeLRMUBA8LKTyaUrwBpWmAm1mcCX8KtrIdoOTmFV10f oMLU6LoLzx8IQGZjjTaJVVkKdADeGONG+6elFknjyjmhdEoqlmLU3jZ7ATFW4LFacmDt BF2WHYD/q1kbrK2fvu9HP1giAQYaTyCF8lkZNqIVtVpbnwhgBetedcvKsHtJxdx/zNBc EvKA== X-Forwarded-Encrypted: i=1; AJvYcCV3TJKibitdrFzGgS72yj7gOJVMpnk9dY5m2v0QXrLLFCueVFJsUzRj8JoJno8YcHuGc0308Bcyxg==@kvack.org X-Gm-Message-State: AOJu0YwGq0a9aqjGD724koCoIhQWGU9M7GTAeBcruq7kt8pzUVAC8aPM y7R/aqPZN3ZQCz7z1dyVeNRSnf2o41+FhJ2HzjOqPexT/2ubxP/2C34HG2Fz3Q== X-Gm-Gg: ASbGncv1lDgZVmeCnqwcZh+U/j6XojuUKy74KjZliFCRbgNmlmMfFuLgjEui96SWm3a LBPdeXNaaV1kFC/+5NljR5Vp2Lrcpki58PvcDaBsacqZJ5Dbh8zmJ2xz3/cdumBqzTja8xKFTcl tXvyfyV4loRS+vcpM6AufF+qOtkCWM/89MTg0mArDH6YJvFs1qQjEGghsWU5U4asrTGVlrd2rBt TUCMeWCwSkpd+OIxyukQn7CHi682nWYxPZp1z5ZFQLZVGMN0eXjnqfGCs0SxXQdtduPa+jetO4E FEiobE+9WzNljC1cbDoloHc0z5hG X-Google-Smtp-Source: AGHT+IFtN36KhbjavF+Sg24ptpizXiER9hpFjSJioRr2SlZ1w260b/Y5kfU5U1Qhbzz/n+DC0vw00w== X-Received: by 2002:a17:90a:da87:b0:2fa:1e3e:9be0 with SMTP id 98e67ed59e1d1-2fce78c9247mr13494362a91.19.1740280376731; Sat, 22 Feb 2025 19:12:56 -0800 (PST) Received: from google.com ([2401:fa00:8f:203:badf:54f:bbc8:4593]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2fceb0786e9sm3838542a91.33.2025.02.22.19.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2025 19:12:56 -0800 (PST) Date: Sun, 23 Feb 2025 12:12:47 +0900 From: Sergey Senozhatsky To: Herbert Xu Cc: Sergey Senozhatsky , Barry Song <21cnbao@gmail.com>, Yosry Ahmed , Minchan Kim , "Sridhar, Kanchana P" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "hannes@cmpxchg.org" , "nphamcs@gmail.com" , "chengming.zhou@linux.dev" , "usamaarif642@gmail.com" , "ryan.roberts@arm.com" , "akpm@linux-foundation.org" , "linux-crypto@vger.kernel.org" , "davem@davemloft.net" , "clabbe@baylibre.com" , "ardb@kernel.org" , "ebiggers@google.com" , "surenb@google.com" , "Accardi, Kristen C" , "Feghali, Wajdi K" , "Gopal, Vinodh" Subject: Re: [PATCH v5 02/12] crypto: acomp - Define new interfaces for compress/decompress batching. Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: 468B8C0004 X-Stat-Signature: fart38uztquw1ztng3dox1b3rgspjmda X-Rspamd-Server: rspam03 X-HE-Tag: 1740280379-260387 X-HE-Meta: U2FsdGVkX1/PtHurUgQZczcDF6cW0bM2bUUFyjEOmsyuCN2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zHLQYD/FHg0qeERipVQCJbCtFJRic/g0mWC9lFZE23sA3wSGUzCHmznAGOk9Q/QQavgiK0uAZy1nN5L8/f6O0jtrPIIbC+1ikObJZ3a95nAQk1Rn4lZGyDH4KLuU/NyX71zV8sqdbUSxblk9cAmIPpy1rvGBTzn/yeiX1oYySCNDTBIGPLyNMJVuYGtCX7TayltsgKXyT4J3RDhk9CEFYIpGs7Lq/NPPd03XiSrwu5UBKuawCD58oE4zlHH1JyI38IMsslWJqvC6OYaoelvK4PcAw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000379, 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/02/23 10:52), Herbert Xu wrote: > On Sun, Feb 23, 2025 at 11:09:32AM +0900, Sergey Senozhatsky wrote: > > > > Right, for lzo/lzo-rle we need a safety page. > > We should fix it because it's a security hole for anyone who calls > it through the Crypto API. Yeah, I don't disagree. > > It also seems that there is no common way of reporting dst_but overflow. > > Some algos return -ENOSPC immediately, some don't return anything at all, > > and deflate does it's own thing - there are these places where they see > > they are out of out space but they Z_OK it > > > > if (s->pending != 0) { > > flush_pending(strm); > > if (strm->avail_out == 0) { > > /* Since avail_out is 0, deflate will be called again with > > * more output space, but possibly with both pending and > > * avail_in equal to zero. There won't be anything to do, > > * but this is not an error situation so make sure we > > * return OK instead of BUF_ERROR at next call of deflate: > > */ > > s->last_flush = -1; > > return Z_OK; > > } > > } > > Z_OK is actually an error, see crypto/deflate.c: I saw Z_STREAM_END, but deflate states "this is not an error" and there are more places like this. > ret = zlib_deflate(stream, Z_FINISH); > if (ret != Z_STREAM_END) { > ret = -EINVAL; > goto out; > } > > We could change this to ENOSPC for consistency. So it will ENOSPC all errors, not sure how good that is. We also have lz4/lz4hc that return the number of bytes "(((char *)op) - dest)" if successful and 0 otherwise. So any error is 0. dst_buf overrun is also 0, impossible to tell the difference, again not sure if we can just ENOSPC.