All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Nikolai Merinov <n.merinov@inango-systems.com>
Cc: Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
	linux-kernel@vger.kernel.org,
	Aleksandr Yashkin <a.yashkin@inango-systems.com>,
	Ariel Gilman <a.gilman@inango-systems.com>
Subject: Re: [PATCH] pstore/ram: fix for adding dumps to non-empty zone
Date: Mon, 30 Dec 2019 11:02:07 -0800	[thread overview]
Message-ID: <201912301100.473042C@keescook> (raw)
In-Reply-To: <20191223133816.28155-1-n.merinov@inango-systems.com>

On Mon, Dec 23, 2019 at 06:38:16PM +0500, Nikolai Merinov wrote:
> From: Aleksandr Yashkin <a.yashkin@inango-systems.com>
> 
> The circle buffer in ramoops zones has a problem for adding a new
> oops dump to already an existing one.
> 
> The solution to this problem is to reset the circle buffer state before
> writing a new oops dump.

Can you describe the real-world problem you're fixing here? Dumps should
be appended as new records. Are you saying that once the circular list
is full, it blocks future dumps?

-Kees

> 
> Signed-off-by: Aleksandr Yashkin <a.yashkin@inango-systems.com>
> Signed-off-by: Nikolay Merinov <n.merinov@inango-systems.com>
> Signed-off-by: Ariel Gilman <a.gilman@inango-systems.com>
> 
> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
> index 8caff834f002..33fceadbf515 100644
> --- a/fs/pstore/ram.c
> +++ b/fs/pstore/ram.c
> @@ -407,6 +407,13 @@ static int notrace ramoops_pstore_write(struct pstore_record *record)
>  
>  	prz = cxt->dprzs[cxt->dump_write_cnt];
>  
> +	/* Clean the buffer from old info.
> +	 * `ramoops_read_kmsg_hdr' expects to find a header in the beginning of
> +	 * buffer data, so we must to reset the buffer values, in order to
> +	 * ensure that the header will be written to the beginning of the buffer
> +	 */
> +	persistent_ram_zap(prz);
> +
>  	/* Build header and append record contents. */
>  	hlen = ramoops_write_kmsg_hdr(prz, record);
>  	if (!hlen)
> -- 
> 2.17.1
> 

-- 
Kees Cook

  reply	other threads:[~2019-12-30 19:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 13:38 [PATCH] pstore/ram: fix for adding dumps to non-empty zone Nikolai Merinov
2019-12-30 19:02 ` Kees Cook [this message]
2019-12-30 20:37 ` Kees Cook
2019-12-31  8:00   ` Nikolai Merinov
2020-01-02 22:05     ` 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=201912301100.473042C@keescook \
    --to=keescook@chromium.org \
    --cc=a.gilman@inango-systems.com \
    --cc=a.yashkin@inango-systems.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=n.merinov@inango-systems.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 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.