mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
ANDROID: KVM: arm64: Fix cpu type for tracing HVCs
CPU being an int, we need to check if it is negative to ensure no out-of-bounds access. Make it unsigned. Bug: 229972309 Change-Id: I987a66d83c7bf3143a6ba287e929cd52de549850 Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
@@ -58,8 +58,8 @@ void *rb_reserve_trace_entry(struct hyp_rb_per_cpu *cpu_buffer, unsigned long le
|
|||||||
int __pkvm_load_tracing(unsigned long pack_va, size_t pack_size);
|
int __pkvm_load_tracing(unsigned long pack_va, size_t pack_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_rb_swap_reader_page(int cpu);
|
int __pkvm_rb_swap_reader_page(unsigned int cpu);
|
||||||
int __pkvm_rb_update_footers(int cpu);
|
int __pkvm_rb_update_footers(unsigned int cpu);
|
||||||
int __pkvm_enable_event(unsigned short id, bool enable);
|
int __pkvm_enable_event(unsigned short id, bool enable);
|
||||||
|
|
||||||
#define HYP_EVENT(__name, __proto, __struct, __assign, __printk) \
|
#define HYP_EVENT(__name, __proto, __struct, __assign, __printk) \
|
||||||
@@ -94,12 +94,12 @@ 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_rb_swap_reader_page(int cpu)
|
static inline int __pkvm_rb_swap_reader_page(unsigned int cpu)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int __pkvm_rb_update_footers(int cpu)
|
static inline int __pkvm_rb_update_footers(unsigned int cpu)
|
||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1241,14 +1241,14 @@ static void handle___pkvm_enable_tracing(struct kvm_cpu_context *host_ctxt)
|
|||||||
|
|
||||||
static void handle___pkvm_rb_swap_reader_page(struct kvm_cpu_context *host_ctxt)
|
static void handle___pkvm_rb_swap_reader_page(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_rb_swap_reader_page(cpu);
|
cpu_reg(host_ctxt, 1) = __pkvm_rb_swap_reader_page(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle___pkvm_rb_update_footers(struct kvm_cpu_context *host_ctxt)
|
static void handle___pkvm_rb_update_footers(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_rb_update_footers(cpu);
|
cpu_reg(host_ctxt, 1) = __pkvm_rb_update_footers(cpu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ static void rb_teardown_bpage_backing(void)
|
|||||||
hyp_buffer_pages_backing.size = 0;
|
hyp_buffer_pages_backing.size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __pkvm_rb_update_footers(int cpu)
|
int __pkvm_rb_update_footers(unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct hyp_rb_per_cpu *cpu_buffer;
|
struct hyp_rb_per_cpu *cpu_buffer;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -508,9 +508,9 @@ int __pkvm_rb_update_footers(int cpu)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __pkvm_rb_swap_reader_page(int cpu)
|
int __pkvm_rb_swap_reader_page(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;
|
||||||
|
|
||||||
if (cpu >= hyp_nr_cpus)
|
if (cpu >= hyp_nr_cpus)
|
||||||
|
|||||||
Reference in New Issue
Block a user