Skip to content

dl_iterate_phdr assumes GNU/Linux #659

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

Closed
workingjubilee opened this issue Aug 29, 2024 · 1 comment · Fixed by #660
Closed

dl_iterate_phdr assumes GNU/Linux #659

workingjubilee opened this issue Aug 29, 2024 · 1 comment · Fixed by #660

Comments

@workingjubilee
Copy link
Member

workingjubilee commented Aug 29, 2024

Only GNU/Linux guarantees:

  • the name of the executable is ""
  • the executable is the first callback

This doesn't seem to be guaranteed to be true, even on other flavors of Linux, which may have a sense of humor, e.g. musl's choices in the static linkage case:

        info.dlpi_addr  = base;
	info.dlpi_name  = "/proc/self/exe";
	info.dlpi_phdr  = (void *)aux[AT_PHDR];
	info.dlpi_phnum = aux[AT_PHNUM];
	info.dlpi_adds  = 0;
	info.dlpi_subs  = 0;
	if (tls_phdr) {
		info.dlpi_tls_modid = 1;
		info.dlpi_tls_data = __tls_get_addr((tls_mod_off_t[]){1,0});
	} else {
		info.dlpi_tls_modid = 0;
		info.dlpi_tls_data = 0;
	}
	return (callback)(&info, sizeof (info), data);
@rust-lang rust-lang deleted a comment from africanobyamugisha Aug 29, 2024
@workingjubilee
Copy link
Member Author

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

Successfully merging a pull request may close this issue.

1 participant