[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#560348: xen: racy temporary files for kernel and initrd



Package: debian-installer
Version: 20090123lenny4
Severity: normal

Hi,

I encountered this while testing daily snapshots under Xen 3.2 with long
extra command lines (you may consider this sort of preseeding stupid, but
that's not the point now):

$ sudo xm create -c xm-debian.cfg install=true install-installer=http://people.debian.org/~joeyh/d-i/images/daily
Using config file "./xm-debian.cfg".
Install Mirror: http://ftp.debian.org/debian
Install Suite: squeeze
Installer: http://people.debian.org/~joeyh/d-i/images/daily

WARNING: Installer kernel and ramdisk are not authenticated.

Fetching http://people.debian.org/~joeyh/d-i/images/daily/netboot/xen/vmlinuz
Fetching http://people.debian.org/~joeyh/d-i/images/daily/netboot/xen/initrd.gz
command line is "debian-installer/exit/always_halt=true DEBIAN_FRONTEND=text debian-installer/locale=en_HU console-keymaps-at/keymap=us netcfg/disable_dhcp=true netcfg/get_nameservers="xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx" netcfg/get_ipaddress=xxx.xxx.xxx.xxx netcfg/get_netmask=xxx.xxx.xxx.xxx netcfg/get_gateway=xxx.xxx.xxx.xxx netcfg/get_hostname=unassigned-hostname netcfg/get_domain=unassigned-domain netcfg/confirm_static=true anna/choose_modules=network-console,openssh-client-udeb network-console/password=xxx network-console/password-again=xxx network-console/start= mirror/country=manual mirror/http/hostname=ftp.xxx.debian.org mirror/http/directory=/debian mirror/http/proxy= passwd/make-user=false popularity-contest/participate=false tasksel:tasksel/first= -- quiet console=hvc0"
Error: Kernel image does not exist: /tmp/tmp8kZcOJ

Strace revealed that the temporary files holding the kernel and the initrd
are unlinked before the RPC call to start the domain is done:

14124 write(1, "command line is \"debian-installer"..., 786) = 786
14124 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e1e6f8) = 14131
14124 select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
14131 unlink("/tmp/tmp8kZcOJ")          = 0
14131 unlink("/tmp/tmpZmbQSd.gz")       = 0
14131 socket(PF_FILE, SOCK_STREAM, 0)   = 3
14131 connect(3, {sa_family=AF_FILE, path="/var/run/xend/xmlrpc.sock"...}, 27) = 0

A successful run goes like this instead:

15434 write(1, "command line is \"debian-installer"..., 79) = 79
15434 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7e106f8) = 15451
15434 select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
15451 socket(PF_FILE, SOCK_STREAM, 0)   = 3
15451 connect(3, {sa_family=AF_FILE, path="/var/run/xend/xmlrpc.sock"...}, 27) = 0
15451 send(3, "POST /RPC2 HTTP/1.0\r\nHost: \r\nUser"..., 133, 0) = 133
15451 send(3, "<?xml version='1.0'?>\n<methodCall"..., 2376, 0) = 2376
15451 recv(3, "H"..., 1, 0)             = 1
15451 recv(3, "T"..., 1, 0)             = 1
15451 recv(3, "T"..., 1, 0)             = 1
15451 recv(3, "P"..., 1, 0)             = 1
[...]
15451 recv(3, "\n"..., 1, 0)            = 1
15451 recv(3, "\r"..., 1, 0)            = 1
15451 recv(3, "\n"..., 1, 0)            = 1
15451 unlink("/tmp/tmpazBx1R")          = 0
15451 unlink("/tmp/tmpJxsmb5.gz")       = 0
15451 recv(3, "<?xml version='1.0'?>\n<methodResp"..., 1024, 0) = 1024

The current code in xm-debian.cfg uses Python-managed temporary files,
which are unlinked too early (in parallel with the RPC call).  I can't
recommend a good solution, and maybe it's already fixed in the current
(version 3.4) tools.

Thanks,
Feri.

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (500, 'stable'), (50, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-- no debconf information



Reply to: