IOS/ES: Return IPC_EINVAL for unknown ioctlvs

Instead of allowing unknown ioctlvs and faking success for both unknown
and unimplemented ioctlvs, which can possibly result in nasty, hard to
debug bugs (if the emulated software behaves unexpectedly), we should
reject unknown ioctlvs and log known, but unimplemented ioctlvs.
This commit is contained in:
Léo Lam 2017-04-06 15:18:23 +02:00
parent 36ab5eafcf
commit 60d47eaeff
2 changed files with 35 additions and 7 deletions

View File

@ -409,12 +409,29 @@ IPCCommandResult ES::IOCtlV(const IOCtlVRequest& request)
return Sign(request);
case IOCTL_ES_GETBOOT2VERSION:
return GetBoot2Version(request);
default:
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_ES);
break;
}
return GetDefaultReply(IPC_SUCCESS);
case IOCTL_ES_VERIFYSIGN:
case IOCTL_ES_DELETESHAREDCONTENT:
case IOCTL_ES_UNKNOWN_39:
case IOCTL_ES_UNKNOWN_3A:
case IOCTL_ES_UNKNOWN_3B:
case IOCTL_ES_UNKNOWN_3C:
case IOCTL_ES_UNKNOWN_3D:
case IOCTL_ES_UNKNOWN_3E:
case IOCTL_ES_UNKNOWN_3F:
case IOCTL_ES_UNKNOWN_40:
case IOCTL_ES_UNKNOWN_41:
case IOCTL_ES_UNKNOWN_42:
case IOCTL_ES_UNKNOWN_43:
case IOCTL_ES_UNKNOWN_44:
PanicAlert("IOS-ES: Unimplemented ioctlv 0x%x (%zu in vectors, %zu io vectors)",
request.request, request.in_vectors.size(), request.io_vectors.size());
request.DumpUnknown(GetDeviceName(), LogTypes::IOS_ES, LogTypes::LERROR);
return GetDefaultReply(IPC_EINVAL);
default:
return GetDefaultReply(IPC_EINVAL);
}
}
IPCCommandResult ES::GetConsumption(const IOCtlVRequest& request)

View File

@ -112,7 +112,7 @@ private:
IOCTL_ES_GETBOOT2VERSION = 0x2E,
IOCTL_ES_ADDTITLECANCEL = 0x2F,
IOCTL_ES_SIGN = 0x30,
// IOCTL_ES_VERIFYSIGN = 0x31,
IOCTL_ES_VERIFYSIGN = 0x31,
IOCTL_ES_GETSTOREDCONTENTCNT = 0x32,
IOCTL_ES_GETSTOREDCONTENTS = 0x33,
IOCTL_ES_GETSTOREDTMDSIZE = 0x34,
@ -120,7 +120,18 @@ private:
IOCTL_ES_GETSHAREDCONTENTCNT = 0x36,
IOCTL_ES_GETSHAREDCONTENTS = 0x37,
IOCTL_ES_DELETESHAREDCONTENT = 0x38,
//
IOCTL_ES_UNKNOWN_39 = 0x39,
IOCTL_ES_UNKNOWN_3A = 0x3A,
IOCTL_ES_UNKNOWN_3B = 0x3B,
IOCTL_ES_UNKNOWN_3C = 0x3C,
IOCTL_ES_UNKNOWN_3D = 0x3D,
IOCTL_ES_UNKNOWN_3E = 0x3E,
IOCTL_ES_UNKNOWN_3F = 0x3F,
IOCTL_ES_UNKNOWN_40 = 0x40,
IOCTL_ES_UNKNOWN_41 = 0x41,
IOCTL_ES_UNKNOWN_42 = 0x42,
IOCTL_ES_UNKNOWN_43 = 0x43,
IOCTL_ES_UNKNOWN_44 = 0x44,
IOCTL_ES_CHECKKOREAREGION = 0x45,
};