Add generic data patching functions
Status from this message: Applied to powerpc/next.
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest5 patches 6 repliesApplied
- v35 patches 6 repliesSuperseded
- v23 patches 7 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 3 patches | 2 replies | Superseded |
Changes in v4 from the cover letter
* Improved the boot test. Now that alignment is enforced, it checks the word (but not doubleword) aligned patch_ulong().
Patches in v4 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | powerpc/code-patching: Add generic memory patchingarch/ arch/ | +80 | 1 reply | |
| 2/5 | powerpc/code-patching: Add data patch alignment checkarch/ arch/ | +12 | 1 reply | |
| 3/5 | powerpc/64: Convert patch_instruction() to patch_u32()arch/ | +2 | 1 reply | |
| 4/5 | powerpc/32: Convert patch_instruction() to patch_uint()arch/ arch/ | +2 | 1 reply | |
| 5/5 | powerpc/code-patching: Add boot selftest for data patchingarch/ | +41 | 1 reply |
Reviews trailers per patch
3 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Hari Bathini |
|---|---|
| 1/5 | R-b |
| 2/5 | R-b |
| 3/5 | T-b |
| 4/5 | T-b |
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v4 0/5] Add generic data patching functions
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.
To solve this, this series pulls out the size parameter to the 'top' of the memory patching logic, and propagates it through the various functions.
The two sizes supported are int and long; this allows for patching instructions and pointers on both ppc32 and ppc64. On ppc32 these are the same size, so care is taken to only use the size parameter on static functions, so the compiler can optimise it out entirely. Unfortunately GCC trips over its own feet here and won't optimise in a way that is optimal for strict RWX (mpc85xx_smp_defconfig) and no RWX (pmac32_defconfig). More details in the v2 cover letter.
Changes from v3:
* Improved the boot test. Now that alignment is enforced, it checks the word (but not doubleword) aligned patch_ulong().
Changes from v2:
* Various changes noted on each patch
* Data patching now enforced to be aligned
* Restore page aligned flushing optimisation
Changes from v1:
* Addressed the v1 review actions
* Removed noinline (for now)
v3: https://patchwork.ozlabs.org/project/linuxppc-dev/cover/[email protected]/
v2: https://patchwork.ozlabs.org/project/linuxppc-dev/cover/[email protected]/
v1: https://patchwork.ozlabs.org/project/linuxppc-dev/cover/[email protected]/
Benjamin Gray (5):
powerpc/code-patching: Add generic memory patching powerpc/code-patching: Add data patch alignment check powerpc/64: Convert patch_instruction() to patch_u32() powerpc/32: Convert patch_instruction() to patch_uint() powerpc/code-patching: Add boot selftest for data patching
arch/powerpc/include/asm/code-patching.h | 37 +++++++++++++ arch/powerpc/kernel/module_64.c | 5 +- arch/powerpc/kernel/static_call.c | 2 +- arch/powerpc/lib/code-patching.c | 70 +++++++++++++++++++----- arch/powerpc/lib/test-code-patching.c | 41 ++++++++++++++ arch/powerpc/platforms/powermac/smp.c | 2 +- 6 files changed, 137 insertions(+), 20 deletions(-)
--
2.45.0