From nobody Sat Jun 13 20:23:16 2026 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (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 579E3472760 for ; Tue, 5 May 2026 15:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.112 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777996592; cv=none; b=qsALfFtrbZr0bNMGsmulQcx7FCXnAUkVpZeaWDx66uzyzTFUudu7r17y5MrFDLfH8spJ5cnEHzDi7Ts8k7hywbk9Y65TbMvBMT49XcGLWGMJaaJmmebBA6KY9m8FC6gYzqB7+GjgKdou2rssnVvBFEL+YhM4xTrnfhHzziBfs/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777996592; c=relaxed/simple; bh=NsiMSm3PGiJiPsdB8NRYslap8vRYGA0umdvGhobVt4Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=S7lNdeWyRf1FV3SOMAMRweTAhhkKrin9536sKF+IozfVaqpziUMJ8aAsVAgZdIm4cElN0nIcRECcr9yFnhR+2tEP2sINTKE6g9OACr+j4knEGZBPqppwtdpwQLx1l/pKATYdCWegYUnVfMZtReg2tXEQwAyIszneK2pk4JW/5iI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=xtu6Xjs5; arc=none smtp.client-ip=115.124.30.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="xtu6Xjs5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1777996581; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=pYXhan5/BhHZaUFYN6mzVa2Xk6sTmgmZ+Veyox0lqTA=; b=xtu6Xjs5L3hmv/hCKOnjP8LcYtPfw5V9zrktUBOU5CcrlaKVFvLHJFpDHF76ILmp87HkdAjbmHJF8o05GC1gjGEUWUXDva2zv+aLhU9xBq5+fwQZjHvRpDlsb8uIQ7C0uHpe7WkR1Rz+J7phG87RLnTZTVKpm11AHT/tQAxo3K0= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0X2IBQDW_1777996576; Received: from x31i01179.sqa.na131.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X2IBQDW_1777996576 cluster:ay36) by smtp.aliyun-inc.com; Tue, 05 May 2026 23:56:20 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org, Chao Yu Cc: LKML , oliver.yang@linux.alibaba.com, Gao Xiang , Carlos Llamas , Sandeep Dhavale , Tatsuyuki Ishi Subject: [PATCH] erofs: use the opener's credential when verifing metadata accesses Date: Tue, 5 May 2026 23:56:15 +0800 Message-ID: <20260505155615.2719500-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 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" Similar to commit 905eeb2b7c33 ("erofs: impersonate the opener's credentials when accessing backing file"), rw_verify_area() needs the same too. Fixes: 307210c262a2 ("erofs: verify metadata accesses for file-backed mount= s") Cc: Carlos Llamas Cc: Sandeep Dhavale Cc: Tatsuyuki Ishi Signed-off-by: Gao Xiang Tested-by: Carlos Llamas --- Can we verify this patch resolve the android-mainline issue? fs/erofs/data.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index b2c12c5856ac..51b8e860b6b2 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -40,9 +40,11 @@ void *erofs_bread(struct erofs_buf *buf, erofs_off_t off= set, bool need_kmap) */ if (buf->file) { fpos =3D (loff_t)index << PAGE_SHIFT; - err =3D rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE); - if (err < 0) - return ERR_PTR(err); + scoped_with_creds(buf->file->f_cred) { + err =3D rw_verify_area(READ, buf->file, &fpos, PAGE_SIZE); + if (err < 0) + return ERR_PTR(err); + } } =20 if (buf->page) { --=20 2.43.5