Message ID | 20191010110856.4376-1-suzuki.poulose@arm.com |
---|---|
State | Superseded |
Headers | show |
Series | arm64: cpufeature: Fix truncating a feature value | expand |
All, On 10/10/2019 12:08, Suzuki K Poulose wrote: > A signed feature value is truncated to turn to an unsigned value > causing bad state in the system wide infrastructure. This affects > the discovery of FP/ASIMD support on arm64. Fix this by making sure > we cast it properly. > > Fixes: 4f0a606bce5ec ("arm64: cpufeature: Track unsigned fields") > Cc: stable@vger.kernel.org # v4.4 Please note that this patch is only applicable for stable 4.4 tree. I should have removed the Fixes tag. Cheers Suzuki
On Thu, Oct 10, 2019 at 12:12:01PM +0100, Suzuki K Poulose wrote: > All, > > On 10/10/2019 12:08, Suzuki K Poulose wrote: > > A signed feature value is truncated to turn to an unsigned value > > causing bad state in the system wide infrastructure. This affects > > the discovery of FP/ASIMD support on arm64. Fix this by making sure > > we cast it properly. > > > > Fixes: 4f0a606bce5ec ("arm64: cpufeature: Track unsigned fields") > > Cc: stable@vger.kernel.org # v4.4 > > Please note that this patch is only applicable for stable 4.4 tree. > I should have removed the Fixes tag. Why is it only for 4.4? That needs to be documented really really really well in the changelog as to why this is a one-off patch, and why we can't just take the relevant patches that are in Linus's tree instead. Please fix up and resend. thanks, greg k-h
On 10/10/2019 13:29, Greg KH wrote: > On Thu, Oct 10, 2019 at 12:12:01PM +0100, Suzuki K Poulose wrote: >> All, >> >> On 10/10/2019 12:08, Suzuki K Poulose wrote: >>> A signed feature value is truncated to turn to an unsigned value >>> causing bad state in the system wide infrastructure. This affects >>> the discovery of FP/ASIMD support on arm64. Fix this by making sure >>> we cast it properly. >>> >>> Fixes: 4f0a606bce5ec ("arm64: cpufeature: Track unsigned fields") >>> Cc: stable@vger.kernel.org # v4.4 >> >> Please note that this patch is only applicable for stable 4.4 tree. >> I should have removed the Fixes tag. > > Why is it only for 4.4? That needs to be documented really really This was fixed later in v4.6 onwards with commit 28c5dcb22f90113dea ("arm64: Rename cpuid_feature field extract routines") rather inadvertently. > really well in the changelog as to why this is a one-off patch, and why > we can't just take the relevant patches that are in Linus's tree > instead. > > Please fix up and resend. I can resend the patch with the above information included if you like. Cheers Suzuki
On Thu, Oct 10, 2019 at 01:46:21PM +0100, Suzuki K Poulose wrote: > > > On 10/10/2019 13:29, Greg KH wrote: > > On Thu, Oct 10, 2019 at 12:12:01PM +0100, Suzuki K Poulose wrote: > > > All, > > > > > > On 10/10/2019 12:08, Suzuki K Poulose wrote: > > > > A signed feature value is truncated to turn to an unsigned value > > > > causing bad state in the system wide infrastructure. This affects > > > > the discovery of FP/ASIMD support on arm64. Fix this by making sure > > > > we cast it properly. > > > > > > > > Fixes: 4f0a606bce5ec ("arm64: cpufeature: Track unsigned fields") > > > > Cc: stable@vger.kernel.org # v4.4 > > > > > > Please note that this patch is only applicable for stable 4.4 tree. > > > I should have removed the Fixes tag. > > > > Why is it only for 4.4? That needs to be documented really really > > This was fixed later in v4.6 onwards with commit 28c5dcb22f90113dea > ("arm64: Rename cpuid_feature field extract routines") rather inadvertently. > > > really well in the changelog as to why this is a one-off patch, and why > > we can't just take the relevant patches that are in Linus's tree > > instead. > > > > Please fix up and resend. > > I can resend the patch with the above information included if you like. As I said, please do, I can not take it otherwise. greg k-h
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 0a66f8241f18..9eb0d8072dd9 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -151,8 +151,8 @@ static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp) static inline s64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 val) { return ftrp->sign ? - cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width) : - cpuid_feature_extract_unsigned_field_width(val, ftrp->shift, ftrp->width); + (s64)cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width) : + (s64)cpuid_feature_extract_unsigned_field_width(val, ftrp->shift, ftrp->width); } static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
A signed feature value is truncated to turn to an unsigned value causing bad state in the system wide infrastructure. This affects the discovery of FP/ASIMD support on arm64. Fix this by making sure we cast it properly. Fixes: 4f0a606bce5ec ("arm64: cpufeature: Track unsigned fields") Cc: stable@vger.kernel.org # v4.4 Cc: Will Deacon <will@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> --- arch/arm64/include/asm/cpufeature.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.21.0