提交 40594264 编写于 作者: A Aruna Balakrishnaiah 提交者: Tony Luck

powerpc/pseries: Read and write to the 'compressed' flag of pstore

If data returned from pstore is compressed, nvram's write callback
will add a flag ERR_TYPE_KERNEL_PANIC_GZ indicating the data is compressed
while writing to nvram. If the data read from nvram is compressed, nvram's
read callback will set the flag 'compressed'. The patch adds backward
compatibilty with old format oops header when reading from pstore.
Signed-off-by: NAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Reviewed-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 9ad2cbe0
...@@ -581,6 +581,9 @@ static int nvram_pstore_write(enum pstore_type_id type, ...@@ -581,6 +581,9 @@ static int nvram_pstore_write(enum pstore_type_id type,
oops_hdr->report_length = (u16) size; oops_hdr->report_length = (u16) size;
oops_hdr->timestamp = get_seconds(); oops_hdr->timestamp = get_seconds();
if (compressed)
err_type = ERR_TYPE_KERNEL_PANIC_GZ;
rc = nvram_write_os_partition(&oops_log_partition, oops_buf, rc = nvram_write_os_partition(&oops_log_partition, oops_buf,
(int) (sizeof(*oops_hdr) + size), err_type, count); (int) (sizeof(*oops_hdr) + size), err_type, count);
...@@ -687,6 +690,11 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, ...@@ -687,6 +690,11 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
return -ENOMEM; return -ENOMEM;
memcpy(*buf, buff + hdr_size, length); memcpy(*buf, buff + hdr_size, length);
kfree(buff); kfree(buff);
if (err_type == ERR_TYPE_KERNEL_PANIC_GZ)
*compressed = true;
else
*compressed = false;
return length; return length;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册