module.c (cdd5b5a9761fd66d17586e4f4ba6588c70e640ea) module.c (12af2b83d0b17ec8b379b721dd4a8fbcd5d791f3)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Kernel module help for s390.
4 *
5 * S390 version
6 * Copyright IBM Corp. 2002, 2003
7 * Author(s): Arnd Bergmann (arndb@de.ibm.com)
8 * Martin Schwidefsky (schwidefsky@de.ibm.com)

--- 7 unchanged lines hidden (view full) ---

16#include <linux/fs.h>
17#include <linux/ftrace.h>
18#include <linux/string.h>
19#include <linux/kernel.h>
20#include <linux/kasan.h>
21#include <linux/moduleloader.h>
22#include <linux/bug.h>
23#include <linux/memory.h>
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Kernel module help for s390.
4 *
5 * S390 version
6 * Copyright IBM Corp. 2002, 2003
7 * Author(s): Arnd Bergmann (arndb@de.ibm.com)
8 * Martin Schwidefsky (schwidefsky@de.ibm.com)

--- 7 unchanged lines hidden (view full) ---

16#include <linux/fs.h>
17#include <linux/ftrace.h>
18#include <linux/string.h>
19#include <linux/kernel.h>
20#include <linux/kasan.h>
21#include <linux/moduleloader.h>
22#include <linux/bug.h>
23#include <linux/memory.h>
24#include <linux/execmem.h>
24#include <asm/alternative.h>
25#include <asm/nospec-branch.h>
26#include <asm/facility.h>
27#include <asm/ftrace.lds.h>
28#include <asm/set_memory.h>
29#include <asm/setup.h>
30
31#if 0

--- 39 unchanged lines hidden (view full) ---

71 return NULL;
72 }
73 return p;
74}
75
76#ifdef CONFIG_FUNCTION_TRACER
77void module_arch_cleanup(struct module *mod)
78{
25#include <asm/alternative.h>
26#include <asm/nospec-branch.h>
27#include <asm/facility.h>
28#include <asm/ftrace.lds.h>
29#include <asm/set_memory.h>
30#include <asm/setup.h>
31
32#if 0

--- 39 unchanged lines hidden (view full) ---

72 return NULL;
73 }
74 return p;
75}
76
77#ifdef CONFIG_FUNCTION_TRACER
78void module_arch_cleanup(struct module *mod)
79{
79 module_memfree(mod->arch.trampolines_start);
80 execmem_free(mod->arch.trampolines_start);
80}
81#endif
82
83void module_arch_freeing_init(struct module *mod)
84{
85 if (is_livepatch_module(mod) &&
86 mod->state == MODULE_STATE_LIVE)
87 return;

--- 417 unchanged lines hidden (view full) ---

505 const Elf_Shdr *s)
506{
507 char *start, *end;
508 int numpages;
509 size_t size;
510
511 size = FTRACE_HOTPATCH_TRAMPOLINES_SIZE(s->sh_size);
512 numpages = DIV_ROUND_UP(size, PAGE_SIZE);
81}
82#endif
83
84void module_arch_freeing_init(struct module *mod)
85{
86 if (is_livepatch_module(mod) &&
87 mod->state == MODULE_STATE_LIVE)
88 return;

--- 417 unchanged lines hidden (view full) ---

506 const Elf_Shdr *s)
507{
508 char *start, *end;
509 int numpages;
510 size_t size;
511
512 size = FTRACE_HOTPATCH_TRAMPOLINES_SIZE(s->sh_size);
513 numpages = DIV_ROUND_UP(size, PAGE_SIZE);
513 start = module_alloc(numpages * PAGE_SIZE);
514 start = execmem_alloc(EXECMEM_FTRACE, numpages * PAGE_SIZE);
514 if (!start)
515 return -ENOMEM;
516 set_memory_rox((unsigned long)start, numpages);
517 end = start + size;
518
519 me->arch.trampolines_start = (struct ftrace_hotpatch_trampoline *)start;
520 me->arch.trampolines_end = (struct ftrace_hotpatch_trampoline *)end;
521 me->arch.next_trampoline = me->arch.trampolines_start;

--- 55 unchanged lines hidden ---
515 if (!start)
516 return -ENOMEM;
517 set_memory_rox((unsigned long)start, numpages);
518 end = start + size;
519
520 me->arch.trampolines_start = (struct ftrace_hotpatch_trampoline *)start;
521 me->arch.trampolines_end = (struct ftrace_hotpatch_trampoline *)end;
522 me->arch.next_trampoline = me->arch.trampolines_start;

--- 55 unchanged lines hidden ---