From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 ACC6A41B34C for ; Thu, 5 Feb 2026 14:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770303574; cv=none; b=sgv1mOYino73z0RY2AW5CSQlxSag5kvZHx+QqKxXiC+O5bJZLPqwnJNJo2nbkjUotVQjhuwMYDYF/EjtEp55qTcstOO2e5HCJf13FNwzos8G1kVeWwdyk54srSyaZzuR5p7ORsD6r2BSDScZ0R7XwT+DjwhKd2qYrLHK5ZOJypg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770303574; c=relaxed/simple; bh=546/c3Yk3Eb6zZ4rQSo3Ja5dhixWrniJX45HEKbftBc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AFEiEvTtHAULQkoyHk8k6TVDP6bY71rbpSQcx6c4WXYCp3CqdUEHRqi1mnTD2LNJpoXwkjLZ6xTmrCf1MgGqlLF+3GQSm2HP70p+p52nMxWVdjspomEEtzjF0IlTJJ2DVxStFiX23TYCu/DgHjsKk+GKhcVbDFuamviIy4nRLN0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=eToxvCe9; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eToxvCe9" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=hj9WPCutL3EUUqoD+sGKEvjQCSu+q1owkybpFjIvAEU=; b=eToxvCe9azgomWq0Zd6jjvfs/a y35Guxpan1Hojpe0M9wHYgIa2KK+nav+U9fJjcSQEXrRwlFMXGbRyeSeDpWtpuz6V4NQEFF6W/7pX H4aQkQ9oaZTewU72eHelQZP3gJYdW4Jsqfd7Hgn31D/KEku+VlkFvOLUoQZ4RuROI3NGzf9U77nIC AoKjpFijS3RqJnsEK4qvRZ3RcKkGZaUYLfdRkGb1IP0glPqIMZYo44b3iPdyxI5qd2oAFRufSaWeE zX+TFl/XFHIsVkE1cVtd4LuoXuI14VHEsp6tIBDtFkNKGuVL+/b7AfvYqX3VBg8dQhRDe8gJYBGa3 Rk0U0Z9g==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vo0p9-00000002Mgg-0hA8; Thu, 05 Feb 2026 14:59:15 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 8E0CF300E8B; Thu, 05 Feb 2026 15:59:12 +0100 (CET) Date: Thu, 5 Feb 2026 15:59:12 +0100 From: Peter Zijlstra To: Chuyi Zhou Cc: tglx@linutronix.de, mingo@redhat.com, luto@kernel.org, paulmck@kernel.org, muchun.song@linux.dev, bp@alien8.de, dave.hansen@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/11] smp: Enable preemption early in smp_call_function_many_cond Message-ID: <20260205145912.GM2995752@noisy.programming.kicks-ass.net> References: <20260203112401.3889029-1-zhouchuyi@bytedance.com> <20260203112401.3889029-6-zhouchuyi@bytedance.com> <20260205095236.GI232055@noisy.programming.kicks-ass.net> <20260205105704.GA245049@noisy.programming.kicks-ass.net> <261ae19f-e3d1-4017-be1e-90b5c6d91dc7@bytedance.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <261ae19f-e3d1-4017-be1e-90b5c6d91dc7@bytedance.com> On Thu, Feb 05, 2026 at 10:29:51PM +0800, Chuyi Zhou wrote: > Hi Peter, > > 在 2026/2/5 18:57, Peter Zijlstra 写道: > > On Thu, Feb 05, 2026 at 10:52:36AM +0100, Peter Zijlstra wrote: > >> On Tue, Feb 03, 2026 at 07:23:55PM +0800, Chuyi Zhou wrote: > >> > >>> + /* > >>> + * 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(); > >> > >> This is horrible crap. migrate_disable() is *NOT* supposed to be used to > >> serialize cpu hotplug. > > > > This was too complicated or something? > > > > Now most callers of smp_call*() explicitly use preempt_disable(). IIUC, > if we want to use cpus_read_lock(), we first need to clean up all these > preempt_disable() calls. > > Maybe a stupid question: Why can't migrate_disable prevent CPU removal? It can, but migrate_disable() is horrible, it should not be used if at all possible.