Message ID | CAJcbSZF6k0=NXvqMGedcSPiMLwGBG3tZGBwCMJWgMm2AXDY9hQ@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, 10 Aug 2016, Thomas Garnier wrote: > Ok, I want to know if the problem is the PUD alignment or the change > of PAGE_OFFSET based all together. Can you test the following change? > (on top of everything else with KASLR enabled). It will randomize the > memory sections only on PGD level. > > diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c > index ec8654f..a8477b0 100644 > --- a/arch/x86/mm/kaslr.c > +++ b/arch/x86/mm/kaslr.c > @@ -120,7 +120,7 @@ void __init kernel_randomize_memory(void) > */ > entropy = remain_entropy / (ARRAY_SIZE(kaslr_regions) - i); > prandom_bytes_state(&rand_state, &rand, sizeof(rand)); > - entropy = (rand % (entropy + 1)) & PUD_MASK; > + entropy = (rand % (entropy + 1)) & PGDIR_MASK; > vaddr += entropy; > *kaslr_regions[i].base = vaddr; > > @@ -129,7 +129,7 @@ void __init kernel_randomize_memory(void) > * randomization alignment. > */ > vaddr += get_padding(&kaslr_regions[i]); > - vaddr = round_up(vaddr + 1, PUD_SIZE); > + vaddr = round_up(vaddr + 1, PGDIR_SIZE); > remain_entropy -= entropy; > } > } I applied this on top of both fixes from Rafael from this thread; still no change in behavior, i.e. reboot immediately after reading the hibernation image.
On Wed, Aug 10, 2016 at 11:52 PM, Jiri Kosina <jikos@kernel.org> wrote: > On Wed, 10 Aug 2016, Thomas Garnier wrote: > >> Ok, I want to know if the problem is the PUD alignment or the change >> of PAGE_OFFSET based all together. Can you test the following change? >> (on top of everything else with KASLR enabled). It will randomize the >> memory sections only on PGD level. >> >> diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c >> index ec8654f..a8477b0 100644 >> --- a/arch/x86/mm/kaslr.c >> +++ b/arch/x86/mm/kaslr.c >> @@ -120,7 +120,7 @@ void __init kernel_randomize_memory(void) >> */ >> entropy = remain_entropy / (ARRAY_SIZE(kaslr_regions) - i); >> prandom_bytes_state(&rand_state, &rand, sizeof(rand)); >> - entropy = (rand % (entropy + 1)) & PUD_MASK; >> + entropy = (rand % (entropy + 1)) & PGDIR_MASK; >> vaddr += entropy; >> *kaslr_regions[i].base = vaddr; >> >> @@ -129,7 +129,7 @@ void __init kernel_randomize_memory(void) >> * randomization alignment. >> */ >> vaddr += get_padding(&kaslr_regions[i]); >> - vaddr = round_up(vaddr + 1, PUD_SIZE); >> + vaddr = round_up(vaddr + 1, PGDIR_SIZE); >> remain_entropy -= entropy; >> } >> } > > I applied this on top of both fixes from Rafael from this thread; still no > change in behavior, i.e. reboot immediately after reading the hibernation > image. Same for me on the box where I can reproduce the problem now.
diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c index ec8654f..a8477b0 100644 --- a/arch/x86/mm/kaslr.c +++ b/arch/x86/mm/kaslr.c @@ -120,7 +120,7 @@ void __init kernel_randomize_memory(void) */ entropy = remain_entropy / (ARRAY_SIZE(kaslr_regions) - i); prandom_bytes_state(&rand_state, &rand, sizeof(rand)); - entropy = (rand % (entropy + 1)) & PUD_MASK; + entropy = (rand % (entropy + 1)) & PGDIR_MASK; vaddr += entropy; *kaslr_regions[i].base = vaddr; @@ -129,7 +129,7 @@ void __init kernel_randomize_memory(void) * randomization alignment. */ vaddr += get_padding(&kaslr_regions[i]); - vaddr = round_up(vaddr + 1, PUD_SIZE); + vaddr = round_up(vaddr + 1, PGDIR_SIZE); remain_entropy -= entropy; } }