#
48e3694a |
| 04-Oct-2025 |
Linus Torvalds <torvalds@linux-foundation.org> |
Merge tag 'printk-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek:
- Add KUnit test for the printk ring buffer
- Fix the check of the
Merge tag 'printk-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux
Pull printk updates from Petr Mladek:
- Add KUnit test for the printk ring buffer
- Fix the check of the maximal record size which is allowed to be stored into the printk ring buffer. It prevents corruptions of the ring buffer.
Note that printk() is on the safe side. The messages are limited by 1kB buffer and are always small enough for the minimal log buffer size 4kB, see CONFIG_LOG_BUF_SHIFT definition.
* tag 'printk-for-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: printk: ringbuffer: Fix data block max size check printk: kunit: support offstack cpumask printk: kunit: Fix __counted_by() in struct prbtest_rbdata printk: ringbuffer: Explain why the KUnit test ignores failed writes printk: ringbuffer: Add KUnit test
show more ...
|
#
7a75a5da |
| 02-Oct-2025 |
Petr Mladek <pmladek@suse.com> |
Merge branch 'rework/ringbuffer-kunit-test' into for-linus
|
Revision tags: v6.17, v6.17-rc7, v6.17-rc6, v6.17-rc5 |
|
#
bf42df09 |
| 02-Sep-2025 |
Arnd Bergmann <arnd@arndb.de> |
printk: kunit: support offstack cpumask
For large values of CONFIG_NR_CPUS, the newly added kunit test fails to build:
kernel/printk/printk_ringbuffer_kunit_test.c: In function 'test_readerwriter':
printk: kunit: support offstack cpumask
For large values of CONFIG_NR_CPUS, the newly added kunit test fails to build:
kernel/printk/printk_ringbuffer_kunit_test.c: In function 'test_readerwriter': kernel/printk/printk_ringbuffer_kunit_test.c:279:1: error: the frame size of 1432 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
Change this to use cpumask_var_t and allocate it dynamically when CONFIG_CPUMASK_OFFSTACK is set.
The variable has to be released via a KUnit action wrapper so that it is freed when the test fails and gets aborted. The parameter type is hardcoded to "struct cpumask *" because the macro KUNIT_DEFINE_ACTION_WRAPPER() does not accept an array. But the function does nothing when CONFIG_CPUMASK_OFFSTACK is not set anyway.
Fixes: 5ea2bcdfbf46 ("printk: ringbuffer: Add KUnit test") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/all/20250620192554.2234184-1-arnd@kernel.org # v1 [pmladek@suse.com: Correctly handle allocation failures and freeing using KUnit test API.] Link: https://lore.kernel.org/all/20250702095157.110916-3-pmladek@suse.com # v2 Signed-off-by: Petr Mladek <pmladek@suse.com>
show more ...
|
Revision tags: v6.17-rc4, v6.17-rc3, v6.17-rc2, v6.17-rc1, v6.16, v6.16-rc7, v6.16-rc6, v6.16-rc5 |
|
#
d18d7989 |
| 02-Jul-2025 |
Petr Mladek <pmladek@suse.com> |
printk: kunit: Fix __counted_by() in struct prbtest_rbdata
__counted_by() has to point to a variable which defines the size of the related array. The code must never access the array beyond this lim
printk: kunit: Fix __counted_by() in struct prbtest_rbdata
__counted_by() has to point to a variable which defines the size of the related array. The code must never access the array beyond this limit.
struct prbtest_rbdata currently stores the length of the string. And the code access the array beyond the limit when writing or reading the trailing '\0'.
Store the size of the string, including the trailing '\0' if we wanted to keep __counted_by().
Consistently use "_size" suffix when the trailing '\0' is counted. Note that MAX_RBDATA_TEXT_SIZE was originally used to limit the text length.
When touching the code, make sure that @text_size produced by get_random_u32_inclusive() stays within the limits.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/eaea66b9-266a-46e7-980d-33f40ad4b215@sabinyo.mountain Suggested-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Link: https://patch.msgid.link/20250702095157.110916-4-pmladek@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
show more ...
|
#
254e8fb5 |
| 02-Jul-2025 |
Petr Mladek <pmladek@suse.com> |
printk: ringbuffer: Explain why the KUnit test ignores failed writes
The KUnit test ignores prb_reserve() failures on purpose. It tries to push the ringbuffer beyond limits.
Note that it is a know
printk: ringbuffer: Explain why the KUnit test ignores failed writes
The KUnit test ignores prb_reserve() failures on purpose. It tries to push the ringbuffer beyond limits.
Note that it is a know problem that writes might fail in this situation. printk() tries to prevent this problem by:
+ allocating big enough data buffer, see log_buf_add_cpu().
+ allocating enough descriptors by using small enough average record, see PRB_AVGBITS.
+ storing the record with disabled interrupts, see vprintk_store().
Also the amount of printk() messages is always somehow bound in practice. And they are serialized when they are printed from many CPUs on purpose, for example, when printing backtraces.
Reviewed-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Link: https://patch.msgid.link/20250702095157.110916-2-pmladek@suse.com Signed-off-by: Petr Mladek <pmladek@suse.com>
show more ...
|
Revision tags: v6.16-rc4, v6.16-rc3, v6.16-rc2 |
|
#
5ea2bcdf |
| 12-Jun-2025 |
Thomas Weißschuh <thomas.weissschuh@linutronix.de> |
printk: ringbuffer: Add KUnit test
The KUnit test validates the correct operation of the ringbuffer. A separate dedicated ringbuffer is used so that the global printk ringbuffer is not touched.
Co-
printk: ringbuffer: Add KUnit test
The KUnit test validates the correct operation of the ringbuffer. A separate dedicated ringbuffer is used so that the global printk ringbuffer is not touched.
Co-developed-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: John Ogness <john.ogness@linutronix.de> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Petr Mladek <pmladek@suse.com> Link: https://patch.msgid.link/20250612-printk-ringbuffer-test-v3-1-550c088ee368@linutronix.de Signed-off-by: Petr Mladek <pmladek@suse.com>
show more ...
|