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

i#2154 Android64: Remove get_kernel_args() #7240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jackgallagher-arm
Copy link
Collaborator

Since the original 32-bit Android port was done bionic was changed [1] to pass argc, argv, and envp to library _init() functions so we can get rid of the old workaround.

This fixes several tests which were failing with the error:

  Internal Error: DynamoRIO debug check failure: failed to find envp
  @dynamorio/core/unix/os.c:801 envp != NULL

[1] https://android.googlesource.com/platform/bionic/+/554374693408cd7c74d0cae596fca7349661edea

Issue: #2154

Since the original 32-bit Android port was done bionic was changed [1] to
pass argc, argv, and envp to library _init() functions so we can get rid
of the old workaround.

This fixes several tests which were failing with the error:
```
  Internal Error: DynamoRIO debug check failure: failed to find envp
  @dynamorio/core/unix/os.c:801 envp != NULL
```

[1] https://android.googlesource.com/platform/bionic/+/554374693408cd7c74d0cae596fca7349661edea

Issue: #2154
@@ -787,19 +787,6 @@ static init_fn_t
INITIALIZER_ATTRIBUTES int
_init(int argc, char **argv, char **envp)
{
# ifdef ANDROID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth keeping this workaround for older Bionic versions? Could we somehow check the Bionic version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour was changed in 2016. Do we need to maintain compatibility back that far?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there's a simple way to keep backward compatibility, this seems fine to me. Maybe worth a note in release.dox that Bionic version < N is not supported now.

Let's wait for Derek's approval too.

Copy link
Contributor

@abhinav92003 abhinav92003 Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we perhaps fallback to not using the workaround when we detect envp == NULL (instead of failing). It's what we do in release build too right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour was changed in 2016. Do we need to maintain compatibility back that far?

For Linux, I would say yes, 2016 is not that long ago. Maybe we should make an explicit decision about Android and document it: what is the oldest version to support? 7.0 was in 2016 and 6.0 in 2015. What is the oldest version that Play supports? I think there are people still using very old versions out there (seeing 4.x in some cases) but seems reasonable to not put effort into things older than what Play supports? AI search summary says that's 6.0 which would say to support pre-2016; but https://developer.android.com/google/play/requirements/target-sdk implies that 10.0 is barely worth supporting.

But if you wanted to keep the get_kernel_args() how would you know when to call it? If old Android didn't pass defined values, are the parameter values here just random values (whatever was in the registers) and not a sentinel like null? Or is there an easy way to get the version?

@@ -787,19 +787,6 @@ static init_fn_t
INITIALIZER_ATTRIBUTES int
_init(int argc, char **argv, char **envp)
{
# ifdef ANDROID
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behaviour was changed in 2016. Do we need to maintain compatibility back that far?

For Linux, I would say yes, 2016 is not that long ago. Maybe we should make an explicit decision about Android and document it: what is the oldest version to support? 7.0 was in 2016 and 6.0 in 2015. What is the oldest version that Play supports? I think there are people still using very old versions out there (seeing 4.x in some cases) but seems reasonable to not put effort into things older than what Play supports? AI search summary says that's 6.0 which would say to support pre-2016; but https://developer.android.com/google/play/requirements/target-sdk implies that 10.0 is barely worth supporting.

But if you wanted to keep the get_kernel_args() how would you know when to call it? If old Android didn't pass defined values, are the parameter values here just random values (whatever was in the registers) and not a sentinel like null? Or is there an easy way to get the version?

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 this pull request may close these issues.

3 participants