lkml.org 
[lkml]   [2017]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 08/30] x86, kaiser: unmap kernel from userspace page tables (core patch)
From
Date
On 11/20/2017 09:21 AM, Thomas Gleixner wrote:
>> + pgd = native_get_shadow_pgd(pgd_offset_k(0UL));
>> + for (i = PTRS_PER_PGD / 2; i < PTRS_PER_PGD; i++) {
>> + unsigned long addr = PAGE_OFFSET + i * PGDIR_SIZE;
> This looks wrong. The kernel address space gets incremented by PGDIR_SIZE
> and does not make a jump from PAGE_OFFSET to PAGE_OFFSET + 256 * PGDIR_SIZE
>
> int i, j;
>
> for (i = PTRS_PER_PGD / 2, j = 0; i < PTRS_PER_PGD; i++, j++) {
> unsigned long addr = PAGE_OFFSET + j * PGDIR_SIZE;
>
> Not that is has any effect right now. Neither p4d_alloc_one() nor
> pud_alloc_one() are using the 'addr' argument.

Ahh, you're saying that 'i' is effectively starting *at* PAGE_OFFSET
since it's halfway up the address space already doing PTRS_PER_PGD/2.
Adding PAGE_OFFSET to PAGE_OFFSET is nonsense.

Would it just be simpler to do:

> for (i = PTRS_PER_PGD / 2; i < PTRS_PER_PGD; i++) {
> unsigned long addr = i * PGDIR_SIZE;

?

\
 
 \ /
  Last update: 2017-11-22 23:46    [W:0.153 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site