Re: random pool entropy starvation in initrd with parse-kickstart

John Reiser <[email protected]>
Newsgroups gmane.linux.redhat.anaconda.devel
Message-ID <[email protected]>
> Some pieces of dracut have been written to avoid execve(). [I did some work for
> 40network/module-setup.sh.]  Other pieces have not.  As you have discovered,
> the result is a voracious appetite for entropy for AT_RANDOM.

In 2011 I implemented a feature which correlates system calls from bash
with the function name and line number of the current executing shell script.
This allowed me to locate the portions of the script that used execve,
then rewrite them to avoid execve where possible.

bash-syspose uses the LD_PRELOAD feature of GNU glibc C library, the PS4 feature
of GNU bash shell, and a compatible two-line tweak to the source of bash itself,
to trace a bash shell script by system call.  An example output line on stderr is:

   0.230123 check@6 < dracut-functions:646 16223:execve("/bin/uname", ["uname", "-m"], 60 vars) = 0

where
   0.230123  elapsed time in seconds since start of tracing
   check@6   current executing function name and line number in script file
   dracut-functions:646   file name and line number of caller of current function
   16223     current process PID
   execve("/bin/uname", ... ) = 0   syscall(arguments) = result [similar to strace]

bash-syspose is implemented as a small (500 lines) C-code shared library which
intercepts (via LD_PRELOAD) selected system calls that bash makes. During inter-
ception, bash-syspose evaluates the PS4 prompt and uses the result as the main
part of tracing output. A two-line tweak to the bash source makes evaluating PS4
essentially transparent to the rest of bash.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.