From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 407F314EC77 for ; Thu, 9 Jan 2025 05:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736400167; cv=none; b=S4ZUdtrUf3GyFJj537MuHu9f38BoipyGsnhqHqRg7zxDdXQFnbnvtiytA4ztGbgSvTseggh2b8IjdtORLq4H4PTRzHrudIJnq9FpCN/QkgoTJBTVNPhKl6UVxhuT/nTCa+bbUe13GAHOOsZyB41cvfXzkG1F8RXQDpZM+xqvFIU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736400167; c=relaxed/simple; bh=y2doB+CgW8AboyjygnAUGVaQmuvhv1ZQV/39vdkYbSQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kJamDZx8XC9WySoOwGxtHtZz2WsS2Q+RMaaqfqYDZf/Fjky6iB33eNQVHJj1TIIreIsAHWl0ADGwO1ZkzgQgqJRSN/r07C3kfA8irDD3q2mPp1jyX0Pi7uVXGELTKAfs+JW7b1I1gWAINGb1tYJjMwEtyxcXFNOFG56ZIjOBgRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DxVOQzwJ; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DxVOQzwJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736400165; x=1767936165; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=y2doB+CgW8AboyjygnAUGVaQmuvhv1ZQV/39vdkYbSQ=; b=DxVOQzwJGfzvHUFqqFNyOG6dAUuW0xllh6gSHqEUtS96MND+DgSaP8dn 9RExCaMpAwonjc0wOr3ZDC0uPKeCv8+gKhHVxfNeVcRYlWsGg/QVe3Tdm owt+znISQbufNtn4dlnhnWm3x3/uSvF0jSu5Tlh9qSsLJtVs0XesjAI5j 40xobJWbzeyF2QNtrcq2RdlCTv6Nr94soX5D/+Sj9xsaGt1mXKe/t2lX1 33lBtFVFG803i2JmPujjzqUujPKctDC38xpP0UihpcZLnLL/FmUUE8ylh Q4pa/+wInDQ5ux1vsugdf0HRobitQ0JHHc6v4n05mQAlRNjesnBu2CviK w==; X-CSE-ConnectionGUID: QVqqc039T+2CQLHlU3ZI7Q== X-CSE-MsgGUID: WlNdn3+6RaGDQ51I878SsA== X-IronPort-AV: E=McAfee;i="6700,10204,11309"; a="47220248" X-IronPort-AV: E=Sophos;i="6.12,300,1728975600"; d="scan'208";a="47220248" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 21:22:44 -0800 X-CSE-ConnectionGUID: 03dzdq7ZQheO0f65ht2y0Q== X-CSE-MsgGUID: VfFOT+ByT5W4+08EXiQaFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,300,1728975600"; d="scan'208";a="134139888" Received: from ericzhan-mobl2.amr.corp.intel.com (HELO desk) ([10.125.145.67]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jan 2025 21:22:44 -0800 Date: Wed, 8 Jan 2025 21:22:37 -0800 From: Pawan Gupta To: David Kaplan Cc: Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Ingo Molnar , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 12/35] x86/bugs: Restructure retbleed mitigation Message-ID: <20250109052237.pq4irr2iycitl5il@desk> References: <20250108202515.385902-1-david.kaplan@amd.com> <20250108202515.385902-13-david.kaplan@amd.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=us-ascii Content-Disposition: inline In-Reply-To: <20250108202515.385902-13-david.kaplan@amd.com> On Wed, Jan 08, 2025 at 02:24:52PM -0600, David Kaplan wrote: [...] > @@ -1064,6 +1063,7 @@ enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init = SPECTRE_V2_NONE; > > enum retbleed_mitigation { > RETBLEED_MITIGATION_NONE, > + RETBLEED_MITIGATION_AUTO, This new enum ... > RETBLEED_MITIGATION_UNRET, > RETBLEED_MITIGATION_IBPB, > RETBLEED_MITIGATION_IBRS, > @@ -1071,14 +1071,6 @@ enum retbleed_mitigation { > RETBLEED_MITIGATION_STUFF, > }; > > -enum retbleed_mitigation_cmd { > - RETBLEED_CMD_OFF, > - RETBLEED_CMD_AUTO, > - RETBLEED_CMD_UNRET, > - RETBLEED_CMD_IBPB, > - RETBLEED_CMD_STUFF, > -}; > - > static const char * const retbleed_strings[] = { > [RETBLEED_MITIGATION_NONE] = "Vulnerable", > [RETBLEED_MITIGATION_UNRET] = "Mitigation: untrained return thunk", ... does not have a corresponding entry in the strings array. AUTO is the default, and it is possible that mitigation mode can stay AUTO throughout the retbleed mitigation selection depending on cmdline and CONFIGs. e.g. retbleed=stuff and spectre_v2=off. Other issue is below print in retbleed_update_mitigation() will dereference a NULL pointer: pr_info("%s\n", retbleed_strings[retbleed_mitigation]);