lib/vsprintf: Make no_hash_pointers take effect early
Subsystems (2)
PATCH 1/1 lib/vsprintf: Make no_hash_pointers take effect early
From: Kaitao Cheng <[email protected]>
The no_hash_pointers boot parameter is now handled as an alias for hash_pointers=never. However, hash_pointers=never only records the selected mode during early parameter parsing, and no_hash_pointers is not updated until hash_pointers_finalize() runs later from SLUB init.
This leaves a window during very early boot where %p output is still hashed even though the user explicitly requested unhashed pointers with no_hash_pointers or hash_pointers=never.
Set no_hash_pointers as soon as the "never" mode is parsed. The later hash_pointers_finalize() call still keeps the final policy decision in one place, but explicit requests to disable pointer hashing now take effect for early boot users too.
--- lib/vsprintf.c | 1 + 1 file changed, 1 insertion(+)
lib/vsprintf.c +1 -0
@@ -2361,6 +2361,7 @@ static int __init hash_pointers_mode_parse(char *str) }else if (strcmp (str,"never" ) ==0 ) {pr_info ("Hash pointers mode set to never.\n" ); hash_pointers_mode =HASH_PTR_NEVER ; + no_hash_pointers = true; }else if (strcmp (str,"always" ) ==0 ) {pr_info ("Hash pointers mode set to always.\n" ); hash_pointers_mode =HASH_PTR_ALWAYS ;
Signature · 1 line
2.50.1 (Apple Git-155)
Andy Shevchenko
reviewerQuoted 5 lines · Kaitao Cheng
The
no_hash_pointersboot parameter is now handled as an alias for hash_pointers=never. However, hash_pointers=never only records the selected mode during early parameter parsing, andno_hash_pointersis not updated untilhash_pointers_finalize()runs later from SLUB init.
Quoted 8 lines
This leaves a window during very early boot where %p output is still hashed even though the user explicitly requested unhashed pointers with
no_hash_pointersor hash_pointers=never.Set
no_hash_pointersas soon as the "never" mode is parsed. The laterhash_pointers_finalize()call still keeps the final policy decision in one place, but explicit requests to disable pointer hashing now take effect for early boot users too.
How is it documented now? And if not documented at all, needs to be.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 9 lines · Kaitao Cheng
The
no_hash_pointersboot parameter is now handled as an alias for hash_pointers=never. However, hash_pointers=never only records the selected mode during early parameter parsing, andno_hash_pointersis not updated untilhash_pointers_finalize()runs later from SLUB init.This leaves a window during very early boot where %p output is still hashed even though the user explicitly requested unhashed pointers with
no_hash_pointersor hash_pointers=never.
Quoted 6 lines
Quoted 4 lines
Set
no_hash_pointersas soon as the "never" mode is parsed. The laterhash_pointers_finalize()call still keeps the final policy decision in one place, but explicit requests to disable pointer hashing now take effect for early boot users too.How is it documented now? And if not documented at all, needs to be.
In Documentation/admin-guide/kernel-parameters.txt, the descriptions of both no_hash_pointers and hash_pointers= are already marked as [KNL,EARLY], which should match the current semantics.
Signature · 2 lines
Thanks Kaitao Cheng
Andy Shevchenko
reviewerQuoted 17 lines · Kaitao Cheng
Quoted 16 lines · Andy Shevchenko
Quoted 13 lines · Kaitao Cheng
The
no_hash_pointersboot parameter is now handled as an alias for hash_pointers=never. However, hash_pointers=never only records the selected mode during early parameter parsing, andno_hash_pointersis not updated untilhash_pointers_finalize()runs later from SLUB init.This leaves a window during very early boot where %p output is still hashed even though the user explicitly requested unhashed pointers with
no_hash_pointersor hash_pointers=never.Set
no_hash_pointersas soon as the "never" mode is parsed. The laterhash_pointers_finalize()call still keeps the final policy decision in one place, but explicit requests to disable pointer hashing now take effect for early boot users too.
Quoted 5 lines
Quoted 1 line
How is it documented now? And if not documented at all, needs to be.
In
Documentation/admin-guide/kernel-parameters.txt, the descriptions of bothno_hash_pointersand hash_pointers= are already marked as [KNL,EARLY], which should match the current semantics.
This detail should be also mentioned in the commit message.
Signature · 2 lines
With Best Regards, Andy Shevchenko