This document describes one way to create the initrd directory hierarchy in order to allow an initrd to be built into your kernel. The trick here is to steal the initrd file used on your Linux laptop, Ubuntu in this case. There are probably much better ways of doing this. That said, here are the commands: ------------------------------------------------------------------------ cd tools/testing/selftests/rcutorture zcat /initrd.img > /tmp/initrd.img.zcat mkdir initrd cd initrd cpio -id < /tmp/initrd.img.zcat ------------------------------------------------------------------------ Another way to create an initramfs image is using "dracut"[1], which is available on many distros, however the initramfs dracut generates is a cpio archive with another cpio archive in it, so an extra step is needed to create the initrd directory hierarchy. Here are the commands to create a initrd directory for rcutorture using dracut: ------------------------------------------------------------------------ dracut --no-hostonly --no-hostonly-cmdline --module "base bash shutdown" /tmp/initramfs.img cd tools/testing/selftests/rcutorture mkdir initrd cd initrd /usr/lib/dracut/skipcpio /tmp/initramfs.img | zcat | cpio -id < /tmp/initramfs.img ------------------------------------------------------------------------ Interestingly enough, if you are running rcutorture, you don't really need userspace in many cases. Running without userspace has the advantage of allowing you to test your kernel independently of the distro in place, the root-filesystem layout, and so on. To make this happen, put the following script in the initrd's tree's "/init" file, with 0755 mode. ------------------------------------------------------------------------ #!/bin/sh [ -d /dev ] || mkdir -m 0755 /dev [ -d /root ] || mkdir -m 0700 /root [ -d /sys ] || mkdir /sys [ -d /proc ] || mkdir /proc [ -d /tmp ] || mkdir /tmp mkdir -p /var/lock mount -t sysfs -o nodev,noexec,nosuid sysfs /sys mount -t proc -o nodev,noexec,nosuid proc /proc # Some things don't work properly without /etc/mtab. ln -sf /proc/mounts /etc/mtab # Note that this only becomes /dev on the real filesystem if udev's scripts # are used; which they will be, but it's worth pointing out if ! mount -t devtmpfs -o mode=0755 udev /dev; then echo "W: devtmpfs not available, falling back to tmpfs for /dev" mount -t tmpfs -o mode=0755 udev /dev [ -e /dev/console ] || mknod --mode=600 /dev/console c 5 1 [ -e /dev/kmsg ] || mknod --mode=644 /dev/kmsg c 1 11 [ -e /dev/null ] || mknod --mode=666 /dev/null c 1 3 fi mkdir /dev/pts mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true mount -t tmpfs -o "nosuid,size=20%,mode=0755" tmpfs /run mkdir /run/initramfs # compatibility symlink for the pre-oneiric locations ln -s /run/initramfs /dev/.initramfs # Export relevant variables export ROOT= export ROOTDELAY= export ROOTFLAGS= export ROOTFSTYPE= export IP= export BOOT= export BOOTIF= export UBIMTD= export break= export init=/sbin/init export quiet=n export readonly=y export rootmnt=/root export debug= export panic= export blacklist= export resume= export resume_offset= export recovery= for i in /sys/devices/system/cpu/cpu*/online do case $i in '/sys/devices/system/cpu/cpu0/online') ;; '/sys/devices/system/cpu/cpu*/online') ;; *) echo 1 > $i ;; esac done while : do sleep 10 done ------------------------------------------------------------------------ References: [1]: https://dracut.wiki.kernel.org/index.php/Main_Page [2]: http://blog.elastocloud.org/2015/06/rapid-linux-kernel-devtest-with-qemu.html [3]: https://www.centos.org/forums/viewtopic.php?t=51621 a426b7a37184dd3d2172394e23d585d6'/>
context:
space:
mode:
authorAndrei Vagin <avagin@openvz.org>2017-01-04 19:28:14 -0800
committerEric W. Biederman <ebiederm@xmission.com>2017-01-10 13:34:56 +1300
commitadd7c65ca426b7a37184dd3d2172394e23d585d6 (patch)
tree28b08b519540041b06ed0ab0b1c005076b932e8e /net/appletalk/atalk_proc.c
parent75422726b0f717d67db3283c2eb5bc14fa2619c5 (diff)
pid: fix lockdep deadlock warning due to ucount_lock
========================================================= [ INFO: possible irq lock inversion dependency detected ] 4.10.0-rc2-00024-g4aecec9-dirty #118 Tainted: G W --------------------------------------------------------- swapper/1/0 just changed the state of lock: (&(&sighand->siglock)->rlock){-.....}, at: [<ffffffffbd0a1bc6>] __lock_task_sighand+0xb6/0x2c0 but this lock took another, HARDIRQ-unsafe lock in the past: (ucounts_lock){+.+...} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Chain exists of: &(&sighand->siglock)->rlock --> &(&tty->ctrl_lock)->rlock --> ucounts_lock Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ucounts_lock); local_irq_disable(); lock(&(&sighand->siglock)->rlock); lock(&(&tty->ctrl_lock)->rlock); <Interrupt> lock(&(&sighand->siglock)->rlock); *** DEADLOCK *** This patch removes a dependency between rlock and ucount_lock. Fixes: f333c700c610 ("pidns: Add a limit on the number of pid namespaces") Cc: stable@vger.kernel.org Signed-off-by: Andrei Vagin <avagin@openvz.org> Acked-by: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'net/appletalk/atalk_proc.c')