From: "tip-bot2 for Yu-cheng Yu" <tip-bot2@linutronix.de> To: linux-tip-commits@vger.kernel.org Cc: "Yu-cheng Yu" <yu-cheng.yu@intel.com>, Borislav Petkov <bp@suse.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86 <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org> Subject: [tip: x86/fpu] x86/fpu/xstate: Warn when checking alignment of disabled xfeatures Date: Wed, 12 Feb 2020 14:50:49 -0000 [thread overview] Message-ID: <158151904924.411.12474197700112093867.tip-bot2@tip-bot2> (raw) In-Reply-To: <20200109211452.27369-4-yu-cheng.yu@intel.com> The following commit has been merged into the x86/fpu branch of tip: Commit-ID: e70b100806d63fb79775858ea92e1a716da46186 Gitweb: https://git.kernel.org/tip/e70b100806d63fb79775858ea92e1a716da46186 Author: Yu-cheng Yu <yu-cheng.yu@intel.com> AuthorDate: Thu, 09 Jan 2020 13:14:52 -08:00 Committer: Borislav Petkov <bp@suse.de> CommitterDate: Wed, 12 Feb 2020 15:43:34 +01:00 x86/fpu/xstate: Warn when checking alignment of disabled xfeatures An XSAVES component's alignment/offset is meaningful only when the feature is enabled. Return zero and WARN_ONCE on checking alignment of disabled features. Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com> Link: https://lkml.kernel.org/r/20200109211452.27369-4-yu-cheng.yu@intel.com --- arch/x86/kernel/fpu/xstate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index edcaacd..73fe597 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -325,6 +325,13 @@ static int xfeature_is_aligned(int xfeature_nr) u32 eax, ebx, ecx, edx; CHECK_XFEATURE(xfeature_nr); + + if (!xfeature_enabled(xfeature_nr)) { + WARN_ONCE(1, "Checking alignment of disabled xfeature %d\n", + xfeature_nr); + return 0; + } + cpuid_count(XSTATE_CPUID, xfeature_nr, &eax, &ebx, &ecx, &edx); /* * The value returned by ECX[1] indicates the alignment
prev parent reply other threads:[~2020-02-12 14:51 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-09 21:14 [PATCH 0/3] Fix two issues in XSAVES offset calculation Yu-cheng Yu 2020-01-09 21:14 ` [PATCH 1/3] x86/fpu/xstate: Fix last_good_offset in setup_xstate_features() Yu-cheng Yu 2020-02-11 18:56 ` Borislav Petkov 2020-02-12 14:50 ` [tip: x86/fpu] " tip-bot2 for Yu-cheng Yu 2020-01-09 21:14 ` [PATCH 2/3] x86/fpu/xstate: Fix XSAVES offsets in setup_xstate_comp() Yu-cheng Yu 2020-02-12 14:50 ` [tip: x86/fpu] " tip-bot2 for Yu-cheng Yu 2020-01-09 21:14 ` [PATCH 3/3] x86/fpu/xstate: WARN_ONCE on checking alignment of disabled xfeatures Yu-cheng Yu 2020-02-12 14:50 ` tip-bot2 for Yu-cheng Yu [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=158151904924.411.12474197700112093867.tip-bot2@tip-bot2 \ --to=tip-bot2@linutronix.de \ --cc=bp@suse.de \ --cc=dave.hansen@linux.intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-tip-commits@vger.kernel.org \ --cc=x86@kernel.org \ --cc=yu-cheng.yu@intel.com \ --subject='Re: [tip: x86/fpu] x86/fpu/xstate: Warn when checking alignment of disabled xfeatures' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).