From: Dan Williams <dan.j.williams@intel.com>
To: Gregory Price <gourry@gourry.net>, <kexec@lists.infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <akpm@linux-foundation.org>,
<bhelgaas@google.com>, <andriy.shevchenko@linux.intel.com>,
<ilpo.jarvinen@linux.intel.com>,
<mika.westerberg@linux.intel.com>, <ying.huang@intel.com>,
<bhe@redhat.com>, <gourry@gourry.net>, <tglx@linutronix.de>,
<takahiro.akashi@linaro.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] resource,kexec: walk_system_ram_res_rev must retain resource flags
Date: Thu, 17 Oct 2024 13:52:40 -0700 [thread overview]
Message-ID: <67117918aa217_10a0a294dc@dwillia2-mobl3.amr.corp.intel.com.notmuch> (raw)
In-Reply-To: <20241017190347.5578-1-gourry@gourry.net>
Gregory Price wrote:
> walk_system_ram_res_rev() erroneously discards resource flags when
> passing the information to the callback.
>
> This causes systems with IORESOURCE_SYSRAM_DRIVER_MANAGED memory to
> have these resources selected during kexec to store kexec buffers
> if that memory happens to be at placed above normal system ram.
>
> This leads to undefined behavior after reboot. If the kexec buffer
> is never touched, nothing happens. If the kexec buffer is touched,
> it could lead to a crash (like below) or undefined behavior.
>
> Tested on a system with CXL memory expanders with driver managed
> memory, TPM enabled, and CONFIG_IMA_KEXEC=y. Adding printk's
> showed the flags were being discarded and as a result the check
> for IORESOURCE_SYSRAM_DRIVER_MANAGED passes.
>
> find_next_iomem_res: name(System RAM (kmem))
> start(10000000000)
> end(1034fffffff)
> flags(83000200)
>
> locate_mem_hole_top_down: start(10000000000) end(1034fffffff) flags(0)
>
[..]
> Link: https://lore.kernel.org/all/20231114091658.228030-1-bhe@redhat.com/
> Fixes: 7acf164b259d ("resource: add walk_system_ram_res_rev()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Gregory Price <gourry@gourry.net>
> ---
> kernel/resource.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/kernel/resource.c b/kernel/resource.c
> index b730bd28b422..4101016e8b20 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -459,9 +459,7 @@ int walk_system_ram_res_rev(u64 start, u64 end, void *arg,
> rams_size += 16;
> }
>
> - rams[i].start = res.start;
> - rams[i++].end = res.end;
> -
> + rams[i++] = res;
> start = res.end + 1;
Looks good to me, makes it obvious that everything that
find_next_iomem_res() would return for walk_system_ram_range() users is
the same as what walk_system_ram_res_rev() returns.
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
next prev parent reply other threads:[~2024-10-17 20:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 19:03 Gregory Price
2024-10-17 20:52 ` Dan Williams [this message]
2024-10-18 2:18 ` Baoquan He
2024-10-18 12:22 ` Andy Shevchenko
2024-10-18 13:52 ` Baoquan He
2024-10-18 14:51 ` Andy Shevchenko
2024-10-18 14:52 ` Andy Shevchenko
2024-10-18 15:39 ` Baoquan He
2024-10-18 15:57 ` Andy Shevchenko
2024-10-18 12:57 ` Andy Shevchenko
2024-10-18 13:38 ` Gregory Price
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=67117918aa217_10a0a294dc@dwillia2-mobl3.amr.corp.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhe@redhat.com \
--cc=bhelgaas@google.com \
--cc=gourry@gourry.net \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=takahiro.akashi@linaro.org \
--cc=tglx@linutronix.de \
--cc=ying.huang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®