[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202210111209.7F1541F5BE@keescook>
Date: Tue, 11 Oct 2022 12:38:49 -0700
From: Kees Cook <keescook@...omium.org>
To: pso@...omium.org
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux-Fsdevel <linux-fsdevel@...r.kernel.org>,
Dmitry Torokhov <dtor@...omium.org>,
Paramjit Oberoi <psoberoi@...gle.com>,
Anton Vorontsov <anton@...msg.org>,
Colin Cross <ccross@...roid.com>,
Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH 1/1] pstore/ram: Ensure stable pmsg address with per-CPU
ftrace buffers
On Tue, Oct 11, 2022 at 11:36:31AM -0700, pso@...omium.org wrote:
> From: Paramjit Oberoi <psoberoi@...gle.com>
>
> When allocating ftrace pstore zones, there may be space left over at the
> end of the region. The paddr pointer needs to be advanced to account for
> this so that the next region (pmsg) ends up at the correct location.
>
> Signed-off-by: Paramjit Oberoi <pso@...omium.org>
> Reviewed-by: Dmitry Torokhov <dtor@...omium.org>
> Signed-off-by: Paramjit Oberoi <psoberoi@...gle.com>
Hm, interesting point. Since only ftrace is dynamically sized in this
fashion, how about just moving the pmsg allocation before ftrace, and
adding a comment that for now ftrace should be allocated last?
i.e. something like:
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 650f89c8ae36..9e11d3e7dffe 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -788,6 +788,11 @@ static int ramoops_probe(struct platform_device *pdev)
if (err)
goto fail_init;
+ err = ramoops_init_prz("pmsg", dev, cxt, &cxt->mprz, &paddr,
+ cxt->pmsg_size, 0);
+ if (err)
+ goto fail_init;
+
cxt->max_ftrace_cnt = (cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU)
? nr_cpu_ids
: 1;
@@ -799,11 +804,6 @@ static int ramoops_probe(struct platform_device *pdev)
if (err)
goto fail_init;
- err = ramoops_init_prz("pmsg", dev, cxt, &cxt->mprz, &paddr,
- cxt->pmsg_size, 0);
- if (err)
- goto fail_init;
-
cxt->pstore.data = cxt;
/*
* Prepare frontend flags based on which areas are initialized.
(Note that this won't apply to the current tree, where I've started some
other refactoring.)
--
Kees Cook
Powered by blists - more mailing lists