harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Santiago Gala (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3547) [drlvm] segfault on classloading due to use of alloca blowing the stack
Date Sat, 07 Apr 2007 09:44:32 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487391
] 

Santiago Gala commented on HARMONY-3547:
----------------------------------------

I'm not sure Pavel's version will solve the problem, as it leaves using alloca one of the
biggest "offenders".

In the current code, buf is alloca'ed first
     cd_size = fsize < 67000 ? fsize : 67000

and later another one (without any freeing operation)
     fsize - offsetCD

this means, potentially (I've seen a number of 67000 printouts) bumping the stach ~120000
bytes

changing the first one only goes back to around 60000 bytes, still a potentially big
number. Changing the second one to REALLOC looks saner, IMO. Changing both removes all sources
of alloca > 4192 (I did a number of test runs with eclipse and this different hack to print
it).


man alloca here says:

       The  inlined  code often consists of a single instruction adjusting the
       stack pointer, and does not check for stack overflow.  Thus,  there  is
       no NULL error return.

BUGS
       The  alloca()  function is machine and compiler dependent. On many sys-
       tems its implementation is buggy. Its use is discouraged.

I'll test with both versions of the patch and report


> [drlvm] segfault on classloading due to use of alloca blowing the stack 
> ------------------------------------------------------------------------
>
>                 Key: HARMONY-3547
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3547
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: linux, x86_64 both "latest" of Apr 1 and svn head built here.
>            Reporter: Santiago Gala
>         Assigned To: Gregory Shimansky
>         Attachments: H3547.patch, harmony-alloca-stack-overflow.patch
>
>
> Running eclipse-3.2, all goes well, until it tries to index the documentation. Then I
get, after a while, the following dump:
> SIGSEGV in VM code.
> Stack trace:
>         0: BootstrapClassLoader::LoadFromJarFile(JarFile*, char const*, String const*,
bool*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1833)
>         1: BootstrapClassLoader::LoadFromFile(String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1743)
>         2: BootstrapClassLoader::DoLoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1535)
>         3: ClassLoader::LoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1490)
>         4: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:359)
>         5: Class::load_ancestors(Global_Env*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/Class.cpp:273)
>         6: ClassLoader::DefineClass(Global_Env*, char const*, unsigned char*, unsigned
int, unsigned int, String const**) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:309)
>         7: BootstrapClassLoader::LoadFromJarFile(JarFile*, char const*, String const*,
bool*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1843)
>         8: BootstrapClassLoader::LoadFromFile(String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1743)
>         9: BootstrapClassLoader::DoLoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1535)
>         10: ClassLoader::LoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1490)
>         11: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:359)
>         12: Class::load_ancestors(Global_Env*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/Class.cpp:273)
>         13: ClassLoader::DefineClass(Global_Env*, char const*, unsigned char*, unsigned
int, unsigned int, String const**) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:309)
>         14: BootstrapClassLoader::LoadFromJarFile(JarFile*, char const*, String const*,
bool*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1843)
>         15: BootstrapClassLoader::LoadFromFile(String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1743)
>         16: BootstrapClassLoader::DoLoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1535)
>         17: ClassLoader::LoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1490)
>         18: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:359)
>         19: Class::load_ancestors(Global_Env*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/Class.cpp:273)
>         20: ClassLoader::DefineClass(Global_Env*, char const*, unsigned char*, unsigned
int, unsigned int, String const**) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:309)
>         21: BootstrapClassLoader::LoadFromJarFile(JarFile*, char const*, String const*,
bool*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1843)
>         22: BootstrapClassLoader::LoadFromFile(String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1743)
>         23: BootstrapClassLoader::DoLoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1535)
>         24: ClassLoader::LoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1490)
>         25: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:359)
>         26: Class::load_ancestors(Global_Env*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/Class.cpp:273)
>         27: ClassLoader::DefineClass(Global_Env*, char const*, unsigned char*, unsigned
int, unsigned int, String const**) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:309)
>         28: BootstrapClassLoader::LoadFromJarFile(JarFile*, char const*, String const*,
bool*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1843)
>         29: BootstrapClassLoader::LoadFromFile(String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1743)
>         30: BootstrapClassLoader::DoLoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1535)
>         31: ClassLoader::LoadClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:1490)
>         32: ClassLoader::LoadVerifyAndPrepareClass(Global_Env*, String const*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/classloader.cpp:359)
>         33: Class::_resolve_class(Global_Env*, unsigned int) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/Resolve.cpp:167)
>         34: resolve_class (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/Resolve.cpp:914)
>         35: Jitrino::Jet::Compiler::handle_ik_obj(Jitrino::Jet::JInst const&) (/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/jet/bcproc.cpp:581)
>         36: Jitrino::Jet::Compiler::handle_inst() (/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/jet/bcproc.cpp:71)
>         37: Jitrino::Jet::Compiler::comp_gen_insts(unsigned int, unsigned int, unsigned
int) (/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/jet/compiler.cpp:1026)
>         38: Jitrino::Jet::Compiler::comp_gen_code_bb(unsigned int) (/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/jet/compiler.cpp:818)
>         39: Jitrino::Jet::Compiler::compile(void*, Method*, OpenMethodExecutionParams
const&) (/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/jet/compiler.cpp:393)
>         40: Jitrino::Jet::compile_with_params(void*, void*, Method*, OpenMethodExecutionParams)
(/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/jet/jet.cpp:523)
>         41: JIT_compile_method_with_params (/home/sgala/newcode/harmony/working_vm/vm/jitrino/src/vm/drl/DrlJITInterface.cpp:274)
>         42: Dll_JIT::compile_method_with_params(void*, Method*, OpenMethodExecutionParams)
(/home/sgala/newcode/harmony/working_vm/vm/vmcore/include/dll_jit_intf.h:86)
>         43: compile_do_compilation_jit(Method*, JIT*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/jit/compile.cpp:657)
>         44: vm_compile_method (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/class_support/C_Interface.cpp:2487)
>         45: DrlEMImpl::compileMethod(Method*) (/home/sgala/newcode/harmony/working_vm/vm/em/src/DrlEMImpl.cpp:570)
>         46: CompileMethod (/home/sgala/newcode/harmony/working_vm/vm/em/src/em_intf.cpp:50)
>         47: compile_do_compilation (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/jit/compile.cpp:770)
>         48: compile_me(Method*) (/home/sgala/newcode/harmony/working_vm/vm/vmcore/src/jit/compile.cpp:790)
>         49: ?? (??:-1)
>         50: org/apache/xalan/xsltc/trax/TransformerImpl.transform(Ljavax/xml/transform/Source;Lorg/apache/xml/serializer/SerializationHandler;Ljava/lang/String;)V
(TransformerImpl.java:628)
>         51: org/apache/xalan/xsltc/trax/TransformerImpl.transform(Ljavax/xml/transform/Source;Ljavax/xml/transform/Result;)V
(TransformerImpl.java:301)
>         52: org/eclipse/help/internal/xhtml/UATransformManager.convertToString(Lorg/w3c/dom/Document;)Ljava/lang/String;
(UATransformManager.java:75)
>         53: org/eclipse/help/internal/xhtml/UATransformManager.getAsInputStream(Lorg/w3c/dom/Document;)Ljava/io/InputStream;
(UATransformManager.java:91)
>         54: org/eclipse/help/internal/DynamicContentProducer.openXHTMLFromPlugin(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)Ljava/io/InputStream;
(DynamicContentProducer.java:124)
>         55: org/eclipse/help/internal/DynamicContentProducer.getInputStream(Ljava/lang/String;Ljava/lang/String;Ljava/util/Locale;)Ljava/io/InputStream;
(DynamicContentProducer.java:53)
>         56: org/eclipse/help/internal/util/ResourceLocator.openFromProducer(Lorg/osgi/framework/Bundle;Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;
(ResourceLocator.java:227)
>         57: org/eclipse/help/internal/protocols/HelpURLConnection.getInputStream()Ljava/io/InputStream;
(HelpURLConnection.java:113)
>         58: java/net/URL.openStream()Ljava/io/InputStream; (URL.java:664)
>         59: org/eclipse/help/internal/search/HTMLDocParser.openDocument(Ljava/net/URL;)V
(HTMLDocParser.java:62)
>         60: org/eclipse/help/internal/search/HTMLSearchParticipant.addDocument(Lorg/eclipse/help/search/ISearchIndex;Ljava/lang/String;Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;Lorg/apache/lucene/document/Document;)Lorg/eclipse/core/runtime/IStatus;
(HTMLSearchParticipant.java:53)
>         61: org/eclipse/help/internal/search/SearchIndex.addDocument(Ljava/lang/String;Ljava/net/URL;)Lorg/eclipse/core/runtime/IStatus;
(SearchIndex.java:215)
>         62: org/eclipse/help/internal/search/IndexingOperation.addDocuments(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/util/Collection;Z)V
(IndexingOperation.java:279)
>         63: org/eclipse/help/internal/search/IndexingOperation.addNewDocuments(Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/util/Collection;Z)Ljava/util/Map;
(IndexingOperation.java:175)
>         64: org/eclipse/help/internal/search/IndexingOperation.execute(Lorg/eclipse/core/runtime/IProgressMonitor;)V
(IndexingOperation.java:105)
>         65: org/eclipse/help/internal/search/SearchManager.updateIndex(Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/help/internal/search/SearchIndex;Lorg/eclipse/help/internal/search/ProgressDistributor;)V
(SearchManager.java:883)
>         66: org/eclipse/help/internal/search/SearchManager.ensureIndexUpdated(Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/help/internal/search/SearchIndexWithIndexingProgress;)V
(SearchManager.java:847)
>         67: org/eclipse/help/internal/search/federated/IndexerJob.run(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
(IndexerJob.java:27)
>         68: org/eclipse/core/internal/jobs/Worker.run()V (Worker.java:58)
>         69: java/lang/Thread.runImpl()V (Thread.java:672)
> <end of stack trace>
> As seen in slot 50, xsltc is generating code for a XSL transformation, and giving it
to the interpreter. The crash happens after Jitrino tries to load a class in the bootstrap
loader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message