Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3611997pxu; Tue, 15 Dec 2020 10:59:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVP27hFrNZKE+FPmQECq9MMgdndGUNMjoLY3issSVheW6SaH0o3T1SQ68gu2KbjbdK0O0m X-Received: by 2002:a17:906:1ed6:: with SMTP id m22mr11367461ejj.231.1608058739940; Tue, 15 Dec 2020 10:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608058739; cv=none; d=google.com; s=arc-20160816; b=chAR1j32Q96QgCKWk5Nz2E5R6dxV5rJVgMujsKKMhgA1zHyDMq4jn9qAMTqzoKTAze a3fDFMNcu8nwY23SFStPH8YFA1b3lg5xxQGlgSf9sMKKTT5OvFRfG6vbkbZaB7TaFN2u 3hm5onOJ4PShxdzVMWqvdqHXLP+asL2iBzad/rHM2Q42rqz5D9TpNaJibgZcIhC90ftM rh55Ss2SOzN47R0LVQnWm1d+xupyOiRXM/eQ7OQqIn/HuCqSXQ/jYf0d0XZoM07hu0Cv ylmC/uCcggk/1y+OyYG8SOHr+4D5wfrFcgpLJ/6r/KhXRBZF6wOw2ZZ5JKKObGBqpa+i bxbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=PcVoxPd+ouBc/AI8p99dbs+lJQKrEG95kYdrjQrEewo=; b=zmWXrZ+Xrj63HBJbpZKoP+vbzFy5dx3y6Unq5+xviwebWzqC9ogQHTDOc24+2pD2k/ QsEaZ7FIN6XlOJnNJop9zzxd17QNv+yqHoRk//jJMJeouK0qM4oYQ3P6mKLayqe87+nM 0XwEp0VrXwmBkcLnsrHjgKOTrA7KNrjNQVE0WrGa75OSUol/sJBLDTfFrS2MuLHq6szV tZ7y0HeM6JwGqMqWPVBsWY1Y+XoU28AtXCHWxKm7E1cWKh7Qz407BeqgAlQegdMAG1gt n2exvqK0CBrkwJuncqegxLkKBwe6HrHJIanjdZNmpAS7YPuysL741E5TwNbyLl12S33i 5hag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Dzq4TAQj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg40si1219290ejc.197.2020.12.15.10.58.34; Tue, 15 Dec 2020 10:58:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Dzq4TAQj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731785AbgLOSxT (ORCPT + 99 others); Tue, 15 Dec 2020 13:53:19 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34474 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731767AbgLOSxO (ORCPT ); Tue, 15 Dec 2020 13:53:14 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BFIYoAP131577; Tue, 15 Dec 2020 13:52:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=PcVoxPd+ouBc/AI8p99dbs+lJQKrEG95kYdrjQrEewo=; b=Dzq4TAQjDuXa62CHAy2cPPYdo+lWkGfWVNsYsWIT/4ZNIoMLZavq0zXRBpAsWFFakzVh t1i3drNhytHRpSVPYhFfL9RZFlEyF0L7mRZ9ycS5m60RsdgeXiuwxZOY8IE5qlPsCqPF N/nUws/WSxzjW82gu7Ii14T3txOVnYW0mFTAEAi99tAu17sDwREfD1DLLf8PpRGpAW/2 0x15AEwbTVTgi7x1I91bfMp6IkFGzz6WECv0qNXXLXHdjZ06OPJXL1uxeury7UH/qb9T QG8FEsbJb6lKlBVmgmBFsv9qCSJ36qduYoWkUzaGAudUbKHgjSW2PBm1cTa+wT3PEltm Gw== Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 35f093q9j3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Dec 2020 13:52:32 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BFIpwrG000961; Tue, 15 Dec 2020 18:52:30 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 35cng8bhbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Dec 2020 18:52:30 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BFIqSC423462160 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Dec 2020 18:52:28 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09633A4040; Tue, 15 Dec 2020 18:52:28 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A3C0A4051; Tue, 15 Dec 2020 18:52:27 +0000 (GMT) Received: from oc7455500831.ibm.com (unknown [9.171.18.42]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 15 Dec 2020 18:52:27 +0000 (GMT) Subject: Re: [PATCH] lib/zlib: fix inflating zlib streams on s390 To: Ilya Leoshkevich , Andrew Morton Cc: Heiko Carstens , Vasily Gorbik , Mikhail Zaslonko , linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org References: <20201215155551.894884-1-iii@linux.ibm.com> From: Christian Borntraeger Message-ID: Date: Tue, 15 Dec 2020 19:52:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201215155551.894884-1-iii@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-15_12:2020-12-15,2020-12-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 bulkscore=0 phishscore=0 mlxlogscore=919 lowpriorityscore=0 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012150122 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.12.20 16:55, Ilya Leoshkevich wrote: > Decompressing zlib streams on s390 fails with "incorrect data check" > error. > > Userspace zlib checks inflate_state.flags in order to byteswap checksums > only for zlib streams, and s390 hardware inflate code, which was ported > from there, tries to match this behavior. At the same time, kernel zlib > does not use inflate_state.flags, so it contains essentially random > values. For many use cases either zlib stream is zeroed out or checksum > is not used, so this problem is masked, but at least SquashFS is still > affected. > > Fix by always passing a checksum to and from the hardware as is, which > matches zlib_inflate()'s expectations. > > Fixes: 126196100063 ("lib/zlib: add s390 hardware support for kernel zlib_inflate") > Signed-off-by: Ilya Leoshkevich With a zlib compressed squashfs: Tested-by: Christian Borntraeger Acked-by: Christian Borntraeger We should add Cc: # 5.6 > --- > lib/zlib_dfltcc/dfltcc_inflate.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/zlib_dfltcc/dfltcc_inflate.c b/lib/zlib_dfltcc/dfltcc_inflate.c > index db107016d29b..fb60b5a6a1cb 100644 > --- a/lib/zlib_dfltcc/dfltcc_inflate.c > +++ b/lib/zlib_dfltcc/dfltcc_inflate.c > @@ -125,7 +125,7 @@ dfltcc_inflate_action dfltcc_inflate( > param->ho = (state->write - state->whave) & ((1 << HB_BITS) - 1); > if (param->hl) > param->nt = 0; /* Honor history for the first block */ > - param->cv = state->flags ? REVERSE(state->check) : state->check; > + param->cv = state->check; > > /* Inflate */ > do { > @@ -138,7 +138,7 @@ dfltcc_inflate_action dfltcc_inflate( > state->bits = param->sbb; > state->whave = param->hl; > state->write = (param->ho + param->hl) & ((1 << HB_BITS) - 1); > - state->check = state->flags ? REVERSE(param->cv) : param->cv; > + state->check = param->cv; > if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { > /* Report an error if stream is corrupted */ > state->mode = BAD; >