From nobody Sun Jul 26 01:48:10 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B206397E85 for ; Fri, 10 Jul 2026 08:28:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783672135; cv=none; b=rmS+BQjK8jaVY8IEyqsDo43066uUcK3WF2K2Q3rS7ffQI5MruFFNrrvnTdaTIOMnK3skdYU4xZS4+qmApI/wqXG4MFlbtHhUsyxsOIx2z1guJCDP/tOm2ROhfVt9EC0Pv9Iu4nhPfXzabA59fO7WibBOqCDuT/Rn+z37a03MBTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783672135; c=relaxed/simple; bh=rNxs4H7JZDfwdxgK02aUPsRq6Bki9OLaSpDIMQgTsDk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tdHdizmPoGAy/Gg8dSuIoTRWSHxjVVbBOiQJtIO9wdVh4BvRBXyW8MZKzRZHK6k32NN4Ad2vupXhLcBm+Lx4NY0qSrMOO/fkYy0VVMPaFDl1UGcKEqGS/G0G8NTyT6+0f8J+dW2uYskBImtFLZFPpbPUERiBcwCr2ZC7DFrXLWA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 5cb2f1887c3911f1aa26b74ffac11d73-20260710 X-CTIC-Tags: HR_CC_COUNT, HR_CC_DOMAIN_COUNT, HR_CC_NAME, HR_CC_NO_NAME, HR_CTE_8B HR_CTT_MISS, HR_DATE_H, HR_DATE_WKD, HR_DATE_ZONE, HR_FROM_NAME HR_SJ_LANG, HR_SJ_LEN, HR_SJ_LETTER, HR_SJ_NOR_SYM, HR_SJ_PHRASE HR_SJ_PHRASE_LEN, HR_SJ_WS, HR_TO_COUNT, HR_TO_DOMAIN_COUNT, HR_TO_NO_NAME IP_TRUSTED, SRC_TRUSTED, DN_TRUSTED, SA_EXISTED, SN_UNTRUSTED SN_UNFAMILIAR, SPF_NOPASS, DKIM_NOPASS, DMARC_NOPASS, CIE_GOOD CIE_GOOD_SPF, GTI_FG_BS, GTI_RG_INFO, GTI_C_BU, AMN_GOOD ABX_MISS_RDNS X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:6e982667-8bbb-49db-85fb-e5b91f8e77af,IP:10, URL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:-15 X-CID-INFO: VERSION:1.3.12,REQID:6e982667-8bbb-49db-85fb-e5b91f8e77af,IP:10,UR L:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-15 X-CID-META: VersionHash:e7bac3a,CLOUDID:47ed8060824e5aaeacefd11062448ea5,BulkI D:260710162846BCIR0X1Z,BulkQuantity:0,Recheck:0,SF:17|19|66|78|102|127|865 |898,TC:nil,Content:0|15|50,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:nil,QS :nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,A RC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 5cb2f1887c3911f1aa26b74ffac11d73-20260710 X-User: husong@kylinos.cn Received: from ctao-book.. [(223.70.159.239)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 2021237231; Fri, 10 Jul 2026 16:28:43 +0800 From: Song Hu To: linux-mm@kvack.org Cc: hannes@cmpxchg.org, yosry@kernel.org, nphamcs@gmail.com, chengming.zhou@linux.dev, ljs@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Song Hu Subject: [PATCH] mm/zswap: flush dcache in the compressed decompression path Date: Fri, 10 Jul 2026 16:28:22 +0800 Message-ID: <20260710082822.583930-1-husong@kylinos.cn> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Both branches of zswap_decompress() write the destination folio through a kernel mapping: the incompressible branch via kmap_local_folio() and the compressed branch via the crypto scatterwalk. Yet only the incompressible branch calls flush_dcache_folio(); the compressed branch was missed. On aliasing D-cache architectures this can leave stale cache lines visible to userland after a zswap load. zram flushes in the same situation (zram_bio_read()). Hoist a single flush_dcache_folio() out of the incompressible branch so both paths are covered. Fixes: e2c3b6b21c77 ("mm: zswap: use SG list decompression APIs from zsmall= oc") Signed-off-by: Song Hu --- mm/zswap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/zswap.c b/mm/zswap.c index b5a17ea20237..bb0c16d102d5 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -943,7 +943,6 @@ static bool zswap_decompress(struct zswap_entry *entry,= struct folio *folio) memcpy_from_sglist(dst, input, 0, PAGE_SIZE); dlen =3D PAGE_SIZE; kunmap_local(dst); - flush_dcache_folio(folio); } else { sg_init_table(&output, 1); sg_set_folio(&output, folio, PAGE_SIZE, 0); @@ -954,6 +953,9 @@ static bool zswap_decompress(struct zswap_entry *entry,= struct folio *folio) dlen =3D acomp_ctx->req->dlen; } =20 + /* Both branches write the folio through a kernel alias. */ + flush_dcache_folio(folio); + zs_obj_read_sg_end(pool->zs_pool, entry->handle); mutex_unlock(&acomp_ctx->mutex); =20 --=20 2.43.0