Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glibc passes argv and stuff to DSO init funcions, we don't #795

Closed
nyh opened this issue Sep 2, 2016 · 2 comments
Closed

Glibc passes argv and stuff to DSO init funcions, we don't #795

nyh opened this issue Sep 2, 2016 · 2 comments

Comments

@nyh
Copy link
Contributor

nyh commented Sep 2, 2016

As explained nicely in golang/go#13492, since 1996 glibc's dlopen() passes argv and a bunch of other stuff to the initialization functions of shared objects, while we don't pass any argument (see object::run_init_funcs()). Golang code (ref #522), in particular, assumes it gets argv, auxv, etc., this way.

Passing argv et al. to init functions doesn't make any sense, not to mention it isn't clear which argv we're supposed to pass (or what happens if the executable modified these things before or during the dlopen call). So according to research in the above link, NONE of the other glibc clones passes these things to DSO initialization functions. But sadly, glibc does - since the following unexplained commit in 1996:

https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=dcf0671d905200c449f92ead6cf43c184637a0d5

So probably we need to do this too :-(

The above doesn't mention auxv, so probably look at newer code to see what glibc really passes these days.

By the way, looking at that commit, I discovered that glibc exposes also
extern int __libc_argc;
extern char *___libc_argv;
extern char *___libc_envp;

So probably we should have those too (even if golang doesn't use them, somebody is bound to use them someday).

benoit-canet pushed a commit to benoit-canet/osv that referenced this issue Nov 15, 2016
As explained nicely in golang/go#13492, since 1996
glibc's dlopen() passes argv and a bunch of other
stuff to the initialization functions of shared
objects, while we don't pass any argument
(see object::run_init_funcs()). Golang code
(ref cloudius-systems#522), in particular, assumes it gets argv,
auxv, etc., this way.

Fixes: cloudius-systems#795

Signed-off-by: Benoît Canet <[email protected]>
benoit-canet pushed a commit to benoit-canet/osv that referenced this issue Jan 13, 2017
As explained nicely in golang/go#13492, since 1996
glibc's dlopen() passes argv and a bunch of other
stuff to the initialization functions of shared
objects, while we don't pass any argument
(see object::run_init_funcs()). Golang code
(ref cloudius-systems#522), in particular, assumes it gets argv,
auxv, etc., this way.

Fixes: cloudius-systems#795

Signed-off-by: Benoît Canet <[email protected]>
benoit-canet pushed a commit to benoit-canet/osv that referenced this issue Feb 8, 2017
As explained nicely in golang/go#13492, since 1996
glibc's dlopen() passes argv and a bunch of other
stuff to the initialization functions of shared
objects, while we don't pass any argument
(see object::run_init_funcs()). Golang code
(ref cloudius-systems#522), in particular, assumes it gets argv,
auxv, etc., this way.

Fixes: cloudius-systems#795

Signed-off-by: Benoît Canet <[email protected]>
benoit-canet pushed a commit to benoit-canet/osv that referenced this issue Feb 8, 2017
As explained nicely in golang/go#13492, since 1996
glibc's dlopen() passes argv and a bunch of other
stuff to the initialization functions of shared
objects, while we don't pass any argument
(see object::run_init_funcs()). Golang code
(ref cloudius-systems#522), in particular, assumes it gets argv,
auxv, etc., this way.

Fixes: cloudius-systems#795

Signed-off-by: Benoît Canet <[email protected]>
benoit-canet pushed a commit to benoit-canet/osv that referenced this issue Feb 9, 2017
As explained nicely in golang/go#13492, since 1996
glibc's dlopen() passes argv and a bunch of other
stuff to the initialization functions of shared
objects, while we don't pass any argument
(see object::run_init_funcs()). Golang code
(ref cloudius-systems#522), in particular, assumes it gets argv,
auxv, etc., this way.

Fixes: cloudius-systems#795

Signed-off-by: Benoît Canet <[email protected]>
@geraldo-netto
Copy link
Contributor

Hello @nyh,

Based on @benoit-canet patches, argc and argv are been passed
Maybe this ticket is outdated

Kind Regards,
Geraldo Netto

@nyh
Copy link
Contributor Author

nyh commented Apr 12, 2018

The patch was not yet committed. @wkozaczuk recently sent a new version of @benoit-canet 's patch, and when this patch is committed this issue will be automatically closed. Until it is committed, we shouldn't close the issue.

@nyh nyh closed this as completed in e60339d Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants