public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] enable early printing of hashed pointers
@ 2018-05-01 23:33 Tobin C. Harding
  2018-05-01 23:33 ` [PATCH 1/3] random: Fix whitespace pre random-bytes work Tobin C. Harding
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Tobin C. Harding @ 2018-05-01 23:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tobin C. Harding, Linus Torvalds, Randy Dunlap, Steven Rostedt,
	Kees Cook, Anna-Maria Gleixner, Andrew Morton, Theodore Ts'o,
	Greg Kroah-Hartman, Arnd Bergmann

Currently if an attempt is made to print a pointer before there is
enough entropy then '(____ptrval____)' is printed.  This makes debugging
stack traces during early boot difficult.

It was observed that we can relax the requirement for cryptographically
secure hashing when debugging while still maintaining pointer hashing
behaviour.  This allows kernels to be debugged without developers
relying on different pointer printing behavior.

Most of this code (excluding the command line option stuff) was written
by Kees and Linus on LKML.  Any mistakes introduced are however my own.

For the command line option stuff I copied crypto/fips.c mixed with
kernel/power/hibernate.c 

Taking suggestions please on the get_random_bytes_arch() local variable
name 'left' (I thought of 'togo' and 'rem' (as in remaining) as well).

Testing

The command line option stuff has been verified to work.  I have built
and booted a patched kernel on a machine without RDRAND (qemu) and on a
machine with RDRAND (intel core M5Y70).  The code appears to work as it
is written.  I am unsure however whether this solves the initial
problem.  I tried printing a pointer from within 
init/main.c:kernel_init() and that did _not_ work.  I do not know how
early is early, or in other words, when we are hoping for this to work.

thanks,
Tobin.


Tobin C. Harding (3):
  random: Fix whitespace pre random-bytes work
  random: Return nbytes filled from hw RNG
  vsprintf: Add use-early-random-bytes cmd line option

 drivers/char/random.c  | 19 ++++++++++---------
 include/linux/random.h |  2 +-
 lib/vsprintf.c         | 50 +++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 58 insertions(+), 13 deletions(-)

-- 
2.7.4

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

end of thread, other threads:[~2018-05-03  2:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01 23:33 [PATCH 0/3] enable early printing of hashed pointers Tobin C. Harding
2018-05-01 23:33 ` [PATCH 1/3] random: Fix whitespace pre random-bytes work Tobin C. Harding
2018-05-02  0:18   ` Theodore Y. Ts'o
2018-05-01 23:33 ` [PATCH 2/3] random: Return nbytes filled from hw RNG Tobin C. Harding
2018-05-01 23:44   ` Tobin C. Harding
2018-05-02  0:19   ` Theodore Y. Ts'o
2018-05-02  1:39   ` Steven Rostedt
2018-05-02  2:07     ` Tobin C. Harding
2018-05-01 23:33 ` [PATCH 3/3] vsprintf: Add use-early-random-bytes cmd line option Tobin C. Harding
2018-05-02  1:02   ` Linus Torvalds
2018-05-02  1:27     ` tcharding
2018-05-02  1:45       ` Steven Rostedt
2018-05-02  2:05         ` tcharding
2018-05-02  2:51         ` Linus Torvalds
2018-05-02 21:56   ` Andrew Morton
2018-05-03  2:56     ` Tobin C. Harding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox