tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 52627] New: Segmentation in org.apache.tomcat.jni.File.infoGet() native method
Date Wed, 08 Feb 2012 22:21:15 GMT

             Bug #: 52627
           Summary: Segmentation in org.apache.tomcat.jni.File.infoGet()
                    native method
           Product: Tomcat Native
           Version: 1.1.22
          Platform: Macintosh
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Library
    Classification: Unclassified

Created attachment 28291
Source code for the repro case

There is a potential segfault in the tomcat native wrappers around
apr_file_info_get() (which themselves probably wrap the fstat() and stat()

I've attached a simple java file that reproduces this 100% of the time on my OS
X 10.7 system with tomcat-native-1.1.22. I'm not sure if infoGet() is actually
used in the tomcat server codebase, I stumbled upon the bug in my own project
that uses the tomcat native library's JNI wrappers around Apache Portable

Repro instructions:

1) Download and build tomcat-native (I think I got the source from and followed the instructions). You may
need to install libapr (apache portable runtime) through apt-get or port or
whatever package manager you use.

2) Download the attachment
3) Copy tomcat-native-*-dev.jar to the same directory as the attachment.
4) Copy the libtcnative library files for your architecture to the same
directory as the attachment (they get built into
3) Build the repro case with:

javac -classpath ./tomcat-native*.jar:.

4) Run the repro case with:

java -Djava.library.path=. -classpath ./tomcat-native*.jar:.

The repro just opens a file descriptor to the file named by the first argument
(its own source in the example), creates a FileInfo structure, and tries to
fstat it via org.apache.tomcat.jni.File.infoGet() 100,000 times. This segfaults
for me every single time.

I've coded up a fix and submitted it as a pull request on github:

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message