<?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>2639</bug_id>
          
          <creation_ts>2012-06-21 05:46:26 +0000</creation_ts>
          <short_desc>groupadd: malloc(): memory corruption</short_desc>
          <delta_ts>2012-08-01 08:48:57 +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>devtools / tool chain</component>
          <version>1.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>(P2)</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.3 M4</target_milestone>
          
          <blocked>2434</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Yang">liezhi.yang</reporter>
          <assigned_to name="Seebs">seebs</assigned_to>
          <cc>liezhi.yang</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>sgw</cc>
    
    <cc>song.liu</cc>
    
    <cc>yi.zhao</cc>
    
    <cc>zhenfeng.zhao</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>22459</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2012-06-21 05:46:26 +0000</bug_when>
    <thetext>groupadd, useradd and rpm.real have the similar error.

when set the length of builddir longer than 266(maybe smaller), there are such errors:

NOTE: package dbus-1.4.20-r3.0: task do_install: Started
*** glibc detected *** groupadd: malloc(): memory corruption: 0x000000000101da70 ***
*** glibc detected *** groupadd: malloc(): memory corruption: 0x000000000101da70 ***

Then the build would hang, this is caused by the command:

PSEUDO_PREFIX=/too/long/path/tmp/sysroots/x86_64-linux/usr
PSEUDO_LOCALSTATEDIR=... PSEUDO_PASSWD=...
PSEUDO_NOSYMLINKEXP=1 PSEUDO_DISABLED=0 PSEUDO_LOCALSTATEDIR
... /too/long/path/to/tmp/sysroots/x86_64-linux/usr/bin/pseudo
groupadd --root /too/long/path/to/tmp/sysroots/qemux86 -r netdev -f

1) I had looked into the code of groupadd, and found that this would
happen when it used the glibc function which needs malloc(for example,
the access()), so it seemed this was caused by the glibc or pseudo,
but I didn&apos;t know why it only happened to groupadd/useradd.

2) I had tried not to use pseudo, it worked well:

sudo groupadd --root /too/long/path/to/tmp/sysroots/qemux86 -r netdev -f

From this, it seemed that the glibc was ok

3) I had tried to write a small piece of code which used the access(), and
used pseudo to run it, it worked well:

/too/long/path/for/pseudo/settings/and/then/run/pseudo my_app</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22647</commentid>
    <comment_count>1</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2012-06-28 03:31:38 +0000</bug_when>
    <thetext>It&apos;s a bug of pseudo, re-assign it to Peter, he will send a patch sooner.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22649</commentid>
    <comment_count>2</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2012-06-28 04:42:27 +0000</bug_when>
    <thetext>Here is the code that can reproduce the problem simply:

The too_long_line path should be longer than 300.

#include &lt;unistd.h&gt;
#include &lt;stdio.h&gt;

main()
{
        if(chroot(too_long_line)){
                printf(&quot;OOOOOOOOOOOO\n&quot;);
        }
        else   
                printf(&quot;NNNNNNNNNNN\n&quot;);

        access(&quot;/etc/gshadow&quot;, F_OK);
}

Compile it and use the pseudo to run it, then we can see the error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22682</commentid>
    <comment_count>3</comment_count>
    <who name="Seebs">seebs</who>
    <bug_when>2012-06-28 22:38:03 +0000</bug_when>
    <thetext>Fixed in pseudo 1.3.1. Updating tar balls and such, will send out an oe-core update for this Real Soon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>22918</commentid>
    <comment_count>4</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2012-07-10 01:52:03 +0000</bug_when>
    <thetext>Merged into master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=fe5feba665980b515a624bf6f07fff864a9edcfa</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23698</commentid>
    <comment_count>5</comment_count>
    <who name="Yi Zhao">yi.zhao</who>
    <bug_when>2012-08-01 08:48:57 +0000</bug_when>
    <thetext>Verified with 1.3 master branch
git info: bd726660a3b365b8f0f702771afef30dcd05b6d7

Create a build directory, the length is 410. No errors when running &quot;bitbake core-image-sato&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>