Re: [PATCH -next] x86/efi_64: fix a user-memory-access in runtime
From: kbuild test robot
Date: Mon Jan 27 2020 - 18:31:00 EST
Hi Qian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20200117]
[cannot apply to efi/next v5.5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Qian-Cai/x86-efi_64-fix-a-user-memory-access-in-runtime/20200118-171142
base: de970dffa7d19eae1d703c3534825308ef8d5dec
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-153-g47b6dfef-dirty
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> arch/x86/platform/efi/efi_64.c:1045:48: sparse: sparse: incorrect type in argument 2 (different address spaces)
>> arch/x86/platform/efi/efi_64.c:1045:48: sparse: expected void const [noderef] <asn:1> *from
>> arch/x86/platform/efi/efi_64.c:1045:48: sparse: got union efi_runtime_services_t [usertype] *[usertype] runtime
vim +1045 arch/x86/platform/efi/efi_64.c
1020
1021 efi_status_t __init efi_set_virtual_address_map(unsigned long memory_map_size,
1022 unsigned long descriptor_size,
1023 u32 descriptor_version,
1024 efi_memory_desc_t *virtual_map)
1025 {
1026 efi_runtime_services_t runtime;
1027 efi_status_t status;
1028 unsigned long flags;
1029 pgd_t *save_pgd = NULL;
1030
1031 if (efi_is_mixed())
1032 return efi_thunk_set_virtual_address_map(memory_map_size,
1033 descriptor_size,
1034 descriptor_version,
1035 virtual_map);
1036
1037 if (efi_enabled(EFI_OLD_MEMMAP)) {
1038 save_pgd = efi_old_memmap_phys_prolog();
1039 if (!save_pgd)
1040 return EFI_ABORTED;
1041 } else {
1042 efi_switch_mm(&efi_mm);
1043 }
1044
> 1045 if (copy_from_user(&runtime, efi.systab->runtime, sizeof(runtime)))
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation