mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Bohac <jbohac@suse.cz>
To: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>,
	Anton Vorontsov <anton@enomsg.org>,
	Colin Cross <ccross@android.com>,
	Matteo Croce <mcroce@linux.microsoft.com>,
	linux-kernel@vger.kernel.org
Subject: Re: pstore: fix compression
Date: Fri, 19 Feb 2021 01:54:23 +0100	[thread overview]
Message-ID: <20210219005423.p2y5ob6637pp245n@dwarf.suse.cz> (raw)
In-Reply-To: <161368019685.305632.7880211837303066992.b4-ty@chromium.org>

On Thu, Feb 18, 2021 at 12:30:03PM -0800, Kees Cook wrote:
> Eek; thanks for the catch!

thanks for applying the fix;

BTW, with the compression broken, I was not getting any dmesg
stored in ERST at all, not even uncompressed. After instrumenting
the code with a lot of debug printks I found that writing
erst_erange.size worth of data into the ERST fails and the
maximum writeable size is 98 bytes smaler:

Details: 

	- erst_erange.size = 65536
	- this results in  erst_info.bufsize = 65336
	- pstore_compress() returned -EINVAL (because of the
	  just-fixed typo), zipped_len = -EINVAL.
	- pstore_dump calls copy_kmsg_to_buffer to only copy bufsize
	  bytes from big_oops_buf to psinfo->buf;
	  record.size = bufsize = 65336

	psinfo->write(&record) then fails with -EINVAL;
	by more tracing inside the ERST code I found the -EINVAL was
	produced by __erst_write_to_storage()
	after apei_exec_ctx_get_output() returned
	val=ERST_STATUS_FAILED=3 and this got translated into -EINVAL by
	erst_errno().

	Once the compression was fixed everything started working because
	the records are much smaller after the compression (~30kB).

	My next thought was to find the largest possible record that
	could be written successfully.
	I modified the ERST init code to decrease erst_info.bufsize by a
	value specified on the cmdline. The maximum writable record was
	65238 bytes long (i.e. erst_erange.size - sizeof(struct
	cper_pstore_record) - 98). With this hack I got
	65238 bytes of uncompressed dmesg stored to ERST.

Any idea what might be causing this?
As far as I can tell, there are no other records in the ERST
(checked through the erst-dbg interface).
Tested on a HPE ProLiant DL120 Gen10 server.

Thanks!


-- 
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, Prague, Czechia


      reply	other threads:[~2021-02-19  0:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 11:15 Jiri Bohac
2021-02-18 11:48 ` Matteo Croce
2021-02-18 12:12 ` Greg KH
2021-02-18 20:30 ` Kees Cook
2021-02-19  0:54   ` Jiri Bohac [this message]

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=20210219005423.p2y5ob6637pp245n@dwarf.suse.cz \
    --to=jbohac@suse.cz \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcroce@linux.microsoft.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

all inboxes | Powered by JetHome®