mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-31 19:48:53 +00:00
[loader] change ASLR algo to be more uniform (#3869)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3869 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
@@ -228,9 +228,8 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
|
|||||||
code_size += patch_ctx.GetTotalPatchSize();
|
code_size += patch_ctx.GetTotalPatchSize();
|
||||||
|
|
||||||
// TODO: this is bad form of ASLR, it sucks
|
// TODO: this is bad form of ASLR, it sucks
|
||||||
size_t aslr_offset = ((::Settings::values.rng_seed_enabled.GetValue()
|
std::uintptr_t aslr_offset = ((::Settings::values.rng_seed_enabled.GetValue()
|
||||||
? ::Settings::values.rng_seed.GetValue()
|
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
||||||
: Common::Random::Random64(0)) * 0x734287f27) & 0xfff000;
|
|
||||||
|
|
||||||
// Setup the process code layout
|
// Setup the process code layout
|
||||||
if (process.LoadFromMetadata(metadata, code_size, fastmem_base, aslr_offset, is_hbl).IsError()) {
|
if (process.LoadFromMetadata(metadata, code_size, fastmem_base, aslr_offset, is_hbl).IsError()) {
|
||||||
|
|||||||
@@ -89,9 +89,8 @@ AppLoader::LoadResult AppLoader_KIP::Load(Kernel::KProcess& process,
|
|||||||
codeset.DataSegment().size += kip->GetBSSSize();
|
codeset.DataSegment().size += kip->GetBSSSize();
|
||||||
|
|
||||||
// TODO: this is bad form of ASLR, it sucks
|
// TODO: this is bad form of ASLR, it sucks
|
||||||
size_t aslr_offset = ((::Settings::values.rng_seed_enabled.GetValue()
|
std::uintptr_t aslr_offset = ((::Settings::values.rng_seed_enabled.GetValue()
|
||||||
? ::Settings::values.rng_seed.GetValue()
|
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
||||||
: Common::Random::Random64(0)) * 0x734287f27) & 0xfff000;
|
|
||||||
|
|
||||||
// Setup the process code layout
|
// Setup the process code layout
|
||||||
if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), codeset.memory.size(), 0, aslr_offset, false).IsError()) {
|
if (process.LoadFromMetadata(FileSys::ProgramMetadata::GetDefault(), codeset.memory.size(), 0, aslr_offset, false).IsError()) {
|
||||||
|
|||||||
@@ -242,9 +242,8 @@ static bool LoadNroImpl(Core::System& system, Kernel::KProcess& process,
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
// TODO: this is bad form of ASLR, it sucks
|
// TODO: this is bad form of ASLR, it sucks
|
||||||
size_t aslr_offset = ((::Settings::values.rng_seed_enabled.GetValue()
|
std::uintptr_t aslr_offset = ((::Settings::values.rng_seed_enabled.GetValue()
|
||||||
? ::Settings::values.rng_seed.GetValue()
|
? ::Settings::values.rng_seed.GetValue() : Common::Random::Random64(0)) << 12) & 0xfff000;
|
||||||
: Common::Random::Random64(0)) * 0x734287f27) & 0xfff000;
|
|
||||||
|
|
||||||
// Setup the process code layout
|
// Setup the process code layout
|
||||||
if (process
|
if (process
|
||||||
|
|||||||
Reference in New Issue
Block a user