Skip to content

Commit 5b07aac

Browse files
committed
Merge tag 'pstore-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull pstore updates from Kees Cook: - Greatly simplify compression support (Ard Biesheuvel) - Avoid crashes for corrupted offsets when prz size is 0 (Enlin Mu) - Expand range of usable record sizes (Yuxiao Zhang) - Fix kernel-doc warning (Matthew Wilcox) * tag 'pstore-v6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: pstore: Fix kernel-doc warning pstore: Support record sizes larger than kmalloc() limit pstore/ram: Check start of empty przs during init pstore: Replace crypto API compression with zlib_deflate library calls pstore: Remove worst-case compression size logic
2 parents 547635c + af58740 commit 5b07aac

File tree

5 files changed

+137
-346
lines changed

5 files changed

+137
-346
lines changed

fs/pstore/Kconfig

Lines changed: 9 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
config PSTORE
33
tristate "Persistent store support"
4-
select CRYPTO if PSTORE_COMPRESS
54
default n
65
help
76
This option enables generic access to platform level
@@ -22,99 +21,18 @@ config PSTORE_DEFAULT_KMSG_BYTES
2221
Defines default size of pstore kernel log storage.
2322
Can be enlarged if needed, not recommended to shrink it.
2423

25-
config PSTORE_DEFLATE_COMPRESS
26-
tristate "DEFLATE (ZLIB) compression"
27-
default y
28-
depends on PSTORE
29-
select CRYPTO_DEFLATE
30-
help
31-
This option enables DEFLATE (also known as ZLIB) compression
32-
algorithm support.
33-
34-
config PSTORE_LZO_COMPRESS
35-
tristate "LZO compression"
36-
depends on PSTORE
37-
select CRYPTO_LZO
38-
help
39-
This option enables LZO compression algorithm support.
40-
41-
config PSTORE_LZ4_COMPRESS
42-
tristate "LZ4 compression"
43-
depends on PSTORE
44-
select CRYPTO_LZ4
45-
help
46-
This option enables LZ4 compression algorithm support.
47-
48-
config PSTORE_LZ4HC_COMPRESS
49-
tristate "LZ4HC compression"
50-
depends on PSTORE
51-
select CRYPTO_LZ4HC
52-
help
53-
This option enables LZ4HC (high compression) mode algorithm.
54-
55-
config PSTORE_842_COMPRESS
56-
bool "842 compression"
57-
depends on PSTORE
58-
select CRYPTO_842
59-
help
60-
This option enables 842 compression algorithm support.
61-
62-
config PSTORE_ZSTD_COMPRESS
63-
bool "zstd compression"
64-
depends on PSTORE
65-
select CRYPTO_ZSTD
66-
help
67-
This option enables zstd compression algorithm support.
68-
6924
config PSTORE_COMPRESS
70-
def_bool y
25+
bool "Pstore compression (deflate)"
7126
depends on PSTORE
72-
depends on PSTORE_DEFLATE_COMPRESS || PSTORE_LZO_COMPRESS || \
73-
PSTORE_LZ4_COMPRESS || PSTORE_LZ4HC_COMPRESS || \
74-
PSTORE_842_COMPRESS || PSTORE_ZSTD_COMPRESS
75-
76-
choice
77-
prompt "Default pstore compression algorithm"
78-
depends on PSTORE_COMPRESS
27+
select ZLIB_INFLATE
28+
select ZLIB_DEFLATE
29+
default y
7930
help
80-
This option chooses the default active compression algorithm.
81-
This change be changed at boot with "pstore.compress=..." on
82-
the kernel command line.
83-
84-
Currently, pstore has support for 6 compression algorithms:
85-
deflate, lzo, lz4, lz4hc, 842 and zstd.
86-
87-
The default compression algorithm is deflate.
88-
89-
config PSTORE_DEFLATE_COMPRESS_DEFAULT
90-
bool "deflate" if PSTORE_DEFLATE_COMPRESS
91-
92-
config PSTORE_LZO_COMPRESS_DEFAULT
93-
bool "lzo" if PSTORE_LZO_COMPRESS
94-
95-
config PSTORE_LZ4_COMPRESS_DEFAULT
96-
bool "lz4" if PSTORE_LZ4_COMPRESS
97-
98-
config PSTORE_LZ4HC_COMPRESS_DEFAULT
99-
bool "lz4hc" if PSTORE_LZ4HC_COMPRESS
100-
101-
config PSTORE_842_COMPRESS_DEFAULT
102-
bool "842" if PSTORE_842_COMPRESS
103-
104-
config PSTORE_ZSTD_COMPRESS_DEFAULT
105-
bool "zstd" if PSTORE_ZSTD_COMPRESS
106-
107-
endchoice
108-
109-
config PSTORE_COMPRESS_DEFAULT
110-
string
111-
depends on PSTORE_COMPRESS
112-
default "deflate" if PSTORE_DEFLATE_COMPRESS_DEFAULT
113-
default "lzo" if PSTORE_LZO_COMPRESS_DEFAULT
114-
default "lz4" if PSTORE_LZ4_COMPRESS_DEFAULT
115-
default "lz4hc" if PSTORE_LZ4HC_COMPRESS_DEFAULT
116-
default "842" if PSTORE_842_COMPRESS_DEFAULT
117-
default "zstd" if PSTORE_ZSTD_COMPRESS_DEFAULT
31+
Whether pstore records should be compressed before being written to
32+
the backing store. This is implemented using the zlib 'deflate'
33+
algorithm, using the library implementation instead of using the full
34+
blown crypto API. This reduces the risk of secondary oopses or other
35+
problems while pstore is recording panic metadata.
11836

11937
config PSTORE_CONSOLE
12038
bool "Log kernel console messages"

fs/pstore/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void free_pstore_private(struct pstore_private *private)
5454
if (!private)
5555
return;
5656
if (private->record) {
57-
kfree(private->record->buf);
57+
kvfree(private->record->buf);
5858
kfree(private->record->priv);
5959
kfree(private->record);
6060
}

0 commit comments

Comments
 (0)