Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp32474lqh; Thu, 30 May 2024 13:03:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWSZ3GTU+b8FgL61WEhzFreGd9wVlRRsuTEIXqLx4E0O8yDdaaWujDKuh+PbUv66/CzlZS6KV+goT8Awoe/4NTrhzXmvffhe7/aQIIMg== X-Google-Smtp-Source: AGHT+IHsuBKiNCkNZbHld44fgovIGKd54lpfsHCFHWz1+ftt8MJeJNGVyKxL+gRgWbkEQUMauVkd X-Received: by 2002:aca:1317:0:b0:3c7:d8c:75c5 with SMTP id 5614622812f47-3d1dcca399dmr2972501b6e.20.1717099405351; Thu, 30 May 2024 13:03:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717099405; cv=pass; d=google.com; s=arc-20160816; b=LIwB0L4POUeRmQm5wWp13anigWBuyan5gk3KK5zAZIxaDbB9dEHtcjzvflL+EnT7kD xaokVgO21P7zuH6koMEGoqr4ebbfzhDFVmyGmh94t02Iu5d1+fTwoEyV+2u1P+v94BAP Nb0zHXr5zqfTGNK7oOckvaiPT9JYv/9TJ6lIY5lbIZGDQSLOO3vynq4H4KJZVeBh1Ns5 UIQxE56KuW9gcmPzEJYv3Emi4canfTh2ZFkpa/6Fqec4ZNgq1xdPxhJXrbPkRh0NQ65s lRwwMKWaYxE7wi2OnDFTUUIQ4RwOWEET0R0m1gjSVsmBiT3b8/dcClUBIZAd/xgCZIF5 6WSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=8WIvvZ5hk/ptSvSBf6Ha9B8uNyWqyavLCIUNhhI3Qjw=; fh=4ZFbxgadT7ro7jB+v/5epOGSXF+73Vq0vlRf01PvljM=; b=AoZpAinP5f+cFnITkUD8HAeyOoGb0cmc+IQoSl3dk43bioNTIED03zZF+4eKRmeO40 L0CmnzRLXugLKfZleLU1+460A/JELgwcl2LMba1yoLR9DbzcwkCW3bLRP334mq2Dry7h 9SLfdtnx9CaB+PXBB9xnVrJ7bVsTK10nZVUnnjNNP6l8V5q7ohy6++G/pzKy7fotkFHy waCXL6+yGEwiD6iAzxsi0DApMMithY0qzeNZ9u8Uhs+IOdT3OuEGecpSdu9c25jQDl8X jKhLxM71p8u0TqJS0pedslmsiMDi+v8S5kqdEjwXZYAeEmrAup5ol9IrAyfq8TZSMQpj sGSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=KG8OgMFc; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-195849-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195849-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 71dfb90a1353d-4eafedc96d8si125837e0c.66.2024.05.30.13.03.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 13:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195849-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=KG8OgMFc; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-195849-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195849-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0FE461C23EDE for ; Thu, 30 May 2024 20:03:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 084C355884; Thu, 30 May 2024 20:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="KG8OgMFc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2E108187568 for ; Thu, 30 May 2024 20:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717099399; cv=none; b=cr4eeMPAgb7snTJpQ/zvrr89F+fH96LLITNCMi9w6Drrm8n7Rhbel6CZTMA9X4qK1E6VexHaOUYN5PSCr/UqZOYv7AMsXozNWagCjY3CV7LI3gOcwuCb2YhI8YrOdc3CBBeN9xRoEGo+OjEStaDC+ciy+WKe88RGTFBWaZQQKbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717099399; c=relaxed/simple; bh=2Zk9G4N1QVb6dL/7eakVW9j4sKX8lEMickryI8gm060=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=tZ5SR1aBxpoUloTPrzO3SwCk8En4xliQKAKa9pDqhOHncnbTx5z4Cvs9MmoPGVkF4rt8uo31AbLqIUbuGVcx9NBxe0enunKS7VJK+mQHQkmkWgF+9hp70VzsoQFz4DriUshlVodVIWpCHnG+w7hjyWTlu2AImDh8NVrI4MWu5NA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=KG8OgMFc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 995FEC2BBFC; Thu, 30 May 2024 20:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1717099399; bh=2Zk9G4N1QVb6dL/7eakVW9j4sKX8lEMickryI8gm060=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=KG8OgMFc2LRGn6x9Y62ndM1Cvk9t0TmadtaEYAsyIXFPl3B7/RAlkOSxYeReyw6ro viThB6cIZ9P2/i8ZGwC88TQaXdFcU4sevPvdES7ZDT4GU9pXN+/jQbtGcPDCsgbA6+ DQs2uCwMZujFkb3gaXK8uc/DMXlET8eXedwqkgXA= Date: Thu, 30 May 2024 13:03:18 -0700 From: Andrew Morton To: Cc: , , , <21cnbao@gmail.com>, , , , , , "Hailong . Liu" Subject: Re: [RFC PATCH] mm/vmalloc: fix vbq->free breakage Message-Id: <20240530130318.2a78c0797c352a4d38cfb2c1@linux-foundation.org> In-Reply-To: <20240530093108.4512-1-hailong.liu@oppo.com> References: <20240530093108.4512-1-hailong.liu@oppo.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 30 May 2024 17:31:08 +0800 wrote: > From: "hailong.liu" > > The function xa_for_each() in _vm_unmap_aliases() loops through all > vbs. However, since commit 062eacf57ad9 ("mm: vmalloc: remove a global > vmap_blocks xarray") the vb from xarray may not be on the corresponding > CPU vmap_block_queue. Consequently, purge_fragmented_block() might > use the wrong vbq->lock to protect the free list, leading to vbq->free > breakage. What are the userspace-visible runtime effects of this change? > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index d12a17fc0c17..869e7788a7d5 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -2269,10 +2269,9 @@ static void _vm_unmap_aliases(unsigned long start, unsigned long end, int flush) > for_each_possible_cpu(cpu) { > struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu); > struct vmap_block *vb; > - unsigned long idx; > > rcu_read_lock(); > - xa_for_each(&vbq->vmap_blocks, idx, vb) { > + list_for_each_entry_rcu(vb, &vbq->free, free_list) { > spin_lock(&vb->lock); > > /* > --- > https://lore.kernel.org/all/20240530025144.1570865-1-zhaoyang.huang@unisoc.com/ > BTW, zhangyang also encounter the same issue, maybe revert commit not a > better solution. we need a map to get vbq from vb. That patch didn't describe the runtime effects either. Folks, please always do this. So that others can decide whether their kernel needs the fix, and so that others can decide whether this fix might address an issue which their users are reporting.