On Wed, 15 May 2024 12:44:40 +1000, Benjamin Gray wrote: > Currently patch_instruction() bases the write length on the value being > written. If the value looks like a prefixed instruction it writes 8 bytes, > otherwise it writes 4 bytes. This makes it potentially buggy to use for > writing arbitrary data, as if you want to write 4 bytes but it decides to > write 8 bytes it may clobber the following memory or be unaligned and > trigger an oops if it tries to cross a page boundary. > > [...]
Applied to powerpc/next. [1/5] powerpc/code-patching: Add generic memory patching https://git.kernel.org/powerpc/c/e6b8940e7e80cdfe98ba8493214922998920dd9c [2/5] powerpc/code-patching: Add data patch alignment check https://git.kernel.org/powerpc/c/dbf828aab466c6534711d1f1454c409ea68d18d0 [3/5] powerpc/64: Convert patch_instruction() to patch_u32() https://git.kernel.org/powerpc/c/90d4fed5b273155c378b1d37595f2209f0a92bed [4/5] powerpc/32: Convert patch_instruction() to patch_uint() https://git.kernel.org/powerpc/c/5799cd765fea93e643d81dbdae76a9c34e06dd18 [5/5] powerpc/code-patching: Add boot selftest for data patching https://git.kernel.org/powerpc/c/b7d47339d00d89af559a7068f4a640fc828177ad cheers