Package: nfs-kernel-server
Version: 1:1.1.1-1
Severity: grave
Tags: patch

After upgrade, exportfs consistently segfaults on amd64, making the package
unusable:

 Exporting directories for NFS kernel daemon...exportfs: 
/etc/init.d/nfs-kernel-s erver: line 60: 20695 Segmentation fault      
$PREFIX/sbin/exportfs -r

Backtrace from a rebuild with debugging symbols:

(gdb) bt
#0  0x00002aaf70189a90 in strlen () from /lib/libc.so.6
#1  0x00002aaf7015819a in vfprintf () from /lib/libc.so.6
#2  0x00002aaf70159083 in ?? () from /lib/libc.so.6
#3  0x00002aaf701549be in vfprintf () from /lib/libc.so.6
#4  0x0000000000406fb6 in xlog_backend (kind=1024, 
    fmt=0x4094c0 "%s [%d]: Neither 'subtree_check' or 'no_subtree_check' 
specified for export \"%s:%s\".\n  Assuming default behaviour 
('no_subtree_check').\n  NOTE: this default has changed since nfs-utils version 
1.0.x\n", 
    args=0x7fff3adbc560) at xlog.c:175
#5  0x0000000000407216 in xlog (kind=16, 
    fmt=0x4094c0 "%s [%d]: Neither 'subtree_check' or 'no_subtree_check' 
specified for export \"%s:%s\".\n  Assuming default behaviour 
('no_subtree_check').\n  NOTE: this default has changed since nfs-utils version 
1.0.x\n") at xlog.c:189
#6  0x00000000004052b5 in parseopts (cp=0x7fff3adbd6e8 "", ep=0x60c8e0, 
    warn=1, had_subtree_opt_ptr=0x0) at exports.c:654
#7  0x00000000004063b8 in getexportent (fromkernel=<value optimized out>, 
    fromexports=1) at exports.c:182
#8  0x0000000000403cdc in export_read (fname=<value optimized out>)
    at export.c:37
#9  0x0000000000402471 in main (argc=2, argv=0x7fff3adbda88) at
exportfs.c:115
(gdb) 

The code in xlog_backend() appears to use the same va_list multiple times,
which is forbidden by the C standard and breaks on amd64.

The attached patch appears to fix the error.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/
diff -u nfs-utils-1.1.1/debian/changelog nfs-utils-1.1.1/debian/changelog
--- nfs-utils-1.1.1/debian/changelog
+++ nfs-utils-1.1.1/debian/changelog
@@ -1,3 +1,11 @@
+nfs-utils (1:1.1.1-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix misuse of va_list in logging code, that causes consistent segfaults
+    on amd64.
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Sun, 21 Oct 2007 03:26:47 -0700
+
 nfs-utils (1:1.1.1-1) unstable; urgency=low
 
   * New upstream release.
only in patch2:
unchanged:
--- nfs-utils-1.1.1.orig/support/nfs/xlog.c
+++ nfs-utils-1.1.1/support/nfs/xlog.c
@@ -133,9 +133,13 @@
 void
 xlog_backend(int kind, const char *fmt, va_list args)
 {
+	va_list args2;
+
 	if (!(kind & (L_ALL)) && !(logging && (kind & logmask)))
 		return;
 
+	va_copy(args2, args);
+
 	if (log_syslog) {
 		switch (kind) {
 		case L_FATAL:
@@ -172,10 +176,12 @@
 		fprintf(stderr, "%s: ", log_name);
 #endif
 
-		vfprintf(stderr, fmt, args);
+		vfprintf(stderr, fmt, args2);
 		fprintf(stderr, "\n");
 	}
 
+	va_end(args2);
+
 	if (kind == L_FATAL)
 		exit(1);
 }

Reply via email to