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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Oct 2016 18:47:35 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Wanpeng Li <kernellwp@...il.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Ingo Molnar <mingo@...nel.org>, Mike Galbraith <efault@....de>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Wanpeng Li <wanpeng.li@...mail.com>
Subject: Re: [PATCH v6 1/2] x86/msr: Add write msr notrace

On Thu, Oct 27, 2016 at 12:38:41PM +0800, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@...mail.com>
> 
> Add write msr notrace, it will be used by later patch.
> 
> Suggested-by: Peter Zijlstra <peterz@...radead.org>
> Suggested-by: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Mike Galbraith <efault@....de>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Paolo Bonzini <pbonzini@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Signed-off-by: Wanpeng Li <wanpeng.li@...mail.com>
> ---
>  arch/x86/include/asm/msr.h | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
> index b5fee97..eec29a7 100644
> --- a/arch/x86/include/asm/msr.h
> +++ b/arch/x86/include/asm/msr.h
> @@ -115,17 +115,29 @@ static inline unsigned long long native_read_msr_safe(unsigned int msr,
>  }
>  
>  /* Can be uninlined because referenced by paravirt */
> -notrace static inline void native_write_msr(unsigned int msr,
> +notrace static inline void __native_write_msr_notrace(unsigned int msr,
>  					    unsigned low, unsigned high)
					    ^^^^^^^
Align arguments on an opening brace.

Also, please fix that in a patch ontop of this one:

WARNING: storage class should be at the beginning of the declaration
#43: FILE: arch/x86/include/asm/msr.h:118:
+notrace static inline void __native_write_msr_notrace(unsigned int msr,

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
#54: FILE: arch/x86/include/asm/msr.h:129:
+                                           unsigned low, unsigned high)

And because we know what those are, you can convert them directly to u32.

IOW, the end result should be something like this:

static inline void notrace
__native_write_msr_notrace(unsigned int msr, u32 low, u32 high)

And yes, I suggested using the "_notrace" suffix for the name but then
it would look funny if we end up using it in code.

So maybe we should make that lower-level helper simply:

static inline void notrace
__native_write_msr(unsigned int msr, u32 low, u32 high)

to denote that it does purely the WRMSR operation and nothing else.

Yap, that looks the cleanest to me.

Thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ