Bug 589613

Summary: unify string representation of NULL in vsprintf.c
Product: Red Hat Enterprise Linux 6 Reporter: Dan Horák <dhorak>
Component: kernelAssignee: Dave Anderson <anderson>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: arozansk, jbaron, pbenas, qcai
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-11 15:43:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dan Horák 2010-05-06 14:49:20 UTC
Consider applying upstream commit 0f4f81dce93774a447da3ceb98cce193ef84a3fa that unifies the string representation of NULL in vsprintf.c to (null)

Comment 2 RHEL Program Management 2010-05-06 16:09:20 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Aristeu Rozanski 2010-05-25 17:43:45 UTC
Patch(es) available on kernel-2.6.32-29.el6

Comment 7 Petr Beňas 2010-06-10 12:38:06 UTC
I am not probably triggering the bug correctly...

[root@dell-pesc430-03 ~]# uname -r
2.6.32-28.el6.x86_64
[root@dell-pesc430-03 ~]# gcc test.c 
[root@dell-pesc430-03 ~]# ./a.out 
(nil)

[root@dell-pesc430-03 ~]# uname -r
2.6.32-29.el6.x86_64
[root@dell-pesc430-03 ~]# gcc test.c 
[root@dell-pesc430-03 ~]# ./a.out 
(nil)

test.c:
#include <stdio.h>
#include <stdarg.h>

void vout (char * str, char * fmt, ...);

int main()
{
	char str[100];

	vout(str, "%p", NULL);
	printf("%s\n", str);
	return 0;
}

void vout (char * str, char * fmt, ...)
{
	va_list args;

	va_start(args, fmt);
	vsprintf(str, fmt, args);
	va_end(args);
}

Comment 8 Dan Horák 2010-06-10 12:48:31 UTC
It's about kernel internal implementation of vsprintf() not the user-space one from glibc so in my opinion you need to prepare a kernel module.

Comment 9 Dave Anderson 2010-06-10 13:23:04 UTC
The changes were made to a kernel library file, which would require
that either a base kernel function, or a kernel module function, pass
a NULL string into one of the functions that would return a string
containing "(null)" instead of "<NULL>".  

But writing a kernel module that does something like that seems a bit
of overkill...  

If you just take the kernel src.rpm file, do an "rpmbuild -bp kernel.spec",
and then simply inspect the "linux-2.6.32.noarch/lib/vsprintf.c" file,
you can verify that the two former instances of "<NULL>" that were in
the string() and vbin_printf() functions have been replaced with "(null)".

Comment 10 Petr Beňas 2010-06-14 09:47:28 UTC
VERIFIED Sanity only. 2.6.32-29 src code changed according the patch.
2.6.32-29 /lib/vsprintf.c:
 553  if ((unsigned long)s < PAGE_SIZE)
 554          s = "(null)";
 
1446  if ((unsigned long)save_str > (unsigned long)-PAGE_SIZE
1447                  || (unsigned long)save_str < PAGE_SIZE)
1448          save_str = "(null)";

Comment 11 releng-rhel@redhat.com 2010-11-11 15:43:50 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.