Re: [PATCH v5 10/10] lkdtm: Add test for XPFO

From: kbuild test robot
Date: Sat Aug 12 2017 - 16:24:58 EST


Hi Juerg,

[auto build test ERROR on arm64/for-next/core]
[also build test ERROR on v4.13-rc4]
[cannot apply to next-20170811]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Tycho-Andersen/Add-support-for-eXclusive-Page-Frame-Ownership/20170813-035705
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: x86_64-randconfig-x016-201733 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

drivers/misc/lkdtm_xpfo.c: In function 'read_user_with_flags':
>> drivers/misc/lkdtm_xpfo.c:31:14: error: implicit declaration of function 'user_virt_to_phys' [-Werror=implicit-function-declaration]
phys_addr = user_virt_to_phys(user_addr);
^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/user_virt_to_phys +31 drivers/misc/lkdtm_xpfo.c

10
11 void read_user_with_flags(unsigned long flags)
12 {
13 unsigned long user_addr, user_data = 0xdeadbeef;
14 phys_addr_t phys_addr;
15 void *virt_addr;
16
17 user_addr = vm_mmap(NULL, 0, PAGE_SIZE,
18 PROT_READ | PROT_WRITE | PROT_EXEC,
19 flags, 0);
20 if (user_addr >= TASK_SIZE) {
21 pr_warn("Failed to allocate user memory\n");
22 return;
23 }
24
25 if (copy_to_user((void __user *)user_addr, &user_data,
26 sizeof(user_data))) {
27 pr_warn("copy_to_user failed\n");
28 goto free_user;
29 }
30
> 31 phys_addr = user_virt_to_phys(user_addr);
32 if (!phys_addr) {
33 pr_warn("Failed to get physical address of user memory\n");
34 goto free_user;
35 }
36
37 virt_addr = phys_to_virt(phys_addr);
38 if (phys_addr != virt_to_phys(virt_addr)) {
39 pr_warn("Physical address of user memory seems incorrect\n");
40 goto free_user;
41 }
42
43 pr_info("Attempting bad read from kernel address %p\n", virt_addr);
44 if (*(unsigned long *)virt_addr == user_data)
45 pr_info("Huh? Bad read succeeded?!\n");
46 else
47 pr_info("Huh? Bad read didn't fail but data is incorrect?!\n");
48
49 free_user:
50 vm_munmap(user_addr, PAGE_SIZE);
51 }
52

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip