kern: add version bounds checking
This commit is contained in:
@@ -27,8 +27,10 @@ namespace ams::kern {
|
||||
/* Initial processes may use any user priority they like. */
|
||||
this->priority_mask = ~0xFul;
|
||||
|
||||
/* TODO: Here, Nintendo sets the kernel version to (current kernel version). */
|
||||
/* How should we handle this? Not a MESOSPHERE_TODO because it's not critical. */
|
||||
/* Here, Nintendo sets the kernel version to the current kernel version. */
|
||||
/* We will follow suit and set the version to the highest supported kernel version. */
|
||||
this->intended_kernel_version.Set<KernelVersion::MajorVersion>(ams::svc::SupportedKernelMajorVersion);
|
||||
this->intended_kernel_version.Set<KernelVersion::MinorVersion>(ams::svc::SupportedKernelMinorVersion);
|
||||
|
||||
/* Parse the capabilities array. */
|
||||
return this->SetCapabilities(caps, num_caps, page_table);
|
||||
|
||||
@@ -146,8 +146,11 @@ namespace ams::kern {
|
||||
}
|
||||
|
||||
Result KProcess::Initialize(const ams::svc::CreateProcessParameter ¶ms) {
|
||||
/* TODO: Validate intended kernel version. */
|
||||
/* How should we do this? */
|
||||
/* Validate that the intended kernel version is high enough for us to support. */
|
||||
R_UNLESS(this->capabilities.GetIntendedKernelVersion() >= ams::svc::RequiredKernelVersion, svc::ResultInvalidCombination());
|
||||
|
||||
/* Validate that the intended kernel version isn't too high for us to support. */
|
||||
R_UNLESS(this->capabilities.GetIntendedKernelVersion() <= ams::svc::SupportedKernelVersion, svc::ResultInvalidCombination());
|
||||
|
||||
/* Create and clear the process local region. */
|
||||
R_TRY(this->CreateThreadLocalRegion(std::addressof(this->plr_address)));
|
||||
|
||||
Reference in New Issue
Block a user