Bug 589613 - unify string representation of NULL in vsprintf.c
unify string representation of NULL in vsprintf.c
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel (Show other bugs)
6.0
All Linux
high Severity medium
: rc
: ---
Assigned To: Dave Anderson
Red Hat Kernel QE team
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-06 10:49 EDT by Dan Horák
Modified: 2010-11-11 10:43 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-11-11 10:43:50 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dan Horák 2010-05-06 10:49:20 EDT
Consider applying upstream commit 0f4f81dce93774a447da3ceb98cce193ef84a3fa that unifies the string representation of NULL in vsprintf.c to (null)
Comment 2 RHEL Product and Program Management 2010-05-06 12:09:20 EDT
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 13:43:45 EDT
Patch(es) available on kernel-2.6.32-29.el6
Comment 7 Petr Beňas 2010-06-10 08:38:06 EDT
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 08:48:31 EDT
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 09:23:04 EDT
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 05:47:28 EDT
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 10:43:50 EST
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.

Note You need to log in before you can comment on or make changes to this bug.