All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] fix: enable early printing of hashed pointers
@ 2018-07-10  0:25 Tobin C. Harding
  2018-07-10  0:25 ` [PATCH 1/3] random: Remove unnecessary cast Tobin C. Harding
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Tobin C. Harding @ 2018-07-10  0:25 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Tobin C. Harding, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Steven Rostedt (VMware),
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

Hi Ted,

Sending this set to you because it fixes the recent patch set applied to
your random-next branch.

This set includes changes already posted on LKML as

	[PATCH v9 0/4] enable early printing of hashed pointers

Since I'm a massive noob I did not realise that since v7 of this set was
applied to random-next already that doing incremental versions was
pointless.

So, this set is the changes done in v8 and v9 of the above patch set.
I have retained the acked-by tag from Randy for the docs fixes.
Attribution for pointing out the issues has been 'lost in translation',
I'll buy you guys a beer one day instead ...

With this set applied linux-next still throws a build warning

	lib/vsprintf.c:1667:13: warning: ‘have_filled_random_ptr_key’
 	defined but not used [-Wunused-variable] 

This is fixed by another patch currently in flight ([PATCH] "vsprintf:
fix build warning" - thanks Arnd).

Epic amounts of confusion, solely caused as usual by myself.

thanks,
Tobin.


Tobin C. Harding (3):
  random: Remove unnecessary cast
  vsprintf: Remove incorrect EXPORT_SYMBOL
  docs: Fix docs for boot parameter debug_boot_weak_hash

 Documentation/admin-guide/kernel-parameters.txt | 13 ++++++-------
 drivers/char/random.c                           |  2 +-
 lib/vsprintf.c                                  |  1 -
 3 files changed, 7 insertions(+), 9 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] random: Remove unnecessary cast
  2018-07-10  0:25 [PATCH 0/3] fix: enable early printing of hashed pointers Tobin C. Harding
@ 2018-07-10  0:25 ` Tobin C. Harding
  2018-07-10  2:06   ` Steven Rostedt
  2018-07-10  0:25 ` [PATCH 2/3] vsprintf: Remove incorrect EXPORT_SYMBOL Tobin C. Harding
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Tobin C. Harding @ 2018-07-10  0:25 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Tobin C. Harding, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Steven Rostedt (VMware),
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

Currently we are casting an argument to the macro min_t().  This is
unnecessary since the macro already includes a cast.

Remove unnecessary cast from argument to macro min_t()

Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 drivers/char/random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index d686aa2a129b..03bd13876901 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1736,7 +1736,7 @@ int __must_check get_random_bytes_arch(void *buf, int nbytes)
 	trace_get_random_bytes_arch(left, _RET_IP_);
 	while (left) {
 		unsigned long v;
-		int chunk = min_t(int, left, (int)sizeof(unsigned long));
+		int chunk = min_t(int, left, sizeof(unsigned long));
 
 		if (!arch_get_random_long(&v))
 			break;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] vsprintf: Remove incorrect EXPORT_SYMBOL
  2018-07-10  0:25 [PATCH 0/3] fix: enable early printing of hashed pointers Tobin C. Harding
  2018-07-10  0:25 ` [PATCH 1/3] random: Remove unnecessary cast Tobin C. Harding
@ 2018-07-10  0:25 ` Tobin C. Harding
  2018-07-10  2:12   ` Steven Rostedt
  2018-07-10  0:25 ` [PATCH 3/3] docs: Fix docs for boot parameter debug_boot_weak_hash Tobin C. Harding
  2018-07-10  2:07 ` [PATCH 0/3] fix: enable early printing of hashed pointers Steven Rostedt
  3 siblings, 1 reply; 9+ messages in thread
From: Tobin C. Harding @ 2018-07-10  0:25 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Tobin C. Harding, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Steven Rostedt (VMware),
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

Recently boot variable 'debug_boot_weak_hash' was added (by me).  In a
classic case of cargo cult programming the novice developer added a
macro call to EXPORT_SYMBOL().  This is wrong and was pointed out on
LKML.  As pointed out EXPORT_SYMBOL() cannot be used on static
variables.

Remove incorrect usage of macro EXPORT_SYMBOL()

Fixes: bfe80ed3d7c76 ("vsprintf: add command line option debug_boot_weak_hash")
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 lib/vsprintf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index cdc2c355dff5..fe834a201f3d 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1655,7 +1655,6 @@ static DEFINE_STATIC_KEY_TRUE(not_filled_random_ptr_key);
 
 /* Make pointers available for printing early in the boot sequence. */
 static int debug_boot_weak_hash __ro_after_init;
-EXPORT_SYMBOL(debug_boot_weak_hash);
 
 static int __init debug_boot_weak_hash_enable(char *str)
 {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] docs: Fix docs for boot parameter debug_boot_weak_hash
  2018-07-10  0:25 [PATCH 0/3] fix: enable early printing of hashed pointers Tobin C. Harding
  2018-07-10  0:25 ` [PATCH 1/3] random: Remove unnecessary cast Tobin C. Harding
  2018-07-10  0:25 ` [PATCH 2/3] vsprintf: Remove incorrect EXPORT_SYMBOL Tobin C. Harding
@ 2018-07-10  0:25 ` Tobin C. Harding
  2018-07-10  2:14   ` Steven Rostedt
  2018-07-10  2:07 ` [PATCH 0/3] fix: enable early printing of hashed pointers Steven Rostedt
  3 siblings, 1 reply; 9+ messages in thread
From: Tobin C. Harding @ 2018-07-10  0:25 UTC (permalink / raw)
  To: Theodore Ts'o
  Cc: Tobin C. Harding, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Steven Rostedt (VMware),
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

Recently boot parameter 'debug_boot_weak_hash' was added.  Latter
discussion on LKML developed more descriptive documentation but due to
the programmers lack of understanding (*cough* me) on how linux-next
works these improvements never got picked up.

Update documentation for boot parameter 'debug_boot_weak_hash' as
discussed (patch posted and acked) on LKML.

Fixes: bfe80ed3d7c76 ("vsprintf: add command line option debug_boot_weak_hash")
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
 Documentation/admin-guide/kernel-parameters.txt | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 31c9b76058a7..e3b1c84d19c6 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -749,13 +749,12 @@
 	debug		[KNL] Enable kernel debugging (events log level).
 
 	debug_boot_weak_hash
-			[KNL] Enable printing pointers early in the boot
-			sequence.  If enabled, we use a weak hash instead of
-			siphash to hash pointers.  Use this option if you need
-			to see pointer values during early boot (i.e you are
-			seeing instances of '(___ptrval___)').
-			Cryptographically insecure, please do not use on
-			production kernels.
+			[KNL] Enable printing [hashed] pointers early in the
+			boot sequence.  If enabled, we use a weak hash instead
+			of siphash to hash pointers.  Use this option if you are
+			seeing instances of '(___ptrval___)') and need to see a
+			value (hashed pointer) instead. Cryptographically
+			insecure, please do not use on production kernels.
 
 	debug_locks_verbose=
 			[KNL] verbose self-tests
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] random: Remove unnecessary cast
  2018-07-10  0:25 ` [PATCH 1/3] random: Remove unnecessary cast Tobin C. Harding
@ 2018-07-10  2:06   ` Steven Rostedt
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2018-07-10  2:06 UTC (permalink / raw)
  To: Tobin C. Harding
  Cc: Theodore Ts'o, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

On Tue, 10 Jul 2018 10:25:17 +1000
"Tobin C. Harding" <me@tobin.cc> wrote:

> Currently we are casting an argument to the macro min_t().  This is
> unnecessary since the macro already includes a cast.
> 
> Remove unnecessary cast from argument to macro min_t()
> 
> Signed-off-by: Tobin C. Harding <me@tobin.cc>

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> ---
>  drivers/char/random.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index d686aa2a129b..03bd13876901 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1736,7 +1736,7 @@ int __must_check get_random_bytes_arch(void *buf, int nbytes)
>  	trace_get_random_bytes_arch(left, _RET_IP_);
>  	while (left) {
>  		unsigned long v;
> -		int chunk = min_t(int, left, (int)sizeof(unsigned long));
> +		int chunk = min_t(int, left, sizeof(unsigned long));
>  
>  		if (!arch_get_random_long(&v))
>  			break;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] fix: enable early printing of hashed pointers
  2018-07-10  0:25 [PATCH 0/3] fix: enable early printing of hashed pointers Tobin C. Harding
                   ` (2 preceding siblings ...)
  2018-07-10  0:25 ` [PATCH 3/3] docs: Fix docs for boot parameter debug_boot_weak_hash Tobin C. Harding
@ 2018-07-10  2:07 ` Steven Rostedt
  2018-07-10  2:59   ` Tobin C. Harding
  3 siblings, 1 reply; 9+ messages in thread
From: Steven Rostedt @ 2018-07-10  2:07 UTC (permalink / raw)
  To: Tobin C. Harding
  Cc: Theodore Ts'o, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

On Tue, 10 Jul 2018 10:25:16 +1000
"Tobin C. Harding" <me@tobin.cc> wrote:

> Since I'm a massive noob I did not realise that since v7 of this set was
> applied to random-next already that doing incremental versions was
> pointless.

I wouldn't say you are a noob anymore. You are making the same types of
mistakes that seasoned kernel developers make ;-)

-- Steve

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] vsprintf: Remove incorrect EXPORT_SYMBOL
  2018-07-10  0:25 ` [PATCH 2/3] vsprintf: Remove incorrect EXPORT_SYMBOL Tobin C. Harding
@ 2018-07-10  2:12   ` Steven Rostedt
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2018-07-10  2:12 UTC (permalink / raw)
  To: Tobin C. Harding
  Cc: Theodore Ts'o, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

On Tue, 10 Jul 2018 10:25:18 +1000
"Tobin C. Harding" <me@tobin.cc> wrote:

> Recently boot variable 'debug_boot_weak_hash' was added (by me).  In a
> classic case of cargo cult programming the novice developer added a
> macro call to EXPORT_SYMBOL().  This is wrong and was pointed out on
> LKML.  As pointed out EXPORT_SYMBOL() cannot be used on static
> variables.
> 
> Remove incorrect usage of macro EXPORT_SYMBOL()
> 
> Fixes: bfe80ed3d7c76 ("vsprintf: add command line option debug_boot_weak_hash")
> Signed-off-by: Tobin C. Harding <me@tobin.cc>

Revieved-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

Hmm, not sure if Ted rebases his trees or not, but if he does, he could
also fold this into that commit.

-- Steve

> ---
>  lib/vsprintf.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index cdc2c355dff5..fe834a201f3d 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1655,7 +1655,6 @@ static DEFINE_STATIC_KEY_TRUE(not_filled_random_ptr_key);
>  
>  /* Make pointers available for printing early in the boot sequence. */
>  static int debug_boot_weak_hash __ro_after_init;
> -EXPORT_SYMBOL(debug_boot_weak_hash);
>  
>  static int __init debug_boot_weak_hash_enable(char *str)
>  {


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] docs: Fix docs for boot parameter debug_boot_weak_hash
  2018-07-10  0:25 ` [PATCH 3/3] docs: Fix docs for boot parameter debug_boot_weak_hash Tobin C. Harding
@ 2018-07-10  2:14   ` Steven Rostedt
  0 siblings, 0 replies; 9+ messages in thread
From: Steven Rostedt @ 2018-07-10  2:14 UTC (permalink / raw)
  To: Tobin C. Harding
  Cc: Theodore Ts'o, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

On Tue, 10 Jul 2018 10:25:19 +1000
"Tobin C. Harding" <me@tobin.cc> wrote:

> Recently boot parameter 'debug_boot_weak_hash' was added.  Latter
> discussion on LKML developed more descriptive documentation but due to
> the programmers lack of understanding (*cough* me) on how linux-next
> works these improvements never got picked up.
> 
> Update documentation for boot parameter 'debug_boot_weak_hash' as
> discussed (patch posted and acked) on LKML.
> 
> Fixes: bfe80ed3d7c76 ("vsprintf: add command line option debug_boot_weak_hash")
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Tobin C. Harding <me@tobin.cc>

Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

-- Steve

> ---
>  Documentation/admin-guide/kernel-parameters.txt | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 31c9b76058a7..e3b1c84d19c6 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -749,13 +749,12 @@
>  	debug		[KNL] Enable kernel debugging (events log level).
>  
>  	debug_boot_weak_hash
> -			[KNL] Enable printing pointers early in the boot
> -			sequence.  If enabled, we use a weak hash instead of
> -			siphash to hash pointers.  Use this option if you need
> -			to see pointer values during early boot (i.e you are
> -			seeing instances of '(___ptrval___)').
> -			Cryptographically insecure, please do not use on
> -			production kernels.
> +			[KNL] Enable printing [hashed] pointers early in the
> +			boot sequence.  If enabled, we use a weak hash instead
> +			of siphash to hash pointers.  Use this option if you are
> +			seeing instances of '(___ptrval___)') and need to see a
> +			value (hashed pointer) instead. Cryptographically
> +			insecure, please do not use on production kernels.
>  
>  	debug_locks_verbose=
>  			[KNL] verbose self-tests


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] fix: enable early printing of hashed pointers
  2018-07-10  2:07 ` [PATCH 0/3] fix: enable early printing of hashed pointers Steven Rostedt
@ 2018-07-10  2:59   ` Tobin C. Harding
  0 siblings, 0 replies; 9+ messages in thread
From: Tobin C. Harding @ 2018-07-10  2:59 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Theodore Ts'o, Petr Mladek, Andy Shevchenko, Randy Dunlap,
	Sergey Senozhatsky, Arnd Bergmann, linux-kernel

On Mon, Jul 09, 2018 at 10:07:16PM -0400, Steven Rostedt wrote:
> On Tue, 10 Jul 2018 10:25:16 +1000
> "Tobin C. Harding" <me@tobin.cc> wrote:
> 
> > Since I'm a massive noob I did not realise that since v7 of this set was
> > applied to random-next already that doing incremental versions was
> > pointless.
> 
> I wouldn't say you are a noob anymore. You are making the same types of
> mistakes that seasoned kernel developers make ;-)

Thanks for the vote of confidence Steve :)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-07-10  3:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10  0:25 [PATCH 0/3] fix: enable early printing of hashed pointers Tobin C. Harding
2018-07-10  0:25 ` [PATCH 1/3] random: Remove unnecessary cast Tobin C. Harding
2018-07-10  2:06   ` Steven Rostedt
2018-07-10  0:25 ` [PATCH 2/3] vsprintf: Remove incorrect EXPORT_SYMBOL Tobin C. Harding
2018-07-10  2:12   ` Steven Rostedt
2018-07-10  0:25 ` [PATCH 3/3] docs: Fix docs for boot parameter debug_boot_weak_hash Tobin C. Harding
2018-07-10  2:14   ` Steven Rostedt
2018-07-10  2:07 ` [PATCH 0/3] fix: enable early printing of hashed pointers Steven Rostedt
2018-07-10  2:59   ` Tobin C. Harding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.