<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>200</bug_id>
          
          <creation_ts>2010-08-05 22:05:00 +0000</creation_ts>
          <short_desc>module-init-tools-cross version 3.12 segfaults in depmod.</short_desc>
          <delta_ts>2010-12-21 06:09:41 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>0.9</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Hatle">mark.hatle</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>kevin.tian</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>9270</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2010-08-05 22:05:00 +0000</bug_when>
    <thetext>When using depmod on a RHEL 5 system, module-init-tools-cross can segfault.

Reproducing this bug is dependent upon the memory layout of the host, so it may be difficult to reproduce.

For the full bug report upstream see: http://article.gmane.org/gmane.linux.kernel.modules/478

(a bug will also be filed upstream.)

Important bits quoted below:

I was able to track down the problem to the output_pci_table function.

The pci_table has a bad address in it.  Tracing things 
back in elfops_core.c:fetch_tables, the memset of the tables is never done 
because strings and syms are both empty.

Tracing back further to depmod.c:grab_module, it appears that the new = 
malloc(...) setups up things, but never clears the memory that was just allocated.

As a quick hack I added a memset to clear memory:

  static struct module *grab_module(const char *dirname, const char *filename)
  {
          struct module *new;

          new = NOFAIL(malloc(sizeof(*new)
                              + strlen(dirname?:&quot;&quot;) + 1 + strlen(filename) + 1));
+        memset(new, 0x00, sizeof(*new) + strlen(dirname?:&quot;&quot;) + 1 + 
strlen(filename) + 1);
          if (dirname)
                  sprintf(new-&gt;pathname, &quot;%s/%s&quot;, dirname, filename);
          else

Things now appear to be working as expected, no segfaults, no unusual behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9271</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2010-08-05 22:10:45 +0000</bug_when>
    <thetext>Filed with the upstream maintainer, see:

https://bugzilla.kernel.org/show_bug.cgi?id=16528</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9277</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Hatle">mark.hatle</who>
    <bug_when>2010-08-06 07:01:26 +0000</bug_when>
    <thetext>Note:  this was found on a RHEL 5.1 based system.  Running kernel 2.6.18-53.el5PAE and glibc-2.5-18.

I&apos;ve been able to reproduce the segfault on both 32-bit and 64-bit ia32 systems.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9278</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2010-08-06 10:38:16 +0000</bug_when>
    <thetext>This should be fixed in f4cb0870acd980a35e6e87b5bcf548a4452fd6a7 as far as Poky goes</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>