mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-09 19:05:21 +02:00
ANDROID: KVM: arm64: Fix CPU type for swap_reader_tracing HVC
CPU being an int, we need to check if it is negative to ensure no
out-of-bounds access. Make it unsigned.
Bug: 278749606
Fixes: 794f874404
("ANDROID: KVM: arm64: Add tracing support for the nVHE hyp")
Change-Id: I987a66d83c7bf3143a6ba287e929cd52de549850
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
parent
2c26bdc6d9
commit
a7d1ee788f
|
@ -31,7 +31,7 @@ int register_hyp_event_ids(unsigned long start, unsigned long end);
|
||||||
int __pkvm_load_tracing(unsigned long desc_va, size_t desc_size);
|
int __pkvm_load_tracing(unsigned long desc_va, size_t desc_size);
|
||||||
void __pkvm_teardown_tracing(void);
|
void __pkvm_teardown_tracing(void);
|
||||||
int __pkvm_enable_tracing(bool enable);
|
int __pkvm_enable_tracing(bool enable);
|
||||||
int __pkvm_swap_reader_tracing(int cpu);
|
int __pkvm_swap_reader_tracing(unsigned int cpu);
|
||||||
int __pkvm_enable_event(unsigned short id, bool enable);
|
int __pkvm_enable_event(unsigned short id, bool enable);
|
||||||
|
|
||||||
extern char __hyp_printk_fmts_start[];
|
extern char __hyp_printk_fmts_start[];
|
||||||
|
@ -81,7 +81,7 @@ static inline int register_hyp_event_ids(unsigned long start, unsigned long end)
|
||||||
static inline int __pkvm_load_tracing(unsigned long desc_va, size_t desc_size) { return -ENODEV; }
|
static inline int __pkvm_load_tracing(unsigned long desc_va, size_t desc_size) { return -ENODEV; }
|
||||||
static inline void __pkvm_teardown_tracing(void) { }
|
static inline void __pkvm_teardown_tracing(void) { }
|
||||||
static inline int __pkvm_enable_tracing(bool enable) { return -ENODEV; }
|
static inline int __pkvm_enable_tracing(bool enable) { return -ENODEV; }
|
||||||
static inline int __pkvm_swap_reader_tracing(int cpu) { return -ENODEV; }
|
static inline int __pkvm_swap_reader_tracing(unsigned int cpu) { return -ENODEV; }
|
||||||
static inline int __pkvm_enable_event(unsigned short id, bool enable) { return -ENODEV; }
|
static inline int __pkvm_enable_event(unsigned short id, bool enable) { return -ENODEV; }
|
||||||
#define trace_hyp_printk(fmt, ...)
|
#define trace_hyp_printk(fmt, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1411,7 +1411,7 @@ static void handle___pkvm_enable_tracing(struct kvm_cpu_context *host_ctxt)
|
||||||
|
|
||||||
static void handle___pkvm_swap_reader_tracing(struct kvm_cpu_context *host_ctxt)
|
static void handle___pkvm_swap_reader_tracing(struct kvm_cpu_context *host_ctxt)
|
||||||
{
|
{
|
||||||
DECLARE_REG(int, cpu, host_ctxt, 1);
|
DECLARE_REG(unsigned int, cpu, host_ctxt, 1);
|
||||||
|
|
||||||
cpu_reg(host_ctxt, 1) = __pkvm_swap_reader_tracing(cpu);
|
cpu_reg(host_ctxt, 1) = __pkvm_swap_reader_tracing(cpu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,9 +424,9 @@ err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __pkvm_swap_reader_tracing(int cpu)
|
int __pkvm_swap_reader_tracing(unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct hyp_rb_per_cpu *cpu_buffer = per_cpu_ptr(&trace_rb, cpu);
|
struct hyp_rb_per_cpu *cpu_buffer;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
hyp_spin_lock(&trace_rb_lock);
|
hyp_spin_lock(&trace_rb_lock);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user