Skip to content

Commit

Permalink
From patchwork series 426813
Browse files Browse the repository at this point in the history
  • Loading branch information
Fox Snowpatch committed Oct 7, 2024
1 parent f85c105 commit 6379a0c
Show file tree
Hide file tree
Showing 118 changed files with 831 additions and 235 deletions.
1 change: 1 addition & 0 deletions arch/alpha/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ generic-y += agp.h
generic-y += asm-offsets.h
generic-y += kvm_para.h
generic-y += mcs_spinlock.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/arc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ generic-y += kvm_para.h
generic-y += mcs_spinlock.h
generic-y += parport.h
generic-y += user.h
generic-y += text-patching.h
File renamed without changes.
2 changes: 1 addition & 1 deletion arch/arm/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <asm/insn.h>
#include <asm/set_memory.h>
#include <asm/stacktrace.h>
#include <asm/patch.h>
#include <asm/text-patching.h>

/*
* The compiler emitted profiling hook consists of
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/jump_label.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/jump_label.h>
#include <asm/patch.h>
#include <asm/text-patching.h>
#include <asm/insn.h>

static void __arch_jump_label_transform(struct jump_entry *entry,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/kgdb.h>
#include <linux/uaccess.h>

#include <asm/patch.h>
#include <asm/text-patching.h>
#include <asm/traps.h>

struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <asm/fixmap.h>
#include <asm/smp_plat.h>
#include <asm/opcodes.h>
#include <asm/patch.h>
#include <asm/text-patching.h>

struct patch {
void *addr;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/probes/kprobes/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <asm/cacheflush.h>
#include <linux/percpu.h>
#include <linux/bug.h>
#include <asm/patch.h>
#include <asm/text-patching.h>
#include <asm/sections.h>

#include "../decode-arm.h"
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/probes/kprobes/opt-arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/* for arm_gen_branch */
#include <asm/insn.h>
/* for patch_text */
#include <asm/patch.h>
#include <asm/text-patching.h>

#include "core.h"

Expand Down
1 change: 1 addition & 0 deletions arch/arm64/include/asm/set_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ int set_memory_valid(unsigned long addr, int numpages, int enable);

int set_direct_map_invalid_noflush(struct page *page);
int set_direct_map_default_noflush(struct page *page);
int set_direct_map_valid_noflush(struct page *page, unsigned nr, bool valid);
bool kernel_page_present(struct page *page);

#endif /* _ASM_ARM64_SET_MEMORY_H */
File renamed without changes.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <asm/debug-monitors.h>
#include <asm/ftrace.h>
#include <asm/insn.h>
#include <asm/patching.h>
#include <asm/text-patching.h>

#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
struct fregs_offset {
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/jump_label.h>
#include <linux/smp.h>
#include <asm/insn.h>
#include <asm/patching.h>
#include <asm/text-patching.h>

bool arch_jump_label_transform_queue(struct jump_entry *entry,
enum jump_label_type type)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <asm/debug-monitors.h>
#include <asm/insn.h>
#include <asm/patching.h>
#include <asm/text-patching.h>
#include <asm/traps.h>

struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = {
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/patching.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <asm/fixmap.h>
#include <asm/insn.h>
#include <asm/kprobes.h>
#include <asm/patching.h>
#include <asm/text-patching.h>
#include <asm/sections.h>

static DEFINE_RAW_SPINLOCK(patch_lock);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/probes/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <asm/debug-monitors.h>
#include <asm/insn.h>
#include <asm/irq.h>
#include <asm/patching.h>
#include <asm/text-patching.h>
#include <asm/ptrace.h>
#include <asm/sections.h>
#include <asm/system_misc.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <asm/extable.h>
#include <asm/insn.h>
#include <asm/kprobes.h>
#include <asm/patching.h>
#include <asm/text-patching.h>
#include <asm/traps.h>
#include <asm/smp.h>
#include <asm/stack_pointer.h>
Expand Down
10 changes: 10 additions & 0 deletions arch/arm64/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ int set_direct_map_default_noflush(struct page *page)
PAGE_SIZE, change_page_range, &data);
}

int set_direct_map_valid_noflush(struct page *page, unsigned nr, bool valid)
{
unsigned long addr = (unsigned long)page_address(page);

if (!can_set_direct_map())
return 0;

return set_memory_valid(addr, nr, valid);
}

#ifdef CONFIG_DEBUG_PAGEALLOC
void __kernel_map_pages(struct page *page, int numpages, int enable)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/net/bpf_jit_comp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <asm/cacheflush.h>
#include <asm/debug-monitors.h>
#include <asm/insn.h>
#include <asm/patching.h>
#include <asm/text-patching.h>
#include <asm/set_memory.h>

#include "bpf_jit.h"
Expand Down
1 change: 1 addition & 0 deletions arch/csky/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ generic-y += qspinlock.h
generic-y += parport.h
generic-y += user.h
generic-y += vmlinux.lds.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/hexagon/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ generic-y += extable.h
generic-y += iomap.h
generic-y += kvm_para.h
generic-y += mcs_spinlock.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/loongarch/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ generic-y += ioctl.h
generic-y += mmzone.h
generic-y += statfs.h
generic-y += param.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/loongarch/include/asm/set_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ int set_memory_rw(unsigned long addr, int numpages);
bool kernel_page_present(struct page *page);
int set_direct_map_default_noflush(struct page *page);
int set_direct_map_invalid_noflush(struct page *page);
int set_direct_map_valid_noflush(struct page *page, unsigned nr, bool valid);

#endif /* _ASM_LOONGARCH_SET_MEMORY_H */
21 changes: 21 additions & 0 deletions arch/loongarch/mm/pageattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,24 @@ int set_direct_map_invalid_noflush(struct page *page)

return __set_memory(addr, 1, __pgprot(0), __pgprot(_PAGE_PRESENT | _PAGE_VALID));
}

int set_direct_map_valid_noflush(struct page *page, unsigned nr, bool valid)
{
unsigned long addr = (unsigned long)page_address(page);
pgprot_t set, clear;

return __set_memory((unsigned long)page_address(page), nr, set, clear);

if (addr < vm_map_base)
return 0;

if (valid) {
set = PAGE_KERNEL;
clear = __pgprot(0);
} else {
set = __pgprot(0);
clear = __pgprot(_PAGE_PRESENT | _PAGE_VALID);
}

return __set_memory(addr, 1, set, clear);
}
1 change: 1 addition & 0 deletions arch/m68k/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ generic-y += extable.h
generic-y += kvm_para.h
generic-y += mcs_spinlock.h
generic-y += spinlock.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/microblaze/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ generic-y += parport.h
generic-y += syscalls.h
generic-y += tlb.h
generic-y += user.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/mips/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ generic-y += parport.h
generic-y += qrwlock.h
generic-y += qspinlock.h
generic-y += user.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/nios2/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ generic-y += kvm_para.h
generic-y += mcs_spinlock.h
generic-y += spinlock.h
generic-y += user.h
generic-y += text-patching.h
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ generic-y += spinlock.h
generic-y += qrwlock_types.h
generic-y += qrwlock.h
generic-y += user.h
generic-y += text-patching.h
File renamed without changes.
2 changes: 1 addition & 1 deletion arch/parisc/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <asm/assembly.h>
#include <asm/sections.h>
#include <asm/ftrace.h>
#include <asm/patch.h>
#include <asm/text-patching.h>

#define __hot __section(".text.hot")

Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <linux/jump_label.h>
#include <linux/bug.h>
#include <asm/alternative.h>
#include <asm/patch.h>
#include <asm/text-patching.h>

static inline int reassemble_17(int as17)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <asm/ptrace.h>
#include <asm/traps.h>
#include <asm/processor.h>
#include <asm/patch.h>
#include <asm/text-patching.h>
#include <asm/cacheflush.h>

const struct kgdb_arch arch_kgdb_ops = {
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/kprobes.h>
#include <linux/slab.h>
#include <asm/cacheflush.h>
#include <asm/patch.h>
#include <asm/text-patching.h>

DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
Expand Down
2 changes: 1 addition & 1 deletion arch/parisc/kernel/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <asm/cacheflush.h>
#include <asm/fixmap.h>
#include <asm/patch.h>
#include <asm/text-patching.h>

struct patch {
void *addr;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <linux/percpu.h>
#include <linux/module.h>
#include <asm/probes.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>

#ifdef CONFIG_KPROBES
#define __ARCH_WANT_KPROBES_INSN_SLOT
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/crash_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/io.h>
#include <linux/memblock.h>
#include <linux/of.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/kdump.h>
#include <asm/firmware.h>
#include <linux/uio.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/epapr_paravirt.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <linux/of_fdt.h>
#include <asm/epapr_hcalls.h>
#include <asm/cacheflush.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/machdep.h>
#include <asm/inst.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <linux/kernel.h>
#include <linux/jump_label.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/inst.h>

void arch_jump_label_transform(struct jump_entry *entry,
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <asm/processor.h>
#include <asm/machdep.h>
#include <asm/debug.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <linux/slab.h>
#include <asm/inst.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <linux/slab.h>
#include <linux/set_memory.h>
#include <linux/execmem.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/cacheflush.h>
#include <asm/sstep.h>
#include <asm/sections.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/module_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/bug.h>
#include <linux/sort.h>
#include <asm/setup.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>

/* Count how many different relocations (different symbol, different
addend) */
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/module_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/kernel.h>
#include <asm/module.h>
#include <asm/firmware.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <linux/sort.h>
#include <asm/setup.h>
#include <asm/sections.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/optprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <asm/kprobes.h>
#include <asm/ptrace.h>
#include <asm/cacheflush.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/sstep.h>
#include <asm/ppc-opcode.h>
#include <asm/inst.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#include <asm/firmware.h>
#include <asm/hw_irq.h>
#endif
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/exec.h>
#include <asm/livepatch.h>
#include <asm/cpu_has_feature.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/debugfs.h>

#include <asm/asm-prototypes.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/security_features.h>
#include <asm/sections.h>
#include <asm/setup.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <asm/time.h>
#include <asm/serial.h>
#include <asm/udbg.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/cpu_has_feature.h>
#include <asm/asm-prototypes.h>
#include <asm/kdump.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/setup_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#include <asm/xmon.h>
#include <asm/udbg.h>
#include <asm/kexec.h>
#include <asm/code-patching.h>
#include <asm/text-patching.h>
#include <asm/ftrace.h>
#include <asm/opal.h>
#include <asm/cputhreads.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/static_call.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <linux/memory.h>
#include <linux/static_call.h>

#include <asm/code-patching.h>
#include <asm/text-patching.h>

void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
{
Expand Down
Loading

0 comments on commit 6379a0c

Please sign in to comment.