kernel_optimize_test/tools/testing/selftests/rcutorture/doc
Paul E. McKenney 38e630424b rcutorture: Add initrd support for systems lacking dracut
The support for creating initrd directories using dracut is a great
improvement over having to always hand-create them, it is a bit annoying
to have to install some otherwise irrelevant package just to be able to
run rcutorture.  This commit therefore adds support for creating initrd
directories on systems innocent of dracut.  You do need gcc, but then
again you need that to build the kernel (or to build llvm) in any case.

The idea is to create an initrd directory containing nothing but a
statically linked binary having a for-loop over a long-term sleep().
The result is a Linux kernel with almost no userspace: even the
time-honored /dev, /lib, /tmp, and /usr directories are gone.  In fact,
the only directory present is "/", but only because I don't know how to
get rid of it, at least short of not having an initrd in the first place.
Although statically linked binaries are much maligned, and rightly so,
their disadvantages seem to be irrelevant for this particular use case.
From https://www.akkadia.org/drepper/no_static_linking.html:

1.	Fixes are difficult to apply to hordes of widely scattered
	statically linked binaries.  But in this case, there is only one
	binary, but there would otherwise be no fewer than four libraries.

2.	Security measures like local address randomization cannot be used.
	Prudence prevents me from asserting that it is impossible to
	base a remote attack on a networking-free rcutorture instance.
	Nevertheless, bonus points to the first person who comes up with
	such an attack!

3.	More efficient use of physical memory.  Not in this case, given
	that libc is 1.8MB and the statically linked binary "only" 800K.

4.	Features such as locales, name service switch (NSS),
	internationalized domain names (IDN) tool, and so on require
	dynamic linking.  Bonus points to the first person coming up
	with a valid rcutorture use case requiring these features in
	its initrd.

5.	Accidental violations of (L)GPL.  Actually, this change actually
	helps -avoid- such violations by reducing the temptation to
	pass around tarballs of rcutorture-ready initrd directories.
	After all, the rcutorture scripts automatically create an initrd
	directory for you, so why bother with the tarballs?

6.	Tools and hacks like ltrace, LD_PRELOAD, LD_PROFILE, and LD_AUDIT
	don't work.  Again, bonus points to the first person coming up
	with a valid rcutorture use case requiring these features in
	its initrd.

Nevertheless, the script will use dracut if available, and will create the
statically linked binary only when dracut are missing.  Those preferring
the smaller initrd directory resulting from the statically linked binary
(like me) are free to hand-edit mkinitrd.sh to remove the code using
dracut.  ;-)

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2018-11-08 21:52:55 -08:00
..
initrd.txt rcutorture: Add initrd support for systems lacking dracut 2018-11-08 21:52:55 -08:00
rcu-test-image.txt doc: Fix typo in rcutorture documentation 2018-02-20 16:10:19 -08:00
TINY_RCU.txt rcu: Remove nohz_full full-system-idle state machine 2017-06-08 18:52:39 -07:00
TREE_RCU-kconfig.txt rcu: Drive TASKS_RCU directly off of PREEMPT 2017-08-17 07:26:04 -07:00