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:   Tue, 10 Nov 2020 11:25:09 +0800
From:   kernel test robot <lkp@...el.com>
To:     Tom Lendacky <thomas.lendacky@....com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, x86@...nel.org
Cc:     kbuild-all@...ts.01.org, Paolo Bonzini <pbonzini@...hat.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH v3 05/34] KVM: SVM: Add support for the SEV-ES VMSA

Hi Tom,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/master]
[also build test WARNING on v5.10-rc3 next-20201109]
[cannot apply to tip/x86/core vhost/linux-next kvm/linux-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/Tom-Lendacky/SEV-ES-hypervisor-support/20201110-063133
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git a2445441a132ee5b3e61e6a26c27a3491f4296ef
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/58eb9eb5fdd545590b75f3cf84c62582b012c5b8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Tom-Lendacky/SEV-ES-hypervisor-support/20201110-063133
        git checkout 58eb9eb5fdd545590b75f3cf84c62582b012c5b8
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

>> arch/x86/kvm/svm/sev.c:1198:6: warning: no previous prototype for 'sev_flush_guest_memory' [-Wmissing-prototypes]
    1198 | void sev_flush_guest_memory(struct vcpu_svm *svm, void *va, unsigned long len)
         |      ^~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/svm/sev.c: In function 'sev_flush_guest_memory':
>> arch/x86/kvm/svm/sev.c:1216:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    1216 |   start = (u64)va & PAGE_MASK;
         |           ^
   In file included from include/linux/cache.h:5,
                    from include/linux/printk.h:9,
                    from include/linux/kernel.h:16,
                    from include/asm-generic/bug.h:20,
                    from arch/x86/include/asm/bug.h:93,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/percpu.h:5,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/svm/sev.c:11:
   arch/x86/kvm/svm/sev.c:1217:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    1217 |   stop = PAGE_ALIGN((u64)va + len);
         |                     ^
   include/uapi/linux/kernel.h:11:41: note: in definition of macro '__ALIGN_KERNEL_MASK'
      11 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
         |                                         ^
   include/linux/kernel.h:33:22: note: in expansion of macro '__ALIGN_KERNEL'
      33 | #define ALIGN(x, a)  __ALIGN_KERNEL((x), (a))
         |                      ^~~~~~~~~~~~~~
   include/linux/mm.h:222:26: note: in expansion of macro 'ALIGN'
     222 | #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
         |                          ^~~~~
   arch/x86/kvm/svm/sev.c:1217:10: note: in expansion of macro 'PAGE_ALIGN'
    1217 |   stop = PAGE_ALIGN((u64)va + len);
         |          ^~~~~~~~~~
   arch/x86/kvm/svm/sev.c:1217:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    1217 |   stop = PAGE_ALIGN((u64)va + len);
         |                     ^
   include/uapi/linux/kernel.h:11:47: note: in definition of macro '__ALIGN_KERNEL_MASK'
      11 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
         |                                               ^~~~
   include/linux/kernel.h:33:22: note: in expansion of macro '__ALIGN_KERNEL'
      33 | #define ALIGN(x, a)  __ALIGN_KERNEL((x), (a))
         |                      ^~~~~~~~~~~~~~
   include/linux/mm.h:222:26: note: in expansion of macro 'ALIGN'
     222 | #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
         |                          ^~~~~
   arch/x86/kvm/svm/sev.c:1217:10: note: in expansion of macro 'PAGE_ALIGN'
    1217 |   stop = PAGE_ALIGN((u64)va + len);
         |          ^~~~~~~~~~
   arch/x86/kvm/svm/sev.c:1217:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    1217 |   stop = PAGE_ALIGN((u64)va + len);
         |                     ^
   include/uapi/linux/kernel.h:11:58: note: in definition of macro '__ALIGN_KERNEL_MASK'
      11 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
         |                                                          ^~~~
   include/linux/kernel.h:33:22: note: in expansion of macro '__ALIGN_KERNEL'
      33 | #define ALIGN(x, a)  __ALIGN_KERNEL((x), (a))
         |                      ^~~~~~~~~~~~~~
   include/linux/mm.h:222:26: note: in expansion of macro 'ALIGN'
     222 | #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
         |                          ^~~~~
   arch/x86/kvm/svm/sev.c:1217:10: note: in expansion of macro 'PAGE_ALIGN'
    1217 |   stop = PAGE_ALIGN((u64)va + len);
         |          ^~~~~~~~~~

vim +/sev_flush_guest_memory +1198 arch/x86/kvm/svm/sev.c

  1193	
  1194	/*
  1195	 * Pages used by hardware to hold guest encrypted state must be flushed before
  1196	 * returning them to the system.
  1197	 */
> 1198	void sev_flush_guest_memory(struct vcpu_svm *svm, void *va, unsigned long len)
  1199	{
  1200		/*
  1201		 * If hardware enforced cache coherency for encrypted mappings of the
  1202		 * same physical page is supported, nothing to do.
  1203		 */
  1204		if (boot_cpu_has(X86_FEATURE_SME_COHERENT))
  1205			return;
  1206	
  1207		/*
  1208		 * If the VM Page Flush MSR is supported, use it to flush the page
  1209		 * (using the page virtual address and the guest ASID).
  1210		 */
  1211		if (boot_cpu_has(X86_FEATURE_VM_PAGE_FLUSH)) {
  1212			struct kvm_sev_info *sev;
  1213			u64 start, stop;
  1214	
  1215			/* Align start and stop to page boundaries. */
> 1216			start = (u64)va & PAGE_MASK;
  1217			stop = PAGE_ALIGN((u64)va + len);
  1218	
  1219			if (start < stop) {
  1220				sev = &to_kvm_svm(svm->vcpu.kvm)->sev_info;
  1221	
  1222				while (start < stop) {
  1223					wrmsrl(MSR_AMD64_VM_PAGE_FLUSH,
  1224					       start | sev->asid);
  1225	
  1226					start += PAGE_SIZE;
  1227				}
  1228	
  1229				return;
  1230			} else {
  1231				WARN(1, "Address overflow, using WBINVD\n");
  1232			}
  1233		}
  1234	
  1235		/*
  1236		 * Hardware should always have one of the above features,
  1237		 * but if not, use WBINVD and issue a warning.
  1238		 */
  1239		WARN_ONCE(1, "Using WBINVD to flush guest memory\n");
  1240		wbinvd_on_all_cpus();
  1241	}
  1242	

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

Download attachment ".config.gz" of type "application/gzip" (75864 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ