linux-um.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] x86/module: rework ROX cache to avoid writable copy
@ 2024-12-27  7:28 Mike Rapoport
  2024-12-27  7:28 ` [PATCH 1/8] x86/mm/pat: cpa-test: fix length for CPA_ARRAY test Mike Rapoport
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Mike Rapoport @ 2024-12-27  7:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Andy Lutomirski, Anton Ivanov, Borislav Petkov, Brendan Higgins,
	Daniel Gomez, Daniel Thompson, Dave Hansen, David Gow,
	Douglas Anderson, Ingo Molnar, Jason Wessel, Jiri Kosina,
	Joe Lawrence, Johannes Berg, Josh Poimboeuf, Kirill A. Shutemov,
	Luis Chamberlain, Mark Rutland, Masami Hiramatsu, Mike Rapoport,
	Miroslav Benes, H. Peter Anvin, Peter Zijlstra, Petr Mladek,
	Petr Pavlu, Rae Moar, Richard Weinberger, Sami Tolvanen,
	Shuah Khan, Song Liu, Steven Rostedt, Thomas Gleixner,
	kgdb-bugreport, kunit-dev, linux-kernel, linux-kselftest,
	linux-mm, linux-modules, linux-trace-kernel, linux-um,
	live-patching, x86

From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>

Hi,

Following Peter's comments [1] these patches rework handling of ROX caches
for module text allocations. 

Instead of using a writable copy that really complicates alternatives
patching, temporarily remap parts of a large ROX page as RW for the time of
module formation and then restore it's ROX protections when the module is
ready.

To keep the ROX memory mapped with large pages, make set_memory code
capable of restoring large pages (more details are in patch 3).

The patches also available in git
https://git.kernel.org/rppt/h/execmem/x86-rox/v8

[1] https://lore.kernel.org/all/20241209083818.GK8562@noisy.programming.kicks-ass.net

Kirill A. Shutemov (1):
  x86/mm/pat: Restore large pages after fragmentation

Mike Rapoport (Microsoft) (7):
  x86/mm/pat: cpa-test: fix length for CPA_ARRAY test
  x86/mm/pat: drop duplicate variable in cpa_flush()
  execmem: add API for temporal remapping as RW and restoring ROX
    afterwards
  module: introduce MODULE_STATE_GONE
  modules: switch to execmem API for remapping as RW and restoring ROX
  Revert "x86/module: prepare module loading for ROX allocations of
    text"
  module: drop unused module_writable_address()

 arch/um/kernel/um_arch.c                      |  11 +-
 arch/x86/entry/vdso/vma.c                     |   3 +-
 arch/x86/include/asm/alternative.h            |  14 +-
 arch/x86/include/asm/pgtable_types.h          |   2 +
 arch/x86/kernel/alternative.c                 | 181 ++++++---------
 arch/x86/kernel/ftrace.c                      |  30 ++-
 arch/x86/kernel/module.c                      |  45 ++--
 arch/x86/mm/pat/cpa-test.c                    |   2 +-
 arch/x86/mm/pat/set_memory.c                  | 216 +++++++++++++++++-
 include/linux/execmem.h                       |  31 +++
 include/linux/module.h                        |  21 +-
 include/linux/moduleloader.h                  |   4 -
 include/linux/vm_event_item.h                 |   2 +
 kernel/module/kallsyms.c                      |   8 +-
 kernel/module/kdb.c                           |   2 +-
 kernel/module/main.c                          |  86 ++-----
 kernel/module/procfs.c                        |   2 +-
 kernel/module/strict_rwx.c                    |   9 +-
 kernel/tracepoint.c                           |   2 +
 lib/kunit/test.c                              |   2 +
 mm/execmem.c                                  | 118 ++++++++--
 mm/vmstat.c                                   |   2 +
 samples/livepatch/livepatch-callbacks-demo.c  |   1 +
 .../test_modules/test_klp_callbacks_demo.c    |   1 +
 .../test_modules/test_klp_callbacks_demo2.c   |   1 +
 .../livepatch/test_modules/test_klp_state.c   |   1 +
 .../livepatch/test_modules/test_klp_state2.c  |   1 +
 27 files changed, 511 insertions(+), 287 deletions(-)

-- 
2.45.2



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2025-01-14 11:02 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-27  7:28 [PATCH 0/8] x86/module: rework ROX cache to avoid writable copy Mike Rapoport
2024-12-27  7:28 ` [PATCH 1/8] x86/mm/pat: cpa-test: fix length for CPA_ARRAY test Mike Rapoport
2025-01-03 11:19   ` Peter Zijlstra
2024-12-27  7:28 ` [PATCH 2/8] x86/mm/pat: drop duplicate variable in cpa_flush() Mike Rapoport
2024-12-27  7:28 ` [PATCH 3/8] x86/mm/pat: Restore large pages after fragmentation Mike Rapoport
2025-01-10 10:36   ` Kirill A. Shutemov
2025-01-10 19:18     ` Luis Chamberlain
2025-01-12  8:54     ` Mike Rapoport
2025-01-13  8:01       ` Kirill A. Shutemov
2025-01-14 11:01         ` Mike Rapoport
2024-12-27  7:28 ` [PATCH 4/8] execmem: add API for temporal remapping as RW and restoring ROX afterwards Mike Rapoport
2024-12-27  7:28 ` [PATCH 5/8] module: introduce MODULE_STATE_GONE Mike Rapoport
2025-01-08 15:43   ` Daniel Thompson
2024-12-27  7:28 ` [PATCH 6/8] modules: switch to execmem API for remapping as RW and restoring ROX Mike Rapoport
2025-01-02 21:30   ` Lorenzo Stoakes
2025-01-03  2:06     ` Andrew Cooper
2025-01-03  5:57       ` Andrew Morton
2025-01-03 10:57         ` Marek Marczykowski-Górecki
2025-01-03  6:58       ` Jürgen Groß
2025-01-04  2:07         ` Luis Chamberlain
2025-01-05 12:52           ` Marek Maślanka
2024-12-27  7:28 ` [PATCH 7/8] Revert "x86/module: prepare module loading for ROX allocations of text" Mike Rapoport
2024-12-27  7:28 ` [PATCH 8/8] module: drop unused module_writable_address() Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).