2007-10-21 11:03:12

by Steinar H. Gunderson

[permalink] [raw]
Subject: [PATCH] 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).

Signed-off-by: Steinar H. Gunderson <[email protected]>
Signed-off-by: Steve Langasek <[email protected]>

--- nfs-utils-1.1.1.orig/support/nfs/xlog.c
+++ nfs-utils-1.1.1/support/nfs/xlog.c
@@ -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 */
--
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


2007-10-22 13:46:59

by Kevin Coffman

[permalink] [raw]
Subject: Re: [PATCH] Fix logging segfaults on amd64

On 10/21/07, Steinar H. Gunderson <[email protected]> wrote:
> 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

2007-11-03 12:55:33

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] Fix logging segfaults on amd64



Steinar H. Gunderson wrote:
> 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).
>
> Signed-off-by: Steinar H. Gunderson <[email protected]>
> Signed-off-by: Steve Langasek <[email protected]>
>
> --- nfs-utils-1.1.1.orig/support/nfs/xlog.c
> +++ nfs-utils-1.1.1/support/nfs/xlog.c
> @@ -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);
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

2007-11-03 14:37:01

by Steinar H. Gunderson

[permalink] [raw]
Subject: Re: [PATCH] Fix logging segfaults on amd64

On Sat, Nov 03, 2007 at 08:51:58AM -0400, Steve Dickson wrote:
> 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 */
--
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