misc/164637: Problem with vsnprintf in libc.so when compiled with clang

Pierre-Luc Drouin pldrouin at pldrouin.net
Mon Jan 30 15:20:09 UTC 2012


>Number:         164637
>Category:       misc
>Synopsis:       Problem with vsnprintf in libc.so when compiled with clang
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 30 15:20:08 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Pierre-Luc Drouin
>Release:        9.0-STABLE
>Organization:
>Environment:
FreeBSD wdaemon 9.0-STABLE FreeBSD 9.0-STABLE #0: Mon Jan 23 16:02:56 EST 2012     /usr/obj/usr/src/sys/KERNEL  i386
>Description:
When FreeBSD world (and kernel) is built using clang, the resulting code generated for vsnprintf in the library libc.so does not work properly, causing a segmentation fault. The problem was discovered when attempting to use java on FreeBSD.
>How-To-Repeat:
Compile and run the following C code on FreeBSD 9.0-STABLE built with clang:

#include <stdio.h>
#include <string.h>

int main(int nargrs, const char* args[])
{
  const char* msg="Hello World!";
  int length=strlen(msg);
  printf("length is %i\n",length);
  char string0[256];
  char string[256];
  memset(string0,1,256);
  strcpy(string0,msg);
  vsnprintf(string+1,length,"%s",string0);
  printf("%s\n",string);

  return 0;
}

Alternatively, try launching java or javac from jdk16, diablo-jdk16 or openjdk6
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list