[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <B41E8041-C4AD-4098-B0BA-665847F4A0F6@vmware.com>
Date: Fri, 7 Sep 2018 20:52:04 +0000
From: Nadav Amit <namit@...are.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>, X86 ML <x86@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
linux-arch <linux-arch@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Kees Cook <keescook@...omium.org>,
Dave Hansen <dave.hansen@...el.com>
Subject: Re: [PATCH v2 4/6] x86/alternatives: initializing temporary mm for
patching
at 2:01 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Sun, Sep 02, 2018 at 10:32:22AM -0700, Nadav Amit wrote:
>> +void __init poking_init(void)
>> +{
>> + unsigned long poking_addr;
>> +
>> + poking_mm = copy_init_mm();
>> + if (!poking_mm) {
>> + pr_err("x86/mm: error setting a separate poking address space");
>> + return;
>> + }
>> +
>> + /*
>> + * Randomize the poking address, but make sure that the following page
>> + * will be mapped at the same PMD. We need 2 pages, so find space for 3,
>> + * and adjust the address if the PMD ends after the first one.
>> + */
>> + poking_addr = TASK_UNMAPPED_BASE +
>> + (kaslr_get_random_long("Poking") & PAGE_MASK) %
>> + (TASK_SIZE - TASK_UNMAPPED_BASE - 3 * PAGE_SIZE);
>> +
>> + if (((poking_addr + PAGE_SIZE) & ~PMD_MASK) == 0)
>> + poking_addr += PAGE_SIZE;
>> +}
>
> This fails to compile for me.. I don't have kaslr_get_random_long().
Will be fixed in v3. Thanks.
Powered by blists - more mailing lists