Skip to contentSkip to conversation

Fix logging segfaults on amd64

PATCH In review Steinar H. Gunderson 3 participants 4 messages Oct 21, 2007 – Nov 3, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix logging segfaults on amd64

Hi,

It seems an error crept into nfs-utils 1.1.1 just before release, so exportfs -r segfaults on amd64 whenever there is a warning. The attached patch, from Steve Langasek, fixes the issue (an abuse of va_list).

support/nfs/xlog.c +7 -1
@@ -133,9 +133,13 @@ xlog_enabled(int fac)
 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 @@ xlog_backend(int kind, const char *fmt, 
                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);
 }

/* Steinar */

Signature · 10 lines
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
#1 lore raw
Quoted 5 lines · Steinar H. Gunderson

Hi,

It seems an error crept into nfs-utils 1.1.1 just before release, so exportfs -r segfaults on amd64 whenever there is a warning. The attached patch, from Steve Langasek, fixes the issue (an abuse of va_list).

Thanks, I discovered this on Thursday and came up with the same solution on Friday. I was going to send it on today.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#2 lore raw
In reply to Steinar H. Gunderson
Quoted 26 lines · Steinar H. Gunderson

Hi,

It seems an error crept into nfs-utils 1.1.1 just before release, so exportfs -r segfaults on amd64 whenever there is a warning. The attached patch, from Steve Langasek, fixes the issue (an abuse of va_list).

support/nfs/xlog.c +4 -0
@@ -133,9 +133,13 @@ xlog_enabled(int fac)
 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:

support/nfs/xlog.c xlog_backend(int kind, const char *fmt, · line 179

Quoted 5 lines
support/nfs/xlog.c +1 -1
@@ -172,10 +176,12 @@ xlog_backend(int kind, const char *fmt, 
                fprintf(stderr, "%s: ", log_name);
 #endif
 
-               vfprintf(stderr, fmt, args);
+               vfprintf(stderr, fmt, args2);

How is using args here "an abuse of va_list"? It seem pretty straightforward to me...

steved.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#3 lore raw
Quoted 2 lines · Steve Dickson

How is using args here "an abuse of va_list"? It seem pretty straightforward to me...

You can't use it twice; it's already given to vsyslog.

/* Steinar */

Signature · 10 lines
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs