All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] x86/entry/64: Disallow RDPID in paranoid entry if KVM is enabled
Date: Fri, 21 Aug 2020 18:28:24 +0800	[thread overview]
Message-ID: <202008211856.KuZ6koru%lkp@intel.com> (raw)
In-Reply-To: <20200821025050.32573-1-sean.j.christopherson@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4419 bytes --]

Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/auto-latest]
[also build test ERROR on v5.9-rc1 next-20200821]
[cannot apply to tip/x86/asm luto/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sean-Christopherson/x86-entry-64-Disallow-RDPID-in-paranoid-entry-if-KVM-is-enabled/20200821-105339
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git a9bd3a91d6e49ebd2d7d8ace91d4cc339c382a31
config: x86_64-randconfig-s022-20200821 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/x86/entry/entry_64.S: Assembler messages:
>> arch/x86/entry/entry_64.S:851: Error: too many positional arguments

# https://github.com/0day-ci/linux/commit/bebb51882f9c18938e44b6a7b66fdf0452eea142
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sean-Christopherson/x86-entry-64-Disallow-RDPID-in-paranoid-entry-if-KVM-is-enabled/20200821-105339
git checkout bebb51882f9c18938e44b6a7b66fdf0452eea142
vim +851 arch/x86/entry/entry_64.S

   794	
   795	/*
   796	 * Save all registers in pt_regs. Return GSBASE related information
   797	 * in EBX depending on the availability of the FSGSBASE instructions:
   798	 *
   799	 * FSGSBASE	R/EBX
   800	 *     N        0 -> SWAPGS on exit
   801	 *              1 -> no SWAPGS on exit
   802	 *
   803	 *     Y        GSBASE value at entry, must be restored in paranoid_exit
   804	 */
   805	SYM_CODE_START_LOCAL(paranoid_entry)
   806		UNWIND_HINT_FUNC
   807		cld
   808		PUSH_AND_CLEAR_REGS save_ret=1
   809		ENCODE_FRAME_POINTER 8
   810	
   811		/*
   812		 * Always stash CR3 in %r14.  This value will be restored,
   813		 * verbatim, at exit.  Needed if paranoid_entry interrupted
   814		 * another entry that already switched to the user CR3 value
   815		 * but has not yet returned to userspace.
   816		 *
   817		 * This is also why CS (stashed in the "iret frame" by the
   818		 * hardware at entry) can not be used: this may be a return
   819		 * to kernel code, but with a user CR3 value.
   820		 *
   821		 * Switching CR3 does not depend on kernel GSBASE so it can
   822		 * be done before switching to the kernel GSBASE. This is
   823		 * required for FSGSBASE because the kernel GSBASE has to
   824		 * be retrieved from a kernel internal table.
   825		 */
   826		SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax save_reg=%r14
   827	
   828		/*
   829		 * Handling GSBASE depends on the availability of FSGSBASE.
   830		 *
   831		 * Without FSGSBASE the kernel enforces that negative GSBASE
   832		 * values indicate kernel GSBASE. With FSGSBASE no assumptions
   833		 * can be made about the GSBASE value when entering from user
   834		 * space.
   835		 */
   836		ALTERNATIVE "jmp .Lparanoid_entry_checkgs", "", X86_FEATURE_FSGSBASE
   837	
   838		/*
   839		 * Read the current GSBASE and store it in %rbx unconditionally,
   840		 * retrieve and set the current CPUs kernel GSBASE. The stored value
   841		 * has to be restored in paranoid_exit unconditionally.
   842		 *
   843		 * The MSR write ensures that no subsequent load is based on a
   844		 * mispredicted GSBASE. No extra FENCE required.
   845		 *
   846		 * Disallow RDPID if KVM is enabled as it may consume a guest's TSC_AUX
   847		 * if an NMI arrives in KVM's run loop.  KVM loads guest's TSC_AUX on
   848		 * VM-Enter and may not restore the host's value until the CPU returns
   849		 * to userspace, i.e. KVM depends on the kernel not using TSC_AUX.
   850		 */
 > 851		SAVE_AND_SET_GSBASE scratch_reg=%rax save_reg=%rbx no_rdpid=IS_ENABLED(CONFIG_KVM)
   852		ret
   853	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29093 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org
Cc: kbuild-all@lists.01.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org, Dave Hansen <dave.hansen@intel.com>,
	Chang Seok Bae <chang.seok.bae@intel.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] x86/entry/64: Disallow RDPID in paranoid entry if KVM is enabled
Date: Fri, 21 Aug 2020 18:28:24 +0800	[thread overview]
Message-ID: <202008211856.KuZ6koru%lkp@intel.com> (raw)
In-Reply-To: <20200821025050.32573-1-sean.j.christopherson@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4318 bytes --]

Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/auto-latest]
[also build test ERROR on v5.9-rc1 next-20200821]
[cannot apply to tip/x86/asm luto/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sean-Christopherson/x86-entry-64-Disallow-RDPID-in-paranoid-entry-if-KVM-is-enabled/20200821-105339
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git a9bd3a91d6e49ebd2d7d8ace91d4cc339c382a31
config: x86_64-randconfig-s022-20200821 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arch/x86/entry/entry_64.S: Assembler messages:
>> arch/x86/entry/entry_64.S:851: Error: too many positional arguments

# https://github.com/0day-ci/linux/commit/bebb51882f9c18938e44b6a7b66fdf0452eea142
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Sean-Christopherson/x86-entry-64-Disallow-RDPID-in-paranoid-entry-if-KVM-is-enabled/20200821-105339
git checkout bebb51882f9c18938e44b6a7b66fdf0452eea142
vim +851 arch/x86/entry/entry_64.S

   794	
   795	/*
   796	 * Save all registers in pt_regs. Return GSBASE related information
   797	 * in EBX depending on the availability of the FSGSBASE instructions:
   798	 *
   799	 * FSGSBASE	R/EBX
   800	 *     N        0 -> SWAPGS on exit
   801	 *              1 -> no SWAPGS on exit
   802	 *
   803	 *     Y        GSBASE value at entry, must be restored in paranoid_exit
   804	 */
   805	SYM_CODE_START_LOCAL(paranoid_entry)
   806		UNWIND_HINT_FUNC
   807		cld
   808		PUSH_AND_CLEAR_REGS save_ret=1
   809		ENCODE_FRAME_POINTER 8
   810	
   811		/*
   812		 * Always stash CR3 in %r14.  This value will be restored,
   813		 * verbatim, at exit.  Needed if paranoid_entry interrupted
   814		 * another entry that already switched to the user CR3 value
   815		 * but has not yet returned to userspace.
   816		 *
   817		 * This is also why CS (stashed in the "iret frame" by the
   818		 * hardware at entry) can not be used: this may be a return
   819		 * to kernel code, but with a user CR3 value.
   820		 *
   821		 * Switching CR3 does not depend on kernel GSBASE so it can
   822		 * be done before switching to the kernel GSBASE. This is
   823		 * required for FSGSBASE because the kernel GSBASE has to
   824		 * be retrieved from a kernel internal table.
   825		 */
   826		SAVE_AND_SWITCH_TO_KERNEL_CR3 scratch_reg=%rax save_reg=%r14
   827	
   828		/*
   829		 * Handling GSBASE depends on the availability of FSGSBASE.
   830		 *
   831		 * Without FSGSBASE the kernel enforces that negative GSBASE
   832		 * values indicate kernel GSBASE. With FSGSBASE no assumptions
   833		 * can be made about the GSBASE value when entering from user
   834		 * space.
   835		 */
   836		ALTERNATIVE "jmp .Lparanoid_entry_checkgs", "", X86_FEATURE_FSGSBASE
   837	
   838		/*
   839		 * Read the current GSBASE and store it in %rbx unconditionally,
   840		 * retrieve and set the current CPUs kernel GSBASE. The stored value
   841		 * has to be restored in paranoid_exit unconditionally.
   842		 *
   843		 * The MSR write ensures that no subsequent load is based on a
   844		 * mispredicted GSBASE. No extra FENCE required.
   845		 *
   846		 * Disallow RDPID if KVM is enabled as it may consume a guest's TSC_AUX
   847		 * if an NMI arrives in KVM's run loop.  KVM loads guest's TSC_AUX on
   848		 * VM-Enter and may not restore the host's value until the CPU returns
   849		 * to userspace, i.e. KVM depends on the kernel not using TSC_AUX.
   850		 */
 > 851		SAVE_AND_SET_GSBASE scratch_reg=%rax save_reg=%rbx no_rdpid=IS_ENABLED(CONFIG_KVM)
   852		ret
   853	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29093 bytes --]

  parent reply	other threads:[~2020-08-21 10:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21  2:50 [PATCH] x86/entry/64: Disallow RDPID in paranoid entry if KVM is enabled Sean Christopherson
2020-08-21  7:24 ` peterz
2020-08-21  7:44   ` Borislav Petkov
2020-08-21  7:47 ` Borislav Petkov
2020-08-21  8:09   ` Paolo Bonzini
2020-08-21  8:16     ` Borislav Petkov
2020-08-21  9:05       ` Paolo Bonzini
2020-08-21  9:22         ` Borislav Petkov
2020-08-21  9:44           ` Paolo Bonzini
2020-08-21  9:48             ` Borislav Petkov
2020-08-21 10:07               ` Paolo Bonzini
2020-08-22 16:42                 ` Andy Lutomirski
2020-09-16 16:54                   ` Paolo Bonzini
2020-08-21  9:28     ` Thomas Gleixner
2020-08-21  9:37       ` Paolo Bonzini
2020-08-21 19:55       ` hpa
2020-08-21 20:02         ` Peter Zijlstra
2020-08-21  8:56 ` kernel test robot
2020-08-21  8:56   ` kernel test robot
2020-08-21 10:28 ` kernel test robot [this message]
2020-08-21 10:28   ` kernel test robot

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=202008211856.KuZ6koru%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.