Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1643640lqe; Mon, 8 Apr 2024 15:48:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQmTx40AAvF4KCECEhFr1AZp2YsZpJeVrwUTaL7GwssxQs2y2myEAO4CMfAl01uu9aVrYqGI80Cy5nV6+JMQ2LY5Nr5Z7MKd57x91DTw== X-Google-Smtp-Source: AGHT+IEby/sr7GRaxzs1/QXksicl/VpYqnshlxOugUFPjyLw0EYhRK9N2RYeYnJI0qG0nlSpIEjM X-Received: by 2002:a05:6a20:9788:b0:1a3:bfce:ec9e with SMTP id hx8-20020a056a20978800b001a3bfceec9emr9522778pzc.18.1712616535217; Mon, 08 Apr 2024 15:48:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712616535; cv=pass; d=google.com; s=arc-20160816; b=sWWpqD8evVgt5TAa5tsyzMV235Wu1cxOG6r+/zwA9OFY8iu0v3GP101WlSkCPtrN6B XMtk9gHXMdBaLxiADw2AKuNNKJkN6Fcbvwo0Dio3qF0pVoeHxwzLJWFhRHiP10loaGGk Ml58aVupg8VeeIcYNO/ktn3DKFwTSjefIc7DkyJttvfm50bnNY4x2RZrKzl8rcuQOzTF xho6u2/M+MYJlLnFFvfHrT772omzbaX0d7DRD7B/6rG1qBrp8B8yN7ZKPr2yVsLmjudm 1pnNzvtG9j5OHOJskYBcYIFZ8pmgcRvfl7kFzoyKfqoB6U6HoApiWJngUffD7UEA26y6 c4lw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=Nz3YIIIQmU8yWVDXM1ZV8xt6EYuCL7CXXu2zWkKWpgo=; fh=gCa9cKYuIdJkQUi8fpKCNRV5rm+8Gabpuq6lSTqx5KU=; b=kH/VeSVl/fkMNN1IQO0GYOtTa1A9FNPMt4dA4nEO12NV1Gej9iuJiGMz6BgzEloh27 81G0M412kf9dd0w5bW4agvPK/Y0+JqQ/MS+YspxPwFkqhruS0cfFUunGFlj8O+HkBmt9 DE0xQskb+NLgsMheoxA1wu4E0QO5yM2BQRa7SSb2a6SxI/TjWpJ797tUaVddtS+IVu2K c2V5CVQSCoxd7Ie8hjhgSmQYoGcTUW39KZjlxblbNJn/fEfSOKakluwlX/47tALgrPu8 +GAiYVZSLyIQulnq7k3nrq9Mz2197fpXAJm+oB56BHQF1B1rcFdvPBODAk4oBZQsklCL rMFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=LOYpK2w1; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-135982-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k9-20020aa788c9000000b006ed0d5b09e6si5829720pff.142.2024.04.08.15.48.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 15:48:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135982-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=LOYpK2w1; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-135982-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DA8F32836D6 for ; Mon, 8 Apr 2024 22:48:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A01C2AF14; Mon, 8 Apr 2024 22:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="LOYpK2w1" Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (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 90C0D171B0 for ; Mon, 8 Apr 2024 22:48:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712616528; cv=none; b=o3MpIVaG9bF2eg2FCGdXUeENzgE1lCzUGGPd3p+jpKUlBrIjuUk7oJTVTZZoe/6fdm3puWehQEimMxij8n3XNEW0radKcB28YrE/9kAdfwJAx6IHUQHIWMgVrrsybXK7j4zpsINF+cDROXakHw7gyA40mEKmfSx8FLEecXbHIj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712616528; c=relaxed/simple; bh=RRWWx01pPfJbdFi3MWVf0eOueg30+ChmYzjuX0MhCRQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hpzVdWAos/0MHR4cO5saIyFZuK3VaGh6+tEGmwxijIamoBpKRF2FNS2XIodkhmVBeCeClog+mBqZBIyg84muE0hHXz8psqxl5J20VggiuXvIgIkGBJf95sYUXfv/TW/fy1scIAxpFRFPDVg6dLxDul/0xBzXYQfrL7+czZFPmTU= 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=LOYpK2w1; arc=none smtp.client-ip=115.124.30.111 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 DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1712616523; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=Nz3YIIIQmU8yWVDXM1ZV8xt6EYuCL7CXXu2zWkKWpgo=; b=LOYpK2w1Y3YxK3id5xrc5JL/9ncb6O5LUO6dPO5/v2epvhGUwwpMv3IN/0QvGxi5MRPVtSw0CpFSJESdW8zRHZ4v11gFdwQJQsyszkO6bLqTBnCAOzgDaTeTD/iC5SoGgDkzqPyQIDE4ll30QlW2+MBkFKAzgKdnHsEu2cLORy8= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0W4CNr.I_1712616521; Received: from 192.168.3.4(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0W4CNr.I_1712616521) by smtp.aliyun-inc.com; Tue, 09 Apr 2024 06:48:42 +0800 Message-ID: <3b3d0b99-f7b5-4dcc-a631-1018f4025acf@linux.alibaba.com> Date: Tue, 9 Apr 2024 06:48:41 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool To: Sandeep Dhavale , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Chunhai Guo Cc: linux-erofs@lists.ozlabs.org, syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com, kernel-team@android.com, linux-kernel@vger.kernel.org References: <20240408215231.3376659-1-dhavale@google.com> From: Gao Xiang In-Reply-To: <20240408215231.3376659-1-dhavale@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Sandeep, On 2024/4/9 05:52, Sandeep Dhavale wrote: > erofs will decompress in the preemptible context (kworker or per cpu > thread). As smp_processor_id() cannot be used in preemptible contexts, > use raw_smp_processor_id() instead to index into global buffer pool. > > Reported-by: syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com > Fixes: 7a7513292cc6 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable") > Signed-off-by: Sandeep Dhavale Thanks for catching this, since the original patch is for next upstream cycle, may I fold this fix in the original patch? I will add your credit into the original patch. Thanks, Gao Xiang > --- > fs/erofs/zutil.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c > index b9b99158bb4e..036024bce9f7 100644 > --- a/fs/erofs/zutil.c > +++ b/fs/erofs/zutil.c > @@ -30,7 +30,7 @@ static struct shrinker *erofs_shrinker_info; > > static unsigned int z_erofs_gbuf_id(void) > { > - return smp_processor_id() % z_erofs_gbuf_count; > + return raw_smp_processor_id() % z_erofs_gbuf_count; > } > > void *z_erofs_get_gbuf(unsigned int requiredpages)