Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
08e4f87
x86/segment: Remove .fixup usage
Nov 10, 2021
bcee1b2
x86/cpufeature: Add the CPU feature bit for LKGS
Jan 12, 2023
fcbceeb
x86/opcode: Add the LKGS instruction to x86-opcode-map
Jan 12, 2023
f32d3ce
x86/gsseg: Make asm_load_gs_index() take an u16
Jan 12, 2023
e82e8bc
x86/gsseg: Move load_gs_index() to its own new header file
Jan 12, 2023
19d8841
x86/gsseg: Use the LKGS instruction if available for load_gs_index()
Jan 12, 2023
543d11e
x86/gsseg: Add the new <asm/gsseg.h> header to <asm/asm-prototypes.h>
Jan 13, 2023
e5355c6
x86/cpufeatures,opcode,msr: Add the WRMSRNS instruction support
xinli-intel Dec 5, 2023
69c73ee
x86/entry: Remove idtentry_sysvec from entry_{32,64}.S
xinli-intel Dec 5, 2023
df03c63
x86/trapnr: Add event type macros to <asm/trapnr.h>
xinli-intel Dec 5, 2023
0c3afe3
Documentation/x86/64: Add documentation for FRED
xinli-intel Dec 5, 2023
b3dd187
x86/fred: Add Kconfig option for FRED (CONFIG_X86_FRED)
Dec 5, 2023
44b5cc3
x86/cpufeatures: Add the CPU feature bit for FRED
Dec 5, 2023
acc2b1f
x86/fred: Disable FRED support if CONFIG_X86_FRED is disabled
Dec 5, 2023
75e357e
x86/fred: Add a fred= cmdline param
xinli-intel Dec 5, 2023
5fc697f
x86/opcode: Add ERET[US] instructions to the x86 opcode map
Dec 5, 2023
ce573eb
x86/objtool: Teach objtool about ERET[US]
Dec 5, 2023
043650b
x86/cpu: Add X86_CR4_FRED macro
Dec 5, 2023
0775107
x86/cpu: Add MSR numbers for FRED configuration
Dec 5, 2023
469693a
x86/ptrace: Cleanup the definition of the pt_regs structure
xinli-intel Dec 5, 2023
8b8f6f9
x86/ptrace: Add FRED additional information to the pt_regs structure
xinli-intel Dec 5, 2023
7d0ecc3
x86/fred: Add a new header file for FRED definitions
Dec 5, 2023
dece992
x86/fred: Reserve space for the FRED stack frame
Dec 5, 2023
15b4b09
x86/fred: Update MSR_IA32_FRED_RSP0 during task switch
Dec 5, 2023
a474f05
x86/fred: Disallow the swapgs instruction when FRED is enabled
Dec 5, 2023
79e6863
x86/fred: No ESPFIX needed when FRED is enabled
Dec 5, 2023
b7f4b01
x86/fred: Allow single-step trap and NMI when starting a new task
Dec 5, 2023
f9cc282
x86/fred: Make exc_page_fault() work for FRED
Dec 5, 2023
4f14ff6
x86/idtentry: Incorporate definitions/declarations of the FRED entries
xinli-intel Dec 5, 2023
6ff9a25
x86/fred: Add a debug fault entry stub for FRED
Dec 5, 2023
143c225
x86/microcode: Kill refresh_fw
suryasaimadhu Oct 19, 2022
4dc24b8
x86/microcode: Handle "nosmt" correctly
KAGA-KOKO Oct 2, 2023
db71133
x86/microcode: Clarify the late load logic
KAGA-KOKO Oct 2, 2023
f1ea694
x86/microcode: Sanitize __wait_for_cpus()
KAGA-KOKO Oct 2, 2023
5fa09c1
x86/microcode: Add per CPU result state
KAGA-KOKO Oct 17, 2023
8af7550
x86/microcode: Add per CPU control field
KAGA-KOKO Oct 2, 2023
24b06d3
x86/microcode: Provide new control functions
KAGA-KOKO Oct 2, 2023
26cf90c
x86/microcode: Replace the all-in-one rendevous handler
KAGA-KOKO Oct 2, 2023
40c19c9
x86/microcode: Rendezvous and load in NMI
KAGA-KOKO Oct 2, 2023
8a471a5
x86/apic: Add max_apic_id member
KAGA-KOKO Aug 8, 2023
2bca54a
x86/apic: Prepare x2APIC for using apic::max_apic_id
KAGA-KOKO Aug 8, 2023
62d1900
x86/apic: Provide apic_force_nmi_on_cpu()
KAGA-KOKO Oct 2, 2023
942615b
x86/microcode: Handle "offline" CPUs correctly
KAGA-KOKO Oct 2, 2023
985bfe1
x86/fred: Add a NMI entry stub for FRED
Dec 16, 2023
e15fb8e
x86/fred: Add a machine check entry stub for FRED
xinli-intel Dec 5, 2023
bad730a
x86/cpu: Don't write CSTAR MSR on Intel CPUs
Nov 19, 2021
b09fb17
x86/entry: Rename ignore_sysret()
Jun 23, 2023
cfc552e
x86/entry: Compile entry_SYSCALL32_ignore() unconditionally
Jun 23, 2023
514870b
x86: Introduce ia32_enabled()
Jun 23, 2023
61ead9a
x86/entry: Make IA32 syscalls' availability depend on ia32_enabled()
Jun 23, 2023
35aae4c
x86/coco: Disable 32-bit emulation by default on TDX and SEV
kiryl Dec 4, 2023
58dfbe6
x86/ibt: Base IBT bits
Mar 8, 2022
6ba68dc
x86/ibt,entry: Sprinkle ENDBR dust
Mar 8, 2022
35bd3ea
kprobes: treewide: Make it harder to refer kretprobe_trampoline directly
mhiramat Sep 14, 2021
2d2b06f
x86/kprobes: Add UNWIND_HINT_FUNC on kretprobe_trampoline()
jpoimboe Sep 14, 2021
284629f
x86/unwind/orc: Add 'signal' field to ORC metadata
jpoimboe Feb 10, 2023
0378e4b
x86/entry: Fix unwinding from kprobe on PUSH/POP instruction
jpoimboe Feb 10, 2023
ff5437f
x86/entry: Convert INT 0x80 emulation to IDTENTRY
KAGA-KOKO Dec 4, 2023
5e88412
objtool: Fix ORC 'signal' propagation
jpoimboe Feb 16, 2023
2950350
objtool: Change UNWIND_HINT() argument order
jpoimboe Mar 1, 2023
3340697
x86,objtool: Introduce ORC_TYPE_*
jpoimboe Mar 1, 2023
ac4beb9
x86,objtool: Separate unret validation from unwind hints
jpoimboe Mar 1, 2023
bc8f4bd
x86,objtool: Split UNWIND_HINT_EMPTY in two
jpoimboe Mar 1, 2023
352ac58
x86/fred: FRED entry/exit and dispatch code
Dec 9, 2023
b369f7f
x86/traps: Add sysvec_install() to install a system interrupt handler
xinli-intel Dec 5, 2023
7a764f0
x86/fred: Let ret_from_fork_asm() jmp to asm_fred_exit_user when FRED…
Dec 5, 2023
af056c8
x86/fred: Fixup fault on ERETU by jumping to fred_entrypoint_user
xinli-intel Dec 5, 2023
7223580
x86/entry/calling: Allow PUSH_AND_CLEAR_REGS being used beyond actual…
Dec 5, 2023
25efbba
x86/entry: Add fred_entry_from_kvm() for VMX to handle IRQ/NMI
xinli-intel Dec 5, 2023
dce6c1a
x86/entry: KVM: Use dedicated VMX NMI entry for 32-bit kernels too
sean-jc Dec 13, 2022
88af62c
KVM: x86: Drop current_vcpu for kvm_running_vcpu + kvm_arch_vcpu vari…
sean-jc Nov 11, 2021
d60dddf
KVM: x86: More precisely identify NMI from guest when handling PMI
sean-jc Nov 11, 2021
f1736c8
KVM: VMX: Provide separate subroutines for invoking NMI vs. IRQ handlers
sean-jc Dec 13, 2022
4e8b268
KVM: VMX: Call fred_entry_from_kvm() for IRQ/NMI handling
xinli-intel Dec 5, 2023
0db3816
x86/syscall: Split IDT syscall setup code into idt_syscall_init()
xinli-intel Dec 5, 2023
416ce0b
x86/fred: Add FRED initialization functions
Dec 5, 2023
186aa68
x86/fred: Invoke FRED initialization code to enable FRED
Dec 5, 2023
16ff838
x86/fred: Fix a build warning with allmodconfig due to 'inline' faili…
xinli-intel Feb 2, 2024
9322834
MAINTAINERS: Add a maintainer entry for FRED
xinli-intel Jan 31, 2024
3c1e30f
x86: Put hot per CPU variables into a struct
KAGA-KOKO Sep 15, 2022
449d8ef
x86/xen: Use clear_bss() for Xen PV guests
jgross1 Jun 30, 2022
ae68824
x86/smpboot: Get rid of cpu_init_secondary()
KAGA-KOKO May 12, 2023
dbcaa01
x86/smpboot: Remove initial_stack on 64-bit
Mar 16, 2023
0bb651c
x86/fred: Fix init_task thread stack pointer initialization
xinli-intel Mar 4, 2024
172220c
x86/fred: Parse cmdline param "fred=" in cpu_parse_early_param()
xinli-intel Jul 9, 2024
b65defe
x86/fred: Move FRED RSP initialization into a separate function
xinli-intel Jul 9, 2024
0a26530
x86/fred: Enable FRED right after init_mem_mapping()
xinli-intel Jul 9, 2024
d763d91
x86/fred: Set SS to __KERNEL_DS when enabling FRED
xinli-intel Aug 16, 2024
b29efea
x86/entry: Test ti_work for zero before processing individual bits
xinli-intel Aug 22, 2024
978470d
x86/msr: Switch between WRMSRNS and WRMSR with the alternatives mecha…
andyhhp Aug 22, 2024
ba854c2
x86/entry: Set FRED RSP0 on return to userspace instead of context sw…
xinli-intel Aug 22, 2024
630c5a5
x86/ibt: Add IBT feature, MSR and #CP handling
Mar 8, 2022
b7346b7
x86/shstk: Add Kconfig option for shadow stack
rpedgeco Jun 13, 2023
7327e77
x86/traps: Move control protection handler to separate file
rpedgeco Jun 13, 2023
6741844
x86/ibt,xen: Sprinkle the ENDBR
Mar 8, 2022
0977f4e
x86/cpufeatures: Add CPU feature flags for shadow stacks
rpedgeco Jun 13, 2023
58d8cac
x86/shstk: Add user control-protection fault handler
rpedgeco Jun 13, 2023
9e9ad9f
x86/ibt: Convert IBT selftest to asm
jpoimboe Apr 8, 2023
3389b23
x86/fred: Clear WFE in missing-ENDBRANCH #CPs
xinli-intel Nov 13, 2024
b70f6c7
x86/fred: Fix the FRED RSP0 MSR out of sync with its per-CPU cache
xinli-intel Jan 10, 2025
ffc2259
x86/fred: Fix system hang during S4 resume with FRED enabled
xinli-intel Apr 1, 2025
affb6dc
x86/fred/signal: Prevent immediate repeat of single step trap on retu…
xinli-intel Jun 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,12 @@
Warning: use of this parameter will taint the kernel
and may cause unknown problems.

fred= [X86-64]
Enable/disable Flexible Return and Event Delivery.
Format: { on | off }
on: enable FRED when it's present.
off: disable FRED, the default setting.

ftrace=[tracer]
[FTRACE] will set and start the specified tracer
as early as possible in order to facilitate early
Expand Down
96 changes: 96 additions & 0 deletions Documentation/arch/x86/x86_64/fred.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.. SPDX-License-Identifier: GPL-2.0

=========================================
Flexible Return and Event Delivery (FRED)
=========================================

Overview
========

The FRED architecture defines simple new transitions that change
privilege level (ring transitions). The FRED architecture was
designed with the following goals:

1) Improve overall performance and response time by replacing event
delivery through the interrupt descriptor table (IDT event
delivery) and event return by the IRET instruction with lower
latency transitions.

2) Improve software robustness by ensuring that event delivery
establishes the full supervisor context and that event return
establishes the full user context.

The new transitions defined by the FRED architecture are FRED event
delivery and, for returning from events, two FRED return instructions.
FRED event delivery can effect a transition from ring 3 to ring 0, but
it is used also to deliver events incident to ring 0. One FRED
instruction (ERETU) effects a return from ring 0 to ring 3, while the
other (ERETS) returns while remaining in ring 0. Collectively, FRED
event delivery and the FRED return instructions are FRED transitions.

In addition to these transitions, the FRED architecture defines a new
instruction (LKGS) for managing the state of the GS segment register.
The LKGS instruction can be used by 64-bit operating systems that do
not use the new FRED transitions.

Furthermore, the FRED architecture is easy to extend for future CPU
architectures.

Software based event dispatching
================================

FRED operates differently from IDT in terms of event handling. Instead
of directly dispatching an event to its handler based on the event
vector, FRED requires the software to dispatch an event to its handler
based on both the event's type and vector. Therefore, an event dispatch
framework must be implemented to facilitate the event-to-handler
dispatch process. The FRED event dispatch framework takes control
once an event is delivered, and employs a two-level dispatch.

The first level dispatching is event type based, and the second level
dispatching is event vector based.

Full supervisor/user context
============================

FRED event delivery atomically save and restore full supervisor/user
context upon event delivery and return. Thus it avoids the problem of
transient states due to %cr2 and/or %dr6, and it is no longer needed
to handle all the ugly corner cases caused by half baked entry states.

FRED allows explicit unblock of NMI with new event return instructions
ERETS/ERETU, avoiding the mess caused by IRET which unconditionally
unblocks NMI, e.g., when an exception happens during NMI handling.

FRED always restores the full value of %rsp, thus ESPFIX is no longer
needed when FRED is enabled.

LKGS
====

LKGS behaves like the MOV to GS instruction except that it loads the
base address into the IA32_KERNEL_GS_BASE MSR instead of the GS
segment’s descriptor cache. With LKGS, it ends up with avoiding
mucking with kernel GS, i.e., an operating system can always operate
with its own GS base address.

Because FRED event delivery from ring 3 and ERETU both swap the value
of the GS base address and that of the IA32_KERNEL_GS_BASE MSR, plus
the introduction of LKGS instruction, the SWAPGS instruction is no
longer needed when FRED is enabled, thus is disallowed (#UD).

Stack levels
============

4 stack levels 0~3 are introduced to replace the nonreentrant IST for
event handling, and each stack level should be configured to use a
dedicated stack.

The current stack level could be unchanged or go higher upon FRED
event delivery. If unchanged, the CPU keeps using the current event
stack. If higher, the CPU switches to a new event stack specified by
the MSR of the new stack level, i.e., MSR_IA32_FRED_RSP[123].

Only execution of a FRED return instruction ERET[US], could lower the
current stack level, causing the CPU to switch back to the stack it was
on before a previous event delivery that promoted the stack level.
2 changes: 1 addition & 1 deletion Documentation/livepatch/reliable-stacktrace.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ trampoline or return trampoline. For example, considering the x86_64
.. code-block:: none

SYM_CODE_START(return_to_handler)
UNWIND_HINT_EMPTY
UNWIND_HINT_UNDEFINED
subq $24, %rsp

/* Save the return values */
Expand Down
10 changes: 10 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -9780,6 +9780,16 @@ L: [email protected]
S: Maintained
F: drivers/net/wwan/iosm/

INTEL(R) FLEXIBLE RETURN AND EVENT DELIVERY
M: Xin Li <[email protected]>
M: "H. Peter Anvin" <[email protected]>
S: Supported
F: Documentation/arch/x86/x86_64/fred.rst
F: arch/x86/entry/entry_64_fred.S
F: arch/x86/entry/entry_fred.c
F: arch/x86/include/asm/fred.h
F: arch/x86/kernel/fred.c

INTEL(R) TRACE HUB
M: Alexander Shishkin <[email protected]>
S: Supported
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/include/asm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct kprobe_ctlblk {
};

int kprobe_fault_handler(struct pt_regs *regs, unsigned long cause);
void kretprobe_trampoline(void);
void __kretprobe_trampoline(void);
void trap_is_kprobe(unsigned long address, struct pt_regs *regs);
#else
#define trap_is_kprobe(address, regs)
Expand Down
13 changes: 7 additions & 6 deletions arch/arc/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,9 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,

static void __used kretprobe_trampoline_holder(void)
{
__asm__ __volatile__(".global kretprobe_trampoline\n"
"kretprobe_trampoline:\n" "nop\n");
__asm__ __volatile__(".global __kretprobe_trampoline\n"
"__kretprobe_trampoline:\n"
"nop\n");
}

void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
Expand All @@ -375,13 +376,13 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = NULL;

/* Replace the return addr with trampoline addr */
regs->blink = (unsigned long)&kretprobe_trampoline;
regs->blink = (unsigned long)&__kretprobe_trampoline;
}

static int __kprobes trampoline_probe_handler(struct kprobe *p,
struct pt_regs *regs)
{
regs->ret = __kretprobe_trampoline_handler(regs, &kretprobe_trampoline, NULL);
regs->ret = __kretprobe_trampoline_handler(regs, &__kretprobe_trampoline, NULL);

/* By returning a non zero value, we are telling the kprobe handler
* that we don't want the post_handler to run
Expand All @@ -390,7 +391,7 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p,
}

static struct kprobe trampoline_p = {
.addr = (kprobe_opcode_t *) &kretprobe_trampoline,
.addr = (kprobe_opcode_t *) &__kretprobe_trampoline,
.pre_handler = trampoline_probe_handler
};

Expand All @@ -402,7 +403,7 @@ int __init arch_init_kprobes(void)

int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{
if (p->addr == (kprobe_opcode_t *) &kretprobe_trampoline)
if (p->addr == (kprobe_opcode_t *) &__kretprobe_trampoline)
return 1;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ asmlinkage void do_rseq_syscall(struct pt_regs *regs)
*/
static_assert(NSIGILL == 11);
static_assert(NSIGFPE == 15);
static_assert(NSIGSEGV == 9);
static_assert(NSIGSEGV == 10);
static_assert(NSIGBUS == 5);
static_assert(NSIGTRAP == 6);
static_assert(NSIGCHLD == 6);
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/probes/kprobes/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
* for kretprobe handlers which should normally be interested in r0 only
* anyway.
*/
void __naked __kprobes kretprobe_trampoline(void)
void __naked __kprobes __kretprobe_trampoline(void)
{
__asm__ __volatile__ (
"stmdb sp!, {r0 - r11} \n\t"
Expand All @@ -389,10 +389,10 @@ void __naked __kprobes kretprobe_trampoline(void)
: : : "memory");
}

/* Called from kretprobe_trampoline */
/* Called from __kretprobe_trampoline */
static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
{
return (void *)kretprobe_trampoline_handler(regs, &kretprobe_trampoline,
return (void *)kretprobe_trampoline_handler(regs, &__kretprobe_trampoline,
(void *)regs->ARM_fp);
}

Expand All @@ -403,7 +403,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = (void *)regs->ARM_fp;

/* Replace the return addr with trampoline addr. */
regs->ARM_lr = (unsigned long)&kretprobe_trampoline;
regs->ARM_lr = (unsigned long)&__kretprobe_trampoline;
}

int __kprobes arch_trampoline_kprobe(struct kprobe *p)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/include/asm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void arch_remove_kprobe(struct kprobe *);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
void kretprobe_trampoline(void);
void __kretprobe_trampoline(void);
void __kprobes *trampoline_probe_handler(struct pt_regs *regs);

#endif /* CONFIG_KPROBES */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm64/kernel/probes/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ int __init arch_populate_kprobe_blacklist(void)

void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs)
{
return (void *)kretprobe_trampoline_handler(regs, &kretprobe_trampoline,
return (void *)kretprobe_trampoline_handler(regs, &__kretprobe_trampoline,
(void *)kernel_stack_pointer(regs));
}

Expand All @@ -412,7 +412,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = (void *)kernel_stack_pointer(regs);

/* replace return addr (x30) with trampoline */
regs->regs[30] = (long)&kretprobe_trampoline;
regs->regs[30] = (long)&__kretprobe_trampoline;
}

int __kprobes arch_trampoline_kprobe(struct kprobe *p)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm64/kernel/probes/kprobes_trampoline.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
ldp x28, x29, [sp, #S_X28]
.endm

SYM_CODE_START(kretprobe_trampoline)
SYM_CODE_START(__kretprobe_trampoline)
sub sp, sp, #PT_REGS_SIZE

save_all_base_regs
Expand All @@ -79,4 +79,4 @@ SYM_CODE_START(kretprobe_trampoline)
add sp, sp, #PT_REGS_SIZE
ret

SYM_CODE_END(kretprobe_trampoline)
SYM_CODE_END(__kretprobe_trampoline)
2 changes: 1 addition & 1 deletion arch/arm64/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ void __init minsigstksz_setup(void)
*/
static_assert(NSIGILL == 11);
static_assert(NSIGFPE == 15);
static_assert(NSIGSEGV == 9);
static_assert(NSIGSEGV == 10);
static_assert(NSIGBUS == 5);
static_assert(NSIGTRAP == 6);
static_assert(NSIGCHLD == 6);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/signal32.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void compat_setup_restart_syscall(struct pt_regs *regs)
*/
static_assert(NSIGILL == 11);
static_assert(NSIGFPE == 15);
static_assert(NSIGSEGV == 9);
static_assert(NSIGSEGV == 10);
static_assert(NSIGBUS == 5);
static_assert(NSIGTRAP == 6);
static_assert(NSIGCHLD == 6);
Expand Down
2 changes: 1 addition & 1 deletion arch/csky/include/asm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void arch_remove_kprobe(struct kprobe *p);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr);
int kprobe_breakpoint_handler(struct pt_regs *regs);
int kprobe_single_step_handler(struct pt_regs *regs);
void kretprobe_trampoline(void);
void __kretprobe_trampoline(void);
void __kprobes *trampoline_probe_handler(struct pt_regs *regs);

#endif /* CONFIG_KPROBES */
Expand Down
4 changes: 2 additions & 2 deletions arch/csky/kernel/probes/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,15 @@ int __init arch_populate_kprobe_blacklist(void)

void __kprobes __used *trampoline_probe_handler(struct pt_regs *regs)
{
return (void *)kretprobe_trampoline_handler(regs, &kretprobe_trampoline, NULL);
return (void *)kretprobe_trampoline_handler(regs, &__kretprobe_trampoline, NULL);
}

void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
struct pt_regs *regs)
{
ri->ret_addr = (kprobe_opcode_t *)regs->lr;
ri->fp = NULL;
regs->lr = (unsigned long) &kretprobe_trampoline;
regs->lr = (unsigned long) &__kretprobe_trampoline;
}

int __kprobes arch_trampoline_kprobe(struct kprobe *p)
Expand Down
4 changes: 2 additions & 2 deletions arch/csky/kernel/probes/kprobes_trampoline.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <abi/entry.h>

ENTRY(kretprobe_trampoline)
ENTRY(__kretprobe_trampoline)
SAVE_REGS_FTRACE

mov a0, sp /* pt_regs */
Expand All @@ -16,4 +16,4 @@ ENTRY(kretprobe_trampoline)

RESTORE_REGS_FTRACE
rts
ENDPROC(kretprobe_trampoline)
ENDPROC(__kretprobe_trampoline)
10 changes: 5 additions & 5 deletions arch/ia64/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,14 +392,14 @@ static void __kprobes set_current_kprobe(struct kprobe *p,
__this_cpu_write(current_kprobe, p);
}

static void kretprobe_trampoline(void)
static void __kretprobe_trampoline(void)
{
}

int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs)
{
regs->cr_iip = __kretprobe_trampoline_handler(regs,
dereference_function_descriptor(kretprobe_trampoline), NULL);
dereference_function_descriptor(__kretprobe_trampoline), NULL);
/*
* By returning a non-zero value, we are telling
* kprobe_handler() that we don't want the post_handler
Expand All @@ -415,7 +415,7 @@ void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
ri->fp = NULL;

/* Replace the return addr with trampoline addr */
regs->b0 = (unsigned long)dereference_function_descriptor(kretprobe_trampoline);
regs->b0 = (unsigned long)dereference_function_descriptor(__kretprobe_trampoline);
}

/* Check the instruction in the slot is break */
Expand Down Expand Up @@ -903,14 +903,14 @@ static struct kprobe trampoline_p = {
int __init arch_init_kprobes(void)
{
trampoline_p.addr =
dereference_function_descriptor(kretprobe_trampoline);
dereference_function_descriptor(__kretprobe_trampoline);
return register_kprobe(&trampoline_p);
}

int __kprobes arch_trampoline_kprobe(struct kprobe *p)
{
if (p->addr ==
dereference_function_descriptor(kretprobe_trampoline))
dereference_function_descriptor(__kretprobe_trampoline))
return 1;

return 0;
Expand Down
Loading