public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately
       [not found]   ` <20160617203045.GB3842@pd.tnic>
@ 2016-06-18 10:29     ` Andy Lutomirski
  2016-06-18 10:37       ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2016-06-18 10:29 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Andy Lutomirski, X86 ML, linux-kernel@vger.kernel.org, linux-arch,
	Nadav Amit, Kees Cook, Brian Gerst,
	kernel-hardening@lists.openwall.com, Linus Torvalds,
	Josh Poimboeuf, Jann Horn, Heiko Carstens, Matt Fleming,
	linux-efi@vger.kernel.org

On Fri, Jun 17, 2016 at 1:30 PM, Borislav Petkov <bp@alien8.de> wrote:
> On Fri, Jun 17, 2016 at 01:00:39PM -0700, Andy Lutomirski wrote:
>> It's currently only used in the EFI code, which is safe AFAICT.
>
> "It is basically useful for a pagetable hierarchy which is not init_mm."
>
>> Warn if anyone tries to use it on the normal kernel pgd.
>>
>> Signed-off-by: Andy Lutomirski <luto@kernel.org>
>> ---
>>  arch/x86/mm/pageattr.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
>> index 6a8026918bf6..e9b9c5cedbb8 100644
>> --- a/arch/x86/mm/pageattr.c
>> +++ b/arch/x86/mm/pageattr.c
>> @@ -1996,6 +1996,9 @@ out:
>>  void kernel_unmap_pages_in_pgd(pgd_t *root, unsigned long address,
>>                              unsigned numpages)
>>  {
>> +     /* Unmapping kernel entries from init_mm's pgd is not allowed. */
>> +     WARN_ON(root == init_mm.pgd);
>
> We can also return and not do the unmapping:
>
>         if (WARN_ON(root == init_mm.pgd))
>                 return;

I'll do one better: the only function that calls this function is
unused.  I'll just delete it.

--Andy

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately
  2016-06-18 10:29     ` [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately Andy Lutomirski
@ 2016-06-18 10:37       ` Borislav Petkov
  0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2016-06-18 10:37 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Andy Lutomirski, X86 ML, linux-kernel@vger.kernel.org, linux-arch,
	Nadav Amit, Kees Cook, Brian Gerst,
	kernel-hardening@lists.openwall.com, Linus Torvalds,
	Josh Poimboeuf, Jann Horn, Heiko Carstens, Matt Fleming,
	linux-efi@vger.kernel.org

On Sat, Jun 18, 2016 at 03:29:01AM -0700, Andy Lutomirski wrote:
> I'll do one better: the only function that calls this function is
> unused.  I'll just delete it.

Fair enough - Matt is on CC.

Btw, normally I'm almost never talking to you at that time of the day,
what's up? Can't sleep?

:-))

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-18 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1466192946.git.luto@kernel.org>
     [not found] ` <3336bb02792d56c49d18e2f7a435fd194a4a22e4.1466192946.git.luto@kernel.org>
     [not found]   ` <20160617203045.GB3842@pd.tnic>
2016-06-18 10:29     ` [PATCH v2 03/13] x86/cpa: Warn if kernel_unmap_pages_in_pgd is used inappropriately Andy Lutomirski
2016-06-18 10:37       ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox