mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
Perf events fixes:
- Fix crash when probing CS CALL instructions (Jinke Han) - Fix NULL pointer crash during module unload (Vinay Belgaumkar) Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmqvqiURHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1hiohAAjcvOY7M998pX1tmo1Egw9kAuI0odtNOX weQ4Wq7K3X+tg+q1wVUmE/N/y/WLYWNatjwvjc8TClYdQEiaqBMH4TSLAuY3TOxa TxwdTC20uSN4EPZ0iRhKzm3biPzzzRq4M9hhV+WfGcK7ieXRn4Q7d9S3DDe5oEfG lI4l/RefIBiINVPC7dNM7xpS/7XBEPnzNeshOMwp6ZsPziZJizgC8C7RhQFAPszo Ho36KKFQqMNouCSybQl1GxLyPw+oGtneWESHXrF6Mhp+bcx40fMtJxKNyVLsVWuM wo0Ry843pCbDofOIqg7m0AufWUhz7B4MttTXXrU2/BYMHEbxlgms1AO7lnSGzPmn vP0JHZnT3y34P5uvGaVho7t9QKKbuY47cKNmsiiLuXiBQQuKnvDmDln1Mu1KS3fg a1LI8kv043iLqAjsIWMVtKlRGUX36f4NXUWrxvO/tmup3ocJhG1oYmEe/RaFddVX 5qRbHn7Z1w8jAWldODYSrXkpMRgMtClQuqHdjxZQt5DPZSORzoFxTvSfJLdUUtVx CUiT34zcLPHfvGD+ctHe5kVesgDHCxp/z1tKrJBunB+XZVl6rKHycfiGjaUXQRcR NUp6iFlfay8b79EkMsLC8p6uAmzX2q+gEwNVy8eevBSXdsYqcY5islj3ob7sBHsH vk4gDJikpE0= =onkS -----END PGP SIGNATURE----- Merge tag 'perf-urgent-2026-09-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull perf events fixes from Ingo Molnar: - Fix crash when probing CS CALL instructions (Jinke Han) - Fix NULL pointer crash during module unload (Vinay Belgaumkar) * tag 'perf-urgent-2026-09-20' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Fix null pointer access in is_include_guest_event() x86/kprobes: Fix crash when probing CS CALL instructions
This commit is contained in:
commit
abb91eed94
|
|
@ -164,9 +164,9 @@ unsigned long int3_emulate_pop(struct pt_regs *regs)
|
|||
}
|
||||
|
||||
static __always_inline
|
||||
void int3_emulate_call(struct pt_regs *regs, unsigned long func)
|
||||
void int3_emulate_call(struct pt_regs *regs, unsigned long ip, unsigned long func)
|
||||
{
|
||||
int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE);
|
||||
int3_emulate_push(regs, ip);
|
||||
int3_emulate_jmp(regs, func);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2176,6 +2176,7 @@ int3_exception_notify(struct notifier_block *self, unsigned long val, void *data
|
|||
unsigned long selftest = (unsigned long)&int3_selftest_asm;
|
||||
struct die_args *args = data;
|
||||
struct pt_regs *regs = args->regs;
|
||||
unsigned long ip;
|
||||
|
||||
OPTIMIZER_HIDE_VAR(selftest);
|
||||
|
||||
|
|
@ -2188,7 +2189,8 @@ int3_exception_notify(struct notifier_block *self, unsigned long val, void *data
|
|||
if (regs->ip - INT3_INSN_SIZE != selftest)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
int3_emulate_call(regs, (unsigned long)&int3_selftest_callee);
|
||||
ip = regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE;
|
||||
int3_emulate_call(regs, ip, (unsigned long)&int3_selftest_callee);
|
||||
return NOTIFY_STOP;
|
||||
}
|
||||
|
||||
|
|
@ -2758,7 +2760,7 @@ noinstr int smp_text_poke_int3_handler(struct pt_regs *regs)
|
|||
break;
|
||||
|
||||
case CALL_INSN_OPCODE:
|
||||
int3_emulate_call(regs, (long)ip + tpl->disp);
|
||||
int3_emulate_call(regs, (long)ip, (long)ip + tpl->disp);
|
||||
break;
|
||||
|
||||
case JMP32_INSN_OPCODE:
|
||||
|
|
|
|||
|
|
@ -510,10 +510,9 @@ NOKPROBE_SYMBOL(kprobe_emulate_ret);
|
|||
|
||||
static void kprobe_emulate_call(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
unsigned long func = regs->ip - INT3_INSN_SIZE + p->ainsn.size;
|
||||
unsigned long ip = regs->ip - INT3_INSN_SIZE + p->ainsn.size;
|
||||
|
||||
func += p->ainsn.rel32;
|
||||
int3_emulate_call(regs, func);
|
||||
int3_emulate_call(regs, ip, ip + p->ainsn.rel32);
|
||||
}
|
||||
NOKPROBE_SYMBOL(kprobe_emulate_call);
|
||||
|
||||
|
|
|
|||
|
|
@ -6350,6 +6350,9 @@ static DEFINE_MUTEX(perf_mediated_pmu_mutex);
|
|||
/* !exclude_guest event of PMU with PERF_PMU_CAP_MEDIATED_VPMU */
|
||||
static inline bool is_include_guest_event(struct perf_event *event)
|
||||
{
|
||||
if (!event->pmu)
|
||||
return false;
|
||||
|
||||
if ((event->pmu->capabilities & PERF_PMU_CAP_MEDIATED_VPMU) &&
|
||||
!event->attr.exclude_guest)
|
||||
return true;
|
||||
|
|
@ -13002,6 +13005,7 @@ static void __pmu_detach_event(struct pmu *pmu, struct perf_event *event,
|
|||
exclusive_event_destroy(event);
|
||||
module_put(pmu->module);
|
||||
|
||||
mediated_pmu_unaccount_event(event);
|
||||
event->pmu = NULL; /* force fault instead of UAF */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user