Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 12360

Getting error when compiling kernel for page table walk

$
0
0

I am doing a page table walk. When I am getting ready to update the kernel I get an error:

./arch/x86/include/asm/pgtable.h:988:40: warning: right shift count >= width of type [-Wshift-count-overflow]
 #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
                                        ^
./arch/x86/include/asm/pgtable.h:994:45: note: in expansion of macro ‘pgd_index’
 #define pgd_offset_pgd(pgd, address) (pgd + pgd_index((address)))
                                             ^
./arch/x86/include/asm/pgtable.h:998:33: note: in expansion of macro ‘pgd_offset_pgd’
 #define pgd_offset(mm, address) pgd_offset_pgd((mm)->pgd, (address))
                                 ^
kernel/sys.c:2733:19: note: in expansion of macro ‘pgd_offset’
      pgd_t *pgd = pgd_offset(task_mm, vmpage);
                   ^
kernel/sys.c:2734:30: error: passing argument 1 of ‘pud_offset’ from incompatible pointer type [-Werror=incompatible-pointer-types]
      pud_t *pud = pud_offset(pgd, vmpage);
                              ^
In file included from ./include/linux/mm.h:99:0,
                 from kernel/sys.c:19:
./arch/x86/include/asm/pgtable.h:905:22: note: expected ‘p4d_t * {aka struct <anonymous> *}’ but argument is of type ‘pgd_t * {aka struct <anonymous> *}’
 static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)
                      ^

This is where the code is being used:

....
struct mm_struct *task_mm;
    if ((task_mm = task->mm))
    {
        vma = task_mm->mmap;
        while (vma)
        {
            for (int i = 1, vmpage = vma->vm_start; vmpage < vma->vm_end; vmpage += PAGE_SIZE, i++)
            {
                pgd_t *pgd = pgd_offset(task_mm, vmpage);
                pud_t *pud = pud_offset(pgd, vmpage);
                pmd_t *pmd = pmd_offset(pud, vmpage);
                pte_t *ptep = pte_offset_kernel(pmd, vmpage);
                pte_t pte = *ptep;
                ...

I looked up the errors and notes but didn't find anything about resolving this problem. Is this a well known problem or am I doing something wrong?


Viewing all articles
Browse latest Browse all 12360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>