From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from outbound.baidu.com (mx24.baidu.com [111.206.215.185]) (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 B004032E72F for ; Fri, 12 Jun 2026 05:51:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.206.215.185 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781243513; cv=none; b=VO1C2CN6toAT6S7pAjSkGvbft0kbo0WyMrxnXZgufo/xEqtqj8VTOPCgOQpaNOFBwfXm3Hj6bRsL3Iyq6GDJ5Z6xnh/cTbUG3UcTpBDCWTqz3+Penpzq2R+syTvs6u3A1+OGIToCpqbA7+5r1gtPHIy9XeNS0K1Wf0naEnoMf6s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781243513; c=relaxed/simple; bh=79FigQl4wsM9ThW6gExddI2yCEHkAaPOvR3gQEHZKBs=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=F2t/biSWVwDy+Xw/yjA4xN6dSe/eUhP8Xbr/bSNqEtQv3EEVsYk3R0kjS2zTQJUy77mDQISKEx0GrsSrXgqtCNxGr8Fdh+RKwKX16V9Gcej/5Sonh7RwNfw05vixXgo6+owvBM7zStQy46rRl9UpIynS9gsXaCjBiD2D0P/+JyQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; dkim=fail (0-bit key) header.d=baidu.com header.i=@baidu.com header.b=MukauxNp reason="key not found in DNS"; arc=none smtp.client-ip=111.206.215.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=baidu.com header.i=@baidu.com header.b="MukauxNp" X-MD-Sfrom: lirongqing@baidu.com X-MD-SrcIP: 172.31.50.47 From: lirongqing To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H . Peter Anvin" , Li RongQing , , Subject: [PATCH][v2] x86/process: Return early if TIF_IO_BITMAP is set but no IO bitmap is assigned Date: Fri, 12 Jun 2026 13:49:15 +0800 Message-ID: <20260612054915.2201-1-lirongqing@baidu.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: bjhj-exc10.internal.baidu.com (172.31.3.20) To bjkjy-exc3.internal.baidu.com (172.31.50.47) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baidu.com; s=selector1; t=1781243368; bh=p5AWaP257jczIrmhAbKwiXqJNct+Y0lNWtkp9snFsEg=; h=From:To:Subject:Date:Message-ID:Content-Type; b=MukauxNpmMH4YpIrsAskWhPuOaZEQgvfLRxlAsqiUVfDFLJYMl6PP9mKGERHLl7zv KGqfDWrBHCk5N5VAd50ZON5rgiw7yxr4If0Kt4VytFa4ySp1DexUFGkzACG5sA/ion R9MqG6UQnuEuyZwYJnsj+DanImRxACgj7ElVkPJ8AqqZEkptR1Lc2T36hFmaD0i44G SAOmp06a5kV77FEqOIliTcgJfJkMBKdVRURV16H6QVevQf08Sf1dXEAEzw/Tu2mey+ KiuzmMoQk2r6LFAal2KsnKCXeojTgVf8JMAxK+PeraNvI899ceE7K/NnJsxOfaWyGR m7IJTpfYcYPTA== From: Li RongQing Outside the IOPL emulation path, the IO bitmap is always expected to be allocated when TIF_IO_BITMAP is set. The paranoid WARN_ON_ONCE() handles the case where the flag and the pointer got out of sync. In this rare scenario, return early instead of continuing and dereferencing a NULL pointer. [Sohil Mehta: rephrased commit message] Reviewed-by: Sohil Mehta Signed-off-by: Li RongQing --- Diff with v1: rephrased commit message arch/x86/kernel/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 4c718f8..d5cd217 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -486,6 +486,7 @@ void native_tss_update_io_bitmap(void) if (WARN_ON_ONCE(!iobm)) { clear_thread_flag(TIF_IO_BITMAP); native_tss_invalidate_io_bitmap(); + return; } /* -- 2.9.4