diff options
| author | Petr Mladek <pmladek@suse.com> | 2026-10-22 10:21:06 +0200 |
|---|---|---|
| committer | Petr Mladek <pmladek@suse.com> | 2026-10-22 10:21:06 +0200 |
| commit | 046d687e58ed60d917f91b348f70125acc345088 (patch) | |
| tree | 214bf388924c06fc5e7b52374af3f4e225caf62c /lib | |
| parent | 9d586910e3d858fb25d061b7bf3f9642eca89213 (diff) | |
| parent | c56e202c1a48918392c61cbdd3caf04afe425970 (diff) | |
Merge branch 'for-7.4' into for-linus
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tests/printf_kunit.c | 1 | ||||
| -rw-r--r-- | lib/vsprintf.c | 19 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c index eccf041ebd56..290d59b22c29 100644 --- a/lib/tests/printf_kunit.c +++ b/lib/tests/printf_kunit.c @@ -876,3 +876,4 @@ kunit_test_suite(printf_test_suite); MODULE_AUTHOR("Rasmus Villemoes <linux@rasmusvillemoes.dk>"); MODULE_DESCRIPTION("Test cases for printf facility"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING"); diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 1d95ab9314bf..f44c4eeb6629 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -25,6 +25,7 @@ #include <linux/module.h> /* for KSYM_SYMBOL_LEN */ #include <linux/types.h> #include <linux/string.h> +#include <linux/string_helpers.h> #include <linux/ctype.h> #include <linux/hex.h> #include <linux/kernel.h> @@ -54,12 +55,13 @@ #include <asm/byteorder.h> /* cpu_to_le16 */ #include <linux/unaligned.h> -#include <linux/string_helpers.h> +#include <kunit/visibility.h> + #include "kstrtox.h" /* Disable pointer hashing if requested */ bool no_hash_pointers __ro_after_init; -EXPORT_SYMBOL_FOR_MODULES(no_hash_pointers, "printf_kunit"); +EXPORT_SYMBOL_IF_KUNIT(no_hash_pointers); /* * Hashed pointers policy selected by "hash_pointers=..." boot param @@ -762,9 +764,8 @@ static int fill_ptr_key(struct notifier_block *nb, unsigned long action, void *d { get_random_bytes(&ptr_key, sizeof(ptr_key)); - /* Pairs with smp_rmb() before reading ptr_key. */ - smp_wmb(); - WRITE_ONCE(filled_random_ptr_key, true); + /* Pairs with smp_load_acquire() before reading ptr_key. */ + smp_store_release(&filled_random_ptr_key, true); return NOTIFY_DONE; } @@ -781,12 +782,10 @@ static inline int __ptr_to_hashval(const void *ptr, unsigned long *hashval_out) { unsigned long hashval; - if (!READ_ONCE(filled_random_ptr_key)) + /* Pairs with smp_store_release() after writing ptr_key. */ + if (!smp_load_acquire(&filled_random_ptr_key)) return -EBUSY; - /* Pairs with smp_wmb() after writing ptr_key. */ - smp_rmb(); - #ifdef CONFIG_64BIT hashval = (unsigned long)siphash_1u64((u64)ptr, &ptr_key); /* @@ -850,7 +849,7 @@ static char *default_pointer(char *buf, char *end, const void *ptr, } int kptr_restrict __read_mostly; -EXPORT_SYMBOL_FOR_MODULES(kptr_restrict, "printf_kunit"); +EXPORT_SYMBOL_IF_KUNIT(kptr_restrict); static noinline_for_stack char *restricted_pointer(char *buf, char *end, const void *ptr, |
