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

Bug#342931: doesn't work on alpha



reassign 342931 klibc 1.1.1-4
# completely broken binaries on an arch == RC
severity 342931 grave
tags 342931 patch
thanks

Well, I haven't been able to reproduce Norbert's exact error, but I think
this may be due to differences in successive versions of klibc.

Here's what I am able to reproduce:

EXT3-fs: mounted filesystem with ordered data mode.
Begin: Running /scripts/log-bottom ...
[...]
run-init: rootfs not a ramfs or tmpfs: error 0
Kernel panic - not syncing: Attempted to kill init!

This one was pretty easy to figure out once I dug into run-init: the 64-bit
definition of struct statfs is completely wrong for alpha.  I'd be pretty
surprised if it were correct anywhere; using a 64-bit f_type field makes no
sense anywhere.  This is the first patch that's attached.  Please confirm
that this doesn't cause regressions on other 64-bit archs; it's my
understanding that people have klibc working on amd64, which my reading of
the source says should be using the 64-bit version of the struct, so.

The next problem in line was that when trying to clear the initramfs to free
memory before overmounting, run-init was getting EPERM instead of EISDIR
when calling unlink() on directories.  After stepping through both glibc and
klibc linked binaries, I've concluded that the issue is simply that klibc is
trying to read the errno from the wrong register.  Initially, I was
concerned this meant unlink was different from other syscalls on alpha,
which didn't make sense; then I realized that none of the other syscalls I
was looking at were *returning* a non-zero errno, just a return value.  So
this second simple patch applied after the first should get us a completely
working initramfs-tools on alpha, AFAICT.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/
diff -u klibc-1.1.1/debian/changelog klibc-1.1.1/debian/changelog
--- klibc-1.1.1/debian/changelog
+++ klibc-1.1.1/debian/changelog
@@ -1,3 +1,11 @@
+klibc (1.1.1-4.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix the definition of struct statfs64, required for run-init to work on
+    alpha
+
+ -- Steve Langasek <vorlon@debian.org>  Thu, 15 Dec 2005 00:08:56 -0800
+
 klibc (1.1.1-4) unstable; urgency=low
 
   * debian/rules,debian/control: Use gcc-3.3 for sparc.
only in patch2:
unchanged:
--- klibc-1.1.1.orig/include/sys/vfs.h
+++ klibc-1.1.1/include/sys/vfs.h
@@ -32,17 +32,17 @@
 #else /* _BITSIZE == 64 */
 
 struct statfs {
-        uint64_t f_type;
-        uint64_t f_bsize;
+        uint32_t f_type;
+        uint32_t f_bsize;
         uint64_t f_blocks;
         uint64_t f_bfree;
         uint64_t f_bavail;
         uint64_t f_files;
         uint64_t f_ffree;
         __kernel_fsid_t f_fsid;
-        uint64_t f_namelen;
-        uint64_t f_frsize;
-        uint64_t f_spare[5];
+        uint32_t f_namelen;
+        uint32_t f_frsize;
+        uint32_t f_spare[5];
 };
 
 #endif /* _BITSIZE */
diff -u klibc-1.1.1/debian/changelog klibc-1.1.1/debian/changelog
--- klibc-1.1.1/debian/changelog
+++ klibc-1.1.1/debian/changelog
@@ -3,6 +3,7 @@
   * Non-maintainer upload.
   * Fix the definition of struct statfs64, required for run-init to work on
     alpha
+  * Grab the errno from the right register after syscalls on alpha!
 
  -- Steve Langasek <vorlon@debian.org>  Thu, 15 Dec 2005 00:08:56 -0800
 
only in patch2:
unchanged:
diff -Nru /tmp/Ylb9yZiFni/klibc-1.1.1/klibc/arch/alpha/syscall.S /tmp/qrWEKspwxh/klibc-1.1.1/klibc/arch/alpha/syscall.S
--- /tmp/Ylb9yZiFni/klibc-1.1.1/klibc/arch/alpha/syscall.S      2005-09-06 13:49:34.000000000 -0700
+++ /tmp/qrWEKspwxh/klibc-1.1.1/klibc/arch/alpha/syscall.S      2005-12-15 23:42:02.000000000 -0800
@@ -17,8 +17,8 @@
 2:
 	ldgp	gp, 0(pv)
 	lda	a1, errno
+	stl	v0, 0(a1)
 	lda	v0, -1(zero)
-	stl	a3, 0(a1)
 1:
 	ret	zero,(ra),1
 

Attachment: signature.asc
Description: Digital signature


Reply to: