[PATCH 0/3] enable early printing of hashed pointers

From: Tobin C. Harding
Date: Tue May 01 2018 - 19:34:27 EST


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