diff --git a/src/kpatch/750.c b/src/kpatch/750.c index 02d2645..3e9b565 100644 --- a/src/kpatch/750.c +++ b/src/kpatch/750.c @@ -63,12 +63,76 @@ static inline void restore(void *kbase, struct kexec_args *uap) { } } -// TODO: __attribute__((always_inline)) static inline void patch_aio(void *kbase) { + disable_cr0_wp(); + const u64 aio_off = 0xb20f5; - disable_cr0_wp(); + // patch = {0xeb, 0x03} + write16(kbase, aio_off, 0x03eb); + + // offset = 0x10e + // patch = {0xe9, 0xf2, 0xfe, 0xff, 0xff} + write32(kbase, aio_off + 0x10e, 0xfffef2e9); + write8(kbase, aio_off + 0x112, 0xff); + + // offset = 0x5 + // patch = {0x41, 0x83, 0xbe, 0xa0, 0x04, 0x00, 0x00, 0x00} + write64(kbase, aio_off + 0x5, 0x00000004a0be8341); + + // offset = 0x13 + // patch = {0x49, 0x8b, 0x86, 0xd0, 0x04, 0x00, 0x00} + write32(kbase, aio_off + 0x13, 0xd0868b49); + write16(kbase, aio_off + 0x17, 0x0004); + write8(kbase, aio_off + 0x19, 0x00); + + // offset = 0x20 + // patch = {0x49, 0x8b, 0xb6, 0xb0, 0x04, 0x00, 0x00} + write32(kbase, aio_off + 0x20, 0xb0b68b49); + write16(kbase, aio_off + 0x24, 0x0004); + write8(kbase, aio_off + 0x26, 0x00); + + // offset = 0x38 + // patch = {0x49, 0x8b, 0x86, 0x40, 0x05, 0x00, 0x00} + write32(kbase, aio_off + 0x38, 0x40868b49); + write16(kbase, aio_off + 0x3c, 0x0005); + write8(kbase, aio_off + 0x3e, 0x00); + + // offset = 0x45 + // patch = {0x49, 0x8b, 0xb6, 0x20, 0x05, 0x00, 0x00} + write32(kbase, aio_off + 0x45, 0x20b68b49); + write16(kbase, aio_off + 0x49, 0x0005); + write8(kbase, aio_off + 0x4b, 0x00); + + // offset = 0x5d + // patch = {0x49, 0x8d, 0xBe, 0xc0, 0x00, 0x00, 0x00} + write32(kbase, aio_off + 0x5d, 0xc0be8d49); + write16(kbase, aio_off + 0x61, 0x0000); + write8(kbase, aio_off + 0x63, 0x00); + + // offset = 0x69 + // patch = {0x49, 0x8d, 0xbe, 0xe0, 0x00, 0x00, 0x00} + write32(kbase, aio_off + 0x69, 0xe0be8d49); + write16(kbase, aio_off + 0x6d, 0x0000); + write8(kbase, aio_off + 0x6f, 0x00); + + // offset = 0x7c + // patch = {0x49, 0x8d, 0xbe, 0x00, 0x01, 0x00, 0x00} + write32(kbase, aio_off + 0x7c, 0x00be8d49); + write16(kbase, aio_off + 0x80, 0x0001); + write8(kbase, aio_off + 0x82, 0x00); + + // offset = 0x88 + // patch = {0x49, 0x8d, 0xbe, 0x20, 0x01, 0x00, 0x00} + write32(kbase, aio_off + 0x88, 0x20be8d49); + write16(kbase, aio_off + 0x8c, 0x0001); + write8(kbase, aio_off + 0x8e, 0x00); + + // offset = 0x99 + // patch = {0x4c, 0x89, 0xf7} + write16(kbase, aio_off + 0x99, 0x894c); + write8(kbase, aio_off + 0x9b, 0xf7); enable_cr0_wp(); } diff --git a/src/kpatch/800.c b/src/kpatch/800.c index 961c031..e649e6a 100644 --- a/src/kpatch/800.c +++ b/src/kpatch/800.c @@ -65,13 +65,12 @@ static inline void restore(void *kbase, struct kexec_args *uap) { __attribute__((always_inline)) static inline void patch_aio(void *kbase) { - const u64 aio_off = 0x9f141; - disable_cr0_wp(); - // offset = 0x00 + const u64 aio_off = 0x9F141; + // patch = {0xeb, 0x48} - write16(kbase, aio_off + 0x00, 0x48eb); + write16(kbase, aio_off, 0x48eb); // offset = 0x42 // patch = {0xeb, 0x06} diff --git a/src/kpatch/850.c b/src/kpatch/850.c index 5c3f10e..fc2aa98 100644 --- a/src/kpatch/850.c +++ b/src/kpatch/850.c @@ -65,13 +65,12 @@ static inline void restore(void *kbase, struct kexec_args *uap) { __attribute__((always_inline)) static inline void patch_aio(void *kbase) { - const u64 aio_off = 0x30221; - disable_cr0_wp(); - // offset = 0x00 + const u64 aio_off = 0x30221; + // patch = {0xeb, 0x48} - write16(kbase, aio_off + 0x00, 0x48eb); + write16(kbase, aio_off, 0x48eb); // offset = 0x42 // patch = {0xeb, 0x06} diff --git a/src/kpatch/900.c b/src/kpatch/900.c index c8b86b8..827207f 100644 --- a/src/kpatch/900.c +++ b/src/kpatch/900.c @@ -65,13 +65,12 @@ static inline void restore(void *kbase, struct kexec_args *uap) { __attribute__((always_inline)) static inline void patch_aio(void *kbase) { - const u64 aio_off = 0x415a01; - disable_cr0_wp(); - // offset = 0x00 + const u64 aio_off = 0x415A01; + // patch = {0xeb, 0x48} - write16(kbase, aio_off + 0x00, 0x48eb); + write16(kbase, aio_off, 0x48eb); // offset = 0x42 // patch = {0xeb, 0x06} diff --git a/src/kpatch/903.c b/src/kpatch/903.c index e5ed9a3..962322f 100644 --- a/src/kpatch/903.c +++ b/src/kpatch/903.c @@ -65,13 +65,12 @@ static inline void restore(void *kbase, struct kexec_args *uap) { __attribute__((always_inline)) static inline void patch_aio(void *kbase) { - const u64 aio_off = 0x413971; - disable_cr0_wp(); - // offset = 0x00 + const u64 aio_off = 0x413971; + // patch = {0xeb, 0x48} - write16(kbase, aio_off + 0x00, 0x48eb); + write16(kbase, aio_off, 0x48eb); // offset = 0x42 // patch = {0xeb, 0x06} diff --git a/src/kpatch/950.c b/src/kpatch/950.c index 8f60add..a0fa89b 100644 --- a/src/kpatch/950.c +++ b/src/kpatch/950.c @@ -65,13 +65,12 @@ static inline void restore(void *kbase, struct kexec_args *uap) { __attribute__((always_inline)) static inline void patch_aio(void *kbase) { - const u64 aio_off = 0xd7771; - disable_cr0_wp(); - // offset = 0x00 + const u64 aio_off = 0xd7771; + // patch = {0xeb, 0x48} - write16(kbase, aio_off + 0x00, 0x48eb); + write16(kbase, aio_off, 0x48eb); // offset = 0x42 // patch = {0xeb, 0x06}