From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sg-1-102.ptr.blmpb.com (sg-1-102.ptr.blmpb.com [118.26.132.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B632F339843 for ; Mon, 9 Feb 2026 07:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=118.26.132.102 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770623807; cv=none; b=CmSrGe5T8hO7ijYdNtI08mTenQX+LdUZ4ul6VXMUusyoeclIqfwCTabte+k8EgLrzyh1DPLrog5BdaQmTKtImhJG/eobKcg8qPkbG45C6lemauY5FXdScER9E7fAei4fq+H1RZShhR6hMplORkmH7dwzasgPSs5z09M/9R1WyuU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770623807; c=relaxed/simple; bh=P1HT2K7IjGtEl5Xw4hWlc27HPgEVp59XPl8MXiN5j+U=; h=To:References:Cc:From:Subject:Date:Message-Id:Mime-Version: In-Reply-To:Content-Type; b=RwrBXaU5+8XowJxsvdTEU52NorQuJLgl4Auj8KrReKomy5NDPKpJJD6JGrSRnLMXGl7atc+N0n5kKebOTMyQN/4KBvJMaWSkbw36A9YM52TZLfT4EVpLCJgnZe91XEpGz4QruGO2H2xL9pGeLyRnSkeswZjOSWJQz5/OHGnm6lI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=qbCb0p2l; arc=none smtp.client-ip=118.26.132.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="qbCb0p2l" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1770623798; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=28i/9lsC06jkMFG3T6t7OOuCkwUrNoLreb1K1AbE/yM=; b=qbCb0p2l6XcnXvUiUVmndPrjO04OSBdHaoLrFg+F4UagOjQR7ad73g7KPDZs6BHFovqOI8 5eaCt/YfPdbA6nWQXKz8LoQ7233+bJVOU4cPvlw7TDSMjRro5MLMDuVTAOzb7ERjpXf9J4 qErWCZh7l5Oi0qhopVp8p2q/lzWe9tSRWTJq8RxGS4mJJ81t7cu8JUD8KmfYC308BgCjKr vGR9xLfaxONTNEqfsQRUrITaTfUw+3B0C8lZzKDbPUWQni0GwNkmiTVg9kHIfstmb0yvPs U8xho9zY8Xmh1AEOmuvYtK/uLL1bJ0KSkMy2icLh4y1HmJN+qyzy/I2nkHYKAw== To: "Peter Zijlstra" References: <20260203112401.3889029-1-zhouchuyi@bytedance.com> <20260203112401.3889029-6-zhouchuyi@bytedance.com> <20260205095236.GI232055@noisy.programming.kicks-ass.net> X-Original-From: Chuyi Zhou Cc: , , , , , , , User-Agent: Mozilla Thunderbird Content-Transfer-Encoding: quoted-printable From: "Chuyi Zhou" Subject: Re: [PATCH 05/11] smp: Enable preemption early in smp_call_function_many_cond Date: Mon, 9 Feb 2026 15:56:23 +0800 Message-Id: <3f474d49-bf07-4a2c-aa38-093373bd5bf5@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Lms-Return-Path: In-Reply-To: <20260205095236.GI232055@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 =E5=9C=A8 2026/2/5 17:52, Peter Zijlstra =E5=86=99=E9=81=93: > On Tue, Feb 03, 2026 at 07:23:55PM +0800, Chuyi Zhou wrote: >=20 >> + /* >> + * Prevent the current CPU from going offline. >> + * Being migrated to another CPU and calling csd_lock_wait() may cause >> + * UAF due to smpcfd_dead_cpu() during the current CPU offline process= . >> + */ >> + migrate_disable(); >=20 > This is horrible crap. migrate_disable() is *NOT* supposed to be used to > serialize cpu hotplug. Here we can use rcu_read_lock to replace migrate_disable/cpus_read_lock,=20 and in smpcfd_dead_cpu(), wait for all rcu read critical sections to=20 exit before releasing percpu csd data. This allows csd_lock_wait() to be preemptible and migratable, while=20 avoiding concurrency issues between smpcfd_dead_cpu() and csd_lock_wait. Thanks.