Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@gbalykov
Copy link
Member

This PR allows to manually setup default base address option for native images during crossgen

crossgen /BaseAddress <base_addr_value> <other_options>

Also, env variable could be setup to enable/disable mapping of images at default base address.

cc @alpencolt @jkotas

}
#endif // ENSURE_PRIMARY_STACK_SIZE

char* useDefaultBaseAddr = getenv("COMPlus_UseDefaultBaseAddr");
Copy link
Member

Choose a reason for hiding this comment

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

This switch disables a OS security feature. We cannot have this config switch in the product.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could this be added under some #ifdef?

Copy link
Member

Choose a reason for hiding this comment

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

Putting it under ifdef like FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION should be ok (similar to existing FEATURE_ENABLE_NO_RANGE_CHECKS).

Copy link
Member Author

Choose a reason for hiding this comment

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

I've put setup and usage of this parameter under ifdef FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION

@jkotas
Copy link
Member

jkotas commented Jun 19, 2019

Could you please share some details on how you expect to use it? You have done a lot of work on converting pointers to relative pointers earlier. I would expect that it has equivalent benefit.

@gbalykov
Copy link
Member Author

We want to enable both optimizations on removal of relocations and support for default base address option in the same build of CoreCLR. This will allow to choose different approaches to removal of relocations in different scenarios.

@gbalykov gbalykov force-pushed the add-custom-base-addr-option branch from 4670803 to 35af2b9 Compare June 20, 2019 11:56
W(" input assemblies\n")

#endif
W(" /BaseAddress <value> - Specifies base address to use for compilation.\n")
Copy link
Member

Choose a reason for hiding this comment

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

Could you please put this under the ifdef as well?

fLargeVersionBubbleSwitch = true;
}
#endif
else if (MatchParameter(*argv, W("BaseAddress")))
Copy link
Member

Choose a reason for hiding this comment

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

And this place (the rest of the plumbing can stay)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

gbalykov added 2 commits June 20, 2019 22:50
This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.
…eDefaultBaseAddr=0x1 is setup.

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.
@gbalykov gbalykov force-pushed the add-custom-base-addr-option branch from 35af2b9 to 944f761 Compare June 20, 2019 19:52
@jkotas jkotas merged commit 86e600c into dotnet:master Jun 21, 2019
pull bot pushed a commit to HarrievG/coreclr that referenced this pull request Jun 21, 2019
* Add crossgen option to setup default base address for native image

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.

* Mmap native images at default base address if env variable COMPlus_UseDefaultBaseAddr=0x1 is setup.

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.
@gbalykov
Copy link
Member Author

Thanks!

makxenov pushed a commit to makxenov/coreclr that referenced this pull request Jul 15, 2019
* Add crossgen option to setup default base address for native image

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.

* Mmap native images at default base address if env variable COMPlus_UseDefaultBaseAddr=0x1 is setup.

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
)

* Add crossgen option to setup default base address for native image

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.

* Mmap native images at default base address if env variable COMPlus_UseDefaultBaseAddr=0x1 is setup.

This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.


Commit migrated from dotnet/coreclr@86e600c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants