fs.mitm: Always mitm non-sysmodules.

This commit is contained in:
Michael Scire 2018-11-15 14:59:47 -08:00
parent 46cc08160d
commit e0c7bfc93d
4 changed files with 16 additions and 11 deletions

View file

@ -106,7 +106,7 @@ Result FsMitmService::OpenBisStorage(Out<std::shared_ptr<IStorageInterface>> out
/* PRODINFO should *never* be writable. */ /* PRODINFO should *never* be writable. */
storage = std::make_shared<IStorageInterface>(new ROProxyStorage(bis_storage)); storage = std::make_shared<IStorageInterface>(new ROProxyStorage(bis_storage));
} else { } else {
if (allow_writes) { if (!allow_writes) {
storage = std::make_shared<IStorageInterface>(new ROProxyStorage(bis_storage)); storage = std::make_shared<IStorageInterface>(new ROProxyStorage(bis_storage));
} else { } else {
/* Sysmodules should still be allowed to read and write. */ /* Sysmodules should still be allowed to read and write. */
@ -128,6 +128,10 @@ Result FsMitmService::OpenDataStorageByCurrentProcess(Out<std::shared_ptr<IStora
u32 out_domain_id = 0; u32 out_domain_id = 0;
Result rc = 0; Result rc = 0;
if (!this->should_override_contents) {
return RESULT_FORWARD_TO_SESSION;
}
bool has_cache = StorageCacheGetEntry(this->title_id, &storage); bool has_cache = StorageCacheGetEntry(this->title_id, &storage);
ON_SCOPE_EXIT { ON_SCOPE_EXIT {
@ -192,6 +196,10 @@ Result FsMitmService::OpenDataStorageByDataId(Out<std::shared_ptr<IStorageInterf
FsStorage data_storage; FsStorage data_storage;
FsFile data_file; FsFile data_file;
if (!this->should_override_contents) {
return RESULT_FORWARD_TO_SESSION;
}
std::shared_ptr<IStorageInterface> storage = nullptr; std::shared_ptr<IStorageInterface> storage = nullptr;
u32 out_domain_id = 0; u32 out_domain_id = 0;
Result rc = 0; Result rc = 0;

View file

@ -30,9 +30,10 @@ enum FspSrvCmd : u32 {
class FsMitmService : public IMitmServiceObject { class FsMitmService : public IMitmServiceObject {
private: private:
bool has_initialized = false; bool has_initialized = false;
bool should_override_contents;
public: public:
FsMitmService(std::shared_ptr<Service> s) : IMitmServiceObject(s) { FsMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */ this->should_override_contents = !Utils::HasSdDisableMitMFlag(this->title_id) && Utils::HasOverrideButton(this->title_id);
} }
static bool ShouldMitm(u64 pid, u64 tid) { static bool ShouldMitm(u64 pid, u64 tid) {
@ -41,11 +42,7 @@ class FsMitmService : public IMitmServiceObject {
return true; return true;
} }
if (Utils::HasSdDisableMitMFlag(tid)) { return (tid >= 0x0100000000010000ULL || Utils::HasSdMitMFlag(tid));
return false;
}
return (tid >= 0x0100000000010000ULL || Utils::HasSdMitMFlag(tid)) && Utils::HasOverrideButton(tid);
} }
static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx); static void PostProcess(IMitmServiceObject *obj, IpcResponseContext *ctx);

@ -1 +1 @@
Subproject commit 8fcac73ab2b91afe184abe48c887ea1cb9bf2076 Subproject commit 0bec72ca36084e9780a8c28abd4a0b24c03c18af

View file

@ -25,7 +25,7 @@ enum SetSysCmd : u32 {
class SetSysMitmService : public IMitmServiceObject { class SetSysMitmService : public IMitmServiceObject {
public: public:
SetSysMitmService(std::shared_ptr<Service> s) : IMitmServiceObject(s) { SetSysMitmService(std::shared_ptr<Service> s, u64 pid) : IMitmServiceObject(s, pid) {
/* ... */ /* ... */
} }