<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/pstore/inode.c, branch linux-6.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-06-24T18:40:04Z</updated>
<entry>
<title>pstore: Add priv field to pstore_record for backend specific use</title>
<updated>2022-06-24T18:40:04Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2022-06-22T07:31:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8ca869b24538a7b5501af368e87e4a59b0c04117'/>
<id>urn:sha1:8ca869b24538a7b5501af368e87e4a59b0c04117</id>
<content type='text'>
The EFI pstore backend will need to store per-record variable name data
when we switch away from the efivars layer. Add a priv field to struct
pstore_record, and document it as holding a backend specific pointer
that is assumed to be a kmalloc()d buffer, and will be kfree()d when the
entire record is freed.

Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
</content>
</entry>
<entry>
<title>pstore: Fix warning in pstore_kill_sb()</title>
<updated>2021-02-23T17:27:20Z</updated>
<author>
<name>Tetsuo Handa</name>
</author>
<published>2021-02-14T03:13:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c7d83ae6ba67d6c6199cce24573983db3b56332'/>
<id>urn:sha1:9c7d83ae6ba67d6c6199cce24573983db3b56332</id>
<content type='text'>
syzbot is hitting WARN_ON(pstore_sb != sb) at pstore_kill_sb() [1], for the
assumption that pstore_sb != NULL is wrong because pstore_fill_super() will
not assign pstore_sb = sb when new_inode() for d_make_root() returned NULL
(due to memory allocation fault injection).

Since mount_single() calls pstore_kill_sb() when pstore_fill_super()
failed, pstore_kill_sb() needs to be aware of such failure path.

[1] https://syzkaller.appspot.com/bug?id=6abacb8da5137cb47a416f2bef95719ed60508a0

Reported-by: syzbot &lt;syzbot+d0cf0ad6513e9a1da5df@syzkaller.appspotmail.com&gt;
Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20210214031307.57903-1-penguin-kernel@I-love.SAKURA.ne.jp
</content>
</entry>
<entry>
<title>pstore: Move kmsg_bytes default into Kconfig</title>
<updated>2020-12-01T20:09:17Z</updated>
<author>
<name>Vasile-Laurentiu Stanimir</name>
</author>
<published>2020-11-04T13:05:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=26fecbf7602dd69b649914e61526bd67c557fece'/>
<id>urn:sha1:26fecbf7602dd69b649914e61526bd67c557fece</id>
<content type='text'>
While kmsg_bytes can be set for pstore via mount, if a crash occurs
before the mount only partial console log will be stored as kmsg_bytes
defaults to a potentially different hardcoded value in the kernel
(PSTORE_DEFAULT_KMSG_BYTES). This makes it impossible to analyze valuable
post-mortem data especially on the embedded development or in the process
of bringing up new boards. Change this value to be a Kconfig option
with the default of old PSTORE_DEFAULT_KMSG_BYTES

Signed-off-by: Vasile-Laurentiu Stanimir &lt;vasile-laurentiu.stanimir@windriver.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: Remove filesystem records when backend is unregistered</title>
<updated>2020-05-30T17:34:02Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-05-05T02:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=609e28bb139e53621521130f0d4aea27a725d465'/>
<id>urn:sha1:609e28bb139e53621521130f0d4aea27a725d465</id>
<content type='text'>
If a backend was unloaded without having first removed all its
associated records in pstorefs, subsequent removals would crash while
attempting to call into the now missing backend. Add automatic removal
from the tree in pstore_unregister(), so that no references to the
backend remain.

Reported-by: Luis Henriques &lt;lhenriques@suse.com&gt;
Link: https://lore.kernel.org/lkml/87o8yrmv69.fsf@suse.com
Link: https://lore.kernel.org/lkml/20200506152114.50375-11-keescook@chromium.org/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: Add locking around superblock changes</title>
<updated>2020-05-30T17:33:46Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-05-05T02:43:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=27e5041a87e8af2d0b6452dffe053d0253e914cc'/>
<id>urn:sha1:27e5041a87e8af2d0b6452dffe053d0253e914cc</id>
<content type='text'>
Nothing was protecting changes to the pstorefs superblock. Add locking
and refactor away is_pstore_mounted(), instead using a helper to add a
way to safely lock the pstorefs root inode during filesystem changes.

Link: https://lore.kernel.org/lkml/20200506152114.50375-9-keescook@chromium.org/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: Refactor pstorefs record list removal</title>
<updated>2020-05-12T16:15:29Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-05-05T02:41:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a0ad546847a23f92f5e227fa8e4578eaa3a8d0a'/>
<id>urn:sha1:7a0ad546847a23f92f5e227fa8e4578eaa3a8d0a</id>
<content type='text'>
The "unlink" handling should perform list removal (which can also make
sure records don't get double-erased), and the "evict" handling should
be responsible only for memory freeing.

Link: https://lore.kernel.org/lkml/20200506152114.50375-8-keescook@chromium.org/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: Convert "records_list" locking to mutex</title>
<updated>2020-05-12T16:14:18Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-05-05T02:07:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=db23491c77207ef6bec2b232238710de4755db6a'/>
<id>urn:sha1:db23491c77207ef6bec2b232238710de4755db6a</id>
<content type='text'>
The pstorefs internal list lock doesn't need to be a spinlock and will
create problems when trying to access the list in the subsequent patch
that will walk the pstorefs records during pstore_unregister(). Change
this to a mutex to avoid may_sleep() warnings when unregistering devices.

Link: https://lore.kernel.org/lkml/20200506152114.50375-6-keescook@chromium.org/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: Rename "allpstore" to "records_list"</title>
<updated>2020-05-12T16:14:05Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-05-06T06:32:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=47af61ffb19baa8df2b109582f87f7622fbe85cc'/>
<id>urn:sha1:47af61ffb19baa8df2b109582f87f7622fbe85cc</id>
<content type='text'>
The name "allpstore" doesn't carry much meaning, so rename it to what it
actually is: the list of all records present in the filesystem. The lock
is also renamed accordingly.

Link: https://lore.kernel.org/lkml/20200506152114.50375-5-keescook@chromium.org/
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: pstore_ftrace_seq_next should increase position index</title>
<updated>2020-02-27T16:04:59Z</updated>
<author>
<name>Vasily Averin</name>
</author>
<published>2020-02-25T08:11:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c871b7314dde9ab64f20de8f5aa3d01be4518e8'/>
<id>urn:sha1:6c871b7314dde9ab64f20de8f5aa3d01be4518e8</id>
<content type='text'>
In Aug 2018 NeilBrown noticed
commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
"Some -&gt;next functions do not increment *pos when they return NULL...
Note that such -&gt;next functions are buggy and should be fixed.
A simple demonstration is

 dd if=/proc/swaps bs=1000 skip=1

Choose any block size larger than the size of /proc/swaps. This will
always show the whole last line of /proc/swaps"

/proc/swaps output was fixed recently, however there are lot of other
affected files, and one of them is related to pstore subsystem.

If .next function does not change position index, following .show function
will repeat output related to current position index.

There are at least 2 related problems:
- read after lseek beyond end of file, described above by NeilBrown
  "dd if=&lt;AFFECTED_FILE&gt; bs=1000 skip=1" will generate whole last list
- read after lseek on in middle of last line will output expected rest of
  last line but then repeat whole last line once again.

If .show() function generates multy-line output (like
pstore_ftrace_seq_show() does ?) following bash script cycles endlessly

 $ q=;while read -r r;do echo "$((++q)) $r";done &lt; AFFECTED_FILE

Unfortunately I'm not familiar enough to pstore subsystem and was unable
to find affected pstore-related file on my test node.

If .next function does not change position index, following .show function
will repeat output related to current position index.

Cc: stable@vger.kernel.org
Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code ...")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin &lt;vvs@virtuozzo.com&gt;
Link: https://lore.kernel.org/r/4e49830d-4c88-0171-ee24-1ee540028dad@virtuozzo.com
[kees: with robustness tweak from Joel Fernandes &lt;joelaf@google.com&gt;]
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore: Fix double-free in pstore_mkfile() failure path</title>
<updated>2019-07-09T04:04:42Z</updated>
<author>
<name>Norbert Manthey</name>
</author>
<published>2019-07-05T13:06:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4c6d80e1144bdf48cae6b602ae30d41f3e5c76a9'/>
<id>urn:sha1:4c6d80e1144bdf48cae6b602ae30d41f3e5c76a9</id>
<content type='text'>
The pstore_mkfile() function is passed a pointer to a struct
pstore_record. On success it consumes this 'record' pointer and
references it from the created inode.

On failure, however, it may or may not free the record. There are even
two different code paths which return -ENOMEM -- one of which does and
the other doesn't free the record.

Make the behaviour deterministic by never consuming and freeing the
record when returning failure, allowing the caller to do the cleanup
consistently.

Signed-off-by: Norbert Manthey &lt;nmanthey@amazon.de&gt;
Link: https://lore.kernel.org/r/1562331960-26198-1-git-send-email-nmanthey@amazon.de
Fixes: 83f70f0769ddd ("pstore: Do not duplicate record metadata")
Fixes: 1dfff7dd67d1a ("pstore: Pass record contents instead of copying")
Cc: stable@vger.kernel.org
[kees: also move "private" allocation location, rename inode cleanup label]
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
</feed>
