linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: pso@chromium.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	Dmitry Torokhov <dtor@chromium.org>,
	Paramjit Oberoi <psoberoi@google.com>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH 1/1] pstore/ram: Ensure stable pmsg address with per-CPU ftrace buffers
Date: Tue, 11 Oct 2022 12:38:49 -0700	[thread overview]
Message-ID: <202210111209.7F1541F5BE@keescook> (raw)
In-Reply-To: <20221011113511.1.I1cf52674cd85d07b300fe3fff3ad6ce830304bb6@changeid>

On Tue, Oct 11, 2022 at 11:36:31AM -0700, pso@chromium.org wrote:
> From: Paramjit Oberoi <psoberoi@google.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@chromium.org>
> Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
> Signed-off-by: Paramjit Oberoi <psoberoi@google.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

  reply	other threads:[~2022-10-11 19:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 18:36 [PATCH 0/1] pstore/ram: Ensure stable pmsg address with per-CPU ftrace buffers pso
2022-10-11 18:36 ` [PATCH 1/1] " pso
2022-10-11 19:38   ` Kees Cook [this message]
     [not found]     ` <CAHqLn7Hd6KaNYA=goS7=dumrG3wZedbV1+ANa+-dZzFPiP_vsQ@mail.gmail.com>
2022-10-11 20:04       ` Kees Cook
     [not found]         ` <CAHqLn7EG=iKmu1tMJ_Um4MmpLVztshfzACnrzcZqPvvcRRCKuQ@mail.gmail.com>
2022-10-11 22:22           ` Kees Cook

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=202210111209.7F1541F5BE@keescook \
    --to=keescook@chromium.org \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=dtor@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pso@chromium.org \
    --cc=psoberoi@google.com \
    --cc=tony.luck@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;
as well as URLs for NNTP newsgroup(s).