lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YLpZQCyZWjnD/1ZP@google.com>
Date:   Fri, 4 Jun 2021 16:48:00 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Cody Yao-oc <CodyYao-oc@...oxin.com>
Cc:     peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
        mark.rutland@....com, alexander.shishkin@...ux.intel.com,
        jolsa@...hat.com, namhyung@...nel.org, tglx@...utronix.de,
        bp@...en8.de, hpa@...or.com, x86@...nel.org,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/perf: Fixed obtaining address error about
 performance monitor MSR on old Inel CPU.

On Fri, Jun 04, 2021, Cody Yao-oc wrote:
> From: CodyYao-oc <CodyYao-oc@...oxin.com>
> 
> Fix "obtain wrong msr address" bug in function nmi_perfctr_msr_to_bit
> and nmi_eventsel_msr_to_bit. In X86_VENDOR_INTEL switch branch, if all
> of the check conditions are not met, code flow will slip to
> X86_VENDOR_ZHAOXIN branch which may lead to incorrect information.
> 
> Therefore, "fallthrough" should be changed to "break" to avoid it.

This should explicitly state that using fallthrough instead of break was
completely unintentional, assuming that's indeed the case.

Fixes: 3a4ac121c2ca ("x86/perf: Add hardware performance events support for Zhaoxin CPU.")

> Signed-off-by: CodyYao-oc <CodyYao-oc@...oxin.com>
> ---
>  arch/x86/kernel/cpu/perfctr-watchdog.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
> index 3ef5868ac588..7aecb2fc3186 100644
> --- a/arch/x86/kernel/cpu/perfctr-watchdog.c
> +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
> @@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr)
>  		case 15:
>  			return msr - MSR_P4_BPU_PERFCTR0;
>  		}
> -		fallthrough;
> +		break;
>  	case X86_VENDOR_ZHAOXIN:
>  	case X86_VENDOR_CENTAUR:
>  		return msr - MSR_ARCH_PERFMON_PERFCTR0;
> @@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
>  		case 15:
>  			return msr - MSR_P4_BSU_ESCR0;
>  		}
> -		fallthrough;
> +		break;
>  	case X86_VENDOR_ZHAOXIN:
>  	case X86_VENDOR_CENTAUR:
>  		return msr - MSR_ARCH_PERFMON_EVENTSEL0;
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ