All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Yuntao Wang <ytcoode@gmail.com>
Cc: bhe@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, kirill@shutemov.name,
	linux-kernel@vger.kernel.org, luto@kernel.org, mingo@redhat.com,
	peterz@infradead.org, stable@vger.kernel.org, tglx@linutronix.de,
	x86@kernel.org
Subject: Re: [PATCH] x86/mm: Fix possible index overflow when creating page table mapping
Date: Thu, 16 Jun 2022 07:20:40 -0700	[thread overview]
Message-ID: <8e2c9b2b-d8ad-5e9a-7aa6-23e0c599c2e9@intel.com> (raw)
In-Reply-To: <20220616141525.1790083-1-ytcoode@gmail.com>

On 6/16/22 07:15, Yuntao Wang wrote:
> On Thu, 16 Jun 2022 07:02:56 -0700, Dave Hansen wrote:
>> On 6/16/22 06:55, Yuntao Wang wrote:
>>> There are two issues in phys_p4d_init():
>>>
>>> - The __kernel_physical_mapping_init() does not do boundary-checking for
>>>   paddr_end and passes it directly to phys_p4d_init(), phys_p4d_init() does
>>>   not do bounds checking either, so if the physical memory to be mapped is
>>>   large enough, 'p4d_page + p4d_index(vaddr)' will wrap around to the
>>>   beginning entry of the P4D table and its data will be overwritten.
>>>
>>> - The for loop body will be executed only when 'vaddr < vaddr_end'
>>>   evaluates to true, but if that condition is true, 'paddr >= paddr_end'
>>>   will evaluate to false, thus the 'if (paddr >= paddr_end) {}' block will
>>>   never be executed and become dead code.
>> Could you explain a bit how you found this?  Was this encountered in
>> practice and debugged or was it found by inspection?
> I found it by inspection.

Dare I ask how this was tested?

  reply	other threads:[~2022-06-16 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-16 13:55 [PATCH] x86/mm: Fix possible index overflow when creating page table mapping Yuntao Wang
2022-06-16 14:02 ` Dave Hansen
2022-06-16 14:15   ` Yuntao Wang
2022-06-16 14:20     ` Dave Hansen [this message]
2022-06-17  6:38       ` Yuntao Wang
2022-06-18  0:22 ` Kirill A. Shutemov
2022-06-18  2:08   ` Yuntao Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e2c9b2b-d8ad-5e9a-7aa6-23e0c599c2e9@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=ytcoode@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.