Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 433984 - dev-libs/dietlibc-0.33_pre20110403: Invalid environment pointers in third argument to main()
Summary: dev-libs/dietlibc-0.33_pre20110403: Invalid environment pointers in third arg...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: Normal major
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 414629
  Show dependency tree
 
Reported: 2012-09-05 04:26 UTC by Fabian Mewes
Modified: 2013-01-03 20:15 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fabian Mewes 2012-09-05 04:26:57 UTC
Applications which are linked against the latest diet libc from the portage tree and use the third argument to main() to access the process environment fail with a segmentation fault. This happens because of dereferenced invalid pointers.

The bug appears only in version 0.33_pre20110403 which is a snapshot of a github repository[1]. Neither the latest revision of this repository nor the CVS repository[2] of the original author is affected.

[1] https://github.com/hollow/dietlibc
[2] http://www.fefe.de/dietlibc/

Reproducible: Always

Steps to Reproduce:
1. create some test file
$ cat >/tmp/t.c
#include <stdio.h> /* don't hurt me! */

int main(int argc, char *argv[], char *envp[])
{
        while (*envp)
                printf("%p\n", *envp++);
        return 0;
}

2. compile it
$ diet gcc -o /tmp/diettest /tmp/t.c

3. run it
$ /tmp/diettest
Actual Results:  
0x21
0x7fff4f3d5000
[...]
0x5
0x5

Expected Results:  
0x7fffce35a436
0x7fffce35a4ca
[...]
0x7fffce35a52e
0x7fffce35a53e


* extern char **environ is not affected
* I assume the problem to be in the startup code (x86_64/start.S), which differs from the actual repository versions
* this breaks serdo from sys-process/minit
Comment 1 Pacho Ramos gentoo-dev 2013-01-03 20:15:12 UTC
+*dietlibc-0.33_pre20130103 (03 Jan 2013)
+
+  03 Jan 2013; Pacho Ramos <pacho@gentoo.org> +dietlibc-0.33_pre20130103.ebuild:
+  Bump with snapshot taken today to get all the changes upstream did
+